Backup and Restore
Postgram supports PostgreSQL logical backups via the CLI with optional GPG encryption. The Admin Backup tab is the supported restore path for a normal Docker installation.
What this page covers
Section titled “What this page covers”How to create reliable backups and restore into a fresh database for migration or recovery.
Core workflow
Section titled “Core workflow”- For the CLI path, provide the database connection URL. The CLI uses local
pg_dumpwhen available and otherwise its Docker Compose fallback:
export PGM_DATABASE_URL='postgresql://<user>:<password>@<host>:<port>/<database>'export PGM_BACKUP_PASSPHRASE='<choose-a-strong-passphrase>'pgm backup --encrypt --output /tmp/postgram-backups/ --jsonFor the default Docker Compose installation, use Admin → Backup unless you already have the required database connection URL available to the CLI.
- Keep the resulting archive and passphrase separately. To inspect an encrypted archive locally, decrypt a copy:
gpg --batch --yes --pinentry-mode loopback \ --passphrase "$PGM_BACKUP_PASSPHRASE" \ -o /tmp/postgram-backups/restore.dump \ -d /tmp/postgram-backups/<backup-file>.dump.gpg- Restore through Admin → Backup. It validates the archive, restores into a new database, runs health checks, and leaves the current database intact until you explicitly approve switch-over.
- Encrypted backups use
PGM_BACKUP_PASSPHRASE; losing it makes the encrypted archive unusable. - The archive contains application data. Treat it as sensitive, and back up the
postgram_secretsDocker volume separately: database backups do not include the installation keys needed for provider secrets or admin MFA factors. - Use direct
pg_restoreonly as an advanced operator workflow. Restoring over the current database bypasses the staged rollback path.