Feature Request: `fly launch --db=none`

I’m building a template fly.toml for our students. We an external database provider and do not need fly to provision a postgres database for us. I’d like to have simple instructions that do not require the user to tweak settings via the graphical web interface.

Flyctl does not respect the entry in fly.toml for the VM size but I have been able to get by with fly launch --vm-size=shared-cpu-1x.

However, if a database is detected, there doesn’t seem to be a way to skip the provisioning. I checked the source code to confirm.

I’d like to request an additional flag (either in fly.toml or the CLI) that lets us skip the database provisioning entirely for a given project, even if a database is detected.

Maybe something like fly launch --db=none or --skip-db etc.

1 Like

Added databases, flyctl, wishlist

Though that flag doesn’t exist, you might be able to work around the problem by stringing together fly apps create and fly deploy.

Here’s an example script that will create a new app, get the new app name, deploy the app using an existing fly.toml configuration, and then update that fly.toml to include the new app name:

#!/bin/bash

# Create a new app and extract the name
APP_NAME=$(fly apps create --generate-name | grep 'New app created:' | awk '{print $4}')

# Check if the app name was successfully extracted
if [ -z "$APP_NAME" ]; then
    echo "Failed to create app or extract app name."
    exit 1
fi

# Set any secrets needed for deployment, for example DATABASE_URL
# fly --app "$APP_NAME" secrets set SECRET_NAME=SECRET_VALUE

# Deploy using the extracted app name
fly deploy --app "$APP_NAME"

# Update the fly.toml file with the app name
fly config save -y --app "$APP_NAME"

The script assumes that you already have everything else you need to run your app.

1 Like

Cool, this give me a great place to start. I haven’t used fly create before, will look into it. Also love the idea of a random project name, that simplifies some things too.

So in this case, fly create, unlike fly launch, will not provision a database automatically?

So in this case, fly create, unlike fly launch, will not provision a database automatically?

That’s correct. :slightly_smiling_face:

From the fly apps create docs:

The APPS CREATE command will register a new application with the Fly platform. It will not generate a configuration file, but one may be fetched with ‘fly config save -a ’

More or less by using fly apps create and then fly deploy, you’re doing the same thing as fly launch minus a few steps.

You’re skipping the part where fly launch makes assumptions about what app your using and what it requires based on what it finds in the project directory, which is why you might need to set secrets before fly deploy.

For example, if you’re deploying a Rails app you’ll probably want to set the RAILS_MASTER_KEY and DATABASE_URL secrets, which fly launch would automatically do for you.

You don’t necessarily need to save the config again at the end of the script. Really at that point all you’d need to do is add theapp = "APP-NAME" line.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.