Octopress is a really great blogging framework for those not afraid of the command line, but one limitation it has is that when you are away from your desk, publishing to your blog remotely can be difficult.
It was this sticking point that made me hesitant about moving back to Octopress, but after some digging I was able to find a solution that allowed me to remotely publish to my blog through Github.
My preferred setup was to use Heroku to host the blog. Before I would have written my blog post, generated the site and the published it to Heroku. I remember this being a chore when I first used Octopress but there is a better way of doing this. We can offload the site generation bit to be handled by Heroku by using a buildpack.
A buildpack allows Heroku to run a number of languages and frameworks in the one environment. As Heroku’s Cedar stack is a polyglot stack, it can host a number of different languages and frameworks. Heroku isn’t just for Ruby devs now, it’s for everyone.
Jason Garber has a forked buildpack with updates for Octopress that will handle the generating of your site for you.
Now to update our site we simply need to create our new post, save it and push the code to Heroku. The buildpack will spot the incoming push and generate your site for you.
That’s one less step for me to do but I still wanted to publish remotely to my blog. Ideally I would be able to create new posts on Github and then once committed we can then push the blog to Heroku.
The second piece to the puzzle is this little Sinatra application by Anthony Lai. This application takes a repository on Github and deploys it to Heroku. It does this by being triggered by post commit hook at Github. After I commit to my blog on Github, the post receive hook is triggered and it deploys my blog from Github to Heroku.
Now at the moment this means I have two applications on Heroku. One for my blog and one for the Github Heroku pusher application. However it does mean that I can publish to my blog remotely by simply writing my posts to my blog repository on Github and let it trigger the push to Heroku when I commit my post.
It’s a great setup that has worked for me well over the last few weeks and it has meant that I can even publish to my blog from my iPad or even my iPhone if need be.
Yes, it is a bit heavy on the resources side with two Heroku applications and the use of a public Github repository but it works, and that’s what matters to me most at the moment.