Skip to content

Commit

Permalink
Refactoring zustand (#367)
Browse files Browse the repository at this point in the history
* wip refactor

* quick dev fix, needs more work

* wip refactor

* fix warning

* more refactoring and fixes

* finally working fixes

* more fixes and refactoring

* fix add button

* remove type def causing build error

* add comment

* fix build warning and errors

* create nominal types and fix bugs

* more type annotations and converting to satNumToEntry

* install knip to find unused files, and add dependency not listed

* remove unused files

* remove unused type export

* remove last uses of name to entry

* remove unused store functions

* fix bugs caused by removing state

* rename ouiImage to placeholder image

* 89 docs testing (#358)

* docs(docs): 📝 write docs for testing

Co-authored-by: Jakob <jakob.gregusson@gmail.com>, Co-authored-by: Lucas<lucastran1107@gmail.com>

* chore(ide): add docs scope to conventional commits

* docs(docs): 📝 Co-authored-by: Jakob <jakob.gregusson@gmail.com>, Co-authored-by: Lucas<lucastran1107@gmail.com>

* docs(docs): 📝 add test file location to documentation

* docs(docs): 📝 Update docs for component testing

* test(docs): 📝 update docs for testing

* docs(docs): 📝 Update docs for frontend, backend, general usage and root

* docs(docs): 📝 update readmes and remove yarn from command lines since we only use npm

* fix: 🐛 prettier

* docs(docs): 📝 add prettier info

* docs(docs): 📝 write ESLint docs

---------

Co-authored-by: Mats Nyfløt <mnyflot@gmail.com>
Co-authored-by: Jakob <jakob.gregusson@gmail.com>, Co-authored-by: Lucas<lucastran1107@gmail.com>
Co-authored-by: Jakob Grøtan Gregusson <jakobgg@stud.ntnu.no>
Co-authored-by: Mads Hermansen <mads.d.hermansen+main@gmail.com>

* 319 strapi docs (#364)

* Strapi docs

* Strapi backend docs

* docs(backend): 📝 Update docs

---------

Co-authored-by: Lucas Tran <lucastran1107@gmail.com>
Co-authored-by: Mads Hermansen <mads.d.hermansen+main@gmail.com>

* feat(frontend): 🎨 add text to select satellite button (#297)

* feat(frontend): 🎨 add text to select satellite button

* style(frontend): 🎨 Update SatDropdown component to display selected satellite and add icon

* Update SatDropdown component to display selected satellite and add icon

---------

Co-authored-by: Mads Hermansen <mads.d.hermansen+main@gmail.com>

* Update autoredeploy.yml checkout version to v4

* fix build error

* rename env variables, add new strapi url variable for https fix

---------

Co-authored-by: luctra02 <64017398+luctra02@users.noreply.github.com>
Co-authored-by: Mats Nyfløt <mnyflot@gmail.com>
Co-authored-by: Jakob <jakob.gregusson@gmail.com>, Co-authored-by: Lucas<lucastran1107@gmail.com>
Co-authored-by: Jakob Grøtan Gregusson <jakobgg@stud.ntnu.no>
Co-authored-by: Mads Hermansen <mads.d.hermansen+main@gmail.com>
Co-authored-by: EliasKnudsen <38568225+EliasKnudsen@users.noreply.github.com>
Co-authored-by: Lucas Tran <lucastran1107@gmail.com>
  • Loading branch information
8 people authored and GitHub committed Apr 27, 2024
1 parent 5e2121b commit 2179f39
Show file tree
Hide file tree
Showing 44 changed files with 847 additions and 612 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/autoredeploy.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
name: Server auto deploy
on:
push:
branches: ["main"]
push:
branches: ["main"]

jobs:
docker-build:
strategy:
matrix:
node-version: [20.x]
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Stop and remove containers and images, using docker compose down
run: docker-compose down --rmi "all"
- name: Create .env files
run: |
# Create .env with all variables except HOST_URL Backend
echo "HOST=${{ vars.HOST }}" >> .env
echo "PORT=${{ vars.PORT }}" >> .env
echo "DATABASE_CLIENT=${{ vars.DATABASE_CLIENT }}" >> .env
echo "DATABASE_FILENAME=${{ vars.DATABASE_FILENAME }}" >> .env
echo "ADMIN_JWT_SECRET=${{ secrets.ADMIN_JWT_SECRET }}" >> .env
echo "API_TOKEN_SALT=${{ secrets.API_TOKEN_SALT }}" >> .env
echo "APP_KEYS=${{ secrets.APP_KEYS }}" >> .env
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env
echo "TRANSFER_TOKEN_SALT=${{ secrets.TRANSFER_TOKEN_SALT }}" >> .env
# Create .env.production with HOST_URL Frontend
echo "STRAPI_URL=${{ vars.STRAPI_URL }}" >> .env.production
- name: Docker build
run: docker-compose build
- name: Docker up
run: docker-compose up -d
docker-build:
strategy:
matrix:
node-version: [20.x]
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Stop and remove containers and images, using docker compose down
run: docker-compose down --rmi "all"
- name: Create .env files
run: |
# Create .env with all variables except HOST_URL Backend
echo "HOST=${{ vars.HOST }}" >> .env
echo "PORT=${{ vars.PORT }}" >> .env
echo "DATABASE_CLIENT=${{ vars.DATABASE_CLIENT }}" >> .env
echo "DATABASE_FILENAME=${{ vars.DATABASE_FILENAME }}" >> .env
echo "STRAPI_URL=${{ vars.STRAPI_URL }}" >> .env
echo "ADMIN_JWT_SECRET=${{ secrets.ADMIN_JWT_SECRET }}" >> .env
echo "API_TOKEN_SALT=${{ secrets.API_TOKEN_SALT }}" >> .env
echo "APP_KEYS=${{ secrets.APP_KEYS }}" >> .env
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env
echo "TRANSFER_TOKEN_SALT=${{ secrets.TRANSFER_TOKEN_SALT }}" >> .env
# Create .env.production with HOST_URL Frontend
echo "BACKEND_INTERNAL_URL=${{ vars.BACKEND_INTERNAL_URL }}" >> .env.production
- name: Docker build
run: docker-compose build
- name: Docker up
run: docker-compose up -d
14 changes: 9 additions & 5 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# All these should be set in the GitHub Repository actions and secrets at https://github.com/NTNU-SmallSat-Lab/outreach-website/settings/variables/actions
# Any changes done here will not be reflected in the production environment
# All variables named toBeGenerated should be generated with the command `openssl rand -base64 32`
HOST=0.0.0.0
PORT=1337
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
TRANSFER_TOKEN_SALT=tobemodified
JWT_SECRET=tobemodified
STRAPI_URL="https://hypso.space/strapi/"
APP_KEYS="toBeGenerated1,toBeGenerated2"
API_TOKEN_SALT=toBeGenerated
ADMIN_JWT_SECRET=toBeGenerated
TRANSFER_TOKEN_SALT=toBeGenerated
JWT_SECRET=toBeGenerated

DATABASE_CLIENT=sqlite
DATABASE_FILENAME=dbLocation.sqlite # in dev, will use backend root dir, in prod, will be from server os root dir so should be /var/data/strapi.db or similar
11 changes: 11 additions & 0 deletions backend/config/env/production/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = ({ env }) => ({
host: env("HOST", "127.0.0.1"),
port: env.int("PORT", 1337),
app: {
keys: env.array("APP_KEYS"),
},
webhooks: {
populateRelations: env.bool("WEBHOOKS_POPULATE_RELATIONS", false),
},
url: env("STRAPI_URL", "http://localhost:1337"),
});
9 changes: 4 additions & 5 deletions backend/config/server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module.exports = ({ env }) => ({
host: env('HOST', '127.0.0.1'),
port: env.int('PORT', 1337),
host: env("HOST", "127.0.0.1"),
port: env.int("PORT", 1337),
app: {
keys: env.array('APP_KEYS'),
keys: env.array("APP_KEYS"),
},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
populateRelations: env.bool("WEBHOOKS_POPULATE_RELATIONS", false),
},
url: "https://hypso.space/strapi/"
});
4 changes: 2 additions & 2 deletions frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Database url for outside requests
STRAPI_URL=http://localhost:1337
# Strapi url which ApolloClient will use
BACKEND_INTERNAL_URL=http://localhost:1337
4 changes: 2 additions & 2 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Database url for outside requests, set in github repo variables
STRAPI_URL=http://web.hypso.ies.ntnu.no:1337
# 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

8 changes: 8 additions & 0 deletions frontend/knip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
ignore: [
"src/__generated__/*", // ignore generated files
"src/components/shadcn/*", // ignore shadcn
"src/unused_work_for_later_improvements/**", // ignore unused work
"src/**/_*.*", // ignore files starting with underscore
],
};
Loading

0 comments on commit 2179f39

Please sign in to comment.