Applying hot fixes with the Patcher
Metric Insights 6.2.0 introduces the Patcher, a utility designed specifically for Container Orchestrated environments that require code changes (often referred to as hot fixes). Orchestrated Docker environments present unique challenges in terms of hot fixing that do not exist in more basic Virtual Machine or bare metal setups. While VM or bare metal environments allow direct filesystem changes that will persist if the machine is restarted, Docker images in orchestrated environments revert to the default state of the Docker image, pulling a fresh image from the Docker Registry—any code changes to the container are lost.
To solve this, we created a utility that will automatically check for required patches any time the container is started, move the files to the correct location, and proceed with normal operation. Any time the container is restarted, the same checks occur.
When a new Docker image is built for a future release (for example, 6.2.1), these hotfixes are baked into the Docker images and this process is no longer necessary until the next set of new patches need to be applied, which will later be baked into the next release (6.2.2)
The Patcher is included in all Metric Insights containers, with the exception of MySQL.
The Patcher can be used to apply patches to existing code, or add new files into a container/service. For the web service/container, the tool will check for new patches every 60 seconds and apply them automatically. Other services must be manually restarted.
This same method will work in Kubernetes, Azure AKS, OpenShift, Amazon ECS and Docker Swarm.
To apply patches, place the updated file (e.g.
script.js) or a .patch file (a bundle of changes) in the following location on a shared NFS mount connected to all containers:
/opt/mi/patch/<service name>/<container internal path>/<updated file>
The services available are:
(the mysql service is not supported)
For example, to update a
.jar file in the Data Processor, place the file here:
- Determine the internal path inside the container
- Create the same directory structure at this path:
3. Move the updated file or patch to this path.