How to migrate the vFunction Server to a new Linux VM

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

  1. Log into the vFunction Portal at https://portal.vfunction.com/files/shares/installation-files/server/
  2. Download the newest Server version and move the package to the VF Server VM
  3. Unpack the newest version
### Replace VERSION with the actual Server version
tar -Pxvf vfunction-server-installation.VERSION.tgz
  1. Upgrade the server
bash /opt/vfunction/server-installation/upgrade.sh

Backup the existing environment

  1. Backup the Measurements Volume
tar -cvzf /tmp/measurements.tgz /var/lib/docker/volumes/vfapi_measurements_storage_vol
  1. 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
  1. Create a Backup of the Installation directory
tar -cvzf /tmp/backup.tgz /etc/sysconfig/vfunction/installation/backup

Set up the new Server VM

  1. Move the Installation TGZ to the VF Server VM
  2. Unpack the Installation TGZ
### Replace VERSION with the actual Server version
tar -Pxvf vfunction-server-installation.VERSION.tgz
  1. Move the backup.tgz from the old Server VM to the new Server VM
  2. Unpack the backup.tgz
cd /tmp && tar -xvzf backup.tgz -C /etc/sysconfig/vfunction/installation/
  1. Install the VF Server on the new VM
bash /opt/vfunction/server-installation/install.sh
  1. 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
  1. Re-install the new Server
bash /opt/vfunction/server-installation/install.sh

### When prompted, press 'y' to override the existing installation
  1. Move the old Server’s Measurements Volume to the new Server
cd /tmp && tar -xvzf measurements.tgz -C /var/lib/docker/volumes/
  1. 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/*
  1. 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/
  1. Change the permissions of the DB to match the required permissions
chown -R 999:999 /var/lib/docker/volumes/mysql_vol/_data/*
  1. 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
  1. Restart the new Server
bash /opt/vfunction/server-installation/restart-server.sh