Skip to content

Instantly share code, notes, and snippets.

@hotrungnhan
Last active June 4, 2025 07:40
Show Gist options
  • Save hotrungnhan/253cba6c32de12fdf5c342d5af9a208e to your computer and use it in GitHub Desktop.
Save hotrungnhan/253cba6c32de12fdf5c342d5af9a208e to your computer and use it in GitHub Desktop.
Upgrade Postgres DB
  1. Attach volume backup:/backup
  2. Backup current DB
pg_dumpall -U $POSTGRES_USER > /backup/dump.sql
  1. delete postgres data volume
  2. Upgrade container version (new postgres data volume will be create)
  3. Restore
psql  -U $POSTGRES_USER < /backup/dump.sql
  1. Detatch backup volume (if needed, we can keep it there for next upgrade)
  2. Delete backup volume if detact or rm /backup/dump.sql if keep the volume.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment