-
Notifications
You must be signed in to change notification settings - Fork 2
Mount or create IBEX VHDs
The new architecture for deployment is to deploy onto VHDs which will be copied to the desired places and linked in; this was a result of discussions of making deployment quicker.
There needs to be a system VHD, this has been created by Chris and will be detailed CHRIS TODO. This contains windows and user level programs (probably including labview).
IBEX applications needs to be placed on a disk these should be generic for all instruments. In practice hot fixes will make them different, we record hotfixes and these are reapplied on upgrade of needed.
IBEX settings are placed on a setting VHD, these will be created once when the instrument is converted to use VHDs and after that this will be persisted through IBEX and Windows upgrades. On Upgrade the configuration will need to be upgrades and the common calibration files need to be updated.
These contain part of the system which change often. We are undecided what to do on upgrade:
- Either: Create the VHD when migrated and on upgrade truncate the database, move old log files and old autosave files. Then upgrade the database.
- Or: Every upgrade use a new common VHD copy across autosave files (maybe these should live in settings), dump the data schema for interesting tables and reimport it.
For the test system I have gone with the first approach because it was easy. I like the second approach better.
There are some things which are cross disks, e.g. the database is a service but is stored on the apps. Do these instructions live in an upgrade script? How do we unmount and mount the disks during upgrade? The upgrade process needs thinking about.
- Copy the three empty vhdx files (
empty_apps.vhdx,empty_var.vhdx,empty_settings.vhdx) to a local disk (from CompGroup\chris) and rename toapps.vhdx,var.vhdxandsettings.vhdx. - These are pre-configured to be 30GB each.
- Fill them following the steps below and then copy back to the same place appending the release version to each disk. e.g.
apps_5.1.2.vhdx.
- Open
cmdinO3mode diskmgmt.msc- Click Action -> Attach VHD
- I had to click help first
- Select location of VHD
- Close the VHD and copy back
- Right click on drive on left at the bottom
- Detach VHD
- Copy file back to the source
- Mount the VHD (see above)
- Open the mapped drive and copy the following:
- Copy EPICS
- Copy Client
- Copy EPICS UTILS
- Copy Python
- Copy Python3
- Copy ICP Binaries into EPICS
- Copy MySql
Either:
- Copy current settings to VHD
Or:
- Follow instructions to create config and common config from the developer's setup
Either:
- Copy current var to VHD
Or:
- Follow instructions to create a blank database and copy that to the disk
- Add other directories meant to be in var from the developer's setup e.g. log, autosave
To set up a computer to be able to run the automated VHD creation script:
- Hyper-V must be enabled on the computer which will be running the script. It can be turned on by searching for "turn windows features on or off" from the start menu and then selecting the entire Hyper-V tree. If hyper-v wasn't already turned on this will require a restart.
- Powershell must be upgraded to at least version 5 to support the commands we are using.
- Set up an environment variable called
MYSQL_PASSWORDcontaining the MySQL root user password. - In the admin documents area, create an (empty) folder at
C:\Users\Administrator\Documents\fake_release_dir\1.0.0 - The computer needs to have none of the following directories present (this is where it will mount the VHDs):
C:\Instrument\AppsC:\Instrument\Settings\configC:\Instrument\var
Because VHD mounting and dismounting requires admin rights, this is done by a scheduled task running as the admin user. The code run by these scheduled tasks is checked out to C:\Users\Administrator\Documents\ibex_utils\installation_and_upgrade, and the bat file which is run is vhd_scheduled_task.bat.
The scheduled tasks run every minute and look for a file which is created by the install script. If this file exists, the tasks will mount/dismount the vhds and then delete the file. Otherwise the tasks do nothing.