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
- Use
runtime.exsfor secrets and URLs —config.exs/prod.exsare compiled into the release and cannot read env vars at boot - Run migrations via release commands (
bin/migrate) —mixis not available in production releases - Set
PHX_HOSTandPHX_SERVER=true— without these, URL generation breaks and the server won't start - Run
mix assets.deploybefore building the release — forgetting this means no CSS/JS in production - Never hardcode secrets — use
System.fetch_env!/1inruntime.exs(the!crashes on boot if missing, which is what you want) - Split health checks into liveness and readiness — liveness returns 200 without touching the DB; only readiness queries the database
- Use
config :logger, level: :infoin production —:debuglogs 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.