Updating the stack on Heroku

Viewed 1034

I have a small application running there using the heroku-buildpack-perl buildpack. It's just a small Plack application and it had been running fine for about two years.

But then, Heroku informed me that the stack it was running on was getting too old and I needed to upgrade it. "Just run a new deploy and the application will be installed to a new stack!" said they or something like that.

I inniciated a new deploy by creating an empty commit in the git repository, the deployment ran... but the application was crashing. From the logs I realised they updated the Perl version, but the deployment didn't update my XS libraries (I use local::lib, not sure if that's part of the buildpack or I set it up manually when creating the application back then).

In the end, I deleted the application and recreated it on the new stack, which worked OK. I don't keep any data anywhere so it was not a problem. What's the correct way to update the stack, though? There should be an option somewhere that tells Heroku to rebuild the dependencies, right?

Crossposted to PerlMonks.

1 Answers

Setting Heroku stack. In this case to heroku-20 equivalent with Ubuntu 20.04

$ heroku stack:set heroku-20

Since you are using a different stack, the old cache may not be compatible. Clearing cache:

$ heroku plugins:install heroku-builds
$ heroku builds:cache:purge -a appname

Triggering a rebuild:

$ git commit --allow-empty -m "Purge cache"
$ git push heroku master

Note:

You have to make sure that the buildpack you are using is compatible with heroku-20. If it is not it will not work. You will have to wait for the maintainer to update, use a different buildpack or fix the buildpack yourself and use that.
If you follow this step by step it is similar to deploying an entirely fresh app.

Related