Deploy to Fly.io

  • Author
    by Admin User
    3 months ago
  • Deploy to Fly.io

    Thanks to @ebm for posting a discussion on how to deploy to fly.

    1. Set the app name and primary region at fly.toml.

    app = "YOUR_APP_NAME"
    ...
    primary_region = "iad"

    The primary region should match your database (e.g. Supabase) region.

    1. Create the app using fly CLI:

    fly apps create YOUR_APP_NAME
    1. Set your secrets:

    You can see the examples at .env.fly.example.

    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= \
    SUPABASE_KEY= \
    SUPABASE_ANON_PUBLIC_KEY= \
    STRIPE_SK= \
    SUPPORT_EMAIL= \
    POSTMARK_SERVER_TOKEN= \
    POSTMARK_FROM_EMAIL= \
    --app YOUR_APP_NAME
    
    1. Deploy the app:

    fly deploy
    1. Optional: Scale

    fly scale vm shared-cpu-2x --app YOUR_APP_NAME

    If you don't scale enough, you may get crashes:

    image.png
    Related Articles

    We respect your privacy.

    This website uses cookies to help personalize your online experience. Learn more.