One missing feature of my OTRS docker containers was automating a major version upgrade without any manual configuration. It should be as easy to do as it is launching it. Minor versions upgrades are easy: just pull the new image and restart your containers.
For example, if you are running OTRS 6.0.1 and want to upgrade to the latest version (6.0.7 ATM):
sudo docker-compose -f docker-compose-prod.yml pull sudo docker-compose -f docker-compose-prod.yml stop sudo docker-compose -f docker-compose-prod.yml rm -f -v sudo docker-compose -f docker-compose-prod.yml up
That’s it. Minor version upgrades only involve security and bug fixes, so there are no database schema or module upgrades needed, the new image contains the latest OTRS software packages with the latest fixes. Major version upgrades need much more work done, as mentioned before, additional to updating the software components there are others components that need updating too:
- Database schema
- Cronjobs
- Configuration rebuild
- Cache delete
So I have added a new major version upgrade feature controlled by the environment variable OTRS_UPGRADE=yes. When this variable is set in the docker-compose file, the major version upgrade process will be started. Also modify your docker-compose file and make sure that the OTRS docker image has the latest tag (juanluisbaptiste/otrs:latest) on both the otrs and its data container.
Then like with the minor version upgrade, pull the new OTRS image and restart your containers:
sudo docker-compose -f docker-compose-prod.yml pull sudo docker-compose -f docker-compose-prod.yml stop sudo docker-compose -f docker-compose-prod.yml rm -f -v sudo docker-compose -f docker-compose-prod.yml up
The upgrade procedure will pause the OTRS container boot process for 10 seconds to give the user the chance to cancel the upgrade.
The first thing done by the upgrade process is to do a backup of the current version before starting. The backup will be stored on /backups (don’t forget to map that directory to one in your host so you can access it).
Then it will follow the official upgrade instructions:
- Run database upgrade scripts
- Upgrade cronjobs
- Upgrade modules
- Fix file permissions
- Rebuild OTRS configuration and delete cache.
The software components were updated when pulling the new mage. Also, there was no need to stop/start services as the upgrade occurs on container bootup, which means no services are started yet. Also remember to remove the OTRS_UPGRADE variable from the docker-compose file afterwards.
You could use this container to upgrade from non docker installations too, btw.
Note:
This feature was added to both OTRS 5 & 6 images, so upgrades from OTRS 4 can be preformed too.
WARNING: this feature is experimental and is still in heavy testing, use at your own risk !!
Thanks for your work an explanaiton. It help me for my work on docker images.
Glad it helped 🙂