Fly.ioExperimental
Deploy to Fly.io with one command, with Fly's Postgres and Upstash Redis or your own databases.
In a project with deploy fly (CLI 0.25.0 or newer), pnpm clubedge deploy uses Fly's CLI and your Fly login:
pnpm clubedge add deploy fly # if the project deploys elsewhere today
pnpm clubedge deployInstall Fly's CLI first: it is not on npm, so deploy can't download it for you.
What it does
- Signs in with
fly auth login, which opens the browser when you are signed out. WithFLY_API_TOKENset, it skips this. - Creates or reuses the app in your personal organization.
fly launchwrites the app's name (the package name and a short suffix, since Fly names are global) and region intofly.toml; commit it. - Creates the databases unless your env file points them elsewhere: an unmanaged Postgres app,
<app>-db(oneshared-cpu-1xmachine and a 1 GB volume), attached so it setsDATABASE_URL, and withcache redis, Upstash Redis<app>-redisasREDIS_URL. - Imports the secrets:
APP_URLandNEXT_PUBLIC_APP_URLashttps://<app>.fly.dev, aBETTER_AUTH_SECRETthat later runs keep,CLIENT_IP_HEADER=fly-client-ip, where the client's address is (CLI 0.42.0 or newer), and the env file's values. The ones still unset are listed before the build. - Runs
fly deploywithNEXT_PUBLIC_APP_URLas a build argument: Fly builds theDockerfile, runs the migrations as the release command, and waits for the health checks on/api/health.
Costs
Fly bills the app, Postgres, and Redis on your plan. Fly's Managed Postgres starts at $38 a month, so deploy uses unmanaged Postgres; for Managed Postgres, create it with fly mpg create, attach it with fly mpg attach, then run deploy.
When a deploy fails
fly logs --app <app> shows why: a failed migration in the release command, or a health check that never passed. Fix the cause and run deploy again, which reuses what exists.
To set up Fly.io without this command, see Fly.io in the deploy guide.
How is this guide?