#Building a blog, part 1 : “Dynamic website” vs. “Flat-file website” vs. “Static website”

I previously explained why I wanted to conquer and settle my own island and the Web ocean. You want to build a blog too? That’s great, you may be interested by the notes of what I’ve learn during my journey…

Just to precise: I’m not gonna write about service that proposes you to create and host your own blog online, through a nice and user friendly interface that tries to make you forget that if you can’t access your code and content source, you’re enslaved

Instead, let’s face a crucial - the real - choice : Dynamic, Flat-file based or static website? Depending on your technical skills and the needs for your website, you may prefer one to another.

Dynamic website

A dynamic website relies both on a database (SQL most of times) and a applicative server, whatever it runs (Php, Python, etc…) to which the “dynamic” refers to. Most of the times, we choose to take advantage of these technologies for the use of a CMS (Content Managing System) which comes with a lot of nice features for your blog (supports comments on your posts, multi users edition or even languages choice for the reader)

Among such services :

  • Php : WordPress, Drupal, Joomla
  • Python : Mezzanine, Django CMS

The installation is also straightforward and it barely requires any technical skill.

Flat-file based website

“flat-file” websites commonly refer to dynamic websites that do not rely on databases, but on files instead (one markdown file per post for example) I’d like to add that this name doesnt’ properly justify the distinction, since :

  • static websites are also based on Flat-files
  • this type of blogs also use a dynamic language to process the requests. I think the right denomination should be something like “dynamic f websites based on flat files” but whatever, I’m not from marketing.

The pros and the cons :

Advantages: using a application server allows for a lot of features. (comments… and so on). Plus Flat-file brings a lot of portability and ease of maintenance.

Drawbacks: Like in Dynamic website, an application server :

  • if you install it by yourself : it brings a lot of complexity to your server and it will use a notable amount of your resources.
  • if you host your blog on an online service : either you have to pay or the service is very poor (I do not personally know a good, reliable hosting service supporting Python or Php… )

Static websites

Static websites were once dominant in the premise of the Internet. They simply consist of .html .css and .js files that a Web server download to the client. There is no computation made during the request made by the client that simply fetch a file. Progressively, this simple method faded out during the 90s after the come of richer, more powerful dynamic website. However, since a few years, static websites are coming back to take their revenge (!) backed up by static website builders. These awesome tools allows a user to write Flat-file on a server (very simple, with a Markdown or Textile format) on any Web server! For code maintenance or even portability it’s just heaven <3.

My choice

You’ve got it, don’t you? I chose a static website builder to launch what you’re reading now. Among them, I picked the most famous one, Jekyll, also because github offers a service (github-pages) that allow you to host a static website computed by Jekyll. Therefore you can simply edit your blog from anywhere (even from your Android phone) as long as you have:

  • either an internet connection (and directly edit it on github)
  • or a git client and a text editor (and then push it online when you’ll get Internet)

I suggest you to read the next article : Using Jekyll and github-pages.

It’s particularly useful when you want to write your post on your Android phone while not having available network in the transportation… :)

I’m not gonna write about Jekyll, since a lot of good tutorials already exist out there. Instead I’m gonna write about using Jekyll and github-pages together since all the tutorials I found are either wrong or misleading. I know that seems rough but that’s true. That leads us

Before starting to (bricoler) our cloud on a distant server, we wanna get one, right?

Owning vs Renting a server

Buying a machine hosted by a private company should obviously be profitable on the long run. However at first it may be wise to rent it as to test it’s performance or even compatibility for our use. I would add that in any case, a (wise) consumer should almost always avoid (engagement). You’ve understood, we’re gonna rent a server.

Physical server vs VPS

VPS stands for Virtual Private Server. It actually consists of a Virtual Machine (or sometimes a container) that run of top of a physical server. and on which the provider offers a root access (or quasi-root).

The price of VPS services has grealy shrinked during the last years. What have been considered as a cheap service from Digital Ocean is now way more expensive that Pulseheberg,…, or even OVH.

The virtual servers are more or less isolated one from the others, depending on the hypervisor (the technique used for virtualization) that is used.

VPS : KVM vs OpenVZ

KVM is known for providing a better isolation between the VMs. Each VM got his own kernel that you can freely update without restrictions. You can stick with your Linux or even change for a NT kernel on which a Windows Server can be set up, it is up to you :)

OpenVZ is quite different as it behaves more like a container on some aspect. Every OpenVZ VMs share the same kernel (often a Linux 2.7) that obviously cannot be updated from a VM.

  • The pros : it gathers the needs of a large number of VMs and allocate the physical ressources accordingly, which is far more efficient than limiting ressources to VMs in need on one side and having unused ressources on the other sides. It often results on a much lower price for the user.
  • The cons : despite the impossibility to update your kernel, your performance are not guaranteed to be constant over time.

My choice

I personally wanted to use Docker on top of my VPS, a tool that (if you’re not yet familiar with it) is totally awesome. The problem is, Docker must officially runs on top of a Linux 3.2 kernel, as it is explained here. “Officially” because there is some workarounds found that can be set up on the physical machine (on the provider side then) that are proposed for example by Digital Ocean.

I therefore considered this feature while doing a benchmark :

For performance comparison, I used the excellent serverbear script that make things such easy and share the results across the community. I also add that this awesome tool is much underused in France (please use it guys!) as I struggle to find KPIs for my providers.

Welcome to my blog ! This is my piece of web that will handle several topics… that I can’t enumerate for sure at the moment…

Data-sience and technologies

I love technology & data-science (it’s my job). I will certainly write a lot about it, either to express an opinion, to share a project, or to present technical solution that I couldn’t find elsewhere on the web (the community on the web appeared to be very helpful to me… so I certainly owe that)

Music, “drum things”, travels & miscellaneous

Again, the goal is sharing experience. During my (little) free time I play music in a band as a drumer, and during my (big) free time I really love to travel in the Europe/world.

Why doing it on a blog ?

Simply in two lines :

  1. To get my own, independent “piece of the web”
  2. To reach the maximum number of you, people

I surely could write a post on Facebook or Linkedin but it would have been sadly limited to my personnal contacts… I also could write articles on a forum or platform like reddit, but I wouldn’t have got as much liberty I’m enjoying with my blog.

I also have to mention a particulary skillful (former) workmate, Yin Jin, that created his own blog and a cloud-based data lab. He unintentionally triggered the construction of this blog : I’m humbly following his tracks.

Why in English ?

I’m French but I will write every post in English, despite I’m aware that :

  • on one hand a lot of French people won’t appreciate it, most likely because of we care a lot about our language and culture.
  • on the other hand some English-speaking readers will suffer a lot from numerous spelling and grammar mistakes. (I’m really, really sorry about that) The reason is, as I said before, that I don’t want to take away the majority of the world, on the grounds that they cannot read a language spoken by 1% of the world’s population.

What’s next ?

In the next section, I will start by explaining why I chose a static-website builder to host my blog, and why Jekyll and github-pages in particular. I will also write about another project of mine : buidling its own cloud-based services and remote-computer using docker on top of a VPS. For the other posts… well we’ll see.

Here be a sample post with a custom background image. To utilize this “feature” just add the following YAML to a post’s front matter.

image:
  background: filename.png

This little bit of YAML makes the assumption that your background image asset is in the

1
/images
folder. If you place it somewhere else or are hotlinking from the web, just include the full http(s):// URL. Either way you should have a background image that is tiled.

If you want to set a background image for the entire site just add

1
background: filename.png
to your
1
_config.yml
and BOOM — background images on every page!

Background images from Subtle Patterns (Subtle Patterns) / CC BY-SA 3.0