GeniePy supports deployments to Fly.io.
The following sections assume that
flyctl is installed on your machine.
1. Create application
Fly.io supports the Infrastructure-as-Code paradigm by letting you specify parts
of your application inside a
fly.toml configuration file.
GeniePy includes a basic
fly.toml for you to extend. Open it up in your text
editor and adjust the
app setting to a name you've reserved on Fly.io.
app = "example"
Next, launch this app:
$ flyctl launch
2. Set configuration
There are a few configuration settings the app needs to function. Let's set
$ flyctl secrets set \ SITE_NAME=Name \ SITE_DOMAIN=example.com \ SITE_URL=https://example.com \ COOKIE_SECRET=s3cr3t \ CSRF_SECRET=s3cr3t \ EMAIL_SENDERemail@example.com
Note that these values are only examples and that you should change them depending on your application.
3. Initialize the database
Create a new PostgreSQL database on Fly.io:
$ flyctl postgres create --name example-postgres
Next, attach this database to your app:
$ flyctl postgres attach --postgres-app example-postgres
This will "attach" the PostgreSQL cluster to your app the database and export
the connection string as the
DATABASE_URL environment variable to your app.
Now that the app knows how to access the database, let's run database migrations to bring it into the latest state.:
$ flyctl ssh --app-name example "alembic -c app/alembic.ini upgrade head"
4. All done!
That should be it. You can now check your Fly.io dashboard to get more details on the app you just launched and how to access it.