Server move autopsy

It was only early 2005 that I last moved servers and that was such a laborious process that I hoped I’d never have to do it again. But the difficulties of running Movable Type and PHP5 at Pair.com combined with an offer at TextDrive pushed me over the edge and I took the plunge. Result: one long day spent moving everything followed by 2-3 days of clearing up the ensuing mess. Really, this is the last time.

Pair.com

I should say that it was a tough decision to move from Pair. Before this current stint I was with them for a few years some time back and they’ve been as reliable as I could wish for. I can’t remember a single instance of my sites or email being down because of them. They’re scarily robust, inexpensive and have generally good support.

Much of the reliability comes from being very cautious — this is not the place to go if you want to try out newish technologies. PHP5 only runs as a CGI (which, I assume, isn’t ideal) and Ruby on Rails is apparently a pain to set up there, and will run slowly

They also have “reapers” that cut off long-running or memory-hogging processes for the good of everyone on the shared servers. My PHP5 pages were often reaped, seemingly at random, with Internal Server Errors, as was the Movable Type comment script. Many people have problems with mt-comments.cgi taking a long time to run, on different hosts, and although I did all I could to ease its load 20% (at a rough estimate) of comment postings were still cut off with the dreaded Internal Server Errors. I’d given up, and was unenthusiastically looking for another host (the next step up at Pair is to get your own machine, which seemed a bit much for me). Then I noticed the TextDrive offer and decided to give it a whirl. With the accompanying generous Strongspace allocation it would pay for itself in a couple of years.

A few days after I signed up to TextDrive, Pair introduced new reaper rules that have more allowances for Movable Type’s default scripts, which seemed to fix the commenting problem. Damn. Too late for me, unfortunately.

TextDrive

TextDrive is a friendly place. It feels a bit like paying some of your techy friends to run a server for you. It feels like a nice step between shared hosting like Pair’s and having your own machine. Their “Webmin” interface (which is an ugly beast and sometimes painfully slow) lets me administer everything I want (and much more) on my part of the server. It’s more configurable than Pair’s accounts. Support is OK, although so far I’ve been very disappointed with response times, having to wait a day or two or more to hear back. There’s also lots of friendly support on the forum to help out (to be fair, Pair has some helpful Newsgroups too).

As well as being ugly and slow Webmin is a little erratic. Some changes I made seemed not to “take” and names of users I created occasionally changed for no reason. Some things make no immediate sense at all — after creating a MySQL database you have to create a user to access it. Fair enough, but how? By adding an “Email & FTP” user (and probably disabling their email and FTP abilities). This is explained in the vital hosting FAQ which you should read before getting set up.

When you sign up, the domain name you give will be your primary domain. When you FTP/SSH to your server the top-level email, web, cgi-bin, logs directories will be related to that domain. Any virtual server domains you subsequently create will have identical setups within a ‘domains’ directory. It’s not the end of the world, but I’d have preferred all my domains to appear more equal. So if you’re going to host several domains, think which one you want easiest access to, and make that your first domain.

Four other slight annoyances/gotchas:

First, your domains don’t get their own IP addresses, which they did at Pair, so it’s a bit more of a hassle to preview your sites before moving DNS.

Second, when you create new email/FTP users, the namespace is shared across all people hosted on your server. This really does feel messy — my email login name isn’t ‘phil’, because there must be a ‘phil’ already getting email with someone else hosted on the same machine. It makes no difference to the outside world, but it feels like a peculiar and rare intrusion.

Third, for possibly good reasons, you can’t do a mysqldump of your database using the default options. The permissions errors I got from this had me scratching my head for some time before realising I must always add ‘—lock-tables=false’.

Fourth, when I created a database using the supplied phpMyAdmin installation it didn’t appear as available to assign a user to in Webmin. It seems that you have to create a database in Webmin for it to appear there.

Moving

Transferring all my sites reminded me again what a string and sellotape operation websites can be. Huge amounts of things broke due to different versions of PHP, or different locations of certain directories, or different default settings, or missing perl modules, or server time differences, etc, etc. The biggest problem was all my fault though — trying to convert my databases to entirely UTF-8 went horribly wrong and although I’ve spent a couple of days fixing things I fear I’ll be living with the consequences for ever. I don’t think the data is more broken than it was, just broken in a whole new way. Ah well.

I found it useful that I’d kept track of what I’d done last time, so here, again, and for the really honestly I hope please thank you last time, is the list of what I did (and whether it was on the [old] or [new] server).

Day of move

  • 1 hour
    • [old] Post warning message on Pepys Diary about imminent disruption.
    • [old] Switch off incoming comments on MT.
    • [old] Rebuild all MT sites.
    • [new] Create file structure for domains.
    • [new] Create databases (using webmin, not PHPMyAdmin).
    • [new] Create database users.
    • [new] Create email accounts (Got nowhere with that)
  • 1.5 hours
    • [old] Zip up files on each site, transfer to new server.
    • [new] Unzip, put in correct places.
    • [new] Change file paths and database settings in config files, both PHP and MT.
  • 1 hour
    • [old] Zip up command line scripts and cron file, transfer to new site.
    • [new] Unzip, put in correct places.
    • [new] Change file paths and database settings in command line scripts and cron file.
    • [new] Change paths in .htaccess files.
    • [new] Change config for Refer.
  • 1.5 hours
    • [new] Create email accounts (Trying again - eventually successful, although I still don’t understand what Step 3 means.)
  • 1 hour
    • [old] Make dumps of databases.
    • [new] Transfer dumps to new server and import into new databases, converting to UTF-8 in the process.
  • (Stopped keeping track of time)
    • [new] Get cron scripts running.
    • [old] Change DNS to point to new server.
    • [new] Change MT publishing paths.
    • [new] Switch on incoming commments on MT.
    • [new] Post welcome message on Pepys.
    • [new] Rebuild all MT sites.

Since moving

  • [old] Stop Byliner send_emails script from running.
  • [new] Double-check and/or add password protection for private parts of new sites — re-do it all using Webmin because it kept going wrong on the command line.
  • [new] Write script to fix all the existing TrackBack paths in the MT database to use the new paths.
  • [new] Update Pepys Diary to Background Info Trackbacks for 2006-08-09.
  • [new] Fix redirects from www.gyford.com/dir to gyford.com/dir/ 1, 2
  • [new] Fix Byliner send emails script (changed from qmail to sendmail).
    • [new] Fix mysql backup scripts. (Add ‘—lock-tables=false —skip-add-locks’)
  • [new] Is SpamAssassin working, filtering into mailbox? (I still don’t seem to get as much spam as I should, although too much of it is getting through to me.)
  • [new] Fix old rickety, now broken, PHP on Byliner.
  • [new] Fix characters on /japanese/ (For some reason it had got mangled. Re-typed the Japanese characters in a UTF-8 file and changed the encoding from shift_jis.)
  • [new] Fix truncated Pepys’ Diary comments.
    • I’d exported using these instructions which proved to be a bad idea. The database was already (somewhat?) UTF-8 so exporting using latin-1 meant that apostrophes came out as ‘\x92’ rather than a longer UTF-8 string. So when importing that dump into the new, completely UTF-8, database some of the comments were being truncated at these symbols. At least, I think that was the problem.
    • By now the new databases had some new, valid data in, so I couldn’t just replace the entire databases.
    • Solution: Export just the comment table from the old database using (the default of) UTF-8, replace ‘INSERT INTO’ with ‘REPLACE INTO’ in the dump file, import into the new database, writing over the old, truncated comments. Hopefully.
    • The apostrophes (and probably other characters) still appear as question marks on the page, but at least the whole comments are there. Good enough.
    • Took best part of a day.
  • [new] Fix ‘new’ indicators on Pepys’ Diary comments. (Old, broken PHP.)
  • [new] Fix script that posts my del.icio.us links to MT. (Missing perl modules.)
  • [new] Update Byliner Admin’s PHP. (Really old dodgy PHP.)
  • [new] Re-import old Byliner data because it’s been truncated, as above, (writers, stories) in UTF8.
    • See above similar pain, took most of a morning.
  • [new] Check Byliner front page is working for logged-in users. (Fixed, more old broken PHP.)

Still to do at time of writing

  • Get Mary’s DNS updated.
  • [new] Fix combine_feeds script for gyford.com front page — getting “97 - Missing signature” Flickr error. (Looks like a common error with other people this morning — could be Flickr’s problem.)
  • [new] Check script that posts Trackbacks from Pepys’ Diary to the Background Info pages is working from August 17th entry onwards.
  • [old] Archive old web logs.
  • [old] Delete old websites.
  • [new] Set up Subversion and mirror live sites on local machine.

Comments

17 Aug 2006 in Comments elsewhere

Paula & Ben in Paddington… on Flickr - Photo Sharing!
When I first glanced at this I thought Ben was wearing a comedy Hitler moustache!…

On this day I was reading

Music listened to most that week

  1. David Sylvian (19)
  2. Miles Davis (16)
  3. Damien Jurado (4)
  4. De La Soul (4)
  5. Helvetia (4)
  6. Ahmad Jamal (3)
  7. Nas (3)
  8. Pinback (3)
  9. [unknown] (3)
  10. Ans. im. Alexandrova (2)

More at Last.fm…