Tutorials Search / Shipping & infrastructure / Deploy on Fly.io
📝 Written ● Intermediate Updated 2026-05-13

How do I deploy on Fly.io from LingCode?

TL;DR: Run fly auth login once, run fly launch to scaffold a fly.toml in your project, then fly deploy ships it. Fly.io places your Docker container in 30+ regions automatically — pay per-CPU-second.

Fly.io is what happens when a Docker container can live in 30 cities at once. You bring an image; fly deploy places it near your users. Less work than a VPS, more control than a typical PaaS — and the only mainstream option that makes "global by default" cheap.

The traditional cloud picks one trade. Heroku/Render/Railway hide the infrastructure: simple to deploy, but you don't pick what runs where. A raw VPS at DigitalOcean exposes everything: you pick the machine and the city, but you're now responsible for OS, processes, restarts, scaling. Either model is fine for plenty of projects, but neither is quite right for "I want my app close to users in Sydney, São Paulo, and Frankfurt without learning Kubernetes."

Fly.io's model is "containers as primitives." You give them a Docker image (or a Dockerfile they'll build for you). They run it on lightweight Firecracker VMs they call "Machines," in any of 30+ regions, billable by the second. You pick which regions to deploy in; Fly's fly-replay header lets a request hit one region and bounce to another if needed. Apps that would have been one box in one city become "a small process per region the moment a user shows up there."

The catch is that this is more conceptual machinery than most PaaS. You write a fly.toml. You think about Machine sizes and scaling rules. You configure volumes if you need state. The pricing is per-second compute plus storage plus bandwidth — predictable but with more variables than a flat monthly Render plan. For projects that benefit from global reach or container-level control, the trade is worth it. For "I want to deploy a Next.js site and stop thinking," Vercel is simpler.

What you'll learn

Step 1: Install flyctl

1

One command on Mac

brew install flyctl
# or:
curl -L https://fly.io/install.sh | sh

Then sign up + auth in one command:

fly auth signup    # or: fly auth login if you have an account

A browser window opens for the OAuth flow. Once authorized, your local CLI holds a token. Fly requires a payment method on file before deploying anything (even on their generous free-credit tier) — add one in the dashboard.

Step 2: Make sure your app is Docker-able

2

If it runs in Docker locally, Fly runs it in production

The unit of deployment on Fly is a container image. You can:

  • Have a Dockerfile — Fly builds it for you on deploy.
  • Bring a pre-built image — point Fly at ghcr.io/you/myapp:latest or similar.
  • Use a buildpackfly launch can detect common stacks (Node, Python, Go, Rails) and generate a Dockerfile.

For most projects, write a Dockerfile alongside your code. If the app runs with docker run my-image locally on the right port, Fly can deploy it.

Step 3: fly launch

3

The interactive first-deploy

From your project root:

fly launch

The wizard asks: app name (must be globally unique), primary region (pick closest to you for dev), org (defaults to your personal one), and whether you want a Postgres or Redis instance alongside. For a first app, decline the database extras; you can add them later.

Fly creates a fly.toml in your project, builds an image (if needed), and offers to deploy. Say yes. A minute later, your app is live at https://<app-name>.fly.dev.

The fly.toml file is your deployment config: app name, primary region, build settings, env vars, services and their ports, scaling parameters. It's checked into git; teammates running fly deploy get the same config you did.

Step 4: Deploy iterations

4

Standard cadence

Subsequent deploys are one command:

fly deploy

This rebuilds your image (or pushes a fresh one if you specified a remote image), creates new Machines with the new image, swaps traffic to them, kills the old Machines. Default deploy strategy is "rolling" — zero downtime for stateless apps.

Watch deploys with fly status and stream logs with fly logs. For app shells, fly ssh console opens a shell on a running Machine.

Step 5: Add regions

5

"Make this global" in one command

Your initial deploy put one Machine in your primary region. Add more:

fly scale count 3 --region iad,fra,syd
# 3 machines, one each in Ashburn / Frankfurt / Sydney

Fly's anycast routing sends each user to the nearest healthy Machine. For stateless apps (most web servers, most APIs), this works out of the box. For stateful apps, you need to think about which region has the writable database — Fly's fly-replay header is the canonical answer.

Step 6: Bind a custom domain

6

Two records and a Fly command

fly certs create mydomain.com

Fly shows the DNS records you need to add — usually an A or AAAA pointing at a Fly anycast IP, plus an _acme-challenge CNAME for validation. Add them at your DNS provider. Within a few minutes, Fly validates the domain, issues a Let's Encrypt cert, and your app is reachable at the custom name with HTTPS.

Step 7: When NOT to use Fly

7

Three honest cases

  • You want a one-command deploy with zero config. Vercel for Next.js, Railway for whatever — both have less setup than even a small fly.toml. Fly's complexity is only worth it when you actually use the features.
  • You don't need multi-region. Most apps are fine in one region. If yours is, Fly's geographic edge is unused — and DigitalOcean's predictable monthly billing is simpler.
  • Your app isn't Docker-friendly. If you can't get a working Dockerfile, Fly will be painful. Use Render or Railway, both of which handle non-Docker stacks better.
State is harder than stateless. Fly's Machines have local volumes, but they're region-pinned — a Machine in Sydney can't reach a volume in Ashburn. For databases, use Fly Postgres (their managed offering) or, more commonly, point at an external managed DB (Neon, Supabase, PlanetScale). Don't try to build your own multi-region storage on top of raw volumes unless you really know what you're doing.

What's next