Three fixes to ensure alembic migrations always run in production:
1. entrypoint.sh: add `exec "$@"` passthrough so `docker compose run
--rm backend alembic upgrade head` actually runs alembic instead of
ignoring args and starting uvicorn.
2. entrypoint.sh: remove `|| echo` fallback on alembic — if migration
fails the container must stop, not silently continue.
3. deploy.yml: start only postgres+redis first, run migration, THEN
start backend. Previously the backend started before migration,
ran with stale schema, and the separate migration step was broken
by the entrypoint bug.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
8-step pipeline:
1. Git pull
2. pg_dumpall + gzip backup (keep last 10)
3. Build images (with cache)
4. Start services
5. Wait for postgres
6. Run alembic migration (one-shot container)
- On failure: auto-restore DB from backup
7. Health check backend
- On failure: auto-rollback DB + restart
8. Summary with backup path
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Use 'docker compose run --rm backend alembic upgrade head' to run
migration in a throwaway container (doesn't need backend running)
- Restore entrypoint migration fallback (don't block startup)
- Restart backend after migration to pick up schema changes
- Remove --no-cache (too slow, was causing timeouts)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Entrypoint migration can fail silently. Now runs explicitly:
1. Wait for postgres
2. alembic upgrade head (explicit, fails the deploy if broken)
3. Wait for backend healthy
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All services (app + Prometheus + Grafana + node-exporter + cAdvisor)
are now in a single docker-compose.yml. One `docker compose up -d`
starts everything. No more separate monitoring file needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Monitoring was in a separate blocked job. Now everything runs in one
SSH session so Prometheus + Grafana always deploy with the app.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use ubuntu-24.04 runner with SSH to 192.168.1.151 (same pattern as
memento project). Self-hosted runner is not needed on the server.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Auto-deploys to 192.168.1.151 on push to production-deployment:
- Builds backend and frontend Docker images
- Starts all services with health checks
- Optionally deploys monitoring stack
- Cleans up old images
Requires a self-hosted runner on the target server.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>