page:recipes:public directory:phoenix:public media

Host public directory with Phoenix: object-stored public media

Summary

Deploy a public directory built with Phoenix on Ample using the public media library pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, a managed PostgreSQL 16 database is auto-provisioned and injected as DATABASE_URL, a private S3-compatible bucket holds objects with credentials delivered as encrypted environment variables, and a published bucket serves public assets from the CDN host. Verified on Phoenix: an object written to a published bucket with an immutable Cache-Control header, a mapping row, and the CDN URL serving it publicly.

Representative Queries

Resource Requirements

Infrastructure Requirements

  1. Compute: Apps run in isolated x86_64 Firecracker microVMs.
  2. Postgres: Managed PostgreSQL 16 runs in its own microVM.
  3. S3-compatible object storage: Buckets are S3-compatible with issued credentials.
  4. CDN: The CDN host serves objects from published buckets.

Prerequisites

Tested Configuration

Workflow Steps

  1. Build and start: Run the commands specified to build and start the app.
  2. Implement the pattern on PostgreSQL: Copy the public media library module and keep migrations idempotent.
  3. Wire object storage: Create the bucket(s) and pass necessary values as --env.
  4. Deploy: Run the synchronous deploy command and read the result.
  5. Verify: Fetch the live URL and run checks on the deployed app.

Success Checks

Limitations

Cost Estimate

Next Actions