TLDR: Watch the video instead.
Thanks to @ebm for posting a discussion on how to deploy to fly.
Set the app name
and primary region
at fly.toml
.
app = "YOUR_APP_NAME"
...
primary_region = "iad"
IMPORTANT: The primary region should match your database (e.g. Supabase) region.
Create the app using fly
CLI:
fly apps create YOUR_APP_NAME
Set your secrets:
You can see the examples at .env.fly.example
.
Note: Replace "TODO" with your values or delete the variable before running the command, otherwise empty variables cause the command to throw error.
flyctl secrets set APP_NAME=YOUR_APP_NAME \
SERVER_URL=https://YOUR_APP_NAME.fly.dev \
DOMAIN_NAME=YOUR_APP_NAME.fly.dev \
DATABASE_URL=postgres://{USER}:{PASSWORD}@{HOST}:{PORT}/{DATABASE} \
API_ACCESS_TOKEN=1234567890 \
SESSION_SECRET=abc123 \
JWT_SECRET=abc123 \
SUPABASE_API_URL=TODO \
SUPABASE_KEY=TODO \
SUPABASE_ANON_PUBLIC_KEY=TODO \
STRIPE_SK=TODO \
SUPPORT_EMAIL=TODO \
POSTMARK_SERVER_TOKEN=TODO \
POSTMARK_FROM_EMAIL=TODO \
--app YOUR_APP_NAME
Deploy the app:
Make sure to remove "postinstall": "prisma generate"
from package.json
before deploying.
fly deploy
Optional: Scale
fly scale vm shared-cpu-2x --app YOUR_APP_NAME
If you don't scale enough, you may get crashes:
We respect your privacy. We respect your privacy.
TLDR: We use cookies for language selection, theme, and analytics. Learn more. TLDR: We use cookies for language selection, theme, and analytics. Learn more