This blog is now serverless!

I have been think­ing about dif­fer­ent host­ing options for this blog for some time, even just to stop my friends from jok­ing about the fact that I have been so vocal about Server­less tech­nolo­gies and yet, my per­son­al blog runs on Word­Press!

How­ev­er, as some­one who enjoys writ­ing and have lit­tle inter­est in fid­dling with web servers or sta­t­ic site gen­er­a­tors, Word­Press is actu­al­ly a very attrac­tive option. It comes with a lot of tools to make your life easy, and has a rich plu­g­in ecosys­tem to help you go beyond the basic Word­Press fea­tures. And not to men­tion the fact that I have over 700 posts in cir­cu­la­tion and I don’t want to break them.

So there is a lot of rea­sons for me to stick with Word­Press, but the run­time per­for­mance is so… meh. I have worked with my host (I have gone through a cou­ple, the last of which was InMo­tion) to do some opti­miza­tion — using the Super­Cache plu­g­in, updat­ing the .htac­cess file with mag­ic strings, etc. All these effort yield­ed mar­gin­al gains, if at all.

And then, on the 4th March, 2018… my old APL post from 2015 made it to no. 5 spot on Hack­erNews, and that extra traf­fic took my old Word­Press site down for a good 24 hours.

Of the thou­sands of peo­ple who flood­ed onto the site — to read about APL, believe it or not! — I have no idea what per­cent­age of them man­aged to get through. Those that did get through prob­a­bly found a pret­ty damn slug­gish site that’s not worth hang­ing around any longer than is absolute­ly nec­es­sary.

That was the final straw that broke the camel’s back.

So I decid­ed to give Shifter a try, which I remem­ber read­ing about on the Server­less framework’s blog a while back. After some tri­al-and-error, I have man­aged to put both this blog as well as the home­page for my Pro­duc­tion-Ready Server­less course onto Shifter and the over­all expe­ri­ence was pret­ty great.

And man, the per­for­mance of the new site is superb. It per­fect­ly com­bines the con­ve­nience of Word­Press with the per­for­mance of a sta­t­i­cal­ly gen­er­at­ed site, and I get to migrate all my 700+ old posts over and give this site a com­plete new look and feel in the process.

Over­all, I’m a very hap­py cus­tomer so far, and thanks a lot to Daniel from Shifter for help­ing me out through the migra­tion process!

How it works

Essen­tial­ly, Shifter lets you start a Dock­er con­tain­er run­ning Word­Press, so you can cre­ate new posts and update the blog using the same Word­Press tool­ing that you’re famil­iar with.

When you’re done edit­ing, stop the con­tain­er, gen­er­ate a deploy­able arti­fact (which kicks off an auto­mat­ed process to sta­t­i­cal­ly gen­er­a­tor the pages, posts, feeds and archives for your Word­Press site) and then deploy the gen­er­at­ed arti­fact to the CDN.

Of course, you can assign your cus­tom domain to the gen­er­at­ed site as well.

Pros and Cons

As you can imag­ine, some Word­Press fea­tures don’t work any­more since the site is sta­t­i­cal­ly gen­er­at­ed — com­ments, con­tact forms, search, etc. Also, some plu­g­ins are not com­pat­i­ble with this set­up. But you can use 3rd par­ty ser­vices such as Dis­qus or Google Forms instead. Give this post a read to see a few oth­er alter­na­tives you could con­sid­er.

Depend­ing on the size of the site, the gen­er­ate step might take a lit­tle while to com­plete. This blog for instance, takes rough­ly 40 mins* to gen­er­ate each time. Thank­ful­ly, it’s not a prob­lem for my work­flow as I cre­ate 2–3 blog posts per month at best, so the long gen­er­a­tion time is a fair trade­off for the run­time per­for­mance.


  • After a help­ful tip from Dan at Shifter, this is now down to about 15 mins. The trick is to tell Shifter to skip gen­er­at­ing media pages, which by default there is one for every media file…


Also, anoth­er nice ben­e­fit of this approach is that I can almost treat my Word­Press site like a stag­ing envi­ron­ment. I can make all kinds of whole­sale changes, and exper­i­ment with things with­out impact live users until I gen­er­ate and deploy the arti­fact.


What’s more, the Word­Press instal­la­tion itself is no longer sacred. Even if I make a roy­al screw up to the Word­Press instal­la­tion, I can eas­i­ly cre­ate a new con­tain­er with a fresh Word­Press instal­la­tion and restore from the last good back­up. Right now, this back­up has to be cre­at­ed man­u­al­ly, but it’s entire­ly pos­si­ble the plat­form would start pro­vid­ing some form of auto­mat­ed back­up in the future.

Kudos, and keep up the good work Shifter!

Any­ways, I just want­ed to take this oppor­tu­ni­ty to give cred­it where cred­it is due, and give a shout out to the folks at Shifter for a job well start­ed.

As an engi­neer, I also think it’s a fan­tas­tic use of tech­nolo­gies like Dock­er and Lamb­da.

As a blog­ger, it gives me the per­for­mance and scal­a­bil­i­ty I’m after, at a price point that is much cheap­er com­pared to oth­er host­ing options (based on what I will have to pay for the same lev­el of per­for­mance and scal­a­bil­i­ty).

Now, I just need to write anoth­er Hack­erNews-wor­thy post!