wizard Woodland Wizard

no downtime deploy

scattered notes on zero downtime deploys for personal projects.

  1. Use EnvironmentFile on systemd to load env vars
  2. Set LimitNOFILE=65535 on the service to avoid open limit
  3. StandardError=journal StandardOutput=journal so journalctl can see logs
  4. Use postgres, DO takes regular backups, maintenance is low
  5. Nginx has password-protected endpoints, use to hide app logs
  6. Nginx can cache static assets + APIs that barely change

Caddy Health checks and lb_retries can fix downtime Flip the proxy port after the new server is up Reload Caddy

my.domain.com {
  encode gzip
  reverse_proxy http://localhost:8001 {
    lb_try_duration 60s
    fail_duration 1s
    health_uri /healthz
    health_interval 5s
  }
}