| name | flyio |
| description | Deploy and scale full-stack applications globally on Fly.io platform |
| when-to-use | When deploying web applications, APIs, databases, or microservices that need global distribution and automatic scaling |
| version | 1.1 |
| source | https://fly.io/docs/ |
| generated | "2026-01-21T00:00:00.000Z" |
| updated | "2026-01-21T00:00:00.000Z" |
Fly.io Platform Skill
Overview
Fly.io is a platform for deploying full-stack applications and databases globally. It runs your apps on Machines (fast-launching VMs) close to your users and scales compute resources automatically based on demand.
When to Use This Skill
Use Fly.io when you need to:
- Deploy web applications with global distribution
- Run Docker containers in production
- Scale applications automatically based on load
- Deploy databases (Postgres, Redis) close to users
- Run background jobs and workers
- Build multi-region applications with low latency
Core Concepts
Applications
An app on Fly.io can be anything from a simple frontend web app to a complex arrangement of processes and Machines all doing their own thing. Applications are defined using fly.toml configuration files.
Machines
Firecracker micro-VMs that run your application code. Machines can:
- Start in milliseconds
- Scale to zero when idle (autostop/autostart)
- Run anywhere in Fly.io's global network
- Be sized from minimal (shared-cpu-1x) to performance-optimized
Fly Launch
The primary deployment framework that manages the complete application lifecycle:
- Creates and configures applications
- Detects project types automatically
- Builds Docker images
- Provisions resources (IPs, volumes, databases)
- Deploys and scales applications
Quick Start
1. Install flyctl
macOS/Linux:
curl -L https://fly.io/install.sh | sh
Windows:
pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"
2. Sign up or log in
fly auth signup
fly auth login
3. Launch your application
cd your-app
fly launch
This will:
- Scan your project and detect the framework
- Create a
fly.toml configuration file
- Build your application as a Docker image
- Deploy your app to Fly.io
- Allocate IP addresses (IPv6 dedicated, IPv4 shared)
4. Deploy updates
fly deploy
Common Commands
Application Management
fly launch
fly launch --name my-app --region ord --no-deploy
fly deploy
fly deploy --image registry.fly.io/my-app:latest
fly status
fly info
fly open
fly logs
fly ssh console
fly apps list
fly apps destroy my-app
Machine Management
fly machines list
fly machines run registry.fly.io/my-app:latest
fly machines stop <machine-id>
fly machines start <machine-id>
fly machines destroy <machine-id>
Scaling
fly scale count 3
fly scale count 2 --region ord --region iad
fly scale vm shared-cpu-2x --memory 2048
fly autoscale set min=1 max=10
Secrets Management
fly secrets set DATABASE_URL=postgres://...
fly secrets list
fly secrets unset DATABASE_URL
fly secrets import < .env.production
Volumes (Persistent Storage)
fly volumes create data --size 10
fly volumes list
fly volumes delete vol_abc123
fly volumes extend vol_abc123 --size 20
Databases
fly postgres create --name my-db
fly postgres attach --app my-app my-db
fly redis create --name my-redis
fly postgres connect --app my-db
Configuration (fly.toml)
Basic Structure
app = "my-app"
primary_region = "ord"
[build]
dockerfile = "Dockerfile"
[[services]]
protocol = "tcp"
internal_port = 8080
[[services.ports]]
port = 80
handlers = ["http"]
[[services.ports]]
port = 443
handlers = ["tls", "http"]
[vm]
size = "shared-cpu-1x"
memory_mb = 256
[auto_stop_machines]
enabled = true
min_machines_running = 0
[auto_start_machines]
enabled = true
Advanced Features
Environment Variables:
[env]
PORT = "8080"
NODE_ENV = "production"
Process Groups:
[processes]
web = "node server.js"
worker = "node worker.js"
HTTP Service with Health Checks:
[[services]]
protocol = "tcp"
internal_port = 8080
[[services.http_checks]]
interval = "10s"
timeout = "2s"
grace_period = "5s"
method = "GET"
path = "/health"
[[services.tcp_checks]]
interval = "15s"
timeout = "2s"
grace_period = "5s"
Mounted Volumes:
[mounts]
source = "data"
destination = "/data"
Architecture & Deployment Blueprints
1. Resilient Applications with Multiple Machines
Pattern: Build high-availability apps using multiple Machines across regions
Key Concepts:
- Each Machine runs on a single physical host (no automatic failover)
- Service-based apps automatically get 2 Machines with autostop/autostart
- Apps with volumes get only 1 Machine (requires manual replication)
- Standby Machines for worker processes watch primary and start if it fails
Configuration Example:
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 0
[http_service.concurrency]
type = "requests"
soft_limit = 200
Scaling Commands:
fly scale count 2
fly scale count 20 --region ams,ewr,gig
fly machine clone <id> --standby-for <id>
fly machine run <image> --standby-for <machine-id>
Cost Efficiency:
- Stopped Machines charge only for rootfs storage (~$0.18/month for 1.2GB)
- No CPU or RAM charges when stopped
- Makes redundancy financially practical for side projects
When to Use:
- ✅ Production systems with paying users
- ✅ Customer-facing services requiring 99.9% uptime
- ✅ Regulated environments needing geographic availability
- ⚠️ Optional for staging/internal tools/side projects
2. Architecture Patterns
Available Patterns from Fly.io Blueprints:
N-Tier Architecture
- Multiple Machine resilience for high availability
- Session persistence strategies (sticky sessions)
- Shared Nothing architectural approaches
Multi-Region Database Patterns
- Deploy databases close to users
- Use fly-replay for write forwarding
- Read replicas in multiple regions
Networking & Connectivity
- Private application access via Flycast
- WireGuard VPN integration
- Cross-deployment bridging
- SSH server deployment for secure access
3. Scaling & Performance Blueprints
Autoscaling Configuration:
[http_service.concurrency]
type = "requests"
soft_limit = 200
hard_limit = 250
[auto_stop_machines]
enabled = true
min_machines_running = 0
[auto_start_machines]
enabled = true
Machine Autoscaling:
fly autoscale set min=2 max=10
fly scale concurrency soft=200 hard=250
Volume Forking:
- Fork volumes for rapid Machine initialization
- Faster cold starts with pre-populated data
- Useful for read-heavy workloads
4. Background Jobs & Automation
Distributed Work Queue:
fly machines run <image> --env WORKER=true --region ord
fly machine run <image> --env WORKER=true --standby-for <primary-id>
Cron-Based Task Scheduling:
# Using Supercronic for cron execution
FROM alpine:latest
RUN apk add --no-cache supercronic
COPY crontab /etc/crontab
CMD ["supercronic", "/etc/crontab"]
Infrastructure Automation:
- Alternatives to Terraform for Fly.io infrastructure
- Programmatic Machine creation via fly-machines API
- Event-driven automation using webhooks
5. Developer Workflow Blueprints
Zero-Downtime Deployments:
fly deploy
fly deploy --strategy rolling
Application Rollback:
fly releases
fly releases rollback
GitHub Preview Environments:
name: Deploy Preview
on: pull_request
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@1.3
with:
args: "deploy --app my-app-pr-${{ github.event.pull_request.number }}"
Staging/Production Isolation:
fly launch --name myapp-staging --org staging
fly launch --name myapp-production --org production
fly deploy --app myapp-staging
fly deploy --app myapp-production
Per-User Development Environments:
fly machines run <image> --name dev-$USERNAME --region ord
fly machines destroy dev-$USERNAME
6. Deployment Patterns
Static Site (Node.js)
FROM node:18-alpine as builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
API Server (Python FastAPI)
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
Multi-region Deployment
fly deploy --region ord,iad,lhr
[regions]
ord = 2
iad = 2
lhr = 1
Best Practices
Performance
- Use health checks - Configure HTTP/TCP checks for automatic recovery
- Enable autoscaling - Set min/max Machine counts based on load
- Choose regions wisely - Deploy close to users and dependencies
- Optimize Docker images - Use multi-stage builds, minimal base images
- Use volumes sparingly - Volumes add latency; use managed databases when possible
Security
- Use secrets - Never hardcode credentials in
fly.toml or Dockerfile
- Enable HTTPS - Fly.io provides free TLS certificates
- Private networking - Use Fly.io private network (6PN) for inter-app communication
- Least privilege - Deploy tokens and access controls appropriately
- Regular updates - Keep base images and dependencies current
Cost Optimization
- Autostop/autostart - Enable for low-traffic apps to scale to zero
- Right-size Machines - Don't over-provision CPU/RAM
- Use shared CPUs - Sufficient for most workloads
- Monitor usage - Check
fly dashboard for resource consumption
- Clean up unused apps - Destroy test/staging apps when not needed
Reliability
- Multiple Machines - Run at least 2 Machines for high availability
- Health checks - Automatic traffic routing away from unhealthy Machines
- Rolling deployments - Default behavior prevents downtime during updates
- Backup volumes - Snapshot important data regularly
- Monitor logs - Use
fly logs or integrate with logging services
Troubleshooting
Common Issues
App won't start:
fly logs
fly config validate
fly ssh console
Port binding errors:
- Ensure app listens on
0.0.0.0 not localhost
- Match
internal_port in fly.toml with app's listening port
- Check
PORT environment variable
Build failures:
fly deploy --local-only
fly deploy --remote-only
docker build .
Slow performance:
- Check Machine size (CPU/RAM)
- Review autoscaling configuration
- Verify database connection pooling
- Enable connection reuse
- Check region proximity to users/services
Database connection issues:
- Verify
DATABASE_URL secret is set
- Check Postgres cluster status:
fly status --app my-db
- Use Fly.io private network addresses (
.internal)
- Ensure connection pooling (pgbouncer)
Getting Help
fly open https://community.fly.io
fly docs
fly support
fly open https://status.fly.io
Resources
Official Documentation
Community
Pricing
Examples in Repository
See knowledge/ directory for:
- Multi-region deployment examples
- Database integration patterns
- Background worker configurations
- Advanced networking setups
Changelog
Version 1.1 (2026-01-21)
- ✨ Added comprehensive Architecture & Deployment Blueprints section
- ✨ Added resilient applications pattern with multiple Machines
- ✨ Added autoscaling configuration examples
- ✨ Added background jobs and automation patterns
- ✨ Added developer workflow blueprints (zero-downtime, rollback, preview environments)
- ✨ Added cost efficiency guidance for stopped Machines
- ✨ Enhanced scaling commands with multi-region examples
- ✨ Added standby Machine pattern for worker processes
Version 1.0 (2026-01-21)
- Initial skill creation
- Core Fly.io concepts and quick start guide
- Common commands and configuration
- Basic deployment patterns
- Best practices for performance, security, cost, and reliability
- Troubleshooting guide
Version: 1.1
Last Updated: 2026-01-21
Source: Fly.io Official Documentation + Blueprints
Maintained By: Claude Command and Control