Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

613 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local execution

You can run the app locally (excluding the cognito login) by using the following commands:

podman-compose up -d
yarn start:dev

Execute API tests

To 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

TODO

Next up

  • Activate database backup

Bugs

Features

  • 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

Tech update

  • 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)

Common tasks

Evolving the database schema

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

Architecture & Decisions

Users

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.

Environments

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.

Special view for trainers

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.

Deployment

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 on VM

Cloud deployment (cognito)

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.dev

Deployment 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.de

You need to take care of the following things:

  • Provide a domain for each environment
  • Create a certificate in ACM for that domain

Notes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages