Introduction

With the introduction of the SimpleRisk 20230106-001 release it is now necessary to upgrade all SimpleRisk images to the latest version, this is due to the latest SimpleRisk relying on PHP 8 instead of PHP 7. This guide aims to take you through the process of shutting down the SimpleRisk docker, obtaining the latest docker image for SimpleRisk, and finally moving your persistent volumes from the old image to the new. When complete all data will be in place and the only additional actions required are to run the upgrade from the Register & Upgrade menu as you normally would. It can be noted in this example I am using docker for Windows and with this my CLI will be windows based. This should have no bearing or effect on any of the commands used in this process.


Instruction

Starting from a CLI which can interact with your docker instance follow the instructions below to complete the upgrade. 


  1. First we need to identify the name of the source we will be copying from so we run:
    Docker ps -a



  2. Next, assuming that your docker is currently running we will go ahead and create the volumes to receive copies of your currently in use volumes. This way you will retain a fully working backup copy:

    Docker volume create mysql

Docker volume create ssl

Docker volume create configurations

Docker volume create app

Docker volume create ssl

Docker volume create passwords





  1. Now we will go ahead and spin up a temporary instance of SimpleRisk 20221013 or a second container/image of your current image of SimpleRisk if you are unable to easily obtain new images:

    docker run -it  --volumes-from simplerisk --mount source=mysql,target=/target/mysql --mount source=log,target=/target/log --mount source=configurations, target=/target/configurations --mount source=app,target=/target/app --mount source=ssl,target=/target/ssl --mount source=passwords,target=/target/passwords simplerisk/simplerisk:20221013-001 sh




  1. At this point we should be at the CLI terminal of the newly spun up docker. As a general rule I suggest giving it a few moments to finish completely spinning up and mounting before you move on. This docker now has your previous instances volumes mounted to it and we will now copy their contents to the new volumes we made on step 2:


    cp -pr /var/lib/mysql/. /target/mysql/

cp -pr /var/log/. /target/log/

cp -pr /configurations/. /target/configurations/

cp -ar /var/www/simplerisk/. /target/app/

cp -ar /etc/apache2/ssl/. /target/ssl/

cp -ar /passwords/. /target/passwords/


Please note while the commands appear to execute instantly it does take a few moments in our testing for the copy to complete. A very easy way to tell if it has completed copying would be to run “df” periodically and when the amount of space left empty on the drive stops dropping you are safe to go ahead and close back out of the docker using:


exit



  1. Once that completes we need to stop and remove our temporary container that was used for the copy by running:


Docker ps -a


Look for the auto generated name of the temp docker.

    docker stop <tempdockername> && docker rm <tempdockername>

  1. We are now at the final step of data migration where will stand up the new docker image with php 8 and our previous version of simplerisk and its’ database:


docker run -d --name simplerisk0106 --mount source=mysql,target=/var/lib/mysql --mount source=log,target=/var/log --mount source=configurations ,target=/configurations --mount source=app,target=/var/www/simplerisk --mount source=ssl,target=/etc/apache2/ssl --mount source=passwords,target=/passwords -p 80:80 -p 443:443 simplerisk/simplerisk:latest



The newly started docker will now possess your old SimpleRisk Code, MySQL database, and all other persistent data associated with the docker but you will now be on PHP 8 and compatible with the next iterations of SimpleRisk.


Summary

This FAQ will have guided you through the process of migrating your SimpleRisk docker volumes to a newer image of the SimpleRisk docker. From this stage if upgrading the image as part of a SimpleRisk upgrade and are unsure how to upgrade the application through the GUI please see: SimpleRisk Upgrade Guide. If you have any further questions or have run into issues please contact us at support@simplerisk.com.