GeniePy supports a few distinct deployment targets to make it easier for you to make your app go live.
Fly.io
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
them using flyctl secrets
:
$ flyctl secrets set \
SITE_NAME=Name \
SITE_DOMAIN=example.com \
SITE_URL=https://example.com \
COOKIE_SECRET=s3cr3t \
TOKEN_SECRET=s3cr3t \
CSRF_SECRET=s3cr3t \
EMAIL_SENDER=me@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.
Render
GeniePy supports deployments to Render.
Heroku
GeniePy supports deployments to Heroku.
The following sections assume that the heroku
CLI is installed on your machine
and that it's logged in to your Heroku account. Please follow Heroku's setup
instructions if this is not already the case.
1. Create application
The first step is to create an application:
$ heroku apps:create geniepy
Creating ⬢ geniepy... done
https://geniepy.herokuapp.com/ | https://git.heroku.com/geniepy.git
Next, we need to tell Heroku that this app is using containers.
$ heroku stack:set container
2. Set environment variables
Next, we need to set the essential environment variables using heroku config:set
. These are the variables without which the app cannot function.
$ heroku config:set \
SITE_NAME=Name \
SITE_DOMAIN=example.com \
SITE_URL=https://example.com \
COOKIE_SECRET=s3cr3t \
TOKEN_SECRET=s3cr3t \
CSRF_SECRET=s3cr3t \
EMAIL_SENDER=me@example.com
3. Initialize PostgreSQL
PostgreSQL is available on Heroku as an addon. Let's provision one using the CLI.
In this example we will use the "hobby-dev" plan which does not cost anything. For real-world deployments, please consider using a different plan geared more towards production usage.
$ heroku addons:create heroku-postgresql:hobby-dev
This will provision the database and export the connection string as the
DATABASE_URL
environment variable to our app.
Now that the app knows how to access the database, let's run database migrations to bring it into the latest state.
$ heroku run alembic -c app/alembic.ini upgrade head
4. All done!
That should be it! You can now access your app in the browser using:
$ heroku open