Reviving the blog

I have made numerous attempts to revive my blog. Here's another one!

Now, I could have simply completed an unfinished draft and published it. Instead I always end up getting sidetracked by tinkering with pelican1 and the setup first. Often it spirals out of control.

This time, in the name of reviving the blog, I've made the following changes:

  1. Upgraded pelican (the static site generator)
  2. Modified the theme -- Implemented pagination, modified the colours etc.
  3. Migrated from Github pages to an S3 & Cloudfront based setup
  4. Custom domain and TLS

Upgrading pelican from 3.7.1 to 4.8.0 was not trivial but important. The directory structure had changed quite a bit. So instead of an in-place upgrade, it was easier to create a new skeleton project, copy the content, theme inside it and finally reconcile the configuration.

Theme modification, code changes for pagination etc. took some time. It was fun but not really necessary!

I had been considering migrating away from Github pages for a few years. It's not that there are any issues with hosting on Github but sometimes you can feel the lack of control. Besides, I also wanted my own space and domain on the Internet for hosting some other projects too.

Using S3 and Cloudfront for hosting static content is straightforward, although I did find myself lost in the forest of Amazon documentation at one point. The following incremental approach helped:

  1. First, got it working with an S3 bucket (public access)
  2. Then with Cloudfront and private access to the s3 bucket using origin access control
  3. Then got TLS working with Cloudfront using SSL certificates generated by ACM
  4. Finally, configured the custom domain

I uploaded the actual html files to the bucket only after all the above things were done. Until then, a simple index.html file was sufficient as well as convenient for testing.

With the above setup done, there's not much difference in deployment effort as compared to the github pages workflow. Instead of git push, I now need to run,

    aws s3 sync . s3://$BUCKET

I also had to implement redirections from old urls to the new ones. I didn't realize that it would not really be possible to respond with 301 redirect urls from the github servers. So it had to worked around using meta refresh and canonical link. This is not ideal but the popular opinion seems to be that it works. I wrote a custom script to update all the old html pages which are still hosted on github.

Finally, the ultimate goal of this exercise is to regularly write and publish online. As usual, I have a few drafts waiting for attention ;-). This time I am planning to take a casual/relaxed approach to writing. Hopefully it proves effective.


1. Pelican is the static site generator which I use for this blog.

comments powered by Disqus