{"catalogRevision":"cat_726f873af6f566cc","recipeId":"page:migrate:fly-io-app:fastapi","recipeRevision":"r1","canonicalPath":"/migrate/fly-io-app/fastapi","label":"Migrate Fly.io app: FastAPI","title":"How to move a FastAPI app from Fly.io to Ample","family":"Migration guide","summary":"Move FastAPI compute from Fly.io app to Ample, one component at a time. Destination verified on Ample: the app built, started and answered on its public HTTPS URL with encrypted configuration delivered. Source procedure: Export secrets and env from `fly.toml` [env] and `fly secrets list` (values must come from your own records; Fly does not reveal secret values). Move separately: Fly volumes become Ample volumes and 6PN private services connect with `--link`; Ample runs each app in the USA or Europe and handles placement, so Fly Machines API calls drop out. Cutover: Add the custom domain with `ample domain add`, update DNS from the Fly target, keep the Fly app until verified, then scale it to zero. Rollback: keep the source untouched until you confirm; nothing at the source is changed or deleted by this guide.","representativeQueries":["Migrate Fly.io app: FastAPI","Where can I host FastAPI built with FastAPI?","I need a component-scoped export/import or reconfiguration procedure for FastAPI, with compatibility checks, verification and rollback."],"breadcrumbIds":["discovery","migration","migration:compute-sources","migration:fly-io-app","page:migrate:fly-io-app:fastapi"],"breadcrumbs":[{"id":"discovery","label":"Agent hosting discovery","canonicalPath":"/discover/discovery","kind":"root"},{"id":"migration","label":"Migration sources by component","canonicalPath":"/discover/migration","kind":"facet"},{"id":"migration:compute-sources","label":"Compute sources","canonicalPath":"/discover/migration/compute-sources","kind":"group"},{"id":"migration:fly-io-app","label":"Fly.io app","canonicalPath":"/discover/migration/fly-io-app","kind":"atom"},{"id":"page:migrate:fly-io-app:fastapi","label":"Migrate Fly.io app: FastAPI","canonicalPath":"/migrate/fly-io-app/fastapi","kind":"recipe"}],"parentIds":["migration:fly-io-app","stack:framework-fastapi","intent:migrate-compute"],"parents":[{"id":"migration:fly-io-app","label":"Fly.io app","canonicalPath":"/discover/migration/fly-io-app","kind":"atom"},{"id":"stack:framework-fastapi","label":"FastAPI","canonicalPath":"/discover/stack/framework-fastapi","kind":"atom"},{"id":"intent:migrate-compute","label":"Migrate compute","canonicalPath":"/discover/intent/migrate-compute","kind":"atom"}],"resourceRequirements":["primitive:compute","primitive:postgres"],"infrastructureRequirements":[{"primitiveId":"primitive:compute","label":"Compute","canonicalPath":"/discover/primitive/compute","status":"verified","summary":"Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes."},{"primitiveId":"primitive:postgres","label":"Postgres","canonicalPath":"/discover/primitive/postgres","status":"verified","summary":"Managed PostgreSQL 16 with pgvector runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied."}],"framework":"FastAPI","workload":"FastAPI","migrationSource":"Fly.io app","releaseStatus":"published","supportStatus":"verified","executionStatus":"unbound","docsOnly":true,"prerequisites":["Authorized access to the Fly.io app source and its export tooling","An inventory of every component in scope and out of scope","A validated backup or copy before any cutover","An Ample account token with servers:write, databases:read"],"testedConfiguration":{"template":"python-3.12","runtime":"python","size":"s-1vcpu-1gb","install":"python3 -m pip install --target .ample/python -r requirements.txt","start":"PYTHONPATH=.ample/python:${PYTHONPATH:-} python3 run.py"},"inputSchema":null,"outputSchema":null,"workflowSteps":[{"title":"Inventory the source","body":"List what Fly.io app provides beyond the component you are moving. Plan these separately: Fly volumes become Ample volumes and 6PN private services connect with `--link`; Ample runs each app in the USA or Europe and handles placement, so Fly Machines API calls drop out."},{"title":"Source step 1","body":"Export secrets and env from `fly.toml` [env] and `fly secrets list` (values must come from your own records; Fly does not reveal secret values)"},{"title":"Source step 2","body":"Translate `fly.toml` services and the Dockerfile or buildpack into a Node or Python source deploy; Ample builds from source on its templates"},{"title":"Source step 3","body":"Note Fly-only features in use: multi-region placement, machines API, volumes, private networking"},{"title":"Deploy on Ample in parallel","body":"pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template. Pass the exported variables with --env; keep the source running.","command":"ample deploy . --name <app-name> --public --start \"python3 run.py\" --env-file .env.production"},{"title":"Validate before cutover","body":"Run the app's own checks and, for data, compare counts and checksums; the example checks are the pattern self-tests (/p/configuration-secrets, /p/relational-records)."},{"title":"Cut over","body":"Add the custom domain with `ample domain add`, update DNS from the Fly target, keep the Fly app until verified, then scale it to zero."},{"title":"Rollback","body":"Point DNS or configuration back to the source. The source was never modified; deletion is a separate, user-executed step after validation."}],"examples":[{"title":"FastAPI pattern fixture (destination)","description":"Verified destination basis: FastAPI compute.","sourceRef":"tests/deploy-canaries/fastapi-patterns"}],"successChecks":[{"description":"destination app responds on its public URL","kind":"http_get","path":"/","expect":"ample canary fastapi patterns"},{"description":"configuration-secrets check from the destination example","kind":"http_get","path":"/p/configuration-secrets","expect":"see the pattern fixture checks"},{"description":"relational-records check from the destination example","kind":"http_get","path":"/p/relational-records","expect":"see the pattern fixture checks"},{"description":"data or object counts and checksums match the source","kind":"manual","expect":"operator comparison before cutover"}],"limitations":["A step-by-step guide: each stage is an ordinary `ample deploy`, `ample database` or `ample bucket` command you run.","The destination side was verified on Ample with the pattern fixture; the source-side steps use Fly.io app's standard tooling.","Plan separately: Fly volumes become Ample volumes and 6PN private services connect with `--link`; Ample runs each app in the USA or Europe and handles placement, so Fly Machines API calls drop out.","Verified on the python-3.12 template at s-1vcpu-1gb.","Managed PostgreSQL 16 with pgvector. Back up and restore with pg_dump and pg_restore."],"costEstimate":{"currency":"USD","monthlyAmount":10.0,"authoritative":true,"basis":"size prices from pricing.toml (loaded by the API) at build revision 3a3dfe06151688a20d397caac2aa66e562c23eb0","components":[{"name":"app server","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0},{"name":"managed PostgreSQL database","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0}],"note":"Upper-bound monthly price of the tested sizes at the destination."},"evidenceSummary":[{"kind":"canary_run","summary":"Destination side verified: the FastAPI 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) and its checks passed (the app built, started and answered on its public HTTPS URL with encrypted configuration delivered). The source-side export from Fly.io app uses the vendor's standard tooling.","observedAt":"2026-11-06T00:38:14Z","implementationRevision":"7360fc06ef21","expiresAt":"2027-05-05T00:38:14Z","scope":{"checks":["/p/configuration-secrets","/p/relational-records"],"destinationOnly":true,"template":"python-3.12"}}],"lastVerifiedAt":"2026-11-06T00:38:14Z","mcpBinding":null,"unknowns":[],"formats":{"html":"https://ample.computer/migrate/fly-io-app/fastapi","markdown":"https://ample.computer/migrate/fly-io-app/fastapi.md","json":"https://api.ample.computer/v1/catalog/recipes/page%3Amigrate%3Afly-io-app%3Afastapi"},"nextActions":[{"actionId":"browse-catalog","label":"Browse the catalog index","operationId":"catalog_index","method":"GET","relativePath":"/v1/catalog","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"search-recipes","label":"Search published recipes by intent, stack and constraints","operationId":"search_recipes","method":"POST","relativePath":"/v1/catalog/search","origin":"api","parameters":{"body":{"limit":5,"query":"Migrate Fly.io app: FastAPI"}},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"plan:page:migrate:fly-io-app:fastapi","label":"Prepare a side-effect-free deployment plan for an authorized project","operationId":"plan_deployment","method":"POST","relativePath":"/v1/catalog/plan","origin":"api","parameters":{"body":{"inputs":{},"projectId":"<workspace or server id you own>","recipeId":"page:migrate:fly-io-app:fastapi","recipeRevision":"r1"}},"requiresAuthentication":true,"requiresApproval":false},{"actionId":"auth-setup","label":"Read the existing agent authentication setup","operationId":"existing_auth_setup","method":"GET","relativePath":"/mcp/setup","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:migration:fly-io-app","label":"Browse Fly.io app","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/migration%3Afly-io-app","origin":"api","parameters":{"nodeId":"migration:fly-io-app"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:stack:framework-fastapi","label":"Browse FastAPI","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/stack%3Aframework-fastapi","origin":"api","parameters":{"nodeId":"stack:framework-fastapi"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:intent:migrate-compute","label":"Browse Migrate compute","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/intent%3Amigrate-compute","origin":"api","parameters":{"nodeId":"intent:migrate-compute"},"requiresAuthentication":false,"requiresApproval":false}]}