Skip to content
fly-io logo

Fly.io

fly-io

Deploys applications globally on Fly.io edge infrastructure with Firecracker VMs, multi-region deployment, and usage-based pricing. Use when deploying to multiple regions, running containers at the edge, or needing fast cold starts.

SKILL.md

Full skill instructions

Fly.io

Global edge deployment platform running applications in Firecracker micro-VMs close to users.

Quick Start

# Install flyctl
curl -L https://fly.io/​install.sh | sh

# Or on macOS
brew install flyctl

# Login
fly auth login

# Launch app (creates fly.toml)
fly launch

# Deploy
fly deploy

Project Setup

fly.toml

app = "my-app"
primary_region = "ord"

[build]
  dockerfile = "Dockerfile"

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1

  [http_service.concurrency]
    type = "requests"
    hard_limit = 250
    soft_limit = 200

[[vm]]
  cpu_kind = "shared"
  cpus = 1
  memory_mb = 256

Basic Dockerfile

FROM node:20-alpine

WORKDIR /​app

COPY package*.json ./
RUN npm ci --only=production

COPY . .
RUN npm run build

EXPOSE 3000

CMD ["node", "dist/​index.js"]

Deployment

Deploy from Git

# First deploy creates app
fly launch

# Subsequent deploys
fly deploy

# Deploy specific Dockerfile
fly deploy --dockerfile Dockerfile.prod

# Deploy with build args
fly deploy --build-arg API_KEY=$API_KEY

Deploy Strategies

[deploy]
  strategy = "rolling"  # default
  # strategy = "immediate"
  # strategy = "canary"
  # strategy = "bluegreen"

Regions

Multi-Region Deployment

# Add regions
fly regions add ams lhr syd

# List regions
fly regions list

# Remove region
fly regions remove syd

Region Configuration

app = "my-app"
primary_region = "ord"

# Scale to multiple regions
[[vm]]
  memory = "256mb"
  cpu_kind = "shared"
  cpus = 1

  [vm.processes]
    web = 2  # 2 machines per region

Available Regions

CodeLocation
ordChicago
iadVirginia
laxLos Angeles
amsAmsterdam
lhrLondon
fraFrankfurt
sydSydney
nrtTokyo
sinSingapore

Secrets & Environment

Secrets (Encrypted)

# Set secrets
fly secrets set DATABASE_URL=postgres://... API_KEY=secret

# List secrets
fly secrets list

# Unset secret
fly secrets unset API_KEY

Environment Variables

# fly.toml
[env]
  NODE_ENV = "production"
  LOG_LEVEL = "info"

Per-Region Environment

[[env]]
  NODE_ENV = "production"

  [[env.region]]
    region = "ord"
    CDN_URL = "https://us-cdn.example.com"

  [[env.region]]
    region = "ams"
    CDN_URL = "https://eu-cdn.example.com"

Scaling

Machine Scaling

# Scale up
fly scale count 3

# Scale per region
fly scale count 2 --region ord
fly scale count 1 --region ams

# Scale VM size
fly scale vm shared-cpu-1x
fly scale vm dedicated-cpu-1x
fly scale memory 512

Auto-scaling

[http_service]
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1
  max_machines_running = 10

  [http_service.concurrency]
    type = "requests"
    soft_limit = 100
    hard_limit = 250

Databases

Postgres

# Create Postgres cluster
fly postgres create

# Attach to app
fly postgres attach my-postgres-db

# Connect
fly postgres connect -a my-postgres-db

# Proxy to local
fly proxy 5432 -a my-postgres-db

Redis

# Create Redis
fly redis create

# Get connection string
fly redis status my-redis

LiteFS (SQLite)

# Create LiteFS cluster
fly apps create my-app-litefs

# Configure in fly.toml
[mounts]
  source = "litefs"
  destination = "/​var/​lib/​litefs"

Volumes (Persistent Storage)

# Create volume
fly volumes create mydata --size 1 --region ord

# List volumes
fly volumes list

# Destroy volume
fly volumes destroy vol_xxx
# fly.toml
[mounts]
  source = "mydata"
  destination = "/​data"

Networking

Custom Domains

# Add domain
fly certs add example.com

# Check certificate status
fly certs show example.com

Private Networking

# Internal services communicate via .internal DNS
# api.internal:3000

Static IPs

# Allocate IPv4 (paid)
fly ips allocate-v4

# List IPs
fly ips list

Health Checks

[http_service]
  internal_port = 3000

  [[http_service.checks]]
    grace_period = "5s"
    interval = "10s"
    timeout = "2s"
    path = "/​health"
    method = "GET"
    protocol = "http"

Processes

Multiple Processes

[processes]
  web = "node dist/​server.js"
  worker = "node dist/​worker.js"

[[http_service]]
  processes = ["web"]
  internal_port = 3000

[[services]]
  processes = ["worker"]
  internal_port = 0

Background Workers

[processes]
  worker = "node dist/​worker.js"

[[services]]
  processes = ["worker"]
  internal_port = 0
  auto_stop_machines = false

Node.js Configuration

Optimized Dockerfile

FROM node:20-alpine AS builder

WORKDIR /​app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
RUN npm prune --production

FROM node:20-alpine

WORKDIR /​app
COPY --from=builder /​app/​dist ./​dist
COPY --from=builder /​app/​node_modules ./​node_modules
COPY --from=builder /​app/​package.json ./

ENV NODE_ENV=production
USER node

CMD ["node", "dist/​index.js"]

Next.js

app = "my-nextjs-app"
primary_region = "ord"

[build]
  dockerfile = "Dockerfile"

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true

[[vm]]
  memory = "512mb"
  cpu_kind = "shared"
  cpus = 1

CLI Commands

# App management
fly apps create my-app
fly apps list
fly apps destroy my-app

# Deployment
fly deploy
fly deploy --strategy immediate
fly status

# Logs
fly logs
fly logs -a my-app

# SSH
fly ssh console
fly ssh console -C "node -v"

# Monitoring
fly status
fly dashboard

# Scaling
fly scale show
fly scale count 3
fly scale memory 512

# Regions
fly regions list
fly regions add ord ams

# Secrets
fly secrets set KEY=value
fly secrets list

See references/​configuration.md for complete fly.toml options.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View