Skip to content

Commit

Permalink
docs(compose): Document how to migrate the database
Browse files Browse the repository at this point in the history
Add a migration guide for PostgreSQL major version updates in the Docker
Compose environment.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
  • Loading branch information
mnonnenmacher committed Jun 18, 2024
1 parent 2abefeb commit 0df4bc6
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,58 @@ to `latest`:
ORT_SERVER_IMAGE_PREFIX= ORT_SERVER_IMAGE_TAG=latest docker compose up
```

#### Handling major version upgrades of PostgreSQL

PostgreSQL does not support reading the data directory of previous major versions.
When upgrading the PostgreSQL version in the Docker Compose setup, the database data directory must be manually
migrated by following these steps:

- Stop the Docker Compose setup:

```shell
docker compose stop
```

- Start only the PostgreSQL service:

```shell
docker compose up -d postgres
```

- Make a backup of the ORT Server and Keycloak databases:

```shell
docker compose exec postgres pg_dump -Fc -U postgres -d ort_server -n public > keycloak.dump
docker compose exec postgres pg_dump -Fc -U postgres -d ort_server -n ort_server > ort-server.dump
```

- Stop compose and delete the volumes:

```shell
docker compose down -v
```

- Update the PostgreSQL version in `docker-compose.yml`.

- Start the PostgreSQL service again:

```shell
docker compose up -d postgres
```

- Import the database backups:

```shell
cat keycloak.dump | docker compose exec -T postgres pg_restore -U postgres -d ort_server -n public
cat ort-server.dump | docker compose exec -T postgres pg_restore -U postgres -d ort_server -n ort_server
```

- Start all services:

```shell
docker compose up -d
```

### Accessing the services

| Service | URL | Credentials |
Expand Down

0 comments on commit 0df4bc6

Please sign in to comment.