linux · ruby · tech · tips

Develop a Jekyll website… without Jekyll

Containers are great for developers: when I’m messing around with code I try to keep everything neatly containerized, so I can just pull my repository on some other machine, run a few scripts and be ready to keep on developing without having to install stuff on the main Operating System.

Jekyll is a nice Static Website Generator, used prominently on GitHub. An already-made Jekyll container exists, but I couldn’t find out how (or even if) you could use it to create a Jekyll website from scratch. So I fired up a generic Ruby container and installed jekyll in it to create the base layout, then I ran the already-made jekyll container to build the website.

$ cat > Gemfile <<EOF
source ''
gem "jekyll"

$ docker run --rm --volume=$PWD:/usr/src/app -w /usr/src/app -it ruby:latest /bin/bash
[container#1]# bundle install
Fetching jekyll 3.6.0
Installing jekyll 3.6.0
Bundle complete! 1 Gemfile dependency, 20 gems now installed.
Bundled gems are installed into /usr/local/bundle.
[container#1]# jekyll new test01
Bundler: Using jekyll 3.6.0
Bundler: Bundle complete! 1 Gemfile dependency, 20 gems now installed.
Bundler: Bundled gems are installed into /usr/local/bundle.
New jekyll site installed in /usr/src/app/test01.
[container#1]# exit
$ ls -l test01
-rw-r--r-- 1 root root  398 ott 14 16:40 404.html
-rw-r--r-- 1 root root  539 ott 14 16:40
-rw-r--r-- 1 root root 1,7K ott 14 16:40 _config.yml
-rw-r--r-- 1 root root  937 ott 14 16:40 Gemfile
-rw-r--r-- 1 root root  213 ott 14 16:40
drwxr-xr-x 2 root root 4,0K ott 14 16:40 _posts

Once I had the basic site structure ready, I ran the Jekyll container to build it:

$ cd test01
$ docker run --rm  --volume=$PWD:/srv/jekyll  -it  jekyll/jekyll:latest  jekyll build
Resolving dependencies...
The Gemfile's dependencies are satisfied
Configuration file: /srv/jekyll/_config.yml
            Source: /srv/jekyll
       Destination: /srv/jekyll/_site
 Incremental build: disabled. Enable with --incremental
                    done in 0.292 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
$ ls -lh _site/
-rw-r--r-- 1 velenux velenux 5,5K ott 14 16:44 404.html
drwxr-xr-x 2 velenux velenux 4,0K ott 14 16:44 about
drwxr-xr-x 2 velenux velenux 4,0K ott 14 16:44 assets
-rw-r--r-- 1 velenux velenux 3,7K ott 14 16:44 feed.xml
-rw-r--r-- 1 velenux velenux 5,5K ott 14 16:44 index.html
drwxr-xr-x 3 velenux velenux 4,0K ott 14 16:44 jekyll

So… that’s it, you can now develop your Jekyll website without having Jekyll
installed on your system.

linux · tech · tips

Centralize your logs on the cheap on obsolete systems

This is a tale about what you should never do, but you are often forced to do in this time and age.

I’ll explain the technical solution and then tell the story for some context.

On a recent-ish system, install multitail:

# yum -y --enablerepo=epel install multitail

multitail allows to follow multiple tail or even the output of multiple commands in one single window (or multiple windows handled by ncurses), but it also allows to save the output of those commands to another file. In my case the command line looked like:

multitail --mergeall -D -a all.log \
  -l 'ssh web01 "tail -qF /var/log/apache2/*.log /var/log/apache2/*/*.log"' \
  -l 'ssh web02 "tail -qF /var/log/apache2/*.log /var/log/apache2/*/*.log"'

This would create a file all.log containing the output from tail -qF of Apache logs from web01 and web02.

So, what’s the backstory? Why would I do something like this? Centralized logs are nothing new, right? We have Solutions[tm] for that.


Imagine you have a time constraint of “one hour”.

Then imagine you have systems so obsolete that the signing key (valid for 10 years) for their repositories expired.

If I had more time I would try to see if rsyslog was recent enough to have the text-input file module and I would’ve tried to have rsyslog push the logs to a more recent system with logstash/ELK on.

Bonus code

I made a little script to generate the multitail commandline, here, have fun:

HOST_LIST="web01 web02"
LOG_LIST="/var/log/apache2/*.log /var/log/apache2/*/*.log"

CMD_MULTITAIL="multitail --mergeall -D -a all.log"

for target in $HOST_LIST ; do
  CMD_MULTITAIL="$CMD_MULTITAIL -l 'ssh $target \"tail -qF $LOG_LIST\"'"


I seriously hope nobody (else) will ever need this, but if you do, I got you covered.