Skip to content

Commit

Permalink
363 generate sitemap, switch to gql tada, add link to admin panel in …
Browse files Browse the repository at this point in the history
…footer (#381)

* add link to admin panel in footer

* update deploy script to include new env var

* generate sitemap, instal gql tada

* switch to gql tada

* run prettier, update prettierignore

* Update GraphQL section in developing.md

* Update deployment.md with new secrets and variables
  • Loading branch information
Magnus Alexander Strømseng authored and GitHub committed Apr 29, 2024
1 parent 58cad3a commit 15c15c8
Show file tree
Hide file tree
Showing 29 changed files with 1,386 additions and 5,746 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/autoredeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: docker-compose down --rmi "all"
- name: Create .env files
run: |
# Create .env with all variables except HOST_URL Backend
# Create .env for the backend strapi
echo "HOST=${{ vars.HOST }}" >> .env
echo "PORT=${{ vars.PORT }}" >> .env
echo "DATABASE_CLIENT=${{ vars.DATABASE_CLIENT }}" >> .env
Expand All @@ -27,8 +27,9 @@ jobs:
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env
echo "TRANSFER_TOKEN_SALT=${{ secrets.TRANSFER_TOKEN_SALT }}" >> .env
# Create .env.production with HOST_URL Frontend
# Create .env.production for the frontend nextjs
echo "BACKEND_INTERNAL_URL=${{ vars.BACKEND_INTERNAL_URL }}" >> .env.production
echo "STRAPI_URL=${{ vars.STRAPI_URL }}" >> .env.production
- name: Docker build
run: docker-compose build
- name: Docker up
Expand Down
12 changes: 10 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"conventionalCommits.scopes": ["backend", "ide", "frontend", "docs", "ci/cd"],
"eslint.workingDirectories": ["./frontend"]
"conventionalCommits.scopes": [
"backend",
"ide",
"frontend",
"docs",
"ci/cd"
],
"eslint.workingDirectories": ["./frontend"],
"typescript.tsdk": "frontend/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
14 changes: 8 additions & 6 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,21 @@ The secrets should all be filled in and generated using `openssl rand -base64 32
The GitHub repo should define the following secrets:
- APP_KEYS="toBeModified1,toBeModified2"
- API_TOKEN_SALT=tobemodified
- ADMIN_JWT_SECRET=tobemodified
- TRANSFER_TOKEN_SALT=tobemodified
- JWT_SECRET=tobemodified
- APP_KEYS="toBeGenerated1,toBeGenerated2"
- API_TOKEN_SALT=toBeGenerated
- ADMIN_JWT_SECRET=toBeGenerated
- TRANSFER_TOKEN_SALT=toBeGenerated
- JWT_SECRET=toBeGenerated
And the following variables:
- BACKEND_INTERNAL_URL=http://backend:1337
- DATABASE_CLIENT=sqlite
- DATABASE_FILENAME=/var/data/outreach-strapi.db
- HOST=0.0.0.0
- STRAPI_URL=http://backend-app:1337
- OUTWARD_FACING_URL=https://hypso.space
- PORT=1337
- STRAPI_URL=https://hypso.space/strapi
### Apache
Expand Down
11 changes: 3 additions & 8 deletions docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,12 @@ The following should **NOT** be made publicly available:
- Upload
- User-permissions

## GraphQL Type generation
## GraphQL

If you're using GraphQL, then you need to run `npm run compile` from `/frontend` whenever you update a schema or define a new graphQL request in the code. Make sure to import the correct `gql` as
To explore the schema, use the [apollo sandbox](https://studio.apollographql.com/sandbox/explorer/) with `http://localhost:1337/graphql` as the url.

```
import { gql } from"@/generated/gql";
```
Generation of types types is done with [gql.tada](https://github.com/0no-co/gql.tada)

> Any errors in your code other than the GraphQL types, can result in the codegen not working, so make sure to fix all other errors before running the codegen.
> [https://www.apollographql.com/docs/react/development-testing/static-typing/](https://www.apollographql.com/docs/react/development-testing/static-typing/)

## Strapi invite others

Expand Down
2 changes: 2 additions & 0 deletions frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Strapi url which ApolloClient will use
BACKEND_INTERNAL_URL=http://localhost:1337
STRAPI_URL=http://localhost:1337
OUTWARD_FACING_URL=http://localhost:1337
6 changes: 4 additions & 2 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Strapi url which ApolloClient will use, set in github repo variables, at https://github.com/NTNU-SmallSat-Lab/outreach-website/settings/variables/actions
BACKEND_INTERNAL_URL=http://web.hypso.ies.ntnu.no:1337

# Should be the internal docker compose url, http://backend:1337, but here we set it to the external one to test production builds which are not built on the server
BACKEND_INTERNAL_URL=https://hypso.space/strapi
STRAPI_URL=https://hypso.space/strapi
OUTWARD_FACING_URL=https://hypso.space
4 changes: 2 additions & 2 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
build
coverage

# Ignore graphQL codegen generated types
src/__generated__/*
# Ignore gql.tada generated types
src/tada/graphql-env.d.ts
21 changes: 0 additions & 21 deletions frontend/codegen.ts

This file was deleted.

Loading

0 comments on commit 15c15c8

Please sign in to comment.