Migrating from Symbiosis

From Sympl Wiki
Revision as of 08:36, 8 July 2019 by Kelduum (talk | contribs) (Created page with "This rough guide will take you through migrating from a server running Symbiosis, to a new server running Sympl. It requires a little downtime of any s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This rough guide will take you through migrating from a server running Symbiosis, to a new server running Sympl.

It requires a little downtime of any sites running on the old server, but you have the option do a dry-run and check things work before committing to the change.

Note that while it's not needed for the dry-run, you will need access to change your DNS records to make the change.

This guide has not been fully tested yet, so you should should ensure you do the dry run before the live run.

Preparation

On The Destination Server Running Sympl

Get the Sympl user's MySQL password, with cat /home/sympl/mysql-password

Make a directory for incoming databases mkdir /home/sympl/incoming-db

On The Source Server Running Symbiosis

Add the new server's sympl user MySQL details to current database.

sudo mysql --defaults-file=/etc/mysql/debian.cfg -e "CREATE USER 'sympl'@'localhost' IDENTIFIED BY 'password-from-new-server';"

sudo mysql --defaults-file=/etc/mysql/debian.cfg -e "GRANT ALL PRIVILEGES ON * . * TO 'sympl'@'localhost';"

Dry Run

On The Source Server Running Symbiosis

Dump the Databases

sudo /etc/symbiosis/backup.d/pre-backup.d/10-dump-mysql

Sync Sites And Databases To New Server

rsync -aviP /var/backups/mysql/* sympl@new-server.example.com:~/incoming-db

This will overwrite any domains on the new server with the same details.

rsync -aviP /srv/*.* sympl@new-server.example.com:/srv/

On The Destination Server Running Sympl

cd /home/sympl/incoming-db

If have any local databases, exclude: roundcube.sql.gz, information_schema.sql.gz, performance_schema.sql.gz

If you don't have any local databases, exclude: roundcube.sql.gz, information_schema.sql.gz, performance_schema.sql.gz

zcat filename.sql.gz | mysql

Once this is all complete, run sudo mysql-upgrade to ensure any database updates have happened.

Then run: sudo sympl-filesystem-security; sudo sympl-web-configure

Testing the sites

For each site, you'll probably want to test things, which you can do by editing your hosts file and then browsing to the sites manually.

Once you're happy everything is working, then you can do the live run.

Live Run

You will need to update the DNS for the relevant domains when making this change, so before starting this ensure you have access to change the DNS all the domains being moved.

On The Source Server Running Symbiosis

Stop the services to prevent anything changing while you're migrating things over.

You can skip this step if you're not moving all the sites at once, or aren't worried about changes not being copied over while DNS propagates.

touch /etc/symbiosis.d/monit/disable

sudo service apache2 stop

sudo service exim4 stop

sudo service dovecot stop

If you need to re-enable these services later, you can do so with rm /etc/symbiosis.d/monit/disable

Dump the Databases

sudo /etc/symbiosis/backup.d/pre-backup.d/10-dump-mysql

Sync Sites And Databases To New Server

rsync -aviP /var/backups/mysql/* sympl@new-server.example.com:~/incoming-db

This will overwrite any domains on the new server with the same details.

rsync -aviP /srv/*.* sympl@new-server.example.com:/srv/

On The Destination Server Running Sympl

cd /home/sympl/incoming-db

If have any local databases, exclude: mysql.sql.gz roundcube.sql.gz, information_schema.sql.gz, performance_schema.sql.gz

Note that you will need to create new database users manually. to replace the old ones.

If you don't have any local databases, exclude: roundcube.sql.gz, information_schema.sql.gz, performance_schema.sql.gz

For every file in the directory, do zcat filename.sql.gz | mysql

Once this is all complete, run sudo mysql-upgrade to ensure any database updates have happened.

Then run: sudo sympl-filesystem-security; sudo sympl-web-configure

Move the DNS to Point To The New Server

You should now make the DNS change if you haven't done so already, but in the mean time you can edit your hosts file to make sure everything looks right.