page:guides:phoenix:schema changes

Apply Database Schema Changes for Phoenix

Summary

Schema changes for a Phoenix app on Ample. Verified on Phoenix: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok). 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

  1. Compute

    • Status: verified
    • Summary: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
  2. Postgres

    • Status: verified
    • Summary: Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.

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.
  2. Run Migrations as the Release Command

    • Ample runs the command before activation and fails the release if it exits non-zero; keep migrations idempotent.
    • Command: ample deploy . --name --public --release-command "python3 migrate.py"
  3. Verify

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

Examples

Success Checks

  1. App Responds on Its Public URL

    • Kind: http_get
    • Path: /
    • Expect: ample canary phoenix patterns
  2. Migrated Check from the Example

    • Kind: http_get
    • Path: /p/migrated
    • Expect: see the pattern fixture checks

Limitations

Cost Estimate

Evidence Summary

Next Actions

  1. Browse the Catalog Index

    • Action ID: browse-catalog
    • Method: GET
    • Relative Path: /v1/catalog
  2. Search Published Recipes by Intent, Stack and Constraints

    • Action ID: search-recipes
    • Method: POST
    • Relative Path: /v1/catalog/search
    • Parameters: { "body": { "limit": 5, "query": "Apply database schema changes for Phoenix" } }
  3. Prepare a Side-Effect-Free Deployment Plan

    • Action ID: plan:page:guides:phoenix:schema-changes
    • Method: POST
    • Relative Path: /v1/catalog/plan
    • Parameters: { "body": { "inputs": {}, "projectId": "", "recipeId": "page:guides:phoenix:schema-changes", "recipeRevision": "r1" } }
  4. Read the Existing Agent Authentication Setup

    • Action ID: auth-setup
    • Method: GET
    • Relative Path: /mcp/setup
  5. Browse Phoenix

    • Action ID: browse:stack:framework-phoenix
    • Method: GET
    • Relative Path: /v1/catalog/nodes/stack%3Aframework-phoenix