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
- A Starlette project (pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template)
- A PostgreSQL driver reading DATABASE_URL at runtime
- An Ample account token with
servers:write,databases:read
Resource Requirements
- Compute
- Postgres
Infrastructure Requirements
Compute
Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.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
Build and start
pip install into .ample/python from requirements.txt, thenuvicorn from run.py reading PORT on the python-3.12 template; the server must bind0.0.0.0on PORT.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"Verify
Fetch the live URL and/p/migratedon the example; on failure read the build and runtime logs.
Command:ample logs <your-app-name> --kind build
Limitations
- Verified on the python-3.12 template at
s-1vcpu-1gb; other sizes and Starlette major versions are not verified. - Region, compliance attestations and request-duration limits are unknown and not claimed.
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.
Cost Estimate
- Currency: USD
- Monthly Amount: 10.0
- Basis: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty
- Components:
- App server (size:
s-1vcpu-1gb, quantity: 1.0, monthly amount: 5.0) - Managed PostgreSQL database (size:
s-1vcpu-1gb, quantity: 1.0, monthly amount: 5.0)
- App server (size:
Examples
Starlette pattern fixture
- Verified schema changes on Starlette.
- Source Reference: tests/deploy-canaries/starlette-patterns
Success Checks
App responds on its public URL (
/)- Expected Response:
ample canary starlette patterns
- Expected Response:
Migrated check from the example (
/p/migrated)- Expected Response:
see the pattern fixture checks
- Expected Response:
Evidence Summary
- Kind: canary_run
- Summary: Starlette pattern fixture deployed on Ample (pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template); for this guide: a
--release-commandmigration ran before activation and its marker was readable by the live app (migrated=release-ok). - Observed At: 2026-09-21T01:21:36Z
- Implementation Revision: 50dbac567d2c5cc8e55e6c748a646be0025d9cfb-dirty (CLI 0.1.21)
- Expires At: 2027-03-20T01:21:36Z
Next Actions
Browse the catalog index
- Method: GET
- Relative Path: /v1/catalog
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" }
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" }
Read the existing agent authentication setup
- Method: GET
- Relative Path: /mcp/setup
Browse Starlette
- Method: GET
- Relative Path: /v1/catalog/nodes/stack%3Aframework-starlette
Browse Configure deployment
- Method: GET
- Relative Path: /v1/catalog/nodes/intent%3Aconfigure-deployment
Browse Transactional workflows
- Method: GET
- Relative Path: /v1/catalog/nodes/pattern%3Atransactional-workflows