How to migrate the vFunction Server to a new Linux VM for a Sudo Installation



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

  1. Download the newest Server version and move the package to the VF Server VM
  2. Unpack the Server version
### Replace VERSION with the actual Server version
sudo tar -Pxvf vfunction-server-installation.vVERSION.tgz
  1. Upgrade the server
sudo bash /opt/vfunction/server-installation/upgrade.sh

Backup the existing environment

If reusing the existing environment’s Volumes, skip these Backup steps and simply grab the existing server-installation.yaml for use in the new environment.

  1. Backup the Measurements Volume
sudo tar -cvzf /tmp/measurements.tgz /var/lib/docker/volumes/vfapi_measurements_storage_vol
  1. Gather the Database Backup
### Find the largest, most recent TGZ that is listed here
sudo ls -laS /var/lib/docker/volumes/mysql_vol/_data/backups/

### Replace TIMESTAMP and VERSION with the actual values
sudo cp /var/lib/docker/volumes/mysql_vol/_data/backups/dump-TIMESTAMP-VERSION.sql.tgz /tmp
  1. Create a Backup of the Installation directory
sudo 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
sudo 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
sudo tar -xvzf /tmp/backup.tgz -C /etc/sysconfig/vfunction/installation/
  1. Install the VF Server on the new VM
sudo bash /opt/vfunction/server-installation/install.sh

NOTE: Perform Steps 6-9 if you backed up the Measurements and Database Volumes rather than re-use the existing Volumes. If you re-used the existing Volumes, skip to Step 10.

  1. Move the old Server’s Measurements Volume to the new Server
sudo tar -xvzf /tmp/measurements.tgz -C /var/lib/docker/volumes/
  1. Change the permission of the unpacked Measurements Volume to match the required permissions
sudo 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
sudo 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
sudo 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
  1. Restart the new Server
sudo bash /opt/vfunction/server-installation/restart-server.sh