You can run the app locally (excluding the cognito login) by using the following commands:
podman-compose up -d
yarn start:devTo execute the API tests, you have to start the server with the environment variable
DISABLE_JWT_CHECKS=1 set.
Also, you need to start the database in the background with docker compose up -d.
Then, run yarn vitest -c api-tests/vite.config.js
- Activate database backup
- Playwright test: enter -> approve -> compensate.
- Playwright test: duplicates
- Warning if training limits have been reached
- include tour for new users: https://github.com/elrumordelaluz/reactour
- /compensate: Auswahl nach Jahr
- Join payments and compensation api routes (and domain objects) into /payments/{id}/compensations
- Run API tests in CI
- Think about auditing table
- Use Number Field for numbers: https://mui.com/material-ui/react-number-field/
- Rotate logs (VM)
All commands should be prefixed with yarn run dotenv -e .env.development.local -- to load the database connection values
Update the generated code: prisma generate
Make changes to the schema. Push the changes to the local database with prisma db push.
After you are done, you can create a migration like so: prisma migrate dev
If you want to run the playwright tests locally, you need to set initial data in your local database.
Do this with prisma db seed.
More information can be found in the Prisma docs
I used cognito to learn it, and to keep the user credentials in a secure spot, i.e., not me.
Every environment has its own user pool. The one in prod and test are managed by cloudformation, the one for dev is managed manually.
Only users who exist in cognito and in the database may log in. When a user is deleted, it is soft-deleted in the database and disabled in cognito.
We have two environments in the cloud, test and prod. Because we do not use Github Environments, we cannot use manual approval/deployment rules, and a further differentiation with a dev-environment would not make too much sense.
There is a dev-cognito which is used for local development. This instance is managed manually.
I use a different views for the enter-route, because I assume that trainers are much more likely to be on mobile. The office will always use a PC, so a table view is better suited for them.
The software is mainly intended to run on a VM. Additionally, we use the AWS service cognito to manage user logins and as an OAuth2 provider.
Deployment of test environment
aws cloudformation update-stack \
--region eu-north-1 \
--stack-name janus-trainer-test \
--capabilities CAPABILITY_NAMED_IAM \
--template-body file://cloudformation.yaml \
--parameters ParameterKey=JanusEnvironment,ParameterValue=test \
ParameterKey=JanusDomain,ParameterValue=janus-test.lippert.devDeployment of prod environment
aws cloudformation update-stack \
--region eu-north-1 \
--stack-name janus-trainer-prod \
--capabilities CAPABILITY_NAMED_IAM \
--template-body file://cloudformation.yaml \
--parameters ParameterKey=JanusEnvironment,ParameterValue=prod \
ParameterKey=JanusDomain,ParameterValue=jota.sc-janus.deYou need to take care of the following things:
- Provide a domain for each environment
- Create a certificate in ACM for that domain