Seamless Deployment with Heroku

By default there is no seamless deployment on Heroku. That means, if you do a git push, your app gets deployed and there is a little downtime. That’s just because how Heroku works. At first they kill your running dynos, then they build the new app, deploy it on new dynos and finally boot up the new dynos.

But there is a new “preboot” feature in the Heroku labs. With that the procedure looks like that:

  1. Code push
  2. Run buildpack; store slug
  3. Boot new dynos
  4. Switch routing
  5. Kill old dynos

With that “preboot” Feature you don’t have any down times. You can activate the “preboot” feature for your app with this command:

heroku labs:enable -a myapp preboot

Now you can directly do “git push heroku master” and 3 minutes later your new version is online without any downtimes. I just tried it for VersionEye and it works perfectly for me.

That also means that there 2 different versions of the app online for round about 2 minutes. There is a short overlap for a short amount of time. That can be dangerous if you do big db migrations. For this kind of deployments you should disable the feature with

heroku labs:disable -a myapp preboot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s