deployment-gotchas

Installation
SKILL.md

Deployment Gotchas

Not a deployment guide — these are the 7 things that break every first Phoenix deploy. Every rule maps to a real production incident pattern.

RULES — Follow these with no exceptions

  1. Use runtime.exs for secrets and URLsconfig.exs/prod.exs are compiled into the release and cannot read env vars at boot
  2. Run migrations via release commands (bin/migrate)mix is not available in production releases
  3. Set PHX_HOST and PHX_SERVER=true — without these, URL generation breaks and the server won't start
  4. Run mix assets.deploy before building the release — forgetting this means no CSS/JS in production
  5. Never hardcode secrets — use System.fetch_env!/1 in runtime.exs (the ! crashes on boot if missing, which is what you want)
  6. Split health checks into liveness and readiness — liveness returns 200 without touching the DB; only readiness queries the database
  7. Use config :logger, level: :info in production:debug logs query parameters including user data

1. runtime.exs vs config.exs

The incident: App deploys fine but uses the wrong database URL. DATABASE_URL was set correctly in the environment, but the release ignores it.

Installs
3
GitHub Stars
147
First Seen
Apr 21, 2026
deployment-gotchas — j-morgan6/elixir-phoenix-guide