Skip to content

Postgres Upgrades and changes#2091

Merged
Didayolo merged 3 commits intodevelopfrom
postgresUpgrades
Feb 24, 2026
Merged

Postgres Upgrades and changes#2091
Didayolo merged 3 commits intodevelopfrom
postgresUpgrades

Conversation

@ObadaS
Copy link
Collaborator

@ObadaS ObadaS commented Dec 22, 2025

Description

Updated Postgres image to the latest version (12 -> 18)
Added postgres configuration file to optimize the database (default values only, can use tools like https://pgtune.leopard.in.ua/ to get a configuration)
Updated documentation

Manual intervention

1. Maintenance mode on to avoid update on the database during the upgrade:

touch maintenance_mode/maintenance.on
git pull

2. Create the new postgres.conf file from the sample:

cp my-postgres_sample.conf my-postgres.conf

3. Rebuild docker containers to take into account the new image:

docker compose build --no-cache

4. Dump the database, remove it and reload it on the new configuration:

# Dump database
docker compose exec db bash -lc 'PGPASSWORD="$DB_PASSWORD" pg_dump -Fc -U "$DB_USERNAME" -d "$DB_NAME" -f /app/backups/upgrade-1.24.dump'
# Check that dump file is not empty
docker compose exec db bash -lc 'ls -lh /app/backups/upgrade-1.24.dump && pg_restore -l /app/backups/upgrade-1.24.dump | head'

/!\ Dangerous operation here: confirm that your dump worked before removing the database!

# Remove database
sudo rm -rf var/postgres
# Launch the new containers (containing the updated databse image and Restore from backup)
docker compose up -d
docker compose exec db bash -lc 'PGPASSWORD="$DB_PASSWORD" pg_restore --verbose --clean --no-acl --no-owner -U "$DB_USERNAME" -d "$DB_NAME" /app/backups/upgrade-1.24.dump'

See this for more details.

5 Disable maintenance mode:

rm maintenance_mode/maintenance.on

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ObadaS ObadaS force-pushed the postgresUpgrades branch 3 times, most recently from fb5debb to 70395e7 Compare February 24, 2026 09:02
@ObadaS ObadaS marked this pull request as ready for review February 24, 2026 09:03
@ObadaS ObadaS requested a review from Didayolo February 24, 2026 09:04
@Didayolo Didayolo self-assigned this Feb 24, 2026
@Didayolo Didayolo merged commit 871bc4a into develop Feb 24, 2026
1 check passed
@Didayolo Didayolo deleted the postgresUpgrades branch February 24, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants