3.9 KiB
3.9 KiB
Public Launch Runbook (Self-Hosted + Dokploy)
1) Goals
- Deploy Fiddy publicly without stack rewrite.
- Keep Postgres self-hosted.
- Enable fast rollback and basic operational visibility.
- Keep security baseline enforceable for direct home-IP exposure.
2) Deploy Control Plane (Dokploy)
- Install Dokploy on your Proxmox Docker host.
- Add project in Dokploy and connect Gitea repository.
- Configure image source:
git.nicosaya.com/nalalangan/fiddy/web. - Deploy by immutable tag (
github.sha) and keepmainas convenience tag. - Configure health check endpoint:
/api/health/ready. - Keep previous releases for rollback and verify rollback button path.
Required secrets/variables
DATABASE_URLDATABASE_SSLALLOWED_DB_NAMESSESSION_COOKIE_NAMESESSION_TTL_DAYSDEBUG_API=0
3) CI/CD (Gitea Actions)
- Use
.gitea/workflows/deploy-dokploy.yml. - Required secrets:
REGISTRY_USERREGISTRY_PASSDOKPLOY_DEPLOY_HOOKDOKPLOY_HEALTHCHECK_URL
- Health gate:
- workflow calls
scripts/wait-for-health.shagainstDOKPLOY_HEALTHCHECK_URL - default retry window: 5 minutes (30 attempts x 10s)
- workflow calls
4) Reverse Proxy + Network Hardening
- Use
docker/nginx/fiddy.confas baseline. - Install certificate with Let's Encrypt.
- Route 443 -> app container only.
- Keep Postgres private; never expose 5432 publicly.
- Restrict SSH to allowlist/VPN.
- Add host firewall rules:
- Allow inbound
80/443. - Deny all other inbound by default.
- Allow inbound
- Confirm Nginx writes JSON logs:
/var/log/nginx/fiddy-access.log/var/log/nginx/fiddy-error.log
- Apply/verify host baseline using scripts:
- dry-run firewall apply:
SSH_ALLOW_CIDR=<your-cidr> DRY_RUN=1 scripts/harden-host-ufw.sh - real firewall apply:
SSH_ALLOW_CIDR=<your-cidr> DRY_RUN=0 sudo scripts/harden-host-ufw.sh - host status audit:
scripts/check-host-security.sh
- dry-run firewall apply:
- Auto-ban templates:
- fail2ban:
docker/security/fail2ban/* - crowdsec (optional):
docker/security/crowdsec/acquis.yaml
- fail2ban:
5) Observability
- Bring up monitoring stack:
docker compose -f docker/observability/docker-compose.observability.yml up -d
- Configure Grafana datasource to Loki (
http://loki:3100). - Verify nginx logs are ingested by Promtail (
job="nginx"). - Add Uptime Kuma monitors:
/api/health/live/api/health/ready- home page (
/)
5.1) Deployment Smoke Check
- Run after every deploy and rollback:
scripts/smoke-public-launch.sh https://your-domain
- The script verifies:
/api/health/liveand/api/health/readyreturn200- both responses include
X-Request-Idheader - both response bodies include
request_id
6) Backup + Restore
- Daily backup command:
scripts/backup-postgres.sh
- Periodic base backup (for faster full recovery):
PRIMARY_DATABASE_URL=<replication-url> scripts/basebackup-postgres.sh
- Retention:
- default 7 days (
RETENTION_DAYS=7)
- default 7 days (
- Restore drill:
scripts/restore-drill-postgres.sh backups/postgres/<file>.dump <target_database_url>
- Run restore drill on non-prod DB before public launch.
- Record drill outcome:
scripts/log-restore-drill.sh <environment> <backup_file> <restore_target> <status> <rto_minutes> <notes>- log file:
docs/restore-drill-log.csv
7) Incident Response Quick Flow
- Identify failing request and
request_id. - Correlate application logs (Loki) by
request_id. - Check
/api/health/readystatus and DB connectivity. - Roll back to previous known-good Dokploy release if needed.
- Capture root cause and update this runbook/checklist.
8) Rollback Checklist
- Select previous healthy image in Dokploy release history.
- Trigger rollback and wait for deployment completion.
- Run
scripts/smoke-public-launch.sh https://your-domain. - Verify error-rate drop in Grafana/Loki and confirm no DB migration mismatch.
- Log the rolled back version, timestamp, and reason.