Moving a Movable Type installation from one server to another

This article discusses how to successfully move an installation from one server to another. It will cover the following topics:

  1. Generating the database dump.
  2. Moving files.
  3. Setting up the new installation.
  4. Testing the migration.
  5. Performing the final DNS switch over.

Getting Started

Hopefully this process will not be too daunting, but you should be aware that it does require some basic system administration knowledge. We recommend you read this entire article before proceeding and executing any of the steps it documents. If you feel that any of the steps are beyond your skill level, we strongly recommend you consult a qualified Movable Type professional to help with the migration.

Endevver also recommends that users do NOT attempt to migrate and upgrade at the same time. Do these steps separately. Upgrade and then migrate, or vice-versa.

Archiving a Site

To move a site, you must first package all of its contents in a zip file to be moved effectively. A sites contents are typically in three major pieces:

  1. The Database Data
  2. The files on the file system
  3. Movable Type application files

Archiving the Database

At Endevver we use the MySQL command line tool called mysqldump to export a database's contents. The command is documented at MySQL. But this is what it usually looks like:

prompt> mysqldump -h localhost -u DBUSER -p  movabletypedb > mt.DATE.sql

Archiving a Site's Files

A site's files contain:

  • the files published by MT
  • files uploaded by the user

The location of these files will depend upon where you have configured your Movable Type install to publish files. Furthermore, the location of these files may dispersed across an entire file system if each blog publishes to different location on the server's file system. For example, in a shared hosting environment, it would not be unusual for a system with two blogs to have its site's files published to directories like so:

  • /home/userA/www/
  • /home/userB/www/

It will be your job to ascertain where Movable Type is publishing files for each of its blogs, and to add those directories to a single zip file containing all of the installation's site files.

Archiving Movable Type

This should be pretty easy. Find where Movable Type is installed. Then zip up that entire directory. Be sure you include in this zip file:

  • All of the plugins you have installed
  • All of the static files of your system. If your static files are located outside of the MT_HOME directory, be sure you copy these too.
  • All of MT's application files.

The Big Move

Once all of the files have been zipped up let's move them to the new server. Follow these steps.

  1. Setup your database. Create a new database on the new server. Then import the SQL file you exported using mysqldump earlier.

  2. Next, take the zip file containing the Movable Type application, plugin and static files and install them on the web server on your new machine. Edit the mt-config.cgi file with the database credentials needed to access the database you created in the previous step. Confirm that the mt-config.cgi references the right mt-static files and paths.

  3. Access your mt-check.cgi script on the new machine. Ensure that all necessary perl modules are installed. If they aren't, install them.

  4. Check to make sure you can login to the new instance of Movable Type. Make sure all of your data is there from the old install.

The Easy Way or the Hard Way

The "hard" part about a server migration is making sure all of the paths to all of the files in your old system, which are now present in your new system, still resolve properly.

The quickest and easiest way to do this, is to mirror where your site's files are stored in your new system with that of the old system. In other words, if on your old system files were published to /var/www/html then they should be published to the same place on the new system.

Changing where files are stored

Sometimes when executing a server migration, you want to reorganize the file system itself to better organize it. If this is the case, then extra work may be required to ensure that all old URLs and paths still work when the files are moved from one server to another.

Newer versions of Movable Type are smart enough to allow users to change the Base Path of their blog without impacting MT's ability to find files located beneath that base path. Older versions of MT (MT3 and before) hard code paths into your system making this process a little harder.

If you desire to re-organize how and where your files are stored during the course of a server migration, we recommend consulting a qualified Movable Type professional. Otherwise, more time will be required to document the specifics of that process.

In the mean time, you can just try relocating the files as you see fit and then just seeing if it works. If it doesn't, then you probably will need help. It it works, congrats.

Changing Blog Publishing Settings

Now it is time to change each of your blog's publishing settings. This is what we recommend. For each blog:

  • Navigate to Preferences > Publishing.
  • Change the "Publishing Path" accordingly and if necessary.

Test Everything Out

Endevver also recommends setting up your new machine on a separate domain from your main website, like stage.yourdomain.com, or beta.yourdomain.com. Then set your Blog's URL to use this temporary domain while you test to make sure the migration was done successfully.

The next to last step is test everything out. Try publishing your new blog. Check to see that the changes are being reflected on your new server accordingly.

If everything looks good to you...

Final Step: the DNS switch over

Now that the new machine is setup and working properly, tell the world the new IP address. Do this by editing your site's DNS settings.

If you setup the new server under a temporary test doman like stage.yourdomain.com, you will need to change it back to your primary domain, e.g. www.yourdomain.com, and republish your site. Do this before changing your DNS.

Summary

We hope you have found this article helpful. Please contact us at Endevver if you need professional help in facilitate a server migration. It is one of our many specialties.