Backup and upgrades
Back up Postgres and uploads, then upgrade ChatAI safely.
What to back up
| Data | Location | Notes |
|---|---|---|
| Database | Compose volume chatai_pgdata | Assistants, chunks, conversations, API keys |
| Uploads | Compose volume chatai_uploads | Original files under /app/uploads |
| Config | Your .env / secrets store | Not in the image. Keep ENCRYPTION_KEY with your backups: without it, restored per-assistant provider keys can't be decrypted |
| Voice recordings | Your S3-compatible bucket | Only if recording is enabled; back up with your storage provider's tools |
Database dump
With Compose running:
docker compose exec -T db pg_dump -U chatai -d chatai -Fc > chatai-$(date +%Y%m%d).dumpPlain SQL:
docker compose exec -T db pg_dump -U chatai -d chatai > chatai-$(date +%Y%m%d).sqlRestore
# Example: custom format dump into a fresh volume
docker compose up -d db
docker compose exec -T db pg_restore -U chatai -d chatai --clean --if-exists < chatai-YYYYMMDD.dumpPrefer restoring into an empty database or a new volume. Coordinate with app downtime so ingest workers are not writing mid-restore.
Uploads volume
Copy the named volume or bind-mount contents. Example with a temporary Alpine container:
docker run --rm \
-v chatai_chatai_uploads:/data \
-v "$PWD:/backup" \
alpine tar czf /backup/chatai-uploads-$(date +%Y%m%d).tgz -C /data .Adjust the volume name to match docker volume ls on your host (Compose prefixes the project name).
Upgrade flow
Upgrading from 1.0? Read Upgrading to 1.1 first. Moving to 1.4 for Voice experiences / npm embeds? See Upgrading to 1.4.
-
Back up Postgres and uploads
-
Pull / rebuild the app image:
git pull docker compose build app -
Restart so the entrypoint runs migrations:
docker compose up -d appMigrations run automatically via
node /app/packages/database/scripts/migrate.mjson boot. You do not need to apply0000_*.sqlby hand. -
Smoke health:
curl -s http://localhost:3000/api/health # {"status":"ok","db":"ok"} -
Sign in, open an assistant playground, and send a short test message.
Existing databases
If an older install only applied the first SQL file and skipped later migrations, restarting the current image applies pending Drizzle migrations (0001–…) on boot.