page:guides:phoenix:cdn assets

Deliver public assets through CDN for Phoenix

Cdn assets for a Phoenix app on Ample. Verified on Phoenix: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. 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.

Representative Queries

Resource Requirements

Infrastructure Requirements

Prerequisites

  1. 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).
  2. A bucket from ample bucket create with credentials passed as encrypted S3_* environment variables.
  3. An Ample account token with servers:write, buckets:read.

Tested Configuration

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.

Publish a Bucket for Public Assets

Publish only the asset bucket; upload versioned keys with an immutable Cache-Control header and build URLs from its public URL. Command: ample bucket publish

Verify

Fetch the live URL and /p/versioned-static-assets on the example; on failure read the build and runtime logs. Command: ample logs --kind build

Success Checks

Limitations

Cost Estimate

Examples

Phoenix Pattern Fixture

Evidence Summary

Next Actions

  1. Browse the catalog index: [API Call](GET /v1/catalog)
  2. Search published recipes by intent, stack and constraints [API Call](POST /v1/catalog/search)
  3. Prepare a side-effect-free deployment plan for an authorized project [API Call](POST /v1/catalog/plan)
  4. Read the existing agent authentication setup [API Call](GET /mcp/setup)
  5. Browse Phoenix [API Call](GET /v1/catalog/nodes/stack%3Aframework-phoenix)
  6. Browse Add CDN [API Call](GET /v1/catalog/nodes/intent%3Aadd-cdn)
  7. Browse Versioned static assets [API Call](GET /v1/catalog/nodes/pattern%3Aversioned-static-assets)