-
Notifications
You must be signed in to change notification settings - Fork 1
Deploying app on Fly.io
Resources included for free on all plans:
- Up to 3 shared-cpu-1x 256mb VMs
- 3GB persistent volume storage (total)
- 160GB outbound data transfer
Additional resources are billed at the usage-based pricing detailed here.
- 1 shared-cpu-1x 256mb VM
- <1GB persistent volume storage (total)
- <20GB outbound data transfer
Our app can easily be supported using only free allowances.
- 1 PostgreSQL Server Free @ Tecnico
-
Install the Fly.io CLI
-
Create App
appname
from the CLIflyctl apps create appname
-
Notice that Fly.io wants most files to be at the root of the repository (e.g., fly.toml, Dockerfile, etc.)
-
Before our first deploy we need to set a couple of standard environment variables:
flyctl secrets set FLASK_APP=app
flyctl secrets set FLASK_DEBUG=0
flyctl secrets set FLASK_ENV=production
Generate your app's unique secret key
python3 -c 'import secrets; print(secrets.token_hex())'
Set the environment variable
flyctl secrets set FLASK_SECRET_KEY='your_key_from_the_previous_step'
flyctl secrets set WEB_CONCURRENCY=2
-
We will set the
DATABASE_URL
to use the database from Tecnico. Note that you need to replaceistxxxxxx
andpgpass
using your information.flyctl secrets set DATABASE_URL='postgres://istxxxxxx:[email protected]/istxxxxxx'
-
Are you ready for our first deploy?
flyctl deploy
Take notice of the output of the previous command. It should tell you whether the app was sucessfuly deployed or not. Congratulations!
-
Open the
appname
index page at https://appname.fly.dev/