Baldowl

my nest somewhere in GitHub's forest

Working with Heroku, Jekyll and Sinatra

Ok, I’ve changed my mind and tweaked this site into a blog. Will I write it regularly? Only time will say.

Anyway, I was playing with Heroku to evaluate the feasibily of using it to host a small site generated by Jekyll.

Why bother?

There are already at least a couple of solutions, namely Rack-Jekyll and a blog post which explains how to use Sinatra. I see problems with both of them:

  • Rack-Jekyll does not set any HTTP cache header, so every request will hit the dyno;

  • the blog post was written before Sinatra 1.0, and with this latest release it does not work perfectly because Sinatra does not apply filters to requests for static assets anymore, so the HTTP cache header is not set.

And now?

The possible solutions:

  • stick with Sinatra pre-1.0 and follow the blog post;

  • still follow the blog post but turn off the management of static assets by Sinatra 1.0 and handle them manually with a big splat argument route:

  • put the product of Jekyll in public, let Heroku’s web server handle every request and use Sinatra or plain Rack just to map ’/’ to ‘/index.html’.

Using Sinatra to handle requests allows you to set whatever header you want, so you can set Cache-Control the way you like it; leaving everything to Heroku’s web server will set just the Last-Modified header (at least at the time of this writing). Is it enough? I think the answer is “Yes!”, but your taste is king and having alternatives is always good.

What's going on here

Honestly, I don't know what to use this page for, but I know I won't build a blog, because I'm not a talkative person (and because public, futile rants aren't very much in demand).

Ruby & Co.

Being mainly a system administrator forced by life into a web programmer, I chose the easiest path and turned to Ruby on Rails. After a while, I started using Ruby more and more, negletting sed, awk and the other tools who served me faithfully over the years.

Enough sadness :-)

At the moment I'm really interested in Ruby, Ruby on Rails, Sinatra, Rack, Cocoa (but I'd rather not use Objective-C... go MacRuby, go!), Merb and Chef.