Containerising an Octopress 2.0 Blog
This blog was started almost 11 years ago, on Octopress 2.0. It was a different world: Ruby 1.x was king of the hill, and Docker wasn’t even a thing yet. It was an amazing thing to use.
Over the years, every time I switched machines, I noticed it was getting harder and harder for me to get the blog and in particular Octopress 2.0 working on it. It was plagued by incompatibility between system versions, tooling, and dependencies on various levels (OS, Gem, Ruby, etc), but I was also getting more and more out of touch with the Ruby world, having long jumped over to other languages.
Still, I loved this Markdown-based blog, and didn’t think it was time to move to a newer version (Octpress 3.0) or another tool (I’d heard good things about Hugo). I simply didn’t have the time to upgrade or port, nor did I feel the need to: it may be using old versions of things, but at the end of the day, it was generating and deploying simple static HTML files that get served. Finally, this year, I decided to take a stab at containerising it so that I could hopefully easily keep using it for years to come (and lose another excuse to not write..).
Overview
References vs what’s new
I didn’t come up with everything from scratch and followed in the footsteps of those who already did most of the heavy lifting.
I just updated some things here and there:
- Ubuntu LTS 22.04
- Rancher Desktop
Target audience
- People who have their own Octopress 2.0 blog already and want to continue to use it. You may have already containerised but it are looking to another take on it.
- Geeks: Octopress says it’s for “hackers”
Dockerfile
To start with the conclusion, here is the complete Dockerfile
in the root dir of my Octopress 2.0 project
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
I’ll go through the things that are different from the awesome article at Octopress in a Docker Container. Whatever I don’t call out below should be taken as unchanged from that article, so use it as a reference.
Ubuntu 22.04
The Octopress in a Docker Container article uses Ubuntu but at version 16.04. I love Ubuntu and think it’s a great choice for an Octropess dev env, but since it’s Jan 2024, I wanted to use the latest Ubuntu LTS release (required for Ruby 2.3) install, 22.04, instead (knowing full well that the next LTS is slated for release in a few months..). Hence
1
|
|
That brought interesting challenges, mostly stemming from the fact that the default apt-get install
for ruby would be too new for (my) Octopress installation’s dependencies.
Installing Ruby 2.3
There are different ways to install Ruby on a system, but I opted for ruby-build, in particular the standalone install option because it was simple.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
The main thing here was installing libssl1.0-dev (I used the RVM PPA), and installing GCC-7 (otherwise I got segfaults using Ruby).
Gemfile.lock file for project dependencies
Since my goal was to get this working with an old Octopress blog and I didn’t want to mess around with version conflicts, I ADD
ed the Gemfile.lock
file as well, before RUN
ning bundle install
1 2 3 4 5 6 |
|
Compared with the reference article, we update Rubygems and lock down the bundler version.
Rakefile
This is mentioned in the Octopress in a Docker Container article as well, but I’ll mention it here too: in order to preview the blog, you need to change the Rakefile
from
1
|
|
to
1
|
|
Docker
With Rancher Desktop
Since it’s 2024, I also wanted to try using a Docker Desktop alternative, and chose Rancher Desktop. Overall, the entire experience was really smooth and in my Octopress usage so far, I. haven’t noticed much difference between Rancher Desktop and Docker Desktop, but I’ve only been lightly using docker
CLI.
I did notice that the auto-regenerate-based-on-changes feature of rake preview
worked better (faster, more reliably) with the VZ
emulation mode and virtiofs
volume mount type.
Makefile to work with all of the above
I added a Makefile
to make it simpler for future me to deal with building the image and working with it
1 2 3 4 5 |
|
This is entirely optional/subjective but I find make start-env
more manageable for starting an Octopress env that has everything mounted properly.
Conclusion
So that’s it: yet another containerised-Octopress-2.0 article, with this entry being the first beachape.com one that was written and published entirely using it.