UESPWiki:Server Upgrade

These are tentative plans and procedures if/when the UESP server is upgraded or replaced in the future.

Transition Procedure
This is a basic plan for moving the site's data from one physical server to another server.

:# Backup all files on the old server and copy to the new. Directory structure should be identical unless the OS/environment has changed on the new server (in which case work will have to be done to move things where they should be on the new server). The old server is still unlocked and running during this time.
:# Setup and test new machine and ensure everything is working (web server, MediaWiki install, PHP cache, database replication, directory shares, etc...).
:# Lock the old and new server to prevent any updates during the transition.
:# Backup and transfer the databases and other required files from the old server to the new. We can transfer the bulk of the Wiki images in the first step step and only need to update any new or updated images. The backup can either be manual transfer via FTP or a combination of database replication and remote rsync. The latter is more work to setup but should allow a much shorter lock/downtime period. Even with manual backups this shouldn't take longer than an hour if done during off-peak hours.
:# Test the new server to ensure the contents were properly transferred.
:# Unlock the new server but keep the old server locked. The new server is now considered the primary site.
:# Post a message on the old server to redirect people to the IP of the new server.
:# Possibly add an automatic redirect of pages on the old server to the new server (test this first to see if its possible and how it works).
:# Change the DNS entry of uesp.net to point to the new server's IP address. Technically this change takes up to 24 hours (or 72?) to be applied but it often takes much less. Hopefully any noticable interruption to the site is limited to less than a day.

Backup Files
Files that need to be backed-up and restored on the new server include:
:* User directories /home and /home2. This includes MediaWiki, the Wiki images and all other website files. 
:* Custom startup and initialization scripts (should all be under /etc).
:* Databases (backup either by exporting/importing or through database replication).
:* Custom utility source installations in /virtual. If the OS is kept the same the source of these utilities can be simply copied and re-installed on the new server to keep the number of changes a minimum. Any significant change in OS/platform may require the appropriate version to be downloaded and installed from scratch. Records of exactly which custom utilities are installed and the installation process should be created for future use.

Remotely Copying Files
Files can be copied remotely using FTP, rsync over SSH, or with the scp command:

   scp user@uesp.net:/home/www/uesp.net/backup.tar.gz . 
 

Detailed Plan
:# Create static backups on the old server of /home, /home2, and /virtual directories.
:# Copy backups from the old server to the new server to a temporary location.
:# Setup and install Php5.
:# Setup and install eaccellerator.
:# Setup and install lighttpd.
:# Setup and install ImageMagick and freetype library.
:# Setup and install mod_evasive and mod_limitipconn for Apache.
:# Update the Apache configuration.
:# Update the MySql configuration (mirroring off initially).
:# Restore the main site backups (files and all databases).
:# Test setup and ensure everything is working before continuing.
:# Ensure new server edits are locked.
:# Setup database and file mirror on the new server (the new server mirrors the old server).
:# Copy any remaining settings (/etc/, ...).
:# Monitor mirror status until ready to switch over.
:# Lock edits on the main server.
:# Create backup(s) and download to local computer.
:# Let the new server catchup on updates.
:# Disable mirroring from all backup servers.
:# Disable replication on the new server.
:# Ensure new server is working.
:# Change uesp.net DNS entries to point to new server IP.
:# Redirect all requests on the old server to point to the new server.
:# Test and monitor site status. Ensure data is being properly pulled from the new site and not the old site.
:# Once things appear to be working correctly the new site can be unlocked.
:# Setup automatic backups on the new server.
:# Setup mirroring once again on the backup servers using the new server.