Luca Nerlich A blog about Tech, Programming and Games.

How we are running and updating this blog.

The following list specifies the steps it takes to update this blog.

  1. Log into the production server using ssh.
  2. cd into the blog directory e.g cd /data/blog
  3. update the repo, stop the current docker, remove the ‘old’ docker and rerun it using the following command:
git pull 
&& docker stop myblog-jekyll 
&& docker rm myblog-jekyll 
&& docker run -d \
--name=myblog-jekyll \
--restart always \
--volume=/data/jekyll_blog:/srv/jekyll \
-it \
--publish 4000:4000 \
myblog /bin/bash -c "chown -R jekyll:jekyll /srv/jekyll; gem install jekyll-paginate; gem install classifier-reborn; jekyll build --lsi --incremental; jekyll serve"

The above unix command chains the tasks mentioned in #3 together. If you are running this setup on Windows, the commands can be chained using a semicolon ; instead of the and && symbol. Docker will now stop the running block container, remove it and then recreate it. -it /bin/bash -c "<command_x>" passes commands to the container. These commands will be executed upon creation. We are using this feature, to immediately execute the following commands:

  1. chown -R jekyll:jekyll /srv/jekyll -> set the user:group jekyll as the owner for the directory and subdirectories of `/srv/jekyll.
    • /srv/jekyll is the path where jekyll stores all its files.
  2. gem install jekyll-paginate -> install the ruby gem jekyll-paginate. This enables jekyll to use pages. The user is then able to set the amount of posts on each page via the _config.yml setting paginate: 1.
  3. gem install classifier-reborn -> install the ruby gem classifier-reborn. This allows us to run the jekyll build with the option –lis. This will then show related posts based on its content.
  4. jekyll build --lsi --incremental -> build the blog. --incremental enables hot swapping of new blog posts.
  5. jekyll serve -> run the jekyll server.