Migrating from Symbiosis: Difference between revisions

From Sympl Wiki
Jump to navigation Jump to search
No edit summary
Tag: visualeditor
Tag: visualeditor
 
(7 intermediate revisions by 4 users not shown)
Line 3: Line 3:
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.
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.<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 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>sudo 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>
Line 18: Line 20:


<code>sudo mysql --defaults-file=/etc/mysql/debian.cnf -e "GRANT ALL PRIVILEGES ON * . * TO 'sympl'@'localhost';"</code>
<code>sudo mysql --defaults-file=/etc/mysql/debian.cnf -e "GRANT ALL PRIVILEGES ON * . * TO 'sympl'@'localhost';"</code>
===='''TIPS'''====
If on your source server you are running CMS packages such as Joomla or Wordpress etc, it may be a good idea to clear their cache. In many cases the cache can double the file size of the site so clearing this cache can reduce not only processing time but the amount of data that needs to be copied to the new location.


==Dry Run==
==Dry Run==
Line 26: Line 31:
<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 Databases and Sites 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 40: Line 45:
If you don't 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


<code>zcat '''''filename'''''.sql.gz | mysql</code>
<code>zcat '''''filename'''''.sql.gz | mysql -u 'sympl' -p your_database</code>


Once this is all complete, run <code>sudo mysql-upgrade</code> to ensure any database updates have happened.
Once this is all complete, run <code>sudo mysql_upgrade</code> to ensure any database updates have happened.


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 [https://wiki.sympl.host/view/Edit_Your_Hosts_File 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.
Line 59: Line 64:
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.
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.


<code>touch /etc/symbiosis.d/monit/disable</code>
<code>touch /etc/symbiosis/monit.d/disable</code>


<code>sudo service apache2 stop</code>
<code>sudo service apache2 stop</code>
Line 67: Line 72:
<code>sudo service dovecot stop</code>
<code>sudo service dovecot stop</code>


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/monit.d/disable</code>


=====Dump the Databases=====
=====Dump the Databases=====
Line 82: Line 87:
<code>cd /home/sympl/incoming-db</code>
<code>cd /home/sympl/incoming-db</code>


If have any local databases, exclude: mysql.sql.gz roundcube.sql.gz, information_schema.sql.gz, performance_schema.sql.gz
If you have any local databases already, 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.
Note that you will need to [[Create database and user|create new databases and 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
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 <code>zcat '''''filename'''''.sql.gz | mysql</code>
For every file in the directory, do <code>zcat '''''filename'''''.sql.gz | mysql -u 'sympl' -p your_database</code>


Once this is all complete, run <code>sudo mysql_upgrade</code> to ensure any database updates have happened.
Once this is all complete, run <code>sudo mysql_upgrade</code> to ensure any database updates have happened.
Line 97: Line 102:
You should now make the DNS change if you haven't done so already, but in the meantime 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 meantime you can edit your hosts file to make sure everything looks right.


=== Updating phpMyAdmin and Roundcube databases ===
===Updating phpMyAdmin and Roundcube databases===
If you're using phpMyAdmin, then the password from the old server will have overwritten the local password. You can fix this with:
If you're using phpMyAdmin, then the password from the old server will have overwritten the local password. You can fix this with:
<code>mysql -e "SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD('$( grep '^$dbpass' /etc/phpmyadmin/config-db.php | sed -e 's|^\$dbpass=.||' -e 's|.;$||' )');"</code>
<code>mysql -e "SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD('$( grep '^$dbpass' /etc/phpmyadmin/config-db.php | sed -e 's|^\$dbpass=.||' -e 's|.;$||' )');"</code>

Latest revision as of 11:34, 17 October 2021

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 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 sudo 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.cnf -e "CREATE USER 'sympl'@'localhost' IDENTIFIED BY 'password-from-new-server';"

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

TIPS

If on your source server you are running CMS packages such as Joomla or Wordpress etc, it may be a good idea to clear their cache. In many cases the cache can double the file size of the site so clearing this cache can reduce not only processing time but the amount of data that needs to be copied to the new location.

Dry Run

On The Source Server Running Symbiosis

Dump the Databases

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

Sync Databases and Sites 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 -u 'sympl' -p your_database

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/monit.d/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/monit.d/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 you have any local databases already, exclude: mysql.sql.gz roundcube.sql.gz, information_schema.sql.gz, performance_schema.sql.gz

Note that you will need to create new databases and 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 -u 'sympl' -p your_database

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 meantime you can edit your hosts file to make sure everything looks right.

Updating phpMyAdmin and Roundcube databases

If you're using phpMyAdmin, then the password from the old server will have overwritten the local password. You can fix this with: mysql -e "SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD('$( grep '^$dbpass' /etc/phpmyadmin/config-db.php | sed -e 's|^\$dbpass=.||' -e 's|.;$||' )');"

Similarly, the password for RoundCube webmail will have been overwritten. This can be fixed with:

mysql -e "SET PASSWORD FOR 'roundcube'@'localhost' = PASSWORD('$( grep '^$dbpass' /etc/roundcube/debian-db.php | sed -e 's|^\$dbpass=.||' -e 's|.;$||' )');"