Repository navigation
Production Deployment
How the managed cloud instance is deployed on EC2 without losing user data.
Never run docker compose down -v on production.
The -v flag deletes the Postgres volume — all signups, tenants, API keys, and events are gone permanently unless you restore from backup.
| Task | Command |
|---|---|
| Production deploy | bash infra/deploy-production.sh |
| Backup only | bash infra/backup-postgres.sh |
| Qdrant backup | bash infra/backup-qdrant.sh |
| Local fresh install |
bash scripts/reset-local-db.sh (laptop only) |
cd ~/agentdb # or your clone path
bash infra/deploy-production.shThis script:
- Backs up Postgres to
infra/backups/zizkadb_<timestamp>.sql.gz - Runs
git pull - Rebuilds API with
docker compose up -d --build— no volume wipe - Restarts API and deploys dashboard
- Prints user count before/after and fails if count drops to zero
Non-interactive:
ZIZKA_DEPLOY_CONFIRM=yes bash infra/deploy-production.shcrontab -eAdd:
0 3 * * * cd /home/ubuntu/agentdb && bash infra/backup-postgres.sh >> /var/log/zizkadb-backup.log 2>&1Backups are kept for 14 days (BACKUP_KEEP_DAYS to override).
cd ~/agentdb
# Pick latest backup
ls -lt infra/backups/
gunzip -c infra/backups/zizkadb_YYYYMMDDTHHMMSSZ.sql.gz | \
docker compose -f infra/docker-compose.yml exec -T postgres \
psql -U zizkadb -d zizkadbFor a full restore into an empty database, stop API first, restore, then restart.
cd ~/agentdb
bash infra/backup-postgres.sh
git pull origin main
docker compose -f infra/docker-compose.yml up -d --build
docker compose -f infra/docker-compose.yml restart api
bash infra/deploy-dashboard.shSchema changes apply on API startup via core/db/connection.py (idempotent ALTER / CREATE IF NOT EXISTS). Do not rely on re-running schema.sql — that only runs on a brand-new empty Postgres volume.
Verify:
curl -s https://db.zizka.ai/health
# {"status":"ok","version":"0.1.0"}cd ~/agentdb
bash infra/deploy-dashboard.shDashboard runs on port 3001 behind nginx at db.zizka.ai.
| Mistake | What happens | Fix |
|---|---|---|
docker compose down -v on EC2 |
All users deleted | Restore backup; use deploy-production.sh
|
npm run build from repo root |
Build fails |
cd dashboard first |
| API not restarted after pull | New routes missing | docker compose restart api |
| Schema fix + volume wipe | Data loss | Use migrations + backup, not -v
|
-
ENV=productionininfra/.env -
DATABASE_URL— Postgres -
REDIS_URL,QDRANT_URL -
JWT_SECRET,JWT_REFRESH_SECRET -
TRIAL_DAYS— trial length (default 30) -
API_KEY_LIMITS_ENFORCED— enable Pro/Team API key caps (default false) -
NEXT_PUBLIC_API_URL=https://db.zizka.aifor dashboard build -
Do not set
DEV_API_KEYin production
-
curl https://db.zizka.ai/health→ ok - Check user count in deploy script output (should not drop)
- Login to dashboard
- Create agent → Test agent → event appears
Backup:
bash infra/backup-qdrant.sh-
Docker: creates a collection snapshot via Qdrant API →
infra/backups/qdrant_docker_<timestamp>.snapshot -
Native: tar archive of
.local/qdrant/storage/→infra/backups/qdrant_native_<timestamp>.tar.gz
Restore (native):
bash scripts/stop-native-stack.sh
rm -rf .local/qdrant/storage
mkdir -p .local/qdrant/storage
tar -xzf infra/backups/qdrant_native_<timestamp>.tar.gz -C .local/qdrant
bash scripts/restart-native-stack.shRestore (Docker): use Qdrant snapshot upload API or restore the qdrant_data volume from backup per Qdrant docs.
- Getting Started
- CONNECT.md — connect your stack
- Worked example 01
- Agents and API Keys
- Troubleshooting