Ninja Space Content Tech Blog

Upgrading From heroku-18 to heroku-22 and Subscribing to Eco Dynos Plan

Posted by Ninja Space Content on Tuesday, December 20, 2022 Under: heroku
When I was in a coding bootcamp, we were using Heroku with heroku-18 on a free version to deploy projects. However, Heroku is drastically changing things. Last November, Heroku eliminated the free version and heroku-18 is now deprecated and will reach end-of-life on April 30, 2023! 

All of my databases and API end points were down for a month because I was hosting all of them on Heroku via their now deprecated free version. After a couple of hours looking at documentation on upgrading, I got one API back up.

Below are my outlined steps that I took to upgrade my heroku-18 to heroku-22 and subscribe to their lowest tier plan, Eco Dynos. For Steps #1 - #5 below, I followed the steps from Heroku, which you can view on their website from this link: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack. I made a couple of modifications because of the way my app was already set up. They recommend that you do a test first which you should, especially if a lot of users are currently visiting your app.

Steps:

  1. I went into my folder where my app sits on my computer and opened it up in VSC. I use Visual Studio Code (VSC) as my IDE.
  2. In the command line, I typed the following to upgrade to heroku-22: heroku stack:set heroku-22 -a 
  3. After that was successful, in my command line within the app in VSC, I typed: git commit --allow-empty -m "Upgrading to heroku-22"
  4. Then, I pushed it to heroku master for deployment with this command: git push heroku master
  5. Unlike the instructions, I had originally deployed this with heroku master and not heroku main. Yours might be different. Then, I typed in the command line: heroku info to make sure it is listing heroku-22 for Stack and it did.
  6. Then, I logged into my Heroku Account via their website and now went through the app to add the postgres add on for an additional $5 per month so that I can use my database and also subscribed to the Eco Dynos plan for $5 a month under the "Resources" section. Good bye, money. 
  7. After adding my postgres package to the heroku under my plan, I now have to seed the data onto heroku on the command line. Uniquely for me, it is: heroku run npm run seed because I had set up my app this way and I use Node.
  8. To test that my postgres add on has been done successfully, I did a query on the Dataclips interface from Heroku and saw data when I did a query like this: select * from activities; because one of my tables is named 'activities'. Great, I saw data on Dataclips via Heroku! However, I could not see anything on my API end point URL. I was racking my brain for like 25 minutes because I knew I added the Eco Dynos subscription and so I went back to my Heroku Log-in to check under the "Resources" section and noticed that it didn't automatically toggle it to the right to turn it on!
    How to turn Eco Dynos on for Heroku upgrade
    Therefore, remember to turn it on and by toggling to the right side. After I did that, my API ends point worked again. JSON never looked so beautiful.

Pro

There is one pro from this heroku-18 deprecation. There is a lot of APIs that I created and don't care to keep up with so when heroku-18 deprecates and all of my app names under those disappear, it is just cleaning out the trash for me. I'm only concerned with 2 sets APIs and I finished deploying the first one today with the upgrade and subscription (see my 8 steps above).

Con

The con from all of this change is I'm going to have invest and pay the $5 per month (I chose the cheapest plan called Eco and Basic) for the APIs that I want to still work on and also the additional $5 a month on top of that for the postgres database add on. 

Cost

It is going to take cost me $120 for this server and database to run on Heroku per year but since it is my main full stack portfolio piece, I'd like to keep it up on Heroku for now.

It took a good full 2 hours for me to read the documentation on upgrading, subscribing and adding on today on Heroku and to also go through my 8 steps above. I know if I decide to still do this for my second database, it'll be faster the next time around.

Errors

In 2024, I ran into an error while trying to upgrade another app to a heroku-22. I had re-add my heroku app by using this command: heroku git:remote -a app_name

In : heroku 


Tags: how to upgrade to heroku-22  heroku free deprecation 

About Ninja Space Content


Ninja Space Content I have been building simple websites on my own since 2008 and currently run several websites at the moment, including this one. I used to be an account manager for an affiliate/e-commerce company, helping affiliates grow their sales so I have some knowledge on the business side and client side of affiliate marketing. Most recently, I decided to complete a JavaScript coding bootcamp and graduated in Dec 2020.
Note: links to resources and promoting special deals may allow me to earn a small commission from each sale.