From 479dff1bd015149d73d61aaa5040b191ba7f4024 Mon Sep 17 00:00:00 2001 From: Sven Kiesewetter Date: Fri, 15 Nov 2024 13:30:43 +0100 Subject: [PATCH] Update & translate readme, fix image name in compose-file --- README.md | 82 ++++++++++++++++++++++++++-------------------- docker-compose.yml | 3 +- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 32cf8a371..c87ee4771 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,81 @@ -### Environment variables - -The following environment variables must be set in each environment/stage: - -``` -SPRING_DATASOURCE_USERNAME -SPRING_DATASOURCE_PASSWORD -SPRING_DATASOURCE_URL -``` - -The following is an example for local testing with the included docker-compose file: +## Run locally -``` -SPRING_DATASOURCE_USERNAME=salattest -SPRING_DATASOURCE_PASSWORD=salattest -SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/salat?useUnicode=true&useJDBCCompliantTimezoneShift=true&serverTimezone=Europe/Berlin&useLegacyDatetimeCode=false&autoReconnect=true -``` +Requirements: -## Run locally +- Java 21 +- Docker (running) +- docker-compose Steps to start Salat locally: -1. Build the .war-file: `./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=docker.io/hbt/salat:latest` +1. Build the image: `./mvnw spring-boot:build-image` 2. Run docker-compose: `docker-compose up` -3. Open in browser: `http://localhost:8080?employee-sign=` -4. Valid signs in the test-dataset are: admin, bm, tt +3. That's it. Salat should now be running. To check, open in browser: Shutdown: 1. Stop docker-compose: CTRL+C 2. Remove built containers: `docker-compose down` -### Login / Logout -Einfach den SALAT mit der URL `http://localhost:8080?employee-sign=` aufrufen. +### Login +Open the URL > + +You can change the `employee-sign` parameter to login as a different user. -Einfach den SALAT mit der URL `http://localhost:8080?logout` aufrufen. +Valid employee-signs in the test-dataset are: + 1. **admin**: Administrator + 2. **bm**: "Bossy Bossmann", Administrator + 3. **tt**: "Testy Testmann", Employee + +### Logout +Open the URL ### Debugging -Start local database only, without Salat: +To start only the local database, without the Salat application: `docker-compose -f docker-compose-infra.yml up` -! Be sure to remove existing docker containers before by running `docker-compose down` if you had the application running before. +⚠️ Be sure to remove existing docker containers before by running `docker-compose down` if you had the application running before. ### Troubleshooting -#### BuildProperties -Falls die Meldung +#### Missing BuildProperties +Should you encounter the error Consider defining a bean of type 'org.springframework.boot.info.BuildProperties' in your configuration. -kommt. Einfach einmal +This can be fixed by running - mvn package + ./mvnw package -ausführen. Hintergrund: Maven erzeugt eine Datei build-info.properties. Diese fehlt ggf. weil die -IDE (auch mit Maven Integration) diese Datei nicht erzeugt. Bei IntelliJ IDEA bei Klaus wird diese -Datei nicht erzeugt. +Explanation: Maven creates a file named `build-info.properties`. +This file might be missing when an IDE does not create it. (Happened to Klaus with IntelliJ IDEA, despite Maven Integration). (by Klaus) -#### Samlung DB-Änderungen -Datenbankänderungen werden via Liquibase in nachfolgender Datei gepflegt. +#### DB-Changes +Changes to the data base are collected via Liquibase in the following file: src/main/resources/db/changelog/db.changelog-master.yaml -### Business-Logiken, die refactored werden sollten, z.B. move to service +## Environment variables + +The following environment variables must be set in each environment/stage: + +``` +SPRING_DATASOURCE_USERNAME +SPRING_DATASOURCE_PASSWORD +SPRING_DATASOURCE_URL +``` + +The following is an example for local testing with the included docker-compose file: + +``` +SPRING_DATASOURCE_USERNAME=salattest +SPRING_DATASOURCE_PASSWORD=salattest +SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/salat?useUnicode=true&useJDBCCompliantTimezoneShift=true&serverTimezone=Europe/Berlin&useLegacyDatetimeCode=false&autoReconnect=true +``` + +## Business-logic that should be refactored (i.e. move to service) - AfterLogin#createWarnings - erzeugt Warnungen, die dem User angezeigt werden sollen. Diese weisen auf Fehler bzw. offenen TODOs hin. Könnte man in einen Service packen und dann via diff --git a/docker-compose.yml b/docker-compose.yml index 0e51326cf..5b1ee5aba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ -version: "3.9" # optional since v1.27.0 services: salat: - image: docker.io/hbt/salat:latest + image: ghcr.io/hbtgmbh/salat:latest ports: - "8080:8080" - "8000:8000"