Remote posting with octopress

Sometimes I don't have access to my server via ssh. That means I cannot deploy new blog posts or changes to my blog. That's a pity but I created a nice workaround:

Prerequesites:

  • keep your blog on Github (or somewhere else where you can use post-receive web hooks. you could use push hooks from every git repo but github makes it easy.)
  • set up a small sinatra app on your server that listens for the post-receive web hook call
  • checkout your blog repo on your server (it's an additional checkout. you'll deploy from that directory.)

{% gist 5935203 %} This is my sinatra app. You might need to load some ENV variables to get everything working. This really depends on your server setup. Took some tweaking on my side.

The hard part for me was getting my server to listen for the hook and to get the rake task going. Eventually it all worked.

No I can deploy whenever I can push to Github. My sinatra app listens for the magic 'publish' keyword and it just works(TM).

Next stop would be a small iOS app that let's me write an entry and push it to Github.

Update: Please see the comment by Christian down below. He found a different way to remote post. Definitely worth a look: http://chymeric.eu/blog/2014/10/17/remote-octopress-blogging/