Jekyll Adventures on a Debian Server

We decided to give Jekyll a go for maintaining our homepage, after have been using some sort of PHP system for the job. Still the easy setup i was comforted with running Jekyll on my laptop was not the same when installing Jekyll on of production servers running Debian Squeeze. We needed to install a newer version of Ruby than the one that was installed by default to make Jekyll run. So i was up for some andventure time involving googling, running make && make install and unkown pitfalls on this path to upgrade Ruby to the minimum required version for Jekyll.

The make path to a gist jewel

So the first natural step was to login into the server, download the latest ruby 1.9.3 version i was supposed to install. Then i started looking at the options i should compile with read the docs plus some googling and so on. After running configure and make it still did not feel right for some reason, been acostumed for a while managing packages and installing trough the Apt system, as it should be. From there i did some more search and ended up finding this jewel:

All credits to @futuremill

This little Gist allows me to install Ruby 1.9.3 as an package on its own, this makes it’s easier to unistall and upgrade the current Ruby version in the case a new version of Ruby 1.9.x show up. I currently used the latest 1.9.3 p545 version of Ruby, an forked gist can be found here.

Still some unkown creature to fight came along on this path, before i could actually install the my new Ruby package, a creature named “ri”. So an dpkg lookup listed the following package ri - Ruby Interactive reference. After removing the package with dpkg -r ri, the installation of the new Ruby package went on without any further problems.

Jekyll & Node sitting on a tree

Clearing the first path, I had now installed Jekyll using the gem installer without any issues or warnings.
Just to make sure jekyll was running as it should be I issued the following command jekyll -version from where another little monster lurking in the bushes starts running around me shouting “Could not find a JavaScript runtime… (ExecJS::RuntimeUnavailable)…” and some other utter nonsense about execjs. A quick tour to the requirements section of the jekyll pages, does not list any requirement about needing to have a JavaScript runtime at the current time being.

So a quick google search detour lead me to this issue, and the related culprit was so called Jekyll::Coffescript and a note about ExecJS which lets your run javascript code from Ruby. So i needed to have a javascript runtime to make jekyll work and the nodejs runtime was on the list of possible items to pick from that i could add to my inventory.

I had previously installed nodejs on the server but only local to one of the users on the server for testing purposes, however as the case with the Ruby upgrade it should be possible to install nodejs as a package. So before i started creating my own package in the spirit of “Not invented here”, i went on a another google quest searching for some repositories that contained an up to date version of nodejs for Debian without luck. Luckily for me after some changes to my google search i ended up finding this github repository on how to automatically build node.js as a .deb package voila.

So i automatically cloned the git repo and followed the usage instructions, trying to install the latest version at the moment issuing the following command bin/make-nodejs-deb.sh 0.10.28. However there are always some unknown requirements to complete a task, and I got the following error No such debuild command found. This happens when you skip reading the how it works section, which outlines a reference to the debuild tool a requirement to compile the nodejs and create a package out it.

So now i needed a tool called debutil but a apt-cache search listed zero results, and again using the almighty google engine i landed on the Introduction to Debian Packaging page, where the technical requirements for making Debian packages are listed. One of these requirements were devscripts, containing the debuild tool i needed. So after installing the technical requirements needed using apt-geti reran the bin/make-nodejs-deb.sh 0.10.28 command, creating nodejs_0.10.28-1_amd64.deb package. That i now could install issuing the following command dpkg -i nodejs_0.10.28-1_amd64.deb.

So now that i had the nodejs JavaScript runtime installed i decided to check the status of the jekyll installation.
Issuing the jekyll -version command issued the following output jekyll 2.0.2 success!

My journey was finally at an end, now we were finally able to use jekyll to publish our site automatically using cron and git to detect when there were changes to our git repo containing the site’s content, here is a gist recipe for the interested.

Afterthoughts

Running Jekyll and syncing our site automatically from a git repository seems like victory for the moment. It is easier for our team to commit too a well-tested simple content system such as Jekyll, with defined guidelines on how to pulish posts and using Markdown to write content.

I still have some paths to explore, such as how to create and maintain own packages using the Debian packaging system. I have often avoided taking this path when i have needed to install dependencies that are not available from any repositories. The next time I am at cross with the Debian packaging path I will have to go down that road…