[[TOC]]
| Mailadresse | [email protected] | | Passwort | 54Rf0_ImT00l.17 | | Benutzername | [email protected] | | Posteingangs- und Ausgangsserver | lx52.hoststar.hosting | | Ports mit SSL/TLS | POP3: 995 / IMAP: 993 / SMTP: 465 | | Ports ohne SSL/TLS | POP3: 110 / IMAP: 143 / SMTP: 587 | | Webmail | https://webmail.hoststar.ch |
Frontend SonarQube
Backend SonarQube
docker compose run --no-deps frontend sh -c "npm install"
If you use an IDE, you most likely also want to install the frontend dependencies locally. To do that, you will have to install node.js and run the following command:
cd frontend && npm install
Backend dependencies are automatically fetched on startup. For local development, make sure to have installed JDK 11+ and gradle 7+.
The backend and database need to be running. The database has to be empty.
# Load minimal data(only admin and agent user):
docker compose exec database sh -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD} ${MYSQL_DATABASE} < /data-minimal.sql'
# Load sample data:
docker compose exec database sh -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD} ${MYSQL_DATABASE} < /data-sample.sql'
# Load dumped production data:
docker compose exec database sh -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD} ${MYSQL_DATABASE} < /data-prod.sql'
- Download the Checkstyle plugin in the settings, and restart your IDE.
- Go to
File > Settings > Tools > Checkstyle
. - Set
Checkstyle version
to9.0
andScan Scope
toonly Java sources (including tests)
. - select
Configuration File > +
. - Under
Use a local Checkstyle file
, navigate tobackend/config/checkstyle/checkstyle.xml
. - Click
next
until the new configuration shows up in the list, and activate it.
Start the application:
docker compose up
Start only the backend:
docker compose up backend
Stop the application:
docker compose down
The frontend is served on localhost:3000
.
The backend is served on localhost:3001
.
Both the front- and backend containers support hot reloading. This means that you don't need to restart the container when you make changes to the code. Instead, changes are monitored and automatically applied to running instances.
The frontend reloads code in-place, which means that code is changed at runtime, at a very high speed.
The backend needs to restart itself everytime, which means it is a lot slower when reloading.
On windows only, the backend reload does not trigger on file save, but only on build. Because of this, you need to either manually execute a
gradle build
after every change (which defeats the entire point of hot reloading), or you configure your IDE to build on save. For Intellij, activate the optionBuild project automatically
inFile > Settings... > Build, Execution, Deployment > Compiler
.
Java- und Typescript-Code is linted using eslint
and Checkstyle, respectively.
Linters are automatically executed when pushing to master
or development
.
To manually lint the backend, run:
# locally (with Java & gradle installed):
gradle checkstyleMain checkstyleTest
# in docker:
docker compose run --no-deps backend sh -c "gradle --no-daemon checkstyleMain checkstyleTest"
To manually lint the frontend, run:
# locally (with npm and dependencies installed):
npm run lint
# in docker
docker compose run --no-deps frontend sh -c "npm run lint"
Remove currently installed frontend dependencies:
docker volume rm rfobaden-incident-manager_frontend.node_modules
Drop the database:
docker volume rm rfobaden-incident-manager_database
# Remove all remaining containers, drop the database, then restart:
docker compose down && docker volume rm rfobaden-incident-manager_database && docker compose up
Tests can also be run locally, without requiring a docker container.
Test the backend:
# locally
cd backend
gradle clean test --rerun-tasks
# in docker
docker compose run --no-deps backend gradle test
Test the frontend:
# locally
cd frontend
npm run test
# locally, using the interactive test runner
cd frontend
npm run test -- --watch
# in docker
docker compose run --no-deps frontend npm run test
# in docker, using the interactive test runner
docker compose run --no-deps frontend npm run test --watch
Backend tests can also be run inside IntelliJ, which also offers built-in coverage testing.
For this to work correctly, make sure to go to File > Settings... > Build, Execution & Deployment > Build Tools > Gradle
,
where you can configure Build and run using:
as Gradle (default)
and Run tests using:
as Intellij IDEA
.
Frontend tests can also be run inside IntelliJ, altough they are remarkably slow compared to just testing using the command line.
The project is continuously deployed.
- Commits to the
development
branch are deployed to the staging environment at https://dev.im.rfobaden.ch. - Commits to the
master
branch are deployed to the production environment at https://im.rfobaden.ch.
The database can be dumped using the following command:
docker compose exec database sh -c 'mysqldump -u root --password=${MYSQL_ROOT_PASSWORD} ${MYSQL_DATABASE} --no-create-info --no-create-db'
The database service has to be running.