I today shifted our modbus (db files for EPICS channels, ioc command files and docker-compose file to run the services) over to this git repo.
Through this, we would have version control now so that we can revert back to a working stage if something causes an error in the hosting of the channels. All db files are updated every 5 minutes by dbFilesUpdate.py in ctn_scripts. So we should try to commit the changes manually once in a while to the repo. This is there so that locally the files track changes in the settings and parameter values but we also have version controlled history in git for long reverts.
On another note, it is important to start the docker processes in a particular order. To ease with this, I have added a restartAll command in the .bashrc of ioc3server which looks like this:
#Restarts all teh EPICS channels and python scripts in the correct manner.
restartAll() {
cd /home/controls/Git/cit_ctnlab/ctn_scripts
sudo docker-compose start dbFilesUpdateOneTime
echo 'Updating db files before restarting...'
while true; do
sleep 1
if [ -z `sudo docker ps -q --no-trunc | sudo grep $(sudo docker-compose ps -q dbFilesUpdateOneTime)` ]; then
break
fi
done
echo 'dB files updated. Shutting down python scripts...'
sudo docker-compose down
cd /home/controls/Git/cit_ctnlab/modbus
echo 'Now restarting the EPICS channels...'
sudo docker-compose down
sudo docker-compose up -d
cd /home/controls/Git/cit_ctnlab/ctn_scripts
echo 'Checking if the python scripts are down...'
sudo docker-compose down --remove-orphans
echo 'Starting python scripts...'
sudo docker-compose up -d
echo 'Done!'
}
So every time a new channel is added. After doing git pull, one should use this command or the commands listed above in order to make sure the channels and python scripts boot up in the right fashion.
Edit Mon May 13 12:17:23 2019: Updated restartAll() function to do a last time db files update before restarting. |