This installation assumes emergence is up and running on your new server.
1. Rsync files to new server’s sites directory
Dry run
rsync -anv username@example.com:/emergence/sites/SITENAME /emergence/sites/
Live
sudo rsync -av username@example.com:/emergence/sites/SITENAME /emergence/sites/
2. Rsync sql files to new server
In this example I took a copy of one of the sql backups generated by the emergence-backup script. If you use rsyn you can pull the files to a temporary directory.
Dry run
rsync -anv username@example.com:/emergence/sql-backups/SITENAME/SITENAME.2015-08-25-00.sql.bz2 /home/username/
Live
sudo rsync -av username@example.com:/emergence/sql-backups/SITENAME/SITENAME.2015-08-25-00.sql.bz2 /home/username/
Next decompress the files to convert to a normal .sql file.
bzip2 -d /home/username/SITENAME.2015-08-25-00.sql.bz2
The file should now be a .sql file not .sql.bz2.
3. Create new mysql databases
Before you can import the databases you need to create them in mysql. First login to mysql using the following command:
mysql -u root -p -S /emergence/services/run/mysqld/mysqld.sock
mysql> create database SITENAME;
mysql> quit
4. Import database into mysql table
mysql -u root -p -S /emergence/services/run/mysqld/mysqld.sock SITENAME < /home/username/SITENAME.2015-08-25-00.sql
5. Creating matching mysql users
Now we need to create mysql users that match the site’s site.config file. To do so log into mysql and run the following command getting the SITENAME and PASSWORD from /emergence/sites/MYSITE/site.config
mysql>CREATE USER 'SITENAME'@'localhost' IDENTIFIED BY PASSWORD('PASSWORD');
Then grant the user access to the respective database.
mysql>GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, LOCK TABLES ON SITENAME.* TO 'SITENAME'@'localhost';
6. Update emergence hosts
Now you need to update the hostnames that correlate with the site you’re working on to be your current host name.
sudo vim /emergence/sites/SITENAME/site.json
7. Restart emergence kernel
Run the following to restart the kernel.
restart emergence-kernel
8. You’re good to go!
Fire up example.com:9083 to verify your new configs and you should be good to go. It the site doesn’t load start/stop web and then mysql from 9083 and you should be good.