Pegasus supports container-based deployment to


If you haven’t already, install the flyctl CLI.

The create an account with fly auth signup or login with fly auth login.


Once you have logged in via the CLI you can create your app and the services it will need. For each of the commands below follow the prompts given.

In the example below the “Chicago, Illinois (US) (ord)” region is selected. You may change the region to suit your needs, but it should be consistent throughout the commands.

  1. Create your app in

    $ fly launch --dockerfile Dockerfile.web \
      --dockerignore-from-gitignore \
      --no-deploy \
      --name {app-name} \
      --region ord
    # Answer 'yes' to the first question:
    An existing fly.toml file was found for app {app-name}
    ? Would you like to copy its configuration to the new app? Yes
    Creating app in /path/to/app/source
    Using dockerfile Dockerfile.web
    Selected App Name: {app-name}
    # Select the organization you want to deploy the app to:
    ? Select organization: My Org (my_org)
    Created app {app-name} in organization my_org
    Wrote config file fly.toml
    Your app is ready. Deploy with `flyctl deploy`
  2. Create the app database

    $ fly postgres create --name {app-name}-db --region ord
    # ? Select Organization: My Org
    # ? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
  3. Attach the DB to your app

    $ fly postgres attach {app-name}-db -a {app-name}
    Postgres cluster {app-name}-db is now attached to {app-name}
    The following secret was added to <app name>:
  4. Create the Redis instance

    $ fly redis create --name {app-name}-redis --region ord
    ? Select Organization: My Org (my_org)
    ? Would you like to enable eviction? Yes
    ? Select an Upstash Redis plan Free: 100 MB Max Data Size
    Your Upstash Redis database {app-name}-redis is ready.
    Apps in the personal org can connect to at redis://.....
  5. Set the REDIS_URL secret

    Using the Redis URL from the command above run:

    $ fly secrets set REDIS_URL={url}


You are now ready to deploy your app.

$ fly deploy

After deploying, review the production checklist for a list of common next steps

Running Database Migrations#

Database migrations are applied during deploy. This is configured in the fly.toml file.

Settings and Secrets# builds use the file. You can add settings here or in the base file, and use environment variables to manage any secrets, following the examples in these files.

Secrets are managed in via the web UI or on the command line using the CLI:

$ fly secrets set MY_VAR=secret_value

Running One-Off Commands#

You can one-off commands via a shell:

$ fly ssh console

app $ ./code/ [command]

Celery Support#

Out of the box, Pegasus is configured to run Celery using the multiprocess support provided by

For alternatives see