Skip to content

default to MPG when you're setting up in a valid MPG region #4505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 6, 2025

Conversation

jphenow
Copy link
Member

@jphenow jphenow commented Jul 31, 2025

  • Prefer MPG when launching in a region MPG is supported
    • With --db and MPG isn't available in the region
    • if it's interactive, offer to switch selected region to the next closest MPG region via prompt
    • if it isn't interactive just use unmanaged postgres in the specified region
  • Allow passing prefernce to --db to launch that permits forcing to unmanaged postgres (upg/legacy) or mpg. If mpg is preferred and it's not available in the region:
    • If it's an interactive session, suggest the next closest MPG region via prompt
    • If it's a non-interactive session, fail with an error
  • When I run launch and MPG is selected it should show details about the cluster and plan cost similar to what we do in fly mpg create
❯ fly launch --region sea --db=mpg
Note: --db=mpg will require switching regions if Managed Postgres is not available in your target region.
An existing fly.toml file was found for app go-short-runtime-still-flower-9532
? Would you like to copy its configuration to the new app? No
Scanning source code
Detected a Dockerfile app
App 'go-short-runtime' already exists. You can deploy to it with `fly deploy`.
? Continue launching a new app?  Yes
Managed Postgres is not available in region sea.
? Would you like to switch to a region that supports Managed Postgres? Yes
? Select a region for Managed Postgres Ashburn, Virginia (US) (iad)
Switched to region Ashburn, Virginia (US) (iad) for Managed Postgres support.
Your app will now launch in this region.

Selected Managed Postgres Plan: Basic
  CPU: Shared x 2
  Memory: 1 GB
  Price: $38 per month

Creating app in /Users/jon/Code/go-short-runtime
We're about to launch your app on Fly.io. Here's what you're getting:

Organization: Jon Phenow                                                                    (fly launch defaults to the personal org)
Name:         go-short-runtime-little-bush-4490                                             (generated)
Region:       Ashburn, Virginia (US)                                                        (specified on the command line)
App Machines: shared-cpu-1x, 1GB RAM                                                        (most apps need about 1GB of RAM)
Postgres:     cluster go-short-runtime-little-bush-4490-db, Basic plan ($38/mo), region iad (forced by --db flag)
Redis:        <none>                                                                        (not requested)
Tigris:       <none>                                                                        (not requested)

? Do you want to tweak these settings before proceeding? No
Created app 'go-short-runtime-little-bush-4490' in organization 'personal'
Admin URL: https://fly.io/apps/go-short-runtime-little-bush-4490
Hostname: go-short-runtime-little-bush-4490.fly.dev
Provisioning Managed Postgres cluster...
Waiting for cluster go-short-runtime-little-bush-4490-db (9g6y30w2dj60v5ml) to be ready...
This may take up to 15 minutes. If this is taking too long, you can press Ctrl+C to continue with deployment.
You can check the status later with 'fly mpg status' and attach with 'fly mpg attach'.
Managed Postgres cluster 9g6y30w2dj60v5ml is ready and attached to go-short-runtime-little-bush-4490
The following secret was added to go-short-runtime-little-bush-4490:
  DATABASE_URL=postgresql://redacted
Wrote config file fly.toml

# ...


❯ fly launch --region sea --db
An existing fly.toml file was found for app go-short-runtime-little-bush-4490
? Would you like to copy its configuration to the new app? No
Scanning source code
Detected a Dockerfile app
App 'go-short-runtime' already exists. You can deploy to it with `fly deploy`.
? Continue launching a new app?  Yes
Managed Postgres is not available in region sea.
? Would you like to switch to a region that supports Managed Postgres? No
Using Unmanaged Postgres in region sea
Creating app in /Users/jon/Code/go-short-runtime
We're about to launch your app on Fly.io. Here's what you're getting:

Organization: Jon Phenow                         (fly launch defaults to the personal org)
Name:         go-short-runtime-young-forest-4376 (generated)
Region:       Seattle, Washington (US)           (specified on the command line)
App Machines: shared-cpu-1x, 1GB RAM             (most apps need about 1GB of RAM)
Postgres:     shared-cpu-1x, 256MB RAM, 1GB disk (forced by --db flag)
Redis:        <none>                             (not requested)
Tigris:       <none>                             (not requested)

? Do you want to tweak these settings before proceeding? No
Created app 'go-short-runtime-young-forest-4376' in organization 'personal'
Admin URL: https://fly.io/apps/go-short-runtime-young-forest-4376
Hostname: go-short-runtime-young-forest-4376.fly.dev
Creating postgres cluster in organization personal
Creating app...

# ...


❯ fly launch --region ord --db
Scanning source code
Detected a Dockerfile app

Selected Managed Postgres Plan: Basic
  CPU: Shared x 2
  Memory: 1 GB
  Price: $38 per month

Creating app in /Users/jon/workspace/superfly/flyctl
We're about to launch your app on Fly.io. Here's what you're getting:

Organization: Jon Phenow                                                            (fly launch defaults to the personal org)
Name:         flyctl-rough-thunder-6554                                             (generated)
Region:       Chicago, Illinois (US)                                                (specified on the command line)
App Machines: shared-cpu-1x, 1GB RAM                                                (most apps need about 1GB of RAM)
Postgres:     cluster flyctl-rough-thunder-6554-db, Basic plan ($38/mo), region ord (forced by --db flag)
Redis:        <none>                                                                (not requested)
Tigris:       <none>                                                                (not requested)

# ...


❯ fly launch --region ord --db=upg
Scanning source code
Detected a Dockerfile app
Creating app in /Users/jon/workspace/superfly/flyctl
We're about to launch your app on Fly.io. Here's what you're getting:

Organization: Jon Phenow                         (fly launch defaults to the personal org)
Name:         flyctl-floral-cloud-6270           (generated)
Region:       Chicago, Illinois (US)             (specified on the command line)
App Machines: shared-cpu-1x, 1GB RAM             (most apps need about 1GB of RAM)
Postgres:     shared-cpu-1x, 256MB RAM, 1GB disk (forced by --db flag)
Redis:        <none>                             (not requested)
Tigris:       <none>                             (not requested)

? Do you want to tweak these settings before proceeding? (y/N)

# ...

@jphenow jphenow merged commit cfd3e5b into master Aug 6, 2025
67 of 72 checks passed
@jphenow jphenow deleted the jphenow/default-mpg-launch branch August 6, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant