Devops

How to upgrade a Heroku production application to the latest stack via Heroku cli

This minipost will guide you through the process of updating a production application running on the Heroku platform to the latest stack via heroku cli. It is a straight forward process and we will use an empty commit with a relevant message to track the upgrade in history.

At this point in time, the latest stack version of Heroku is heroku-18. To set the latest stack to heroku-18 use the following:

heroku stack:set heroku-18 -a appname

(where appname the heroku production application name)

That will output:

stack set, next release on appname will use heroku-18
Run `git push heroku master` to create a new release on heroku-18

From the output you are notified that the stack is set, however, it is not immediately available, the next release of your application will be deployed on the latest stack. You need to perform a fresh deployment to create a new Heroku release deployed on the latest stack.

In order to do that, we will create an empty commit with a relevant message of the upgrade reason, by:

git commit --allow-empty -m "Upgrade to heroku-18"

That will output:

[master bb99ccb] Upgrade to heroku-18

In order to create a new release now, push to heroku master by:

git push heroku master

After this deployment, your production app will be running on the latest Heroku stack.

Buy Me A Coffee

Read also the following