I haven’t updated my blog for various reasons, one of them is due to my laptop changed including while I was at Cisco and then moved to Palao Alto networks.
Jekyll is a very nice framework for blog site. However setting up the development eviroment is not trial while all things are moving include ubuntu OS, ruby version, gem version, jekyll version, plus github, plus I was doing it using a VM running inside VirtualBox.
It is not a pleasant expereince every time when I changed my laptop even though I did back up my VM. Mostly it stopped work.
This time, I decided to make my bog development into Docker container. To share with others and also remind my self in the future, here are details:
step#6 find a jekyll theme to use
https://jekyllthemes.io/free
# install git
root@7446611a9f0a:/# apt install git
# download a template, I like centrarium
root@7446611a9f0a:/# cd /root && git clone https://github.com/bencentra/centrarium.git
step#7 install required gems for jekyll to run
root@7446611a9f0a:/# cd /root/centrarium
root@7446611a9f0a:/# bundle add webrick
root@7446611a9f0a:/# bundle install
root@7446611a9f0a:/# bundle exec jekyll server -H 172.17.0.3 # or use any interface IP inside container so that we can test blog by running browser in the host
........
Auto-regeneration: enabled for'/root/centrarium'
Server address: http://172.17.0.3:4000/
Server running... press ctrl-c to stop.
^Croot@53ca4999c86a:~/centrarium#
Make sure the generated blog site is working.
step#8 Customize your blog site
Clean up all sample dummy posts under "_posts" directory, change "about.mk" etc...
Editing _config.yml for your blog site title.
Create blog post under "_posts" using markdown
Rebuild blog site: bundle exec jekyll server -H 172.17.0.3
The site pages are created under directory "_site", which should be copied to deployment site. In my case, I created github repo "weweng.github.io", and upload over there.
One very important step is to save you docker image from time to time, e.g.
svr:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
53ca4999c86a d8022e61a3e8 "/bin/bash" About an hour ago Up About an hour agitated_hodgkin
svr:~$ docker commit 53ca4999c86a u20.4/jekyll
sha256:3f5b3cd73fb2e654080b902c06e016ac9b23ce0206a8df542849d2b2ed23ae9c
svr:~$
Next time, when you need to add a new blog post, simply do: "docker tun -ti u20.4/jekyll"
this will bring to you back to where it was left last time.
When the laptop is to be refreshed, simply save the container image and import.
</ul>