Fly.io Primer
Deploy globally distributed apps with zero-config TLS, private networking, and edge-aware routing — all from a single Dockerfile.
Why Fly.io
Fly.io runs your app on physical servers in 30+ regions. Every instance gets a dedicated IPv6 address with automatic Anycast routing. Users hit the nearest region. You get a private WireGuard mesh between all your instances — no VPC config required.
The Fly.toml
Every Fly app ships with a fly.toml at its root. This file declares the app name, builder, HTTP service port, concurrency limits, and per-region scaling. Fly reads it on deploy and provisions machines accordingly.
Machines vs Apps
Fly.io v2 uses Machines — lightweight VM units that can be started, stopped, and snapshotted independently. An App is a logical grouping of Machines sharing the same config and private network. You scale by adding Machines in specific regions.
Persistent Storage
Fly Volumes provide NVMe-backed storage tied to a specific Machine. Use them for SQLite, Litestream replication, or local caches. Volumes survive deploys but not Machine destruction — pair with backups for durability.
Fly Postgres
Managed Postgres clusters with automatic leader election, read replicas, and point-in-time recovery. Deploy in any region Fly supports. Connect over the private WireGuard mesh — no public exposure needed.
Secrets & Env
Set secrets with fly secrets set KEY=val. They are encrypted at rest and injected as environment variables at runtime. Never commit secrets to your Dockerfile or fly.toml.
Quick Deploy
1. Install the CLI: brew install flyctl
2. Auth: fly auth signup
3. Launch: fly launch
4. Ship: fly deploy