Use Jekyll To Keep Your Blog From Folding Under Traffic
kapilkale.com
kapilkale.com
Which led to everyone moaning and groaning about what a pain it was to have to wait for the site to rebuild when you made a change.
Which led to WordPress, which used live queries against the database to avoid the need for rebuilding, being hailed as The Future.
Which led to everyone moaning and groaning about how their blog would fall over anytime five people even thought about visiting it.
Which led to tools like Jekyll, which grind out static pages, being hailed as The Future.
Sometimes tech feels less like a story of progress and more like a merry-go-round...
While Jekyll is a nice fit for creating and maintaining a blog, it's an overkill for running other kinds of static sites. I felt there's a need for a simple and more flexible static site generator, so I wrote Punch (http://github.com/laktek/punch).
These days, I'm working on a Punch based extension to generate blogs as well, which solves couple of pains I have with Jekyll (such as slow generation, non-existent error handling, lack of support for partials and rigidness in templating, etc.)
I wrote about this topic last winter after a rash of links on HN went down. http://www.maxmasnick.com/articles/bulletproof_your_blog/
I recently switched to github pages after their stability improved, but if you don't want to pay for a github account or you really want 100% uptime, S3 is where it's at.
There's still certainly more development time than a pre-packaged blog, the "new post" workflow requires a couple of lines on the CLI (rake new_post[title]; $EDITOR path/to/new/post/title.md), and there's no clear documentation on creating your own theme (I ported Bootstrap over to Octopress as a self-contained theme), but it can be a nice option for those who want some flexibility. I just host it all on Heroku out of laziness, although I would likely see some speed improvements if I hosted it on a VPS w/ nginx.
FWIW, I used to host my blog on Tumblr, until they added fixed Open Graph metadata to the site headers that resulted in me unable to show/change a photo thumbnail when sharing to Facebook (a specific issue, and really not their problem to think about).
Also, as others have said, GitHub Pages is a very low-friction alternative to DIY'ing your own Jekyll site and you can always fork a popular users' site to get you up-and-running quickly.
My site uses Jekyll, but I set it up before Octopress was made. If I were doing it now I'd probably use Octopress to get me started.
It uses both PT Sans and PT Serif, which comprise 6 .woff files that amount to 300kb and take almost 3 seconds to load.
One of the main purposes of a static website is to increase its apparent speed. But when I visit an Octopress website, I always have to wait at least 1 second for anything to appear. On iPad it's even worse, as it takes about 5 seconds before any text appears.
I guess Octopress doesn't need those 2 fonts, and can just stick with Georgia and Arial (or Verdana).
Apart from being lazy to switch, it's one of the reasons why I'm still using Jekyll.
I'm also on Jekyll because I prefer something simpler that I can bend to my will ... http://bionicspirit.com
You can't just leave Wordpress based blog to linger on your server after you have quit blogging. It will occasionally eat all your resources and every once in a while new gaping security holes are found which need to be patched. And if you decide to switch hosting provider, it's a hassle.
With static files all these problems go away and maybe our kids get to see what daddy wrote 30 years ago.
is this a good thing?
"Me Too Aside": A few months ago I finally started up my personal blog[1] which uses Hyde[2] (the Python brother of Jekyll) and is served via an S3 bucket. I found it extremely refreshing not to have to worry about yet another web infrastructure to maintain. It's exceedingly easy to update and maintain.
[1]: http://www.verdantrefuge.com/ [2]: https://github.com/hyde/hyde
If you compile your posts into HTML, use Javascript for more dynamic content (like comments by Disqus or a Twitter feed, for example), HTML files take almost no resources to serve, so you can handle a huge load without many resources.
Now I use Wordpress with WP Super Cache plugin which effectively turns my site into a bunch of static files. My site has gotten a lot of traffic from HN and reddit without ever going offline and I made a custom theme in a few hours.
Take all those static files you've generated and just put them right on Akamai. Don't even worry about scaling your infrastructure on Heroku or EC2, because it's all on Akamai.
It's dirt cheap and really easy to keep updated if you do it right. I presented this at SydJS a little while ago, my slides are here:
To edit page for website, just open terminal and edit and git commit & push. That's all. After git server accept the push request, it rebuilds and publishes the website automatically like Github with Jekyll.
Right now I'm experimenting with a tags in javascript that mimics the functionality used in other blog implementations.
What is even better is that you can host those files without a server environment with Amazon S3 and cloudfront.
Seriously, if your website can't handle bursts of traffic like HN would give - upgrade your server. Pay more. Do it now and don't wait for it to fail.
Jekyll sounds clever, but I would be interested to know the benefits of using it over learning how to cache content properly in your server side language, or just getting a better server.
* Don't have to worry about traffic at all.
* Don't have to pay for hosting (it's free using Heroku or Github, probably other places as well).
* Less moving parts, less to go wrong. For my simple personal site I don't need any server-side code and don't want it.
* Still super easy (for me) to use to publish content.
See http://www.kalzumeus.com/2012/02/09/why-i-dont-host-my-own-b... for more.
Patio11's article is a good one but just not relevant to my situation.
I've spent 0 minutes managing hosting details since I first put my website live. That's just the way I like it. That's part of the reason I chose a static solution: less moving parts, less fuss maintaining it.
* No possibility of XSS (generally, although perhaps unusual content modification via javascript could open up XSS avenues?)
* No possibility of obscure dynamic language runtime bugs
Upgrading one's server isn't necessarily the de facto answer. There are a lot of other considerations to be had, specifically whether or not you care if your server can handle HN levels of traffic -- throwing money at the problem isn't necessarily the answer.
We're talking a few tens of dollars a month more. The time a startup founder spends trying to 'fix' the issue in another way would be better spent elsewhere. Pay more, move on.
The other point, y'know, that the article makes, is that if you're not serving static files for your blog, your blog is effectively "badly written". A static file scales to practically infinity. It's almost a guarantee that whatever else you're doing, even if it's wordpress with caching, doesn't scale as well.
And again, why would I change my hosting bill from $10 a month to $100+ a month on the .01% possibility that I'll see a huge traffic spike?
If you use grunt.js, you might like this grunt-jekyll plugin I wrote: https://github.com/dannygarcia/grunt-jekyll
If you're using WordPress, install a full page caching plugin.
I have an additional wrinkle - I have a jekyll plugin I wrote that I want to use, so I have to run jekyll on my own machine and then commit the plain html output to a separate repository. Once it was set up though it doesn't look much different though, just one extra step (running ./push_site_live.sh) after I'm done.