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

Workflow Steps

  1. 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.
  2. 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=...
  3. 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

Limitations

Cost Estimate

Success Checks

  1. App responds on its public URL
    Kind: http_get
    Path: /
    Expect: ample canary phoenix patterns
  2. Configuration-secrets check from the example
    Kind: http_get
    Path: /p/configuration-secrets
    Expect: see the pattern fixture checks

Examples

Evidence Summary

Next Actions

  1. Action: Browse the catalog index
    Method: GET
    Relative Path: /v1/catalog
  2. 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"}
  3. 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"}
  4. Action: Read the existing agent authentication setup
    Method: GET
    Relative Path: /mcp/setup