Install Git and the Heroku CLI and log in using heroku login
.
Then follow this guide to set up and deploy with Git:
# creat the app
heroku create -a python-shiny
# check that the heroku remote is added
git remote -v
Now we use the heroku.yml
as our manifest to build the Docker image on Heroku:
# set the stack of your app to container:
heroku stack:set container
Check in your commits, then git push heroku main
. This will build the image and deploy your app on Heroku.
Get the app URL from heroku info
, then check the app.
Enabling session affinity:
heroku features:enable http-session-affinity
Change dyno type to allow scaling to >1:
# change dyno type
heroku ps:type web=standard-1x
Scale the number of web dynos to 2:
heroku ps:scale web=2
It should say Status: Test complete.
Now let's disable session affinity:
heroku features:disable http-session-affinity
Visit the app URL again, refresh, and you'll see Status: Failure!.
Delete the app from the dashboard or use heroku apps:destroy --confirm=python-shiny
(this will remove the git remote as well).
For the R version, edit the heroku.yml
to use Dockerfile.lb-r
:
build:
docker:
web: Dockerfile.lb-r
You can now repeat the steps above.