page:guides:starlette:schema changes

Apply Database Schema Changes for Starlette

Schema changes for a Starlette app on Ample. Verified on Starlette: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok).
Build and start: pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template.

Prerequisites

Resource Requirements

Infrastructure Requirements

  1. Compute
    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
    Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.

Workflow Steps

  1. Build and start
    pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template; the server must bind 0.0.0.0 on PORT.

  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 <your-app-name> --public --start "python3 run.py" --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 <your-app-name> --kind build

Limitations

Cost Estimate

Examples

Starlette pattern fixture

Success Checks

  1. App responds on its public URL (/)

    • Expected Response: ample canary starlette patterns
  2. Migrated check from the example (/p/migrated)

    • Expected Response: see the pattern fixture checks

Evidence Summary

Next Actions

  1. Browse the catalog index

    • Method: GET
    • Relative Path: /v1/catalog
  2. Search published recipes by intent, stack and constraints

    • Method: POST
    • Relative Path: /v1/catalog/search
    • Parameters:
      Body: { "limit": 5, "query": "Apply database schema changes for Starlette" }
  3. Prepare a side-effect-free deployment plan for an authorized project

    • Method: POST
    • Relative Path: /v1/catalog/plan
    • Parameters:
      Body: { "inputs": {}, "projectId": "", "recipeId": "page:guides:starlette:schema-changes", "recipeRevision": "r1" }
  4. Read the existing agent authentication setup

    • Method: GET
    • Relative Path: /mcp/setup
  5. Browse Starlette

    • Method: GET
    • Relative Path: /v1/catalog/nodes/stack%3Aframework-starlette
  6. Browse Configure deployment

    • Method: GET
    • Relative Path: /v1/catalog/nodes/intent%3Aconfigure-deployment
  7. Browse Transactional workflows

    • Method: GET
    • Relative Path: /v1/catalog/nodes/pattern%3Atransactional-workflows