Skip to content

Commit

Permalink
OAK-11150: add documentation about how to run DBs in Docker (here: Po…
Browse files Browse the repository at this point in the history
…stgreSQL) (#1742)
  • Loading branch information
reschke committed Sep 27, 2024
1 parent cae54ed commit 07ae4da
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion oak-doc/src/site/markdown/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,20 @@ When adding database drivers using the test profiles, such as `-Prdb-derby`, siz

Example:

`mvn clean install -PintegrationTesting -Prdb-derby -Dnsfixtures=DOCUMENT_RDB "-Drdb.jdbc-url=jdbc:derby:./target/derby-test;create=true" -Dmax.jar.size=200000000`
`mvn clean install -PintegrationTesting -Prdb-derby -Dnsfixtures=DOCUMENT_RDB "-Drdb.jdbc-url=jdbc:derby:./target/derby-test;create=true" -Dmax.jar.size=200000000`

Note that Derby supports a local filesytem-based persistence, and thus does not require a standalone database server.

### Running a database in a Docker container

Even if a database is not installed locally, it still can be used using Docker.

Here's an example how to configure PostgreSQL using Docker (assuming Docker is already installed):

`docker run -p 8080:5432 --name oak-postgres -e POSTGRES_PASSWORD=geheim -e POSTGRES_DB=oak -d postgres:13-alpine`

This pulls the docker image "postgres:13-alpine", specifies a system password and a database to be created, and maps the default PostgreSQL port (5432) to the local port 8080.

To run tests, the following parameters would be used:

`mvn clean install -PintegrationTesting -Prdb-postgres -Dnsfixtures=DOCUMENT_RDB -Drdb.jdbc-url=jdbc:postgresql://localhost:8080/oak -Drdb.jdbc-user=postgres -Drdb.jdbc-passwd=geheim -Dmax.jar.size=200000000`

0 comments on commit 07ae4da

Please sign in to comment.