Backups and restore
Two kinds of backups:
| Project databases | Podmaker itself | |
|---|---|---|
| What | PostgreSQL bindings (pg_dump -Fc) |
Podmaker’s own database (encrypted) |
| Where | your backup targets (any S3-compatible storage) | IMP_PLATFORM_BACKUP_* target |
| When | on demand, before unbinding | daily at 02:30 |
Redis bindings are not backed up. Treat Redis as a cache or queue.
Backup targets
Any S3-compatible storage works: Hetzner Object Storage, AWS S3, Backblaze B2, Cloudflare R2, MinIO.
printf '%s' "$S3_SECRET" | podmaker backup target-add offsite \
--endpoint https://fsn1.your-objectstorage.com --bucket podmaker-backups \
--access-key "$S3_KEY" --region fsn1
podmaker backup targets
Use a bucket that only backups write to, ideally in another location than your servers. Enable versioning or object lock at the provider if you need protection against deletion.
Back up a project database
podmaker backup create --project shop --env production --binding db --target offsite
podmaker backup list --project shop --env production --binding db
The agent on the database’s server dumps the database and streams it to the target. Credentials for the target are handed to the agent for that task only.
Run it on a schedule from cron or your CI with a service account that has
backup.create:
# crontab on any machine with the CLI
15 3 * * * podmaker backup create --project shop --env production --binding db --target offsite -y
Restore
A restore overwrites the database (pg_restore --clean). It always needs
a human approval:
podmaker backup restore <backup-id> # request
podmaker backup restores # pending and past restores
podmaker backup approve-restore <restore-id> # or reject-restore
Or approve it under Services in the panel. The approval is signed, and the agent checks the signature before it touches the database.
Practice a restore into staging from time to time. A backup you have never restored is a hope, not a backup.
Protect Podmaker itself
Podmaker’s database holds your projects, encrypted secrets, the agent CA and
the audit log. On the panel server, fill in /srv/podmaker/shared/.env:
IMP_PLATFORM_BACKUP_ENDPOINT=https://fsn1.your-objectstorage.com
IMP_PLATFORM_BACKUP_REGION=fsn1
IMP_PLATFORM_BACKUP_BUCKET=podmaker-platform
IMP_PLATFORM_BACKUP_ACCESS_KEY=...
IMP_PLATFORM_BACKUP_SECRET_KEY=...
IMP_PLATFORM_BACKUP_KEY=<openssl rand -base64 32; store it somewhere else as well>
Then run deploy.sh update <name>, or on the server:
sudo -u podmaker php artisan optimize && systemctl restart podmaker-horizon podmaker-scheduler.
Backups run daily at 02:30.
Keep these outside the server: /srv/podmaker/shared/.env (master key,
app key) and IMP_PLATFORM_BACKUP_KEY. Without the master key, stored
secrets cannot be decrypted, even from a good backup.
Disaster recovery
- Install Podmaker on a new server with
deploy.sh. - Copy the old
IMP_MASTER_KEY,APP_KEYandIMP_PLATFORM_BACKUP_*values into the new/srv/podmaker/shared/.env. - Restore the latest platform backup:
php artisan podmaker:platform:backup --restore=platform/<object> --into=podmaker --force-live. - Point DNS at the new server. Agents reconnect by themselves: they keep their certificates and the Agent API name stays the same.
Details and the recovery drill: production operations.