Another server drive failure – so migrated my WordPress blog to OpenShift

So it happened. Again. Although the last time was at least 5 years ago. A ton of i/o errors in syslog, and one of my drives in a RAID1 array is not responding. Strangely the other drive although still working is reporting in SMART that it is also about to die. That seems unlikely to have two drives go at the same time?

SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.

Uh-oh.

So here’s the deal. The last time, roughly 5 years ago, I had a drive completely die and my Ubuntu server than I run from home wouldn’t boot. I lost several months of blog posts and notes. When I rebuilt it, I installed a pair of 250GB Hitachi Deskstar P7K500 drives in RAID1 configuration. The odd thing is that one of the drives kept dropping out of the array every few months in the last year, but it could be added back with the mdadm commands so I didn’t think much of it. Maybe I should have looked more closely in the logs what was going on.

So I’m at the decision point. Probably shouldn’t just replace one of the drives if one is alreay bad, should probably replace them both. Do I want to spend a couple of hundred on another pair of drives? At least the RAID array probably saved me from completely losing everything again.

I’ve run my own Linux server from home since about 2000. It’s physically changed motherboards a couple of times, its been a PIII and most recently a P4 with just 512MB of RAM and I’ve run JBoss versions from 3.x or so upto 5.x, Glassfish 3.x, I’ve run my blog on on my own custom app (BBWeblog), then Drupal, Joomla, and most recently WordPress on Apache. I’ve enjoyed running my own server since it means I can do whatever I like with it, and other than the cost for the hardware, there’s no hosting costs for my sites.

I think it’s reached the point though where enough is enough. Time to move online somewhere. Given that I’ve been using OpenShift for a number of projects at work, it seemed an easy choice to spin up a gear using the WordPress template and just import my site. And it only took a couple of minutes to get it up and running. I spent more time playing around with the WordPress Themes than I did actually setting it up and importing my site.

The only slightly tricky part was to update the DNS entry to point to OpenShift, which involved the following steps:

  • Update my record on zoneedit.com to delete the entry for my domain. I’ve been using ZoneEdit because they support Dynamic IP addresses by giving you a script to run locally to update what your actual IP address is periodically.
  • Update my GoDaddy account to remove the ZoneEdit DNS servers, switch from Custom DNS settings to Standard, click on DNS Zone File, and then add a CNAME record for ‘www’ pointing to my apps’s URL on OpenShift
  • Back to OpenShift, run ‘rhc add-alias wordpress www.kevinhooke.com’ where wordpress is the name of my app.

This post was useful, and here’s the docs for ‘rhc add-alias’

Done! It actually only took a couple of minutes for the changes to get reflected too, i.e. if I ping www.kevinhooke.com it’s now picking up the new IP for my OpenShift server on AWS.

I’m probably still going to play around with some customization options on WordPress, but  from start to finish it was probably less than an hour. It would have taken me far much longer than that to install new drives in my server, reinstall from a drive image, and get it all set up again. So, fingers crossed, here’s looking forward to my new home on OpenShift 🙂

Adding the WordPress Multisite feature to an existing site

I’ve had this site as my main blog site for a number of years now, but I also keep another site for past projects that I’ve worked on. It’s been a static HTML site for a number of years and gone through a number of revisions, but I wanted to move it to WordPress to make it easier to edit changes directly on the site instead of the normal editing HTML and FTP’ing to the site workflow.

Since this site is already using WordPress, I thought I’d take a look at the Multisite feature to avoid having multiple installs on my Apache server. Turns out starting this late into the evening was probably not the best idea, but after a few hours I finally got it all fixed up. Here’s some key resources:

Key things that I learnt:

  • If you have an existing site, saw www.example.com and you follow all the steps in the above articles, using the subdomain approach you’ll end up with your existing domain as example.com and other sites as subdomain1.example.com, subdomain2.example.com etc. Not wanting to break existing links to my existing site at www.example.com, you could either put in place Apache rewriting, or the  approach I took was to copy my previous posts across to a new subdomain mapped as the original URL, www.example.com
  • To set up the above:
    • export the existing posts using Tools/Export
    • Create a new site and map it to www.example.com
    • Import your exported data into the new site
    • You can now delete the original posts in the original site that’s now mapped to exmaple.com. If it makes sense, create new content for this top site.

Remember Erik Thauvin’s Java Linkblog?

I heard the term ‘link blog’ the other day and it reminded me of one of my favorite Java link blogs that was around up until 2007, Erik Thauvin’s Linkblog. I guess with other sites that rely on the community to collect and post content (eg DevZone, and more generic ones like Reddit etc), Erik decided that it wasn’t a good use of his time to trawl through the ever increasing volume of Java related news stories looking for interesting and useful links. Which is a shame, because his site was in my ‘daily reads’ site list for a long time.