March 18, 2013
I decided that I should put my website in the same place I'm supposed to be putting things for work. Every web-oriented SysAdmin (or Systems Engineer, or "DevOp") these days deals with AWS or its competitors (hopefully a bit of a couple providers). I took the plunge yesterday and finally terminated my account with Yahoo! Web Hosting. Yes, that's right. I had been kind of embarrased by it, but hey, it worked OK. In fact, my new setup is going to work much much worse in terms of reliability and performance.
The setup for addumb.com is really simple. I don't want to have to deal with it daily, weekly, nor even monthly. Here's how I had various services split up while hosted in Yahoo!.
The new setup for addumb.com is like this:
The real reason I moved my tiny site is so that I can get more flexibility. The "Everything else" in the lists above are really the only reason I even have addumb.com. I spend a fair amount of time learning new application stacks, familiarizing myself with each one's development and deployment patterns. I mostly do this because I'm a nerd and it's fun. Also so that I'm not completely lost when Developer X approaches me to deploy Application Y on technology stack Z this afternoon. I need to know what questions to ask, what jargon to use, and how to communicate the needs of performance, reliability and cost.
I'm self-hosting addumb.com sort of similar to how I would recommend hosting any new web property that has similar needs. My needs are just very different than most consumer web properties.
So why on earth would I put all of addumb.com on a single EC2 instance, let alone one with only ephemeral storage?! Just like any web property, I have certain targets in cost, reliability and performance:
But my personal web site is very different than a real business. Most people end up in the blue area here, but you can see where I pick in the trade-offs:
(pardon the kerning) A direct result of me being a cheapskate is that my website will be slower and down more often than most websites you'll see. However, I saved a bundle on my hosting costs! $10/mo versus $20/mo! That's like an extra latte each week!
To help make this less of a terrible idea, I'm putting the whole site in some git repos and hooking as many things as possible into the post-receive hook in the git repos on the EC2 instance(s). Basically, I force a puppet run for every git push, and try to make that puppet run deal with all the important things, as you can kiiiinda see here.
#!/bin/bash #.git/hooks/post-receive example unset GIT_DIR cd .. git reset --hard HEAD sudo puppet apply --modulepath puppet/modules puppet/init.pp #puppet/init.pp node default { include nginx include flask file { ['/var/www','/var/www/html']: ensure => directory, owner => root, group => root, mode => 1766 } exec {'rsync-of-failure': command => '/usr/bin/sudo /usr/bin/rsync -a --delete webroot/* /var/www/html/', require => File['/var/www/html'] } }
Note: See that last exec? Don't ever do that. I'm being sloppy and only hurting myself.
Nobody should jump to any solution for any technical problem without fully understanding (or making a reasonable attempt to understand) the tradeoffs involved and other viable solutions. The increase in flexibility I get from self-hosting (in AWS or some other provider) outweigh the slight increase in cost and decrease in availability and performance for my own website. Mostly because it doesn't matter to anybody but myself. I mean come on, nobody else is even READING this, right?