From a8fb7ce95c144140328ece71f40a0d01031a4b63 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Sat, 18 Jan 2025 16:03:34 +0100 Subject: [PATCH] fix readme and gw-test/gw-check --- .aliases | 4 ++-- README.md | 39 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.aliases b/.aliases index eb60c71d..b7aa5c04 100644 --- a/.aliases +++ b/.aliases @@ -90,8 +90,8 @@ alias pg-sql-restore='gunzip --stdout | docker exec -i hsadmin-ng-postgres psql alias fp='grep -r '@Accepts' src | sed -e 's/^.*@/@/g' | sort -u | wc -l' alias gw-spotless='./gradlew spotlessApply -x pitest -x test -x :processResources' -alias gw-test='. .aliases; ./gradlew test' -alias gw-check='. .aliases; gw test check -x pitest' +alias gw-test='. .aliases; . .tc-environment; ./gradlew test' +alias gw-check='. .aliases; . .tc-environment; gw test check -x pitest' alias howto=bin/howto alias cas-curl=bin/cas-curl diff --git a/README.md b/README.md index 23ae7758..ef1fee8a 100644 --- a/README.md +++ b/README.md @@ -72,12 +72,22 @@ If you have at least Docker and the Java JDK installed in appropriate versions a # if the container has been built already and you want to keep the data, run this: pg-sql-start -Next, compile and run the application without CAS-authentication on `localhost:8080`: +Next, compile and run the application on `localhost:8080` and the management server on `localhost:8081`: + # this disables CAS-authentication, for using the REST-API with CAS-authentication, see `bin/cas-curl`. export HSADMINNG_CAS_SERVER= - gw bootRun -For using the REST-API with CAS-authentication, see `bin/cas-curl`. + # this runs the application with test-data and all modules: + gw bootRun --args='--spring.profiles.active=dev,complete,test-data' + +The meaning of these profiles is: + +- **dev**: the PostgreSQL users are created via Liquibase +- **complete**: all modules are started +- **test-data**: some test data inserted + +Running just `gw bootRun` would just run the *office* module, not insert any test-data and +require the PostgreSQL users created in the database (see env-vars in `.aliases`). Now we can access the REST API, e.g. using curl: @@ -627,13 +637,14 @@ howto Add `--args='--spring.profiles.active=...` with the wanted profile selector: ```sh -gw bootRun --args='--spring.profiles.active=prod' +gw bootRun --args='--spring.profiles.active=external-db,only-office,without-test-data' ``` -Currently, the difference between 'dev' and 'prod' is only that 'dev' creates the PostgreSQL users, -and 'prod' expects these to be already created in the +These profiles mean: -All other differences are currently controlled by environment-variables. +- **external-db**: an external PostgreSQL database is used with the PostgreSQL users already created as specified in the environment +- **only-office**: only the Office module is started, but neither the Booking nor the Hosting modules +- **without-test-data**: no test-data is inserted ### How to Do a Clean Run of the Application @@ -641,18 +652,8 @@ All other differences are currently controlled by environment-variables. If you frequently need to run with a fresh database and a clean build, you can use this: ```sh -gw clean && pg-sql-reset && sleep 5 && gw bootRun --args='--spring.profiles.active=dev-office' 2>&1 | tee log -``` - - -### How to Run Just the Office Module (including dependents): - -At the end of `src/main/resources/application.yml` you can find customized profiles between the sections separated by `---`. - -For example for a dev environment, run: - -```sh -gw bootRun --args='--spring.profiles.active=dev-office' +export HSADMINNG_CAS_SERVER= +gw clean && pg-sql-reset && sleep 5 && gw bootRun' 2>&1 | tee log ```