Backups and upgrades
What to protect
Section titled “What to protect”| Data | What it contains | Required for recovery? |
|---|---|---|
| Media library | Original photos, videos, folder hierarchy, and supporting files | Yes |
| PostgreSQL database | Accounts, public links, branding, comments, ratings, flags, access logs, and server state | Yes |
| Compose and secret configuration | Mounts, public URL, database credentials, and optional integration secrets | Yes |
| Cache | Thumbnails and generated ZIP files | No |
Back up the media and database on a schedule that matches how quickly client review data changes—not only when media is imported.
Back up PostgreSQL while PICR is running
Section titled “Back up PostgreSQL while PICR is running”For the installation guide’s db service, create a logical SQL backup with pg_dump:
mkdir -p backupsdocker compose exec -T db pg_dump -U picr -d picr > backups/picr-$(date +%Y-%m-%d).sqlThe command writes the dump on the Docker host. Store it somewhere independent of the server along with your media and Compose configuration.
If your database service, user, or database name differs from the installation example, adjust the command.
Test restoration
Section titled “Test restoration”A backup is only useful if it restores. Periodically test a dump against a disposable, empty PostgreSQL database and start a matching PICR version against it.
The basic restore command for an empty database is:
docker compose exec -T db psql -U picr -d picr < backups/picr-2026-09-01.sqlDo not restore a full dump over an active production database with existing PICR tables. Stop PICR, prepare an empty target database, restore, then start the compatible PICR version and inspect its migration logs.
Also verify that the restored database points at a media library with the same folder structure. Database rows cannot recreate missing originals.
Back up configuration
Section titled “Back up configuration”Keep recoverable copies of:
compose.yml- Any Compose
.envfile - Reverse-proxy configuration and certificates, where appropriate
- The PICR Ping token and NAS Compose project if Ping is used
- Custom UID/GID or mount configuration needed for media and cache permissions
Before every PICR upgrade
Section titled “Before every PICR upgrade”-
Read the release notes.
-
Create and retain a fresh PostgreSQL dump.
-
Confirm the media backup is current.
-
Record the running PICR and PostgreSQL versions.
-
Pull and recreate PICR:
Upgrade the PICR container docker compose pull picrdocker compose up -d picrdocker compose logs -f picr -
Confirm login, gallery access, background migrations, thumbnails, and a test public link.
PICR applies application database migrations during startup. Do not interrupt the container merely because the first upgraded boot takes longer than normal; follow the logs and investigate an actual error.
PICR compatibility policy
Section titled “PICR compatibility policy”PICR supports a direct upgrade from any release in the previous major version to any release in the next major version unless release notes explicitly declare a required stop.
Examples:
- Any
0.xrelease can upgrade directly to any1.xrelease. - Any
1.xrelease can upgrade directly to any2.xrelease.
The database records a minimum compatible PICR version when a migration makes older application versions unsafe. Downgrading below that floor requires restoring a database backup taken before the upgrade.
PostgreSQL major upgrades
Section titled “PostgreSQL major upgrades”Changing postgres:17 to another PostgreSQL major version is not a normal PICR image update. PostgreSQL data directories are major-version specific and need their own supported migration process, commonly a logical dump/restore or pg_upgrade workflow.
Rollback
Section titled “Rollback”If an application upgrade fails:
- Preserve the failed logs and current database state for diagnosis.
- Check the release notes for a known migration or configuration requirement.
- If the prior PICR version remains above the database compatibility floor, it may be safe to run it against the upgraded database.
- Otherwise, restore the pre-upgrade PostgreSQL backup before starting the older PICR image.
