Users can apply either binary patches or source patches to Apache Stratos to enhance the available features or to fix any security issues that may arise. Applying pre-built binary patches, which are provided by the Apache Stratos Development Committee during the release cycles, is an easy approach to use where, existing executable JAR files need to be changed on the server. Furthermore, if you are a developer, who has done modifications to the source code of Apache Stratos, you can either bundle your changes in a source patch and send a pull request, or apply it to the system as a binary patch using the following patch application process:

For more information on the location where you can find patches that are available for a specific Apache Stratos environment, see Patches Provided for Apache Stratos.

Build a binary patch

Follow the instructions below to build a binary patch:

  1. Set up a development environment as described in the page Building from Source.
  2. Checkout the source code tag relating to the specific version of Stratos you are running, e.g. git checkout 4.0.0
  3. Apply the code changes in the .patch file to the Apache Stratos code base, e.g. git apply 00001-fix-for-something.patch
  4. Create JAR file(s) out of it, by building the code, e.g. mvn clean install
  5. Extract the JAR file(s), which you created in the previous step.

Apply a binary patch

Follow the instructions below to add a patch to Apache Stratos

  1. Create a folder with the name of the patch (for example: patch0001) and place the JAR file(s), which were created in the previous step inside it.

    Since the patches will be applied automatically in a sequential manner, if changes are added to the same JAR file by two patches, then the changes in the patch with the highest digit value will be applied. For example, if changes in patch0001 and patch0005 is applicable on the same JAR file, then changes of patch0005 will be applied on top of the changes in patch0001.

  2. Copy the newly created patch folder (for example: patch0001) to <STRATOS_HOME>/repository/components/patches/ directory.
  3. Startup Apache Stratos server to apply the patch.

    When the server is started up, it will automatically detect and apply if there are any new patches. This can be verified from the <STRATOS_HOME>/repository/logs/patches.log file.

Removing a binary patch

If you want to remove the patch0001 from the server, just remove the folder patch0001 from <STRATOS_HOME>/repository/components/patches/ folder and start the server. This will automatically revert to previous state based on last patch. 

  • No labels