Applying Hot Fixes with the Patcher

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

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:

Prior to v6.3.2

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
v6.3.2+

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. Example of Applying a Patch for Simple Installation in Web Container

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.

  1. Access the file's directory: cd /opt/mi/iv/data/bin/
  2. List file in a long format: ls -l datadeps_check.sh
  3. 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:

  1. Access the file's directory: cd /opt/mi/iv/data/bin/
  2. Display file info in a long format: ls -l datadeps_check.sh
  3. 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

  1. Access patcher log directory: cd /opt/mi/log/
  2. View the patcher.log file: cat patcher.log
  3. 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

  1. Access web master pod
  2. cd patch/
  3. rm <patch.file.name>
  4. exit the web master pod
  5. Run a get pods command
    • OpenShift: oc get pods
    • Kubernetes: kubectl get pods
  6. Delete web master and web 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> 
  7. New web master and web slave pods are automatically recreated and the patch is successfully removed

Docker Swarm or Amazon ECS

  1. Access web master container
  2. cd patch/
  3. rm <patch.file.name>
  4. exit the web master container
  5. Run docker ps command to list the running containers
  6. Delete the web master and web slave containers: docker rm <web master container id>, docker rm <web slave container id>
  7. New web master and web slave pods are automatically recreated and the patch is successfully removed

Simple Install

  1. SSH to the MI app server
  2. Access web container with the command mi-console
  3. cd patch/
  4. rm <patch.file.name>
  5. exit the web container
  6. Turn off the web container: mi-control stop web
  7. Remove the web container with stop option: mi-control rm --stop web
  8. Create a new container: mi-control up -d web
  9. New web container is launched and the patch is successfully removed