2022 is gone, so is heroku free tier, what's the best alternative? (Part 1/2)

2022 is gone, so is heroku free tier, what's the best alternative? (Part 1/2)

Heroku was one of the easiest and cheapest ways of deploying hobby projects. It is no longer the cheapest, so what's next? Enter dokku.

The Origins

Software Developers are control freaks by nature. We design, cry over, write and deploy our own tools because we love control, well, atleast I do. And we also happen to be the laziest beings our there and love spending hours to automate something that can be done in a few minutes(I recently wrote a script to migrate images from google drive to Supabase storage and spent 2 hours instead of doing the same work in... 20 minutes manually 🤡) .

Deploying software wasn't easy a decade ago as it is today. It took a lot of planning and manual networking and configuration to deploy software(some of which, I as a 20-year-old developer cannot even think of) which can now be deployed in seconds to a variety of cloud services with a few clicks. Heroku, a name synonymous with easy deployments was revolutionary for the very same reason.

Heroku was developed to make deployment of Ruby on Rails applications and Postgresql easy and a few years later it became a nerd favourite. Every software developer(especially backend developers like me) who has had to deploy code knows how easy heroku made their lives, atleast for starters and hobbyists.

Every developer I know loves working on new and shiny hobby projects more than anything. Writing code doesn't cost much, but deploying it and showing it to masses? Well, that is hard. For frontend or serverless frameworks like NextJS there are many options, there is Vercel, Netlify, Cloudflare Pages, AWS Lambda, Google cloud functions and many many more. All of these have a very generous free tier and one can practically run a small scale startup using these, IF, your stack comprises of serverless backend. But what if you want to run a docker image or something which can't be done on serverless? Well, heroku used to be an obvious choice for us backend developers.

I had previously worked at a startup, Heiphen, which used heroku for its staging environment. Every code which was merged to the develop branch was automatically deployed to heroku within minutes and developers were free to test their code at all its glory.

I also had around 7-8 hobby projects deployed on heroku for more than a year, and I had never a complaint except for a couple of weeks in 2022 when I couldn't login to my heroku dashboard. For the other 80-90 weeks, everything was smooth!

All you have to do was either run a few git commands (what could be easier than git push heroku main?) or connect heroku to your Git repository and voila! It automatically deploys the changes to the branch and let's you know whenever a service is down. You got 6 apps without adding any credit cards, and a total of 750 hours of compute per month. And to make sure the 750 hours aren't exhausted on apps which aren't in use, heroku used to shut down all dynos(instances) after 30 minutes of inactivity and then restarted them on new requests.

Heroku hobby plan, was a literal dream for beginners and hobbyists. It was the perfect tool for starters and hobbyists who wanted to focus on the code and not on managing infra. And why would one want to spend hours of managing infrastructure when their hobby project is barely for learning and it got very little traffic.

( I have hobby projects which have more commits than the number of times they have been used 😭)

The end of golden days

I wrote had because this dream came to an end. Heroku had to earn money and they eventually ended this hobby tier in 2022. Heroku announced that the hobby plan would end and they introduced a plan for students, which to be fair to them was very honest. But there's a catch.

While the previous plan did not require a credit card, the new student plan does and a lot of student developers I know do not have access to a credit card; all of them flock to services that let's them use their services without adding a credit card. I have been a backend developer for 3 hours, and even I did not have access to a credit card for 2.5 years. So I know the pain of writing code but being unable to show them off. So this is for you, my brilliant, credit card-less friends 🥺

So, in November I began my search for a solution which would lie in my comfort zone, easy enough and efficient enough for me to deploy without a thought but complicated enough to make me feel smart and boost my ego ( very important for us developers).

And that's when I found dokku ( Vivek, one of the best hackers I have come across). Dokku is an Open source, self-hostable and free PAAS. It can run on any hardware with a minimum requirement of 1 gigs of RAM and it was created by people with great humour. Proof?

"Powered by Docker, you can install Dokku on any hardware. Use it on inexpensive cloud providers. Use the extra cash to buy a pony or feed kittens. You'll save tens of dollars a year on your dog photo sharing website." - Official Website.

Not only does dokku support hosting docker images but different languages and frameworks and it also has different plugins for databases and other tools. It also has various commands to control proxying, domain configuration, logs management, SSl certificates and so much more (I have barely scratched the surface here).

I adore the simplicity and the control I get with dokku. I immediately fell in love with the ease of using dokku. It was Heroku, but free and something I could control.

Now that we have a free, open-source and self-hostable heroku like service, how do we host our websites for free, without a credit card, with ease? Well, all you need is an Azure account.

Now I can write code on VS Code(Created by Microsoft), push it to Github(Owned by Microsoft) and deploy it to azure (Also microsoft).

Now I can write code on VS Code(Created by Microsoft), push it to Github(Owned by Microsoft) and deploy it to azure (Also Microsoft).

Let's start with Azure

You can also use any other cloud provider like AWS or the ones which won't burn a hole in your pocket, but I am going with Azure here because they have a very generous student offer where they provide 100 dollar worth of credits to students and a renewable 12-month free tier, which includes, but is not limited to, a free linux instance.

Sign up for your free azure student account here: https://azure.microsoft.com/en-us/free/students/

Once you are done signing with that, you can go to the Azure dashboard and click on the virtual machines icon, like this:

Then click on create:

Soon, you'll see the configuration page. You now want to select a B1 type instance with similar configuration to these(you may choose your own linux distro and region)

Now, for the most crucial part, make sure ssh and HTTP ports are enabled and set a username and password you can remember, you'll need this later! (let's assume my username is shashankkumar and password is Shashank@00):

You may now click on launch and soon you'll have a Linux instance running!
Go to the dashboard and over there, you'll see the public IP address of your instance copy that and keep it handy for the next steps.

Now that we have an Azure linux instance up and running, all we have to do is setup dokku and we will be ready to deploy our applications. Stay tuned for the next part!