Heroku "Stack" is an OS image that is curated and maintained by Heroku. The image below should explain it pretty well:
Some of my old apps are on heroku-16 stack, and I want to upgrade them to heroku-18 that is based on Ubuntu 18.04.
Inspect your Heroku app stack
heroku apps:info === Addons: ... Dynos: ... Stack: heroku-16 ...
Upgrade to heroku-18
Set the stack, create an empty commit, git push to trigger a rebuild.
Make sure test it on a staging environment first 🙂.
heroku stack:set heroku-18 git commit --allow-empty -m "Upgrade to heroku-18 stack" git push heroku master
You can also upgrade via the dashboard. Command line tools are more convenient for me as I have many apps hosted on Heroku.
Tip: You can use Parity to manage multiple heroku apps easily.
Seems like heroku-18 is the default stack for new apps, so if you just created one recently, you'd probably don't need to bother with this post 😁.