posted: December 5, 2016
tl;dr: Behind the scenes of this website...
Note: the discussion below applies to http://chrisshaver64.ddns.net
There - wasn’t that fast? Did this page not load in well under a second? Was it not one of the quickest page loads you’ve experienced recently? Faster than Facebook, Tumblr, Twitter, or your favorite news (or fake news 😀) site? Approaching if not equaling the load time of Google itself?
Notice also how there are no ads cluttering up the pages of this site. No one on this side of the site’s Internet connection is tracking your activity either (it’s just me, and I don’t care). I also can post anything I want that is within the bounds of U.S. law; there is no one censoring me, or even editing me. My out-of-pocket monthly cost for operating this website is pennies: the cost of a little bit of electricity.
There are many options for hosting a website, or more generally for hosting content on the Internet. Facebook is basically a way to easily post text, pictures, and video on the Internet without having to know any HTML. There are many other options for hosting websites, blogs, and content. But they all either cost money or involve a sacrifice, often of privacy. To avoid all that, and to give myself a small technical challenge, I decided to see how easily and cheaply I could roll my own web server. My goal was to see how close to $0/month I could get.
I chose the Raspberry Pi because it is inexpensive ($35 plus a little more for memory and a plastic case, I recycled an old AC adapter to supply power); relatively powerful (the latest has a quad-core ARM processor; I am actually running an older generation); and because it runs Linux and a huge amount of other open source software. If you want or need a computer in your home to be operating around the clock to perform some service, it is a great choice because it consumes hardly any energy.
There are a large number of software options and frameworks for building a web server. I ran across a great tutorial, written by Ben Everard, in the premier issue of the now-defunct (alas) Linux Voice magazine (download it here) which uses Tornado and Python3, both of which I wanted to play with. So I decided to put that framework and my site on the Raspberry Pi and see how it performed.
For Internet connectivity I reconfigured my home routers to punch a pinhole through my firewall for the webserver and to give it access to my public IPv4 address. The final nicety was to register with a DNS hosting service, noip.com (shout out to them - thanks!), which has a free option for hosting my subdomain name, chrisshaver64.ddns.net. I could have purchased a dedicated domain name, but that would cost some money. Maybe someday...
I’m very happy with the end result, especially the performance. Even though I spend my working days in the cloud, it’s always helpful to get hands-on experience with actual servers and networking gear, since that is what the cloud actually is. Although it’s been highly reliable, it does require some babysitting; on my to-do list are setting up some automatic health checks and recovery mechanisms. The biggest to-do, however, is migrating to https, which I plan to do soon by utilizing another free service for an SSL certificate, Let’s Encrypt. Hopefully I’ll have a little time over the holidays to do so.
Update: see My $2/month, ad-free, tracking-free, censorship-free, screaming fast website