Migrating from Symbiosis: Difference between revisions

From Sympl Wiki
Jump to navigation Jump to search
(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...")
 
No edit summary
Line 5: Line 5:
Note that while it's not needed for the dry-run, you will need access to change your DNS records to make the change.<blockquote>This guide has not been fully tested yet, so you should should ensure you do the dry run ''before'' the live run.</blockquote>
Note that while it's not needed for the dry-run, you will need access to change your DNS records to make the change.<blockquote>This guide has not been fully tested yet, so you should should ensure you do the dry run ''before'' the live run.</blockquote>


== Preparation ==
==Preparation==


=== On The Destination Server Running Sympl ===
===On The Destination Server Running Sympl===
Get the Sympl user's MySQL password, with <code>cat /home/sympl/mysql-password</code>
Get the Sympl user's MySQL password, with <code>cat /home/sympl/mysql-password</code>


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


=== On The Source Server Running Symbiosis ===
===On The Source Server Running Symbiosis===
Add the new server's <code>sympl</code> user MySQL details to current database.
Add the new server's <code>sympl</code> user MySQL details to current database.


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


== Dry Run ==
==Dry Run==


=== On The Source Server Running Symbiosis ===
===On The Source Server Running Symbiosis===


===== Dump the Databases =====
=====Dump the Databases=====
<code>sudo /etc/symbiosis/backup.d/pre-backup.d/10-dump-mysql</code>
<code>sudo /etc/symbiosis/backup.d/pre-backup.d/10-dump-mysql</code>


===== Sync Sites And Databases To New Server =====
=====Sync Sites And Databases To New Server=====
<code>rsync -aviP /var/backups/mysql/* sympl@'''''new-server.example.com''''':~/incoming-db</code>
<code>rsync -aviP /var/backups/mysql/* sympl@'''''new-server.example.com''''':~/incoming-db</code>


Line 33: Line 33:
<code>rsync -aviP /srv/*.* sympl@'''''new-server.example.com''''':/srv/</code>
<code>rsync -aviP /srv/*.* sympl@'''''new-server.example.com''''':/srv/</code>


=== '''On The Destination Server Running Sympl''' ===
===On The Destination Server Running Sympl===
<code>cd /home/sympl/incoming-db</code>
<code>cd /home/sympl/incoming-db</code>


Line 46: Line 46:
Then run: <code>sudo sympl-filesystem-security; sudo sympl-web-configure</code>
Then run: <code>sudo sympl-filesystem-security; sudo sympl-web-configure</code>


=== Testing the sites ===
===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.
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.
Once you're happy everything is working, then you can do the live run.


== 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.
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 ===
===On The Source Server Running Symbiosis===
Stop the services to prevent anything changing while you're migrating things over.
Stop the services to prevent anything changing while you're migrating things over.


Line 69: Line 69:
If you need to re-enable these services later, you can do so with <code>rm /etc/symbiosis.d/monit/disable</code>
If you need to re-enable these services later, you can do so with <code>rm /etc/symbiosis.d/monit/disable</code>


===== Dump the Databases =====
=====Dump the Databases=====
<code>sudo /etc/symbiosis/backup.d/pre-backup.d/10-dump-mysql</code>
<code>sudo /etc/symbiosis/backup.d/pre-backup.d/10-dump-mysql</code>


===== Sync Sites And Databases To New Server =====
=====Sync Sites And Databases To New Server=====
<code>rsync -aviP /var/backups/mysql/* sympl@'''''new-server.example.com''''':~/incoming-db</code>
<code>rsync -aviP /var/backups/mysql/* sympl@'''''new-server.example.com''''':~/incoming-db</code>


Line 79: Line 79:
<code>rsync -aviP /srv/*.* sympl@'''''new-server.example.com''''':/srv/</code>
<code>rsync -aviP /srv/*.* sympl@'''''new-server.example.com''''':/srv/</code>


=== '''On The Destination Server Running Sympl''' ===
==='''On The Destination Server Running Sympl'''===
<code>cd /home/sympl/incoming-db</code>
<code>cd /home/sympl/incoming-db</code>


Line 94: Line 94:
Then run: <code>sudo sympl-filesystem-security; sudo sympl-web-configure</code>
Then run: <code>sudo sympl-filesystem-security; sudo sympl-web-configure</code>


=== Move the DNS to Point To The New Server ===
===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.
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.
<br />
<br />
[[Category:How To]]
[[Category:How To]]
[[Category:Upgrading]]
[[Category:Upgrading]]

Revision as of 09:36, 8 July 2019

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.