This should merge with Move Tiki using SSH

Migrate a Tiki to a new server with SSH

These instruction are more tips/reminders for developers than step by step instructions for end-users


Context

  • You need to move a Tiki site from server A to server B
  • Both servers have SSH and rsync
  • Tiki may have been installed by SVN or CVS
  • You are not upgrading (you can do this later)
  • Downtime is OK while you move the site and change the DNS



Close site

  • tiki-admin.php?page=general -> navigation -> Site Access -> Close site (except for those with permission)


DB

You can use PhpMyAdmin if you have it on both servers, but often, files are too big for web interface or you could get "#1153 - Got a packet bigger than 'max_allowed_packet' bytes ". You can also get this via the command line.

Backup DB


Go to a non web accessible directory and create a new directory

Copy to clipboard
cd .. mkdir mysqlbackup cd mysqlbackup


Get the db, user and password from db/local.php
Copy to clipboard
mysqldump -u old_db_user -p --opt old_tiki_db > databasebackupfile.sql

Check the file to be sure it contains the last table: users_users
Copy to clipboard
tail --lines=200 databasebackupfile.sql

Move DB

SFTP

You may want to compress before you migrate

use bzip2
Copy to clipboard
bzip2 databasebackupfile.sql


This will create a file databasebackupfile.sql.bz2 which will be much smaller. Also, if you migrate a compressed file, and there is a transmission problem, you will get a warning when you uncompress at the other end.

Move the file via SFTP and then, uncompress:

use bunzip2
Copy to clipboard
bunzip2 databasebackupfile.sql.bz2


rsync

You can adapt rsync instructions below

Restore DB

Create a new DB via your control panel. This a good opportunity to change the password, so don't use the same as before.

Copy to clipboard
mysql -u new_db_user -p new_tiki_db < databasebackupfile.sql


It's not unlikely that you get an error like

Copy to clipboard
ERROR 1153 (08S01) at line 219147: Got a packet bigger than 'max_allowed_packet' bytes

If so, delete your partially created database, search for the solution for your server to increase this value, and try again.

After you restore, compare both databases via PhpMyAdmin to double check all was well transferred. The number of tables and records should be identical, however, the size in megs can vary, and that's OK.


Files in web directory

Check for differences

This is a good time to check if the Tiki has been modified. The following commands will show you if files were modified.
It's good to detect if you've been hacked or if their are modifications to Tiki that you need to account for (and reproduce when you upgrade later)

CVS

Copy to clipboard
export CVS_RSH=ssh cvs diff

SVN

  • svn st
  • svn diff

Security check

  • tiki-admin_security.php -> Check all tiki files

Migrate files

Rsync

SSH in the new site. From here, we'll pull the files

Create some directories

Copy to clipboard
cd .. mkdir temp_directory_to_receive_files cd temp_directory_to_receive_files

Do a test run

Copy to clipboard
rsync --dry-run --verbose -avz oldusername@olddomain.example.com:/home/oldusername/public_html /home/newusername/temp_directory_to_receive_files/

Do it for real

Remove --dry-run from above

Once this works, you can move the files from
/home/newusername/temp_directory_to_receive_files/*.*
to
/home/newusername/www/*.*

Zip & (S)FTP

  • It's better to compress the files (zip/gzip) before you migrate them to make sure nothing is lost on the way...

Adjust the file permissions

Copy to clipboard
sh setup.sh

Files outside the web directory


Check tiki-admin_system.php

And where attachments are stored for wiki, file gallery, trackers, forums, etc. Ex: tiki-admin.php?page=wiki

Make sure to move these as well...

Update database connection


You can do this via tiki-install.php or by editing db/local.php (Edit this file to use new db name/username/password)

Switch the DNS

  • Ask whoever controls the domain name to switch the DNS


Add an alternate domain to the old site

  • You can do this via cPanel (park domain)
  • It is useful to keep a functioning (and closed) version of the old site so admins can go and check if something is fishy on the new site


Open the new site

  • tiki-admin.php?page=general -> navigation -> Site Access -> Close site (except for those with permission)




Optional but it can't hurt: log in as an admin and
Admin → Tiki Cache/Sys Admin → Clear all Tiki caches