Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(docker-compose): add optional postgres db for zaakbrug #107

Merged
merged 20 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
42a3dfc
Use Postgresql database in development docker-compose
Jun 8, 2023
8829b63
Merge branch '20-use-postgresql-database-in-development-docker-compos…
RayetSena Jun 8, 2023
dae191f
Refactor roltypen query by zaaktype to individual calls to roltype by…
Jun 14, 2023
4a90acd
Add Postgresql database
Jun 14, 2023
dc029d2
Merge branch 'AddPostgresql' of https://github.com/ibissource/zaakbru…
Jun 14, 2023
c51a9fa
revert old changes
Jun 14, 2023
3cac38a
Delete UnwrapOpenZaakApiEnvelopeToListRoltypen.xslt
RayetSena Jun 14, 2023
95853a5
Delete Configuration.xml
RayetSena Jun 14, 2023
e3f0439
Delete Configuration_CreeerZaak_LK01.xml
RayetSena Jun 14, 2023
1dddd1f
Merge branch '20-use-postgresql-database-in-development-docker-compos…
RayetSena Jun 14, 2023
c65e41e
Merge branch 'AddPostgresql' of https://github.com/ibissource/zaakbru…
Jun 14, 2023
5912c19
force
MLenterman Jun 16, 2023
648bac9
Merge branch 'AddPostgresql' of https://github.com/ibissource/zaakbru…
MLenterman Jun 16, 2023
3c9f394
Merge branch 'AddPostgresql' of https://github.com/ibissource/zaakbru…
MLenterman Jun 16, 2023
11150ae
Merge branch 'AddPostgresql' of https://github.com/ibissource/zaakbru…
MLenterman Jun 16, 2023
908c524
Revert "Merge branch 'AddPostgresql' of https://github.com/ibissource…
MLenterman Jun 16, 2023
f28e5e7
Merge branch 'master' of https://github.com/ibissource/zaakbrug into …
Sep 13, 2023
151cd9e
Merge branch 'master' into AddPostgresql
MLenterman Sep 18, 2023
97a3ec7
small postgres naming and config changes
MLenterman Sep 18, 2023
f8911e8
small corrections and contributing md
MLenterman Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ ZaakBrug Console can accessed from `host.docker.internal:9000/zaakbrug/`
ZaakBrug is also exposed on `host.docker.internal:8080/`

#### Configuration
By default ZaakBrug uses a filebased H2 database for storing the last used zaak and documenten identifiers. To facilitate easy swapping between development with docker-compose and the Frank!Runner, the default mount for the database file is `../frank-runner/data`. Using the same database file between the Frank!Runner and docker-compose prevents errors surrounding duplicate identifiers while running tests against OpenZaak. If you don't have the Frank!Runner installed, you can use `./data` that is commented out instead.
By default ZaakBrug uses a filebased H2 database for storing the last used zaak and documenten identifiers. To facilitate easy swapping between development with docker-compose and the Frank!Runner, the default mount for the database file is `../frank-runner/data`. Using the same database file between the Frank!Runner and docker-compose prevents errors surrounding duplicate identifiers while running tests against OpenZaak. If you don't have the Frank!Runner installed, you can use `./data` that is commented out instead or add a volume for it.

### Postgres
Instead of the default filebased H2 database, a Postgresql database can be used too. Adding `-f ./docker-compose.zaakbrug.postgres.yml` to your `docker-compose up` command is all that is needed for this.

For example: `docker-compose -f ./docker-compose.zaakbrug.dev.yml -f ./docker-compose.zaakbrug.postgres.yml up --build`

> Note: Database data is not seamlessly shared with the Frank!Runner out-off-the-box. In `src/webapp/META_INF/context.xml` you can comment out the H2 configuration and uncomment the Postgress one. The Frank!Runner will then use the Postgres database used in the docker-compose.


## docker-compose.zaakbrug.staging.dev
Contains an instance of OpenZaak specifically configured to act as cache or staging for ZGW to ZDS translations. It shares a network with ZaakBrug, and should be considered a component of the ZaakBrug deployment for when ZGW to ZDS translations are required.
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.zaakbrug.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
environment:
- zaakbrug.zds.timezone=UTC
- TZ=Europe/Amsterdam
volumes: &zaakbrug-database-data
volumes:
- ../frank-runner/data:/usr/local/tomcat/data
- logs:/usr/local/tomcat/logs
# - ./data:/usr/local/tomcat/data
Expand All @@ -36,7 +36,6 @@ services:

volumes:
logs:
database-data:
media:
private-media:

Expand Down
33 changes: 33 additions & 0 deletions docker-compose.zaakbrug.postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'

x-zaakbrug-postgres-env:
environment: &zaakbrug-postgres-env
POSTGRES_USER: zaakbrug
POSTGRES_PASSWORD: zaakbrug
POSTGRES_DB: zaakbrug

services:
zaakbrug-postgres:
image: postgres:${POSTGRES_VERSION:-14}
environment:
<<: *zaakbrug-postgres-env
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5400:5432
networks:
- zaakbrug-backend
volumes:
- zaakbrug-postgres-data:/var/lib/postgresql/data

zaakbrug:
environment:
<<: *zaakbrug-postgres-env
DB_HOSTNAME: zaakbrug-postgres
DB_PORT: 5432
volumes:
- ./docker/zaakbrug-postgres/context.xml:/usr/local/tomcat/conf/Catalina/localhost/ROOT.xml:rw
depends_on:
- zaakbrug-postgres

volumes:
zaakbrug-postgres-data:
10 changes: 10 additions & 0 deletions docker/zaakbrug-postgres/context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<JarScanner scanClassPath="false" scanAllFiles="false" scanAllDirectories="false"/>
<Resource name="jdbc/${database.instance.name:-zaakbrug}" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://${DB_HOSTNAME:-zaakbrug-postgres}:${DB_PORT:-5432}/${POSTGRES_DB:-zaakbrug}"
username="${POSTGRES_USER:-zaakbrug}"
password="${POSTGRES_PASSWORD:-zaakbrug}" />
</Context>
8 changes: 8 additions & 0 deletions src/main/webapp/META-INF/context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@
factory="org.apache.naming.factory.BeanFactory"
URL="jdbc:h2:./data/zaakbrug"
/>

<!-- <Resource name="jdbc/zaakbrug" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://${jdbc.hostname:-localhost}:5400/zaakbrug"
username="${database/username:-zaakbrug}"
password="${database/password:-zaakbrug}"
/> -->
</Context>
Loading