Heroku grew in popularity thanks to the free tier they were giving offering for 18 years.
It got into all the books and tutorials for deploying and hosting web apps as students could deploy their first apps without paying anything.
November 28, 2022 they stopped offering free plans, but there are still options to host your apps for free [Link to free Django hosting] or Cheap [Link to cheap heroku hosting]
Why you might want to seek alternative for Heroku?
There are several reasons. I'll list the top three.
Heroku uses a term Dyno to describe their compute units. Each Dyno runs a single process of your app.
A relatively small typical production Django app and see how much it will cost to run it. Django app often needs a web process, background workers and a scheculer, a Postgres and a Redis instances.
Let's see how much it will cost to run on Heroku:
- Web: Standard 1X Dyno $25/mo
- Celery worker: Standard 1X Dyno $25/mo
- Celery Scheduler: Standard 1X Dyno $25/mo
- Postgres: Standard 0 $50/mo
- Redis: Premium 0 $15/mo
Total of $140/mo.
For this amount of money you get: - 512MB RAM per each Dyno (1.5Gb RAM In total) - 4GB RAM for Postgres Instance - 50MB RAM for Redis instance
Which in total is less than 6GB RAM and most of that goes into Postgres DB. For $140/mo.
As the app grows and it needs more resources the pricing curve is very steep. If your apps needs to process a lot of data or has high volume of users, very quickly you might need to at least triple that number.
For example, if you have a celery worker that needs to process a lot of data and you need more than 1GB of RAM to work with it, then the price for the next bigger dyno goes to $250/mo for the Performance M with 2.5 GB RAM.
The Premuim Support plan starts at $1000/mo.
The Standard Support is not super helpful given the 1+ day response.
There are a lot of limitations from the way web server is setup, no way to fix IP addresses(important for accessing some 3rd-party APIs), complicated if you need a lot of custom domains and so on.
Additional functionality is achieved by using plugins, which will again add to the monthly bill for a serious usage.
What is the alternative to Heroku?
Appliku + Hetzner
Appliku Provides a high quality service for server management and application deployment. It automates the boring process of settings up server, configuring services, building and deploying your applications. A powerful and clean dashboard allows anyone on your team to tune your apps settings or create apps in few clicks instead of hiring/assigning a dedicated person for writing webserver configs. Appliku pricing starts at $10/mo for a single server setup and $18/mo for growth package which includes 3 servers, backups and cron jobs.
While Appliku works well with any providers which can provision an Ubuntu server, our favourite is Hetzner.
Their pricing is hard to beat and performance is great.
Let's get back to our example Django app.
In Heroku we had 6GB of RAM and paid $140/mo In Hetzner Cloud a suitable server will cost you €6.49/mo (around $7 at the moment of writing of this post). With a Hobby Appliku plan of $10/mo it is $17/mo for your whole infrastructure. It is $123/mo or $1476/year in savings.
And you can double the server size to have more room for growth €13.49/mo (±$15).
Want to have even more resources?
Pick the Growth Appliku plan that allows up to three servers at $18/mo
- A Separate server for a databases
- A separate server web process
- A separate server for celery workers
Each server can be a €3.79/mo ($4/mo) - $12/mo in total.
In total for $30/mo you will have a super powerful and convenient infrastructure.
Bonus points: you can run as many apps as you want, you can customise your servers configuration or run additional software if you need that.
How to migrate a Django app from Heroku?
- Add a server
- Create an application
- disable run release command
- Use heroku sync config vars from heroku
- Make sure it works on the appliku provided subdomain(update heroku vars to include heroku provided subdomain for DJANGO ALLOWED_HOSTS setting)
- Turn off heroku app
- change A record for your domain(s) to point to your app in appliku
- add custom domain(s) to Appliku app.
- disable Heroku config vars sync
- enable run release command
- add databases within Appliku
- Migrate Postgres data
- Open your app in the browser and again make sure it works fine
- turn off Heroku dynos. Keep Heroku resources as it for a day and observe the behaviour of the app after migration. Delete all resources from Heroku resources when you are satisfied with the migration.
- Set up DB backups
- Set up Cron Jobs
- Enjoy massive savings.