Jekyll
29 January 2021
For ease of security and hosting, I wanted to go with a static site generator, and preferably one with a large userbase and good support. This would ensure that a.) it’d stay around for a while and b.) someone else would have and fix or at least discuss a problem before I had it.
My editing needs aren’t anything extreme. Markdown would actually be a great way to write these. I’m kind of curious how I’d do content management. A richer UI (think Wordpress) may be better for that so I could fire and forget but still interconnect and link like pages, but maybe there’s some solution out there built on top of jekyll that’ll support that need.
In any case, here’s how I got started. . .
Note that I’m trying to get things done as quickly as possible without making massive errors nor learning Ruby. It’s not pretty, but but it should hold up through lots of content addition, and I don’t anticipate needing or wanting to update much functionality
Docker for Windows
I wanted to do this experimentation as cleanly as possible, so Docker seemed the right direction. I could iterate on design in containers, and if I kept a copy of my content/data, I didn’t have to fear loss, corruption, or other setback there.
I installed Docker and set up a mount point to hold my site data, which I could also move at any point without the containerized application being any the wiser. Afer a restart, I ran docker pull jekyll/jekyll
from the command line. Modifying the
run command found in their GitHub page, I was able to use the mount from before to work through the jekyll tutorial.
The boiled down command I used was:
docker run --rm --volume="C:/Users/Nathan/Documents/docker":/srv/jekyll -p 4000:4000 -it jekyll/jekyll jekyll build
I found it helpful, but I didn’t have much of a blog, and because their command starts you with a “build”, it hadn’t bothered even giving me the default minima theme. No problem though, I knew I wanted to choose a theme for myself anyway. . . what an adventure that was!
Theme
bundle. . . if you’re not a Rubyist, you may be better off not having to know how this strange little beast works. I learned just enough to get out of my own way, but not enough to do it right. I’ll highlight what I found out with my final (successful) attempt at using a theme.
The intention
Upon finding a theme, I first wanted to test it. Because the container starts up clean every time (I’m not intending on saving the container, though perhaps I’ll end up doing that) and I didn’t want to change the Dockerfile nor rebuild the container and I didn’t know if build dependencies would be met, I skipped loading from gems. To be honest, I still don’t know how that’d work, though apparently they only complain about missing dependencies and don’t do anything to resolve it.
Trying the theme
Instead of using a gem based theme, I decided to copy the contents of the github repo to the base directory and start with that template. You then have to call bundle install
. That’s when it seems to tell you that you have to have bundle greater than 1.12. Since docker had 2.2.2, it seemed fine, but it wasn’t. What you have to do is install exactly 1.12, you do this by starting the container so as to land on the command line (replace jekyll build
with /bin/bash
) and, well, here’s what I had to use:
cd /srv/jekyll
gem install bundler -v '1.12'
gem install concurrent-ruby -v '1.1.8'
gem install rexml -v '3.2.4'
gem install listen -v '3.4.1'
bundle _1.12_ install
I figured all of the lines between the first and last by calling that last line and having it scream that it needed another dependency. It pretty much gave me the “gem install xyz” line at that point, and I’d run the “bundle” line again. All of that (below the cd) later got saved to a shell script, which I can run when I start the container. I could even call that script at run…
Theme: Conclusion
A little anticlimactic when I cut out how it took a lot of Googling to make the slightest progress as a non-Rubyist, but there you have it.
Docker+Windows+Jekyll other nuggets
You don’t really think that’d be it, do you? Ha, of course not. It’s my adventure after all! So absolute_url
is http://0.0.0.0 by default. There’s a lot going on there, but Windows is the only one that really has a problem with that. Docker, for its sake, needs to listen on 0.0.0.0, but it needs to create absolute links using “localhost”. I didn’t land on the right page right out the gate, but chrisforbes.dev detailed how to fix it, and provided a link to Tony Ho’s page as well. I had to read them both to figure out the what and how I wanted to do to fix it for my personal preferences.
I’ll probably use Chris’ docker-compose setup in the end, but for now I’m doing a first run, documenting the process, and creating content.
Final notes
I hope I didn’t glaze over anything important here, the big thing for me was going into the container with /bin/bash and looking to see what it was actually doing and working out how to resolve the dependency issues. I tried working with the Gemfile and with the gemspec file, but neither of those worked and a regular bash script did so. . . there’s my solution.