Categories
ranting

Server Migration

After 20 years I have finally migrated off of the original confusion.cc server. Since I was in college confusion.cc has been hosted on a server in California. Originally on a physical box in a managed data centre, what is known as a Server Colocation or just “colo”, and later a virtual machine in the same centre. But I’m lazy and have not kept the server up-to-date since I migrated the family email server to a fully managed service ten years ago. And now the confusion.cc server is so out of date that it’s a hopeless task to try and update all the software. Things came to a head a few months ago with the release of WordPress 5.2 which requires PHP 5.6.20. Confusion.cc was limping along on PHP 5.2.5, from 2007!

So, now comes the end of the colo era for confusion.cc. The site is now running on AWS. And if the website sees high levels of traffic in the future, I can easily switch to dedicated server hosting plans. But one does not move a two decade old website without a few issues…

After setting up a vanilla WordPress installation on an EC2 instance and a MySQL RDS instance I uploaded the confusion WordPress database and viola! What’s with all the funny characters showing up in the posts? Best I can tell the original WordPress version used on confusion (installed sometime around 2004, when WordPress was version 1!) defaulted to latin1 encoding but somewhere along the way I started using Unicode characters in posts. For some reason it all worked. Now however, the default WordPress installation uses UTF8, ergo gobbledygook… there are numerous posts out on the web documenting various ways of fixing the DB. Changing the DB config, the individual table config and even the table row config… and there are grep-sed-awk magic spells to cast on a dump file that you can then load into a new DB instance and after a few prays to the elder gods all your Unicodes are correct!

And then there was the one hack to just define the DB_CHARSET variable in the wp-config.php to ‘latin1’ and Cthulhu continues to dream, un-disturbed, in Rayleigh.

Once the posts were loading it was time to tackle all the other assets; scripts and images which on the old server were loaded from sub domains. Originally this was to allow browsers to download the assets in parallel. This is because browsers limit the number of concurrent connections to a sight. However since I don’t have an image heavy design and most scripts are loaded from other sites or CDNs I don’t think it’s a big issue. So I uploaded all the content to an S3 bucket. I had to replace all the links in the theme and posts and then add a mod_rewrite rule to redirect the requests to the S3 bucket.

I also had to drop the “/wp/” from the URL. Long ago when I setup WordPress on the colo I had other things running at the top level so putting the WordPress installation into a directory made sense. Today WordPress is the CMS for the whole site so this setup doesn’t make sense. So off with the “/wp/”, which meant meant updating any post linking back to a confusion post. (This also means that any link to a post from Google or any other random site would be broken. So I added another mod_rewrite rule). I also updated the WordPress settings. And as soon as I did all of this I couldn’t continue to load the pages using the EC2 instance IP. So I had to update the confusion.cc DNS records to point to the AWS site. So, technically it was at that point that confusion.cc moved over to AWS.

Then there was the issue with XML RPC. The WordPress apps were not working. After much investigation I managed to pin it down to lacking PHP support for XML RPC in the default installation. I had to install additional packages for PHP-XML, PHP-XMLRPC and PHP-GD.

The last two bugs turned out to be caused by the same thing. First there was an issue with the icons for the sharing buttons not displaying. The icons are actually a font loaded via CSS from the Jetpack WordPress plugin. Funny thing is they worked on the plugin configuration page but not the site itself. The second issue was with the navigation menu. Clicking on the categories, archives or search option did not display the DIV containing the forms, so there was no way to navigate via categories or archive links and you couldn’t search. On the bright side “Random” still worked. After much tinkering and investigation I found a PHP opening tag was messed up in the header.php file. What should have been “<?php” was just “<?”. No idea how that happened… gremlins.

There may be other things. With nearly two decades of cruft I’m sure I’ve missed something…

Anyway. Next task is to finally consider updating the theme. I’ve been running on this theme since 2013 and it’s only a minor update if an even earlier version and that was my own hack on the original Kubrick theme from WordPress! HTML and CSS have come a long way since then. As well as Javascript – I don’t think in need to use jQuery anymore. So maybe I will get around to fixing it.