| name | fly-deploy |
| description | Quick MVP deployment to fly.io for JavaScript (Next.js, RedwoodSDK, Express), Rust (Axum, Rocket), Python (FastAPI), and generic Dockerfiles. Use when deploying applications to fly.io, setting up databases (Postgres, volumes, Tigris object storage), managing secrets, configuring custom domains, setting up GitHub Actions workflows, creating review apps for pull requests, or troubleshooting fly.io deployments. Covers complete deployment workflows from initial setup through production. |
Fly.io Deployment
Quick MVP deployment to fly.io with support for multiple languages, databases, GitHub integration, and production-ready configurations.
When to Use This Skill
Use this skill when you need to:
- Deploy a new application to fly.io quickly
- Migrate existing applications to fly.io
- Set up databases (Managed Postgres, SQLite with volumes, or Tigris object storage)
- Configure secrets and environment variables
- Add custom domains with SSL certificates
- Set up GitHub Actions for continuous deployment
- Create PR review apps (preview environments)
- Troubleshoot deployment or runtime issues
- Optimize fly.io configurations for cost and performance
Quick Start
New Application
fly launch
Existing Application
fly deploy
fly deploy --remote-only
Workflow Decision Tree
1. Choose Your Starting Point
New App (No fly.toml)
→ See: Deploying New Applications
Existing fly.io App
→ See: Deploying Existing Applications
Migrating from Another Platform
→ See: references/deployment-workflow.md + Language-specific guides
2. Choose Your Language/Framework
Navigate to the appropriate language guide:
JavaScript/Node.js:
Python:
Rust:
Generic Dockerfile:
→ See: references/deployment-workflow.md
Each language guide includes:
- Optimized Dockerfiles (see also:
assets/dockerfiles/)
- fly.toml configuration examples
- Framework-specific best practices
- Common issues and solutions
3. Add Data Persistence (Optional)
Choose based on your needs:
Managed Postgres (Recommended for production SQL databases)
→ See: references/data-persistence.md#managed-postgres
→ Script: scripts/init_postgres.sh
Volumes (For SQLite, file uploads, or local storage)
→ See: references/data-persistence.md#fly-volumes
Tigris Object Storage (For media files, user uploads, S3-compatible)
→ See: references/data-persistence.md#tigris-object-storage
→ Script: scripts/setup_tigris.sh
External Database (Supabase, PlanetScale, Neon, etc.)
→ See: references/data-persistence.md#external-databases
4. Configure Secrets
→ See: references/secrets-and-env.md
fly secrets set DATABASE_URL=postgres://...
fly secrets set API_KEY=abc123
fly secrets set SECRET_KEY=$(openssl rand -hex 32)
5. Add Custom Domain (Optional)
→ See: references/domains-and-networking.md
fly certs add example.com
fly certs show example.com
6. Set Up CI/CD (Optional)
GitHub Actions Deployment:
→ See: references/github-integration.md
→ Template: assets/workflows/deploy.yml
PR Review Apps:
→ See: references/github-integration.md#review-apps
→ Template: assets/workflows/review-apps.yml
→ Script: scripts/setup_review_apps.sh
Deploying New Applications
Step 1: Prepare Your Application
Ensure your app has:
- Dockerfile or package.json/requirements.txt (for buildpacks)
- Health endpoint (e.g.,
/health returning 200 OK)
- Port configuration reading from
PORT environment variable
- Bind to 0.0.0.0 (not localhost or 127.0.0.1)
Example Dockerfiles available in: assets/dockerfiles/
nextjs.Dockerfile
express.Dockerfile
fastapi.Dockerfile
axum.Dockerfile
rocket.Dockerfile
Step 2: Initialize fly.io App
fly launch
Interactive prompts will:
- Detect your app type
- Suggest a name
- Choose a region
- Create
fly.toml
- Optionally deploy immediately
Useful flags:
fly launch --no-deploy
fly launch --name my-app
fly launch --region ord
Step 3: Configure fly.toml
Review and adjust fly.toml:
app = "my-app"
primary_region = "ord"
[build]
dockerfile = "Dockerfile"
[env]
PORT = "8080"
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 0
[[http_service.checks]]
grace_period = "10s"
interval = "30s"
path = "/health"
[[vm]]
memory = "256mb"
cpus = 1
→ For complete fly.toml reference: references/deployment-workflow.md
Step 4: Deploy
fly deploy
Your app will be available at: https://my-app.fly.dev
Deploying Existing Applications
For apps with existing fly.toml:
fly deploy
fly deploy --remote-only
fly deploy --strategy rolling
fly deploy --strategy immediate
Common Tasks
Adding a Database
Managed Postgres (Recommended):
./scripts/init_postgres.sh --app my-app
fly postgres create --name my-app-db
fly postgres attach my-app-db
Tigris Object Storage:
./scripts/setup_tigris.sh --app my-app
fly storage create
→ See: references/data-persistence.md
Managing Secrets
fly secrets set DATABASE_URL=postgres://...
fly secrets set API_KEY=secret123
fly secrets list
fly secrets unset API_KEY
→ See: references/secrets-and-env.md
Setting Up Review Apps
./scripts/setup_review_apps.sh --org personal --region ord
cp assets/workflows/review-apps.yml .github/workflows/
→ See: references/github-integration.md#review-apps
Adding Custom Domain
fly certs add example.com
fly ips list
fly certs show example.com
→ See: references/domains-and-networking.md
Scaling
fly scale memory 512
fly scale vm shared-cpu-2x
fly scale count 3
fly scale count 2 --region ord,iad
→ See: references/deployment-workflow.md#scaling
Troubleshooting
Common Issues
App won't start:
fly logs
Health checks failing:
fly ssh console -C "curl http://localhost:8080/health"
Database connection errors:
fly secrets list
fly ssh console
echo $DATABASE_URL
Deployment slow or timing out:
fly deploy --remote-only
fly deploy --no-cache
→ For comprehensive troubleshooting: references/troubleshooting.md
Debugging Commands
fly status
fly logs
fly ssh console
fly machine list
fly releases
fly checks list
Reference Documentation
Core Guides
- Deployment Workflow - fly.toml configuration, deployment strategies, scaling
- Data Persistence - Postgres, volumes, Tigris, external databases
- Secrets Management - Environment variables, secret handling, security
- GitHub Integration - GitHub Actions, review apps, CI/CD
- Custom Domains - DNS setup, SSL certificates, networking
- Troubleshooting - Common issues, debugging techniques, solutions
Language-Specific Guides
Bundled Resources
Scripts (scripts/)
Automation scripts for common tasks:
setup_review_apps.sh - Generate GitHub Actions workflow for PR review apps
init_postgres.sh - Create and attach Managed Postgres database
setup_tigris.sh - Configure Tigris object storage bucket
All scripts include help text. Run with --help or without arguments for usage.
Dockerfile Templates (assets/dockerfiles/)
Production-ready Dockerfiles for each framework:
nextjs.Dockerfile - Next.js with standalone output (minimal image)
express.Dockerfile - Express.js with multi-stage build
fastapi.Dockerfile - FastAPI with uvicorn
axum.Dockerfile - Axum with optimized Rust build
rocket.Dockerfile - Rocket with multi-stage build
Copy and customize for your app.
GitHub Actions Workflows (assets/workflows/)
Ready-to-use workflow templates:
deploy.yml - Basic deployment on push to main
review-apps.yml - PR review apps with automatic cleanup
test-and-deploy.yml - Run tests before deploying
Copy to .github/workflows/ and customize.
Best Practices
- Always use health checks - Ensures reliable deployments
- Start with minimal resources - Scale up based on actual usage
- Use Managed Postgres for production - Don't run unmanaged databases
- Set secrets properly - Never commit secrets to git
- Use remote builds for CI/CD -
fly deploy --remote-only
- Test locally first - Build and test Docker images locally
- Monitor logs regularly -
fly logs helps catch issues early
- Use review apps - Test changes before merging
- Configure graceful shutdown - Handle SIGTERM properly
- Keep dependencies updated - Security and performance
Quick Reference
fly launch
fly deploy
fly status
fly logs
fly ssh console
fly postgres create
fly postgres attach
fly storage create
fly secrets set KEY=value
fly secrets list
fly scale memory 512
fly scale count 3
fly certs add example.com
fly certs show example.com
fly ips list
fly logs
fly ssh console
fly checks list
fly releases
Getting Help
Note: fly.io changes frequently. This skill is based on documentation current as of January 2026. If commands or features have changed, consult the official fly.io documentation at https://fly.io/docs/