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:

Apply a Patch

  1. Access a Container
  2. Access the Patch Directory
  3. Download the Patch File
  4. Wait 1 Minute for Patch to Be Applied
  5. View the Applied Patches
  6. Example of Applying a Patch for Simple Installation in Web Container
    1. Access Web Container
    2. Check the File that Will Be Patched
    3. Access the Patch Directory
    4. Download the Patch File
    5. Wait 1 Minute for Patch to Be Applied
    6. Check the Patched File
    7. View Patcher Logs

NOTE: For details on rolling back a patch, see Removing a Patch.

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).

Beginning v6.4.5 the Patcher is globally available as mi-patcher.

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: The downloaded patch file should not be unpacked.

4. Wait 1 Minute for Patch to Be Applied

Beginning in v6.4.5, any older patches will not be applied if a newer patch has already been applied. The patches are processed by their creation time.

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."

Beginning v6.4.5 the following parameters are available to check the applied patches and affected files:

  • mi-patcher show --applied - Displays the list of applied patches for the current component.
  • mi-patcher show --applied --details - Displays the list of applied patches for the current component with details on each patch.
  • mi-patcher show --all - Displays all patches, both applied and not applied.
  • mi-patcher show --dependency-tree, mi-patcher show --dependency-list - Displays a graphical representation of applied patches' hierarchy in form of a dependency tree or a list.
  • mi-patcher show --files - Displays files that were modified through the patches in the current component.
6. Example of Applying a Patch for Simple Installation in Web Container

6.1. Access Web Container

Execute mi-web.

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> ]