The Move to DigitalOcean and DNSimple

I recently moved this blog onto DigitalOcean. For years it has been hosted on WordPress.com, and as a guy who writes software for a living, that’s kind of like cheating. I work primarily on the Microsoft stack, and I wanted to dabble in areas unknown.

There were a few hosting options I considered. Just about any cloud platform can run WordPress, but I wanted to own and manage a box running on a Linux distribution. Services that hide their internals, like Heroku, while awesome in their own right, were out of the question for what I wanted. I considered Amazon’s cloud and Microsoft Azure, but found that I could get a lower rate for a single slim server at Linode or DigitalOcean. Linode had a $10/month option for a server with 1GB memory, while DigitalOcean had a $5/month option for a server with 512MB, the same amount of memory as in a Raspberry Pi. I liked the price and I liked the idea of having to work with such tight constraints, so here we are.

DigitalOcean runs all their servers on SSDs, so firing up a new instance and taking complete snapshots is a painless process. You’ve got a variety of OSes and versions to choose from. They also have some pre-made images if you need a quick Gitlab or WordPress instance. I didn’t want to cheat, so I started from scratch and fired up a clean Debian Wheezy instance.

I’ve been intrigued by what I’ve heard about nginx, so I wanted to use that as my server, and I wanted to use Postgresql but found that WordPress doesn’t support any datastore besides MySQL. What I was looking for was summed up as a LEMP server (Linux, nginx, MySQL, and PHP). It’s like a LAMP server, but replaces Apache with nginx. I suppose LNMP was unpronouncable.

Now that it was time to get my hands dirty, I did a little googling, when, lo and behold, Google sent me right back to DigitalOcean. It turns out they have a great documentation portal that clearly explains each step of the very stack I was interested in, and on multiple OSes. I started my journey somewhere around here, How To Install Linux, Nginx, MySQL, PHP (LEMP) Stack on Debian 7.

It was almost too easy. Debian has such a rich set of software in its package repository that I could apt-get just about everything I needed without having to alter my sources list. Even WordPress is included in the stable repository.

nginx

Getting nginx up and running was a breeze. I wanted to toss the WordPress blog under the blog subdomain, but I wanted to keep my SEO links from the top-level domain intact. This quick little nginx config section did the trick:

server {
 listen 80;
 server_name freakingawesome.net;
 return 301 $scheme://blog.freakingawesome.net$request_uri;
}

Every http request for the host now gets a 301 redirect to the blog subdomain. I didn’t have to fire up any actual web application to handle the redirect.

The WordPress setup is a bit longer since it’s running PHP, but overall I was impressed by the brevity of of the server configuration. A few lines give you gzipping based on MIME type:

gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

And a few more lines can tie in your SSL certificate, given a server declaration that listens on port 443:

ssl on;
ssl_certificate /etc/nginx/ssl/blog.crt;
ssl_certificate_key /etc/nginx/ssl/blog.key; 

There’s an option to validate the configuration before turning it on, and there’s a way to reload the configuration without restarting the service.

The Rest

There wasn’t much to do on the MySQL and PHP side of things besides tweaking a few default settings to make things a little more secure.

When it came to installing WordPress, it really boiled down to a simple:

$ sudo apt-get install wordpress

Huh. That was less than dramatic. I expected a battle. After some configuration tweaks and updates to my nginx configuration, I was greeted with the standard blank WordPress installation. Then it was off to install a few plug-ins, export my data from the old instance, import it to this new blog, and that was it.

DNSimple

Troy Hunt sold me on DNSimple, so I gave him an internet high five and a free month of service when I jumped on board.

It was again a painless process to move over my domain. Their domain management tools even have some shortcuts for a bunch of other popular services. Turning on the Google Apps service added all the CNAMEs and MX records that I had on my old host. This could all be set up before the final domain transfer, and that was I was able to cross over with minimal downtime.

Performance

So far, my little 512MB machine is humming along just fine. I’ve got the W3 Total Cache plug-in enabled to lighten the load a little bit. I’ll eventually tie in Varnish just for the hell of it, but as of right now, my little server is performing quite well for the modest 1k visits this blog gets all day (thanks to all you PRK Recovery googlers out there).

DigitalOcean provides some concise real-time graphs for monitoring bandwidth, disk, and CPU usage, as well as configurable warnings for heavy traffic.

Graphs for Public Bandwidthk, Disk Usage, and CPU Usage

I think I’ll be plenty happy with DigitalOcean as my provider moving forward. I’ve only scratched the surface of what they offer, but I’m off to a good start. Kudos to the team for their easy-to-use tools and especially for the treasure trove of documentation they maintain.

 

Aftermath of the Car Crash

Last week we lost the Kia. Jen was driving through an intersection when an oncoming car turned left, directly into the vehicle holding my wife, my eighteen month old daughter, and the best dog this world has ever known.

Jen suffered the bruises and abrasions you get from seat belts and air bags, but was otherwise unharmed. Our daughter was perfectly fine. The car seat did its job wonderfully.

Our dog, Piper, fared the worst. She was in the back of the SUV next to a stroller. Her femur was badly shattered in the accident, so much so that the local specialist wouldn’t touch it. We had to take her to Michigan State University, where Dr. Kyle Snowdon pieced her back together. Now she’s got a metal plate in her leg and a metal rod inside her bones, and she’s walking on the thing. I’ll post the x-rays when I have them, but hot damn do I love modern medicine.

cone-of-shame

The cone-of-shame has caused her more distress and discomfort than the broken leg did. It was bad timing to have a broken leg. The car wreck happened July 2nd and they avoided immediate surgery on Piper because she had some pulmonary contusions that made anesthesia too risky. We had to wait it out until the following Monday, and even then they couldn’t operate until Tuesday. She hobbled around for a week with a shattered femur and there was nothing we could do.

To top that off, our neighborhood loves its fireworks, and this was the Fourth of July weekend. Our only job was to try to keep the dog calm until surgery day, and every slack-jawed yokel in town was blowing up their paycheck right outside our door, making that an impossible task. She didn’t really seem all too affected by the sedative, but we were able to keep her somewhat safe and secure by throwing her in her crate, darkening the room, and turning on as many fans as we could to try and flood the room with white noise. We made it through the weekend without her hurting herself any further. Boy, was it a relief when we finally got her into the doctor’s hands.

She’s put back together now and it will be eight weeks until a full recovery. The Kia, on the other hand, is gone. The insurance company counted it as totaled, so we’re on the lookout for a new vehicle. We were planning on buying a minivan later this year, but it looks like our hand has been forced.

Here we say goodbye to the Kia. She protected my family and deserve’s a hero’s burial. So long, my good friend. I still remember the day I was guilted into buying you after I slammed the fingers of the car salesman in the door.

byebyekia