-
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/
-
Install the Heroku CLI
-
Create App
appname
from the CLIheroku create appname
-
Heroku wants your app to reside standalone in a Git repository. Create a new private repository to hold your app on Github.com and push your app there. Notice that Heroku wants most files to be at the root of the repository (e.g., Procfile, .python-version, etc.)
-
Add a new git remote to your app repository using the
Heroku CLI
. This remoteheroku
is the one you will push to whennever you want to deploy the app to Heroku.heroku git:remote -a appname
If the command is successful you will be able to ommit the
-a appname
part sinceheroku
uses this information.Before our first deploy we need to set a couple of standard environment variables:
heroku config:set FLASK_APP=app
heroku config:set FLASK_DEBUG=0
heroku config:set FLASK_ENV=production
Generate your app's unique secret key
python3 -c 'import secrets; print(secrets.token_hex())'
Set the environment variable
heroku config:set FLASK_SECRET_KEY='your_key_from_the_previous_step'
heroku config: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.heroku config:set DATABASE_URL='postgres://istxxxxxx:[email protected]/istxxxxxx'
-
Are you ready for our first deploy?
git push heroku main
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.herokuapps.com/
Flavio Martins