From b425be103c6fba2b8d35c722de7896b8be499a69 Mon Sep 17 00:00:00 2001 From: Kammerlo Date: Tue, 5 Mar 2024 15:02:46 +0100 Subject: [PATCH] chore: added upgrade information --- README.md | 14 ++++++++++++++ db-upgrade-docker-compose.yml | 16 ++++++++++++++++ docker-compose.yml | 6 +++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 db-upgrade-docker-compose.yml diff --git a/README.md b/README.md index 24e7c60c..0f4889ed 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,20 @@ docker compose -p preview down +### Upgrade Database to Postgres 14 +If you are upgrading from Postgres 11 to 14, you will need to run the following command to upgrade the database: + +- Add your Database password + User into the `./scripts/db-upgrade-docker-compose.yml` file +- Adjust volumes if needed - standard is migration from volume `postgres-data` to `postgres14-data` +- Run the following command to upgrade the database: +``` console +# Start upgrading container +docker compose -f ./scripts/db-upgrade-docker-compose.yml up +# Stop it manually after the upgrade is done with cmd + c +``` +- Adjust volume to the upgraded volume `postgres14-data` in the `docker-compose.yml` file +- Start the stack again + ### Check Cardano DB sync progress Use the GraphQL Playground in the browser at http://localhost:3100/graphql: > **_Note_** This Query is not available in early Era's of Cardano. Check Points of Interest here: [Link](https://ogmios.dev/mini-protocols/local-chain-sync/#points-of-interest) diff --git a/db-upgrade-docker-compose.yml b/db-upgrade-docker-compose.yml new file mode 100644 index 00000000..2249e55d --- /dev/null +++ b/db-upgrade-docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.8" + +services: + db-upgrade: + platform: linux/x86_64 + image: pgautoupgrade/pgautoupgrade:latest + environment: + - POSTGRES_LOGGING=true + - POSTGRES_PASSWORD=doNoUseThisSecret! + - POSTGRES_USER=postgres + volumes: + - postgres-data:/var/lib/postgresql/11/data + - postgres14-data:/var/lib/postgresql/14/data +volumes: + postgres-data: + postgres14-data: \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index f3909413..debdb350 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: postgres: - image: postgres:${POSTGRES_VERSION:-12.18-bullseye} + image: postgres:${POSTGRES_VERSION:-14.10-alpine} environment: - POSTGRES_LOGGING=true - POSTGRES_DB_FILE=/run/secrets/postgres_db @@ -16,7 +16,7 @@ services: - postgres_user shm_size: '2gb' volumes: - - postgres-data:/var/lib/postgresql/data + - postgres14-data:/var/lib/postgresql/data restart: on-failure logging: driver: "json-file" @@ -149,4 +149,4 @@ volumes: db-sync-data: node-db: node-ipc: - postgres-data: + postgres14-data: