add several Spring profiles and Spring profile documentation

This commit is contained in:
Michael Hoennig 2025-01-16 15:03:22 +01:00
parent 7eda0127ca
commit efb824d0ba
2 changed files with 59 additions and 4 deletions

View File

@ -622,6 +622,40 @@ also try this (assumed you've sourced .aliases):
howto
```
### How to Run the Application With Other Profiles, e.g. production:
Add `--args='--spring.profiles.active=...` with the wanted profile selector:
```sh
gw bootRun --args='--spring.profiles.active=prod'
```
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
All other differences are currently controlled by environment-variables.
### How to Do a Clean Run of the Application
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'
```
### How to Configure .pgpass for the Default PostgreSQL Database?
To access the default database schema as used during development, add this line to your `.pgpass` file in your users home directory:

View File

@ -46,7 +46,8 @@ spring:
dialect: net.hostsharing.hsadminng.config.PostgresCustomDialect
liquibase:
contexts: default,dev,office,pg_stat_statements # default just as a marker to show from which profile it comes
# default just as a marker to show from which profile it comes
contexts: default,dev,rbac-test,office,office-test,booking,booking-test,hosting,hosting-test,pg_stat_statements
# keep this in sync with test/.../application.yml
springdoc:
@ -68,7 +69,7 @@ metrics:
---
# the 'dev-all' profile automatically creates the PgSql users and runs only the office module
# the 'dev-all' profile automatically creates the PgSql users and runs all modules without test-data
spring:
config:
activate:
@ -78,7 +79,17 @@ spring:
---
# the 'dev-office' profile automatically creates the PgSql users and runs only the office module
# the 'dev-all' profile automatically creates the PgSql users and runs all modules with test-data
spring:
config:
activate:
on-profile: dev-all-test
liquibase:
contexts: dev,rbac-test,office,office-test,booking,booking-test,hosting,hosting-test,pg_stat_statements
---
# the 'dev-office' profile automatically creates the PgSql users and runs only the office module without test-data
spring:
config:
activate:
@ -88,7 +99,17 @@ spring:
---
# the 'prod-office' profile expects that the PgSql users are already created and runs only the office module
# the 'dev-office' profile automatically creates the PgSql users and runs only the office module with test-data
spring:
config:
activate:
on-profile: dev-office-test
liquibase:
contexts: dev,rbac-test,office,office-test,pg_stat_statements
---
# the 'prod-office' profile expects that the PgSql users are already created and runs only the office module without test-data
spring:
config:
activate: