How to migrate the vFunction Server to a new Linux VM
Overview
The steps below are written for a vFunction Server installed as a root / sudo user running on a VM via Docker. Adjust the steps accordingly.
Upgrade the Existing Server to the newest version
- Download the newest Server version and move the package to the VF Server VM
- Unpack the Server version
### Replace VERSION with the actual Server version
tar -Pxvf vfunction-server-installation.vVERSION.tgz
- Upgrade the server
bash /opt/vfunction/server-installation/upgrade.sh
Backup the existing environment
- Backup the Measurements Volume
tar -cvzf /tmp/measurements.tgz /var/lib/docker/volumes/vfapi_measurements_storage_vol
- Gather the Database Backup
cd /var/lib/docker/volumes/mysql_vol/_data/backups/
### Find the largest, most recent TGZ that is listed here
ls -laS *.tgz
### Replace TIMESTAMP and VERSION with the actual values
cp dump-TIMESTAMP-VERSION.sql.tgz /tmp
- Create a Backup of the Installation directory
tar -cvzf /tmp/backup.tgz /etc/sysconfig/vfunction/installation/backup
Set up the new Server VM
- Move the Installation TGZ to the VF Server VM
- Unpack the Installation TGZ
### Replace VERSION with the actual Server version
tar -Pxvf vfunction-server-installation.VERSION.tgz
- Move the backup.tgz from the old Server VM to the new Server VM
- Unpack the backup.tgz
cd /tmp && tar -xvzf backup.tgz -C /etc/sysconfig/vfunction/installation/
- Install the VF Server on the new VM
bash /opt/vfunction/server-installation/install.sh
- Change the UUIDs on the new Server VM to match those from the old Server VM
### Find-and-replace the CLIENT_ID, CLIENT SECRET
vi /etc/sysconfig/vfunction/nginx/automated-custom-env.list
### Find-and-replace the CLIENT_ID, CLIENT_SECRET, APP_CLIENT_ID, APP_CLIENT_SECRET
vi /etc/sysconfig/vfunction/mysql/automated-custom-env.list
### Find-and-replace the CLIENT_ID, CLIENT SECRET
vi /etc/sysconfig/vfunction/vfapi/automated-custom-env.list
- Re-install the new Server
bash /opt/vfunction/server-installation/install.sh
### When prompted, press 'y' to override the existing installation
- Move the old Server’s Measurements Volume to the new Server
cd /tmp && tar -xvzf measurements.tgz -C /var/lib/docker/volumes/
- Change the permission of the unpacked Measurements Volume to match the required permissions
chown -R 1500:1500 /var/lib/docker/volumes/vfapi_measurements_storage_vol/_data/*
- Move the old Server’s DB to the new Server
### Replace TIMESTAMP and VERSION with the actual values
cp /tmp/dump-TIMESTAMP-VERSION.sql.tgz /var/lib/docker/volumes/mysql_vol/_data/backups/
- Change the permissions of the DB to match the required permissions
chown -R 999:999 /var/lib/docker/volumes/mysql_vol/_data/*
- Restore the DB from the Dump taken on the old Server
docker exec -it vfunction-mysql bash
backup.sh restore dump-TIMESTAMP-VERSION.sql.tgz
exit
- Restart the new Server
bash /opt/vfunction/server-installation/restart-server.sh