page:guides:phoenix:configuration secrets
Configure Environment and Secrets for Phoenix
Summary
Configuration and secrets for a Phoenix app on Ample. Verified on Phoenix: an --env value delivered encrypted and reported as present without being echoed (secret=set). Build and start: mix deps.get, MIX_ENV=prod mix compile and mix release in the builder, then the release bin script with PHX_SERVER=true on the elixir-1.18 template; PORT, DATABASE_URL and SECRET_KEY_BASE read in config/runtime.exs.
Prerequisites
- A Phoenix project (mix deps.get, MIX_ENV=prod mix compile and mix release in the builder, then the release bin script with PHX_SERVER=true on the elixir-1.18 template; PORT, DATABASE_URL and SECRET_KEY_BASE read in config/runtime.exs)
- An Ample account token with servers:write
Workflow Steps
- Build and start
mix deps.get, MIX_ENV=prod mix compile and mix release in the builder, then the release bin script with PHX_SERVER=true on the elixir-1.18 template; PORT, DATABASE_URL and SECRET_KEY_BASE read in config/runtime.exs; the server must bind 0.0.0.0 on PORT. - Pass values on deploy
Use --env KEY=value (repeatable) or --env-file; values are encrypted at rest and reused on redeploys. Declare names only in ample.toml.
Command:ample deploy . --name --public --env MY_SECRET=... - Verify
Fetch the live URL and /p/configuration-secrets on the example; on failure read the build and runtime logs.
Command:ample logs --kind build
Tested Configuration
- Template: elixir-1.18
- Runtime: elixir
- Size: s-1vcpu-1gb
- Install: mix local.hex --force && mix local.rebar --force && MIX_ENV=prod mix deps.get --only prod
- Build: MIX_ENV=prod mix compile && MIX_ENV=prod mix release --overwrite
- Start: PHX_SERVER=true _build/prod/rel/$(ls _build/prod/rel | head -n 1)/bin/$(ls _build/prod/rel | head -n 1) start
Limitations
- Verified on the elixir-1.18 template at s-1vcpu-1gb; other sizes and Phoenix major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
Cost Estimate
- Currency: USD
- Monthly Amount: 5.0
- Basis: size prices from pricing.toml (loaded by the API) at build revision.
- Components:
- Name: app server
- Size: s-1vcpu-1gb
- Quantity: 1.0
- Monthly Amount: 5.0
- Note: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.
Success Checks
- App responds on its public URL
Kind: http_get
Path: /
Expect: ample canary phoenix patterns - Configuration-secrets check from the example
Kind: http_get
Path: /p/configuration-secrets
Expect: see the pattern fixture checks
Examples
- Title: Phoenix pattern fixture
Description: Verified configuration and secrets on Phoenix.
Source Ref: tests/deploy-canaries/phoenix-patterns
Evidence Summary
- Kind: canary_run
Summary: Phoenix pattern fixture deployed on Ample; observed at 2026-09-20T23:45:31Z.
Scope: checks ["/p/configuration-secrets"]; Template: elixir-1.18
Next Actions
- Action: Browse the catalog index
Method: GET
Relative Path: /v1/catalog - Action: Search published recipes by intent, stack and constraints
Method: POST Relative Path: /v1/catalog/search
Body: {"limit": 5, "query": "Configure environment and secrets for Phoenix"} - Action: Prepare a side-effect-free deployment plan for an authorized project
Method: POST Relative Path: /v1/catalog/plan Body: {"inputs": {}, "projectId": "", "recipeId": "page:guides:phoenix:configuration-secrets", "recipeRevision": "r1"} - Action: Read the existing agent authentication setup
Method: GET
Relative Path: /mcp/setup