Pilot

Posted by Maros Kukan on May 11, 2022 · 8 mins read

Welcome to Buldogchef’s blog. In this first pilot post I would like to describe the motivation behind creating a personal blog as well as requirements and challenges that I had to overcome along the way.

Motivation

Lets start with the motivation, which was mainly to give something back to you, fellow engineers and readers who already publish great stuff. Let’s be honest, it often saves the rest us countless hours by not reinventing the wheel again and rather focus on our particular challenge or use case which we are dealing with at any given time. As an author and engineer I also often write code and documentation and it would be pity if it would end in private stash of “todos”.

When it comes to my requirements for blog platform these got refined over they years. I have tried fair amount of them, ranging from SaaS (Blogpost, Wordpress), PaaS (Azure App Service) and even IaaS (Azure VM, AWS EC2 with RDS and ELB). Although my blog attempts or previous posts did not survived to this day, the real value came from the practical experience building on each platform.

Requirements

My primary requirement for this blog itiration is simplicity. Running a web application in proper and secure way can be quite involved. Depending on your stack selection, you may need to manage the application along with its dependencies which including libraries, operating system and infrastucture services.

I want to maximaze the value by focusing on content publishing instead of managing infrastructure that is required to run it. Ideally I would like to set it up once and never need to think about it from operational perspective.

The secondary requirements are captured in table below for reference:

ID Description
SR01 Publish content written in markdown
SR02 Leverage customizable framework or theme
SR03 Provide site extensibility for future needs
SR04 Notify visitors when new content is added
SR05 Provide a discussion place for visitors
SR06 Provide a communication method via web form or social media
SR07 Have low costs associate with site operation
SR08 Have Ad-free content
SR09 Have low technical overhead associated with site operation
SR10 Provide site authenticity and transport layer security
SR11 Provide custom top level domain for branding
SR12 Produce site analytics data for future content enhancements

The secondary requiremnets that are optional and may not be implemented in the first itiration include:

ID Description
SR13 Leverage tags or categories to group similar content together
SR14 Leverage SEO to increase site traffic
SR15 Provide a method to optionally sponsor my work

That is a quite long list of secondary requirements that I would like to fulfill, while still alingning with the primary one which was simplicity. In next few sections I am going to provide some overview how I approach them in case you have similar needs.

Solutions

Content Hosting

I love using GitHub for code hosting, but did you know that it also provides a free of charge website hosting through GitHub Pages? It great choice for simple static web applications. Creating a simple Hello World app is easy and described in the documentation.

Here I would like to highligh some of the adjustments I did in order to customize the visitors experience. The content of this website is hosted from this repository, which would imply that you need to visit https://maroskukan.github.io, but when you do that you are automatically redirected to https://buldogchef.com. In order to use a custom domain with GitHub Pages, you need to adjust the A and AAAA records for your domain to point to following IP address owned by GitHub. The exact procedure depends on your DNS hosting provider, but the end result can be verified using dig utility.

dig buldogchef.com +noall +answer -t A
buldogchef.com.         0       IN      A       185.199.111.153
buldogchef.com.         0       IN      A       185.199.110.153
buldogchef.com.         0       IN      A       185.199.109.153
buldogchef.com.         0       IN      A       185.199.108.153
dig buldogchef.com +noall +answer -t AAAA
buldogchef.com.         0       IN      AAAA    2606:50c0:8000::153
buldogchef.com.         0       IN      AAAA    2606:50c0:8001::153
buldogchef.com.         0       IN      AAAA    2606:50c0:8002::153
buldogchef.com.         0       IN      AAAA    2606:50c0:8003::153

I also recommend creating a CNAME record for www prefix pointing to original URL of the repository.

dig www.buldogchef.com +noall +answer -t CNAME
www.buldogchef.com.     0       IN      CNAME   maroskukan.github.io.

Once the DNS part was completed and verified as shown above, you need to navigate to repository Settings -> Pages area. Here you need to enter and verify your custom domain. I also recommend Enforcing HTTPS which will provide transport layer security and site authenticity without you worrying about certificate management.

Content Editing

GitHub pages also support and are well integrated with static content generation tools. One of the most pupular is Jekyll. Jekyll can transform plain text written in markdown into static website content. Not only that, it supports variables and templates which greatly reduce the operations overhead. Basically once you set it up once, you can focus on content publishing without worrying about any database management or server side processing.

Jekyll is available as a Ruby gem package. The imperative method of installation is well described in documentation, however I prefer to manage my developer environment declaratively using Ansible. Therefore I have added a a new Ruby Dev task into the Workspace Ubuntu Setup.

Once all the bits are installed, you need to create a new boilerplate template in the root directory of the repository.

# Navigate to repository root folder and create new site template
cd maroskukan.github.io
jekyll new .

By default there is an index.markdown file that will be automatically served once you start the local server. For local server validation just append a Welcome message.

echo "Welcome" >> index.markdown

We will customize these content files later in Content Layout section, at the moment we are going to focus on main configuration files.

Start by updating the content of Gemfile which describes which plugins will be installed. You can see the content of this file for this site here.

Further site customizations are done through _config.yml file. This includes variables like the title and description as well as third party integrations (disqus, formspree) identificators. You can see the content of this file for this site here. These values are unique for each deployment.

Finally, using the bundle gem, install the dependencies and start local server.

bundle install
bundle exec jekyll server

You can validate that the content is being served using curl command.

curl http://localhost:4000
<p>Welcome</p>