dira ⋅ geek ⋅ girl

Deploying a non-trivial app on Heroku


I tried heroku – the ‘instant ruby platform’ for one of my pet projects. The deploy was indeed very fast – less than 20 minutes from 0 to working app, but with a few glitches for advanced features.

  • Heroku does not give you bash access, instead you have a bunch of commands that cover all common tasks. You can use it as a script/console (that runs on your server) and to run rake tasks. Together with the admin functions available on the website, it covered everything that I needed.

    Installing the app and getting the web part to work, with the db data from my local application, was a breeze; less than 20 minutes.

  • Heroku is tightly integrated with git – so whenever you push to your heroku git repository, the code is deployed. Live. Automatically :) Your gems will be installed, code updated, and if everything is ok the web server will be restarted.

    But you have to migrate the database yourself. This was not obvious for me so I had 2 minutes of downtime until figuring it out. It would have been nice to run db:migrate automatically, but I guess that is too much of a semantic stretch for a git push.

  • The architecture looks awesome. Grid, cloud, mash – you name it, they have it, with ‘high-performance’ adornment.

  • Heroku specifics:

    • you have to declare the gems that you need in a gem manifest (if they are not already available).

    • they propose using heroku config vars for storing your configuration variables instead of putting them in source. As you don’t have direct access to the file system, you cannot create the config file when deploying; in fact, after deploy you can create files only in /tmp and /log. So, you have to choose between adding config files to git or using heroku config vars.

      I decided not to hook into heroku too much while trying the platform, so I just added the config data to source.

  • You setup your cron jobs by having a rake task that will be run, in theory, once per hour. And you also have logs for your cron jobs.

    However, the logs don’t contain the error stream – just the output stream. This can be quite frustrating when trying to understand why the cron jobs don’t seem to be running on the server.

    In my case, I discovered that a config file was missing, after running the dedicated console command (heroku rake cron) and got the error message.

  • Major glitch: lack of support

    My cron jobs still don’t seem to be running; however, if I invoke the cron manually, it works. It could be because the operation in the cron takes around 30 seconds to complete, it could be something else.

    However, I got no response on the support email about this problem since I asked, a week ago; other users express the same concerns.

Overall, it was an extremely pleasant experience for deploying the rails ‘pure web’ part. Hopefully, when rolling the commercial version there will be some support.