Skip to content

Backups & upgrades

Everything is in the folder mounted at /app/data:

data/
├── pethealth.db # SQLite database (all records)
├── backups/ # automatic snapshots
└── uploads/
├── photos/ # pet photos
├── pdfs/ # lab exam PDFs
└── attachments/ # checkup and exam attachments

Uploaded files never change once written; they get random names and are deleted when their record is deleted.

PetHealth takes a consistent snapshot of the database with SQLite’s online backup API, which is safe while the app is running:

  • every BACKUP_INTERVAL_HOURS hours (default 24; checked hourly and at startup),
  • keeping the newest BACKUP_KEEP files (default 7),
  • in data/backups/pethealth-YYYYMMDD-HHMMSS-mmm.db.

Take one manually at any time:

Terminal window
docker exec pethealth npm run backup

Copying the whole data/ folder is a complete backup, since it holds the database and every upload. For a perfectly consistent copy, either stop the container first or copy the latest snapshot from data/backups/ together with uploads/.

Terminal window
docker compose stop
tar czf pethealth-backup-$(date +%F).tar.gz data
docker compose start
Terminal window
docker compose down
# Option A: restore a full copy
rm -rf data && tar xzf pethealth-backup-2026-10-01.tar.gz
# Option B: roll the database back to a snapshot
rm -f data/pethealth.db-wal data/pethealth.db-shm
cp data/backups/pethealth-20261001-080000-123.db data/pethealth.db
docker compose up -d

PetHealth runs SQLite in WAL mode. When you replace pethealth.db by hand, always delete the -wal and -shm files next to it first. Otherwise SQLite may try to apply leftover changes to the restored file.

To move one pet (with all its files) to another account or another PetHealth server, use Export pet (ZIP) on its profile and Import on the other dashboard. See Reports & export.

Terminal window
docker compose pull
docker compose up -d
  • Schema changes are applied automatically at startup (versioned migrations). You’ll see 🔄 Migración N aplicada in the logs when one runs.
  • Take a backup first, and read the release notes.
  • Downgrading to an older image after a migration isn’t supported. Restore the backup you took before upgrading instead.