Applying Hot Fixes with the Patcher
This article describes how to apply new patches and view the applied patches using the Patcher. An example of applying a patch for MI Simple Installation in the web container is provided at the end of the article.
The Patcher is a utility that automatically checks for required patches any time the container is started, moves the files to the correct location, and proceeds with normal operation. Any time the container is restarted, the same checks occur.
Table of contents:
The hot fixes are baked into the Docker images of future releases (for example, 6.2.5) and this process is no longer necessary until the next set of new patches needs to be applied, which will later be baked into the next release (6.2.6).
Apply a Patch
The procedure of applying patches is the same for Simple Installations and Orchestrated Environments.
1. Access a Container
Access the web
container:
- Simple Installation and Docker Swarm:
docker exec -it <container name> bash
- Kubernetes (access the
web master
container):kubectl exec -n <namespace> -it <pod> -- bash
- OpenShift:
- Single-container pod:
oc exec -it <pod> bash
- Multi-container pod:
oc exec -it <pod> -с <container> bash
- Single-container pod:
2. Access the Patch Directory
Beginning v6.2.5a, the Patcher has been removed from the seed
node.
Access a directory depending on version of your MI application:
Access a service directory: cd /opt/mi/patch/<service>
Available services:
For MI versions prior to 6.2.5a:
- web
- seed
- dataprocessor
- monitoring
- data-analyzer
For MI v6.2.5a+:
- web
- dataprocessor
- monitoring
- data-analyzer
Beginning in v6.3.2, patch subdirectories have been removed. Access the /opt/mi/patch
directory inside any container:
cd /opt/mi/patch
3. Download the Patch File
From the directory opened in the previous step, execute:
-
Prior to 6.4.2
wget <patch URL>
-
v6.4.2+
curl --output /opt/mi/patch/<file_name> <patch URL>
Note that the downloaded patch file should not be unpacked.
4. Wait 1 Minute for Patch to Be Applied
5. View the Applied Patches
Check the Log File
cat /opt/mi/log/patcher.log
The list of the applied patches is displayed in the following format:
[ <Datetime of applying> ] Patcher [ <Log level> ] [ <Hostname> ] [ <Component> ] [ <MI Version> ] [ <Patch id>] [ <JIRA Task> ] [ <Description> ]
Example of the Patcher's log: 2021-01-13 15:18:01 [Patcher] [INFO] web web 101.1.1119.staging_6 202101130e01 OPS-1737 "The patch was applied successfully. Description: MI Patch test."
6.1. Access Web Container
Execute mi-console
.
6.2. Check the File that Will Be Patched
The hot fix will patch the file datadeps_check.sh
located in the /opt/mi/iv/data/bin/
directory.
- Access the file's directory:
cd /opt/mi/iv/data/bin/
- List file in a long format:
ls -l datadeps_check.sh
- Note the date and time when the initial file was changed (Feb 25 15:25)
6.3. Access the Patch Directory
Execute cd /opt/mi/patch/web/
.
6.4. Download the Patch File
From the /patch/web/
directory, execute:
-
Prior to 6.4.2
wget <patch URL>
-
v6.4.2+
curl --output /opt/mi/patch/<file_name> <patch URL>
6.5. Wait 1 Minute for Patch to Be Applied
6.6. Check the Patched File
We can check whether the file has been changed by viewing the date of its' last change:
- Access the file's directory:
cd /opt/mi/iv/data/bin/
- Display file info in a long format:
ls -l datadeps_check.sh
- Note that the date and time have changed (from Feb 25 15:25 to Mar 11 11:50), which means that the file has been successfully patched
6.7. View Patcher Logs
- Access patcher log directory:
cd /opt/mi/log/
- View the patcher.log file:
cat patcher.log
- The list of the applied patches is displayed in the following format:
[ <Datetime of applying> ] Patcher [ <Log level> ] [ <Hostname> ] [ <Component> ] [ <MI Version> ] [ <Patch id>] [ <JIRA Task> ] [ <Description> ]
Roll Back a Patch
NOTE: This section describes the algorithm of rolling back a patch inside the web
container. To roll back a patch which is located inside the other container, execute the same commands simply replacing web
(for Simple Install) or web master
, web slave
(for Orchestrated Environments) with the name of container where the patch is located.
Kubernetes and OpenShift
- Access
web master
pod cd patch/
rm <patch.file.name>
-
exit
theweb master
pod - Run a get pods command
- OpenShift:
oc get pods
- Kubernetes:
kubectl get pods
- OpenShift:
- Delete
web master
andweb slave
pods:- OpenShift:
oc delete pod <web master pod ID>
,oc delete pod <web slave pod ID>
- Kubernetes:
kubectl delete pod <web master pod ID>
,kubectl delete pod <web slave pod ID>
- OpenShift:
- New
web master
andweb slave
pods are automatically recreated and the patch is successfully removed
Docker Swarm or Amazon ECS
- Access
web master
container cd patch/
rm <patch.file.name>
-
exit
theweb master
container - Run
docker ps
command to list the running containers - Delete the
web master
andweb slave
containers:docker rm <web master container id>
,docker rm <web slave container id>
- New
web master
andweb slave
pods are automatically recreated and the patch is successfully removed
Simple Install
- SSH to the MI app server
- Access
web
container with the commandmi-console
cd patch/
rm <patch.file.name>
-
exit
theweb
container - Turn off the
web
container:mi-control stop web
- Remove the
web
container with stop option:mi-control rm --stop web
- Create a new container:
mi-control up -d web
- New
web
container is launched and the patch is successfully removed