It has been quite a few years since I maintained my wiki, blog, and homepage etc. in the same way, and the underlying infrastructure is getting more and more annoying so I decided to spend some time to migrate them to better solutions.
Migrate & Automate Blog Deployment
My blog is built using Jekyll, with some customizations to the templates etc.
For some weird reason, I used to maintain two repos in my Github account, one for the source code of the blog and one for the built
website, in which the later is in a repo called
<my-username>.github.io with Github Pages enabled and custom domain (
Somehow this configuration left me with two annoying issues:
- Each time I enabled Github Pages for another unrelated repo, the default URL will become
blog.zhen-zhang.com/<repo-name>, which is reallly weird if I give this URL to my friend and say: look at the doc for ABC project….like a self-promoting asshole.
- I need to manually built the blog locally, copy the built site to another repo, and push changes in both repos. Even with
Makefileautomation, it still gives me more reasons for procrastination rather than writing up.
Solution: I deleted the
<my-username>.github.io and attach the domain to the source repo instead. Since Github Pages can be used with private repo,
this transition is smooth. Also, the Github Pages deployment is automatic, so I don’t have to do it manually.
Migrate Blog Comment from Disqus to Remark42
My blog isn’t very popular, but it still received several comments a year. I started with Disqus a long time ago, but in recent years I found its UI becoming more and more terrible and distracting, and sometimes it can’t display correctly when accessing within China Mainland…also, the company behind it seems starting to try to add advertisements to the comment section… (making profit isn’t wrong, but it seems a stupid business decision).
Remark42 is a relatively new open-source alternative. Well, strictly speaking it is not an alternative since self-hosting it requires some tinkering and it doesn’t include many features out of box. However, self-hosting it protects the privacy of my visitors, and also make the commenting work and more pleasant. I hosted its docker image in a Digital Ocean Droplet, and connecting it to the outside world with nginx/https. One important sidenote is that remark42 uses JWT to make sure that the comments come from the trusted sources, so you have to use same root domain for the blog and remark42 API.
Migrate & Automate Homepage Deployment
First of all, the domain
zhen-zhang.com is registered on Google Domains. I previously simply configured on the Google Domains Dashboard to make it redirect the apex
domain directly to my allocated URL at UW CSE (
homes.cs.washington.edu/~zgzhen/). That path is served from a directory in a network file system, which I owns.
My homepage website started really simple from a few plain HTML files, but later the need evolved and now I use Jinja2 to build it from a set of templates, configurations, and resource files (and Github API…). I don’t like to use any existing template for this purpose since – I mean – it is a “personal homepage” right? Just like your home, you should personalize it (In reality no one cares though LOL).
So, previously, I simply use
Makefile to automate the build and
rsync the built files to the NFS directory. It works but is quite laborious.
Solution: I empied the NFS directory and left only a redirecting HTML file in case people access from the
homes.cs.washington.edu URL. The actual build and deployment
is automated with Github Actions, which can validate, build, and deploy the website
gh-pages branch. I configured the Github Pages with the custom domain (some work is needed
on the DNS side as well since it is an apex domain, but fairly easy). Now, I can simply commit/rebase to
master and wait the change to be live.
Automate Wiki Deployment
My wiki is built with
mkdocs provides a command line way to deploy to
gh-pages branch, so I used to do this manually. But again this is extra work.
Solution: Similar to the homepage, I used Github Actions to automate the deployment process.
Automate service self-hosting
As you can guess, managing these services can be (both) complex and expensive. My strategy is to host all of them on a single Droplet, and vertical scale the Droplet until the workload is too much (which is unlikely). Also, I started to write Ansible scripts to automate the entire process of setting things up, so I can easily replicate them when needed.
Automation, or infra-as-code, is an important thing I learned from my previous work experiences. Now I applied them back to my little gigs. Doing this becomes much easier in recent years due to the popularity of Github Actions and similar services.
Another important thing is to distrust the free business products and to self-host one if there is a relative mature open-source alternative and when the use case allows. Recent years of rapid development of OSS communities make this possible.
P.S. Google Domains is usable, but its DNS features are not as good as NameCheap, e.g. in support of
ALIAS (as of 2020).
P.P.S. I used to own the domain
zhenzhang.me, which is registered on GoDaddy. But I forget to renew it and it already expired for several weeks when I noticed that.
I even set yearly calendar event in order to buy back, but never really managed to get it back despite I had absolutely NO idea why it is valuable to some random spam hosting people.
(maybe they just want to entice you to engate in an auction process?)
Later I gave up and registered
zhen-zhang.com. BTW, GoDaddy is terrible, don’t use it.