Host your app for free with Heroku

Posted 12 years, 9 months ago in Code

If you ever break out of the PHP world of things and find yourself using more advanced languages and frameworks you find that you need much more to host them. The big guys can afford the heftier hosting to support hosting many apps but when you're more or less just getting started you find your self a little pressed for places to put your ruby or python web app.

Enter Heroku! A site that offers free web app hosting. I'm sure by now you're thinking, "What's the catch?" in which you are quite wise for asking that. The catch is that it's only free hosting up until a certain amount of resources are required. So you might be able to host a larger portfolio site like this one on it but you're definitely not going to be able to host twitter on it.

The amount of space/resources you get before that point is quite reasonable and seems to fit most of my needs. Of course it's not as free as say using a VPS host where you essentially get a complete server to run/manage so you won't be able to just install unix packages and the like. So it's pretty bare-bones hosting but sometimes that's all you need.

How Heroku Works

Heroku basically allows you to use git to push your code to their servers and into your app directory which then compiles your app into a "slug". Which is an app that's ready to be triggered. From there you setup a domain and point to your app server and you're good to go.

Databases

Heroku has two options: Postgres or MySQL which has only been added fairly recently. Postgres is clearly more encouraged by them and most database people I meet seem to highly recommend Postgres over MySQL every time. The cool part is if you're using Ruby on Rails, Django, or an app framework with an ORM (Object Relational Mapper to connect to your database) you can interchange them to a degree. For instance an app I built using MySQL on my local dev server worked fine with Heroku's Shared Postgres option.

Heroku's Postgres is divided into 2 sectors: The free shared sector, and the dedicated premium sector. The prices for their premium offerings is quite high. However when your app is in need of the size of the resources that Heroku can offer, you'll find it's a fair price.

Why use Heroku?

The biggest reason why I use Heroku isn't that it's free but because it's highly flexible. You pay for what you need, and it's free if you don't need much. On projects where I don't know if there's a high demand or big interest I tend to just go with Heroku at least initially until I know our average resource consumption.

Plugins

Heroku comes with many available plugins some free and most others are paid services. Some include HTML5 video encoders, extra databases, analytics plugins, and much more.

Get Started with Heroku

Check out http://heroku.com for more information on what it offers and how to get your app up and running with Heroku.

I will be publishing a specific article on deploying Django apps with Heroku to cover some of the small solutions I had to find for some of the problems not covered by Heroku's documentation. One such instance was setting up a shared database.