Setting up a low cost and reliable blogging platform
I have been, for long, delaying setting up a blog. I always wanted one - a place to share a few things of interest. Cool kids always seem to have one. And now that I had a little bit of free time, it was now or never and I began evaluating my options.
I wanted to build a blog with the least amount of commitment, cost, but something which would last a very long time. I was already paying ₹900 for the domain, and I did not really want to spend thrice that on hosting a static page personal website, every year.
If I had infinite time and resources, I would probably spawn up a VM on say, Azure, AWS or DigitalOcean, install nginx and write a custom asp.net core application. But since neither time or resources are infinite, I had to find something which would consume a very small amount of time to get up and running and also cheaper.
If I were to have a blog up and running the quickest way, I have plenty of options - Wordpress
, Blogger
, Ghost
, Squarespace
, Github Pages
, Netlify
to name a few.
Wordpress.com charges you extra for custom domains and even more for customizing your blog. Ghost and Squarespace are good platforms, but paid. Blogger hasn’t been updated in a while and feels very outdated. Medium does not allow you to have a custom domain anymore. I am not left with Github pages and Netlify, both of which offer hosting along with HTTPS and custom domain support for free.
I had a bad experience with Github - my website on Github pages was blocked because it was used for “commercial purposes”.
I do not want this blog to be blocked because of an arbitary meaning of the word commercial. So that rules out Github.
Netlify has everything - continuous deployment with Git, custom domains with HTTPS. Netlify even has a CMS for static site generators. This was perfect. Netlify also has valid reasons to choose Netlify over Github
Before signing up for an account, I looked for more alternatives. I jotted down all of my requirements:
- A blogging CMS, preferreably a static website generator to keep the costs down.
- If I can go with a static website generator, then continuous integration would be icing on the cake.
- Support for custom domain with HTTPS
- CDN would be nice too, I guess. (Websites hosted in West/East US locations would take a considerable time to load in Asia)
I realized that I could build all this with a cloud provider. The costs would not be that high since the site traffic would be very low - probably a couple of visitors a day (optimistically) and by using static website generators, I wouldn’t even need a compute environment, I could simply be serving static files. Since I already have an Azure account (and I work at Microsoft which makes me much more familiar with Azure), I decided to go with Azure to set this up.
I chose to go with this instead of Netlify, because if Netlify decides to stop their free plan, I would have to search for another place to migrate to, anyway.
Building it cheap with Azure
I wanted to keep the costs down to a minimum. Since I will be serving static files (generated by a static generator CMS), I wouldn’t need a VM or App Service. I could just create a Storage Account
with a blob container and serve static html/css/js/image files from there. Since Jekyll is the most popular static website generator, I decided to go with that.
I can also use Azure CDN
and set up and endpoint to point to the storage account URL. I can set up a custom domain with HTTPS on the CDN, without extra costs.
The challenge now was to run jekyll build
somewhere and copy the files to my Azure Storage account. Since I would not always be blogging on the same machine, I did not really want to perform the build on my machine.
Luckily, VSTS
, now named Azure DevOps
comes to the rescue. I created a private repository and added a build definition with continuous integration. Now, everytime I push the changes to the git repository, VSTS runs the build and publishes the files to my azure storage account.
Azure DevOps offers 1800 minutes free a month, which is around 30 hours. An average build takes around 2 minutes, so I can run the build for around (1800/2 = ) 900 posts a month, which overshoots my blogging frequency a little bit, by 896 posts a month.
Azure Pricing Calculator, predicted that my monthly costs would run upto ₹53.85 (<$1). So, that works!
Creating the setup in Azure was a different experience and one worth writing about in a different blog post.
Stay tuned!