This post is part 1 of the "Building a Blog" series:

  1. Building a Blog: Overview
  2. Building a Blog: Generating Static Files
  3. Building a Blog: Authentation
  4. Building a Blog: Deploy

Why host a blog myself at all? The simple answer is, I need simplicity for writing(markdown) and customization.

Medium is was my choice for writing, it's simple, elegant, and there's a log of goood posts on it. But still something is not that ideal, for example it does not support markdown(as far as last time I tried), no support for math formulas, which means basically they are not intended to serve writers with math at all. So you'll find all equations in a picture.

But I need something more. I want reveal.js slides. I want authorized access by some criteria. There's no way I can get these with Medium or other platforms, yet.

How

I expected to finish this in a few hours, but eventually it took me days. But the pipline is infact not complex. I'll list the process with short descriptions, and leave the details in later posts. There are there major steps: 1. generating content; 2. add an authorization layer 3. host.

Generating Content

The first step is generating and rendering the output with inputs like markdown or rst etc. There are many solutions, you may be already familiar with jeklly, hexo, sphinx etc. I'm using pelican here.

As mentioned earlier, customization is import. At least I need special marks on some kind of posts, special rendering for slides output, and fine control over the template. With pelican I can do that.

Authorization Layer

I'd like to mark some post as confidential and only accessible to authorized visit. Obviously with static pages that's not possible. Here I used flask as an additional layer to manage accessibility.

Hosing

At this point, the content is mostly ready. What remains to be done is hosing it one the net, with a bare machine.

The task is simple, but there'are many things to be prepared.

  • Server users and priviliges
  • nginx for reverse proxy
  • use uWSGI to deploy flask application
  • Use CI to triger automatic update