Octopress is a framework designed for Jekyll, the static blogging engine powering Github pages. It also makes it easier to deploy on other platforms like Web Hosting or Heroku. Heroku deployment requires the least amount of effort; just check-in your Octopress blog repository on Heroku and you're good.
This Heroku deployment strategy comes with a few constraints:
- Harder get contribution for your blog repository from other hackers.
- Every small change will require you to push code onto Heroku Git.
- Harder to track changes if a build breaks. Which happens whenever you are trying out a new theme or modifying current config.
- Its preferred to associate a single piece of infrastructure with only one responsibility; but with Heroku we have a single monolithic repository is serving both as blog generating engine and blog itself.
Here are my solutions to these constraints:
- To make contribution easier you can have blog source code on Github or Bitbucket. These services equip you with a project wiki, a issue tracker and version control system like Git or Mercurial; with blog source code open to other hackers, they can easily contribute to your blog by creating pull requests.
- I prefer to use git-flow to track changes and add new features to project. It is helpful in creating feature branches and releases using git tags.
- It is preferred to keep a separate staging and production environment, so if a build breaks it'll only affects staging. I separate by syncing Github repository's 'develop' branch with Heroku 'staging' environment and 'master' branch with Heroku 'production' environment.
- Singularity in infrastructure can be achieved by keeping blog source code on Github and generated static pages with essential config on Heroku Git.
For these solutions to work you need to make some modifications to octopress default Rakefile.
Aside from that you have to create a barebones Heroku application. Also keep thing simple, we are only going to focus on Heroku production environment i.e. no setup for staging.
Checking-in a placeholder index and 404 error page to Heroku Git.
Finally deployment is easy with:
It will generate static pages and commit changes to Heroku Git.
Ranjeet is an engineer at C42 Engineering. If you liked this post, please consider...