webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Running the webMethods cutom assets using WPM client on containerised MSR 

Mon January 06, 2025 02:12 AM

Introduction: This article will help to setup the wpm on our local windows machine. Upon successful setup we will be able to pull the assets from git hub and package registry.

Problem Statement: 

  • We have developed a lot of custom packages and want to reuse them in our hybrid environment.
  • webMethods provides a lot of custom packages on our repo which can be used by customer to speed up their development phase.

To achieve both the use cases we can install wpm. on installing the wpm we can pull the assets from GitHub and package registry to our service designer using the wpm.

Once we setup the wpm on our local windows. we will create the custom image so that same can be executed as containers.

End goal: Create the custom docker image based on Microservice runtime. This custom docker image can be used to pull the assets what we have configured on our docker compose file.

Pre-requisite:

  1. GitHub account
  2. Access to https://packages.webmethods.io/, Need empower account for this
  3. Access to https://containers.softwareag.com
  4. Service designer installation
  5. admin rights to run wpm
  6. docker setup on laptop. In our case we have setup the rancher desktop on our laptop.

Use case Explanation

  1. From the below diagram we can see we have different components
  2. GitHub where we have checked in our custom packages
  3. packages registry where we have custom packages provided by webMethods like WmJDBC, WmSAP.
  4. webMethods container registry https://containers.softwareag.com from where we can pull the base image for MSR.
  5. In our use case we will build and the image using rancher desktop.

We will create a custom image using MSR. this custom image will have wpm installed. Using this wpm we can pull the assets from package registry and GitHub account.

https://global.discourse-cdn.com/techcommunity/optimized/3X/5/e/5e68e7d77be6d3d807bd8824d17cbe1fd4f69470_2_690x412.png

Download and start the service designer

  • If you do not have service designer 11.0 available, please download from the link Service Designer
  • Extract the setup and start the service designer.
  • Steps to start the Integration server
    •  Navigate to installation directory <Installation directory>\IntegrationServer\bin. In my case installation directory is   "C:\ServiceDesigner\wMServiceDesigner\IntegrationServer\bin"
    • Execute the setenv.bat file
    • Post executing the set env, Run the startup.bat file. This will take hardly a minute to get the server up and running.

 

  •   By default the integration server is runs on 5555 port .
  •   Now when you open the service designer you can see the default list of packages.

Generate the token from package.webMethods.io registry

  • Once you login navigate to setting from user icon from top right
  • Generate the access token. In my case i have named it as package token and provide the expiry for same
  • Save this token , as this token will be used in future for pulling the package from this repo.

Generate the token from github registry

  • Login to your GitHub account.
  • Under user icon on top right  navigate to the settings.
  • click on settings.
  • Now go to the developer settings  in the last.
  • click on personal access tokens and select token classic.
  • Generate new token provide the name and expiry for name.
  • The same token will be used in future to pull the assets from this GitHub account

Setup the wpm on windows machine

  • Download the zip file of wpm
  • Extract the wpm package preferably with in the service designer folder.

Set the environment variable

  • In my case my service designer is running on (C:\ServiceDesigner\wMServiceDesigner) path therefore i have set JAVA_HOME=C:\ServiceDesigner\wMServiceDesigner\jvm\jvm in setrnv.bat file

Below is the snippet for setenv.bat available inside wpm\bin folder location (C:\ServiceDesigner\wMServiceDesigner\wpm\bin)

:setEnv
set JAVA_HOME=C:\ServiceDesigner11\wMServiceDesigner\jvm\jvm
set WPM_CLIENT_HOME=%~dp0..

:setStartHeap
if not "%DCI_START_HEAP%" == "" goto setMaxHeap
set DCI_START_HEAP=10

:setMaxHeap
if not "%DCI_MAX_HEAP%" == "" goto setJavaOpts
set DCI_MAX_HEAP=512

:setJavaOpts
set JAVA_OPTS=%JAVA_OPTS% -Dlog.dir="%WPM_CLIENT_HOME%\logs"
set JAVA_OPTS=%JAVA_OPTS% -DtermOutOn=true
set JAVA_OPTS=%JAVA_OPTS% -DspoolOn=true

rem ==================To enable debug, change this property to 'DEBUG'==========
    set JAVA_OPTS=%JAVA_OPTS% -DlogLevel=TRACE
rem ============================================================================

set JAVA_OPTS=%JAVA_OPTS% -Xms%DCI_START_HEAP%m
set JAVA_OPTS=%JAVA_OPTS% -Xmx%DCI_MAX_HEAP%m
set JAVA_OPTS=%JAVA_OPTS% -Xss256k

  • Save the setenv.bat file and execute the .bat file.

Edit wpm.yml FILE

  • Edit the wpm.yml file
  • target_installation: either provide the relative path or full path. In our case for now I am providing the full path
    • relative default path: /opt/softwareag/IntegrationServer
    • full path:  C:/ServiceDesigner/wMServiceDesigner/IntegrationServer
  • under the repositories section:
    • for repo default section
    • for repo other section
      • type: git
      • location: https://github.com/<github userID>
      • password: <generated from https://github.com> 
  • Now we are ready with the setup. With this setup we can pull the assets from github and https://package .webmethods.io registry to our service designer running on windows laptop.

Test and Verify

  • Using command line prompt navigate to the bin folder of wpm.
  • In my case path is  C:\ServiceDesigner\wMServiceDesigner\wpm\bin
  • Run the below command 
    • wpm install-wr softwareag  WmJDBCAdapter  
    • The above command will pull the package from package regsitry and will install it on local service designer
  • In similar fashion we can run the command to pull the assets from github repo
    • wpm install -u <username> -p <github classic token>-r <https://github.com/<userId>> packageName
    • The above command will pull the package from github and will install it on local service designer

Create Docker Image

  • We will create 2 docker images in this use case
    • First docker image will be the base MSR image where we will install the wpm package
    • In the second docker image we will use the above image as base image will install the custom package  on the new image
  • We will create the docker image using the docker file.

Docker Image with wpm Installation

  • Create the docker file where the wpm folder is present 
  • Add the below content in the docker file.

                   

                  FROM sagcr.azurecr.io/webmethods-microservicesruntime:10.15

                  ADD --chown=sagadmin:sagadmin wpm /opt/softwareag/wpm
                  ENV PATH=/opt/softwareag/wpm/bin:$PATH

  • Save it.
  • Build the docker image
    • On the command prompt navigate to the folder where docker file is present.
      • Run the command docker build -t webmethods-microservicesruntime-wpm:10.15 .
      • Once the image is created, we can see the image details by running the command: "docker images"
      • Refer the screenshot for same.

Note: Make sure you have correct relative path configured inside the wpm.yml file. while doing testing on local if you have changed the target installation path then before the building the image update the path to the below value

 target_installation: /opt/softwareag/IntegrationServer

  • Now if we want to validate if the image created is correct or not. Run the container and execute the wpm command inside the container.
  • Command to run the docker image
    • docker run -d -p 7272:5555  webmethods-microservicesruntime-wpm.10.15 
  • command to get the container ID
    • docker ps
    • Above command will provide the list of all containers with their container ID running on docker.
  • command to stop and remove the container
    • docker stop <containerID>
    • docker rm <containerID>

Create image to install custom packages using wpm client

  • As we have already created custom image with wpm setup.  Now we will create image where we will the custom image created above as base image.
  • We will install the custom packages while creating the image

        Note: You can create this docker file anywhere on your laptop because while creating this docker image it is not referring our any local packages.

  • Create the docker file and paste the below content

                      

FROM webmethods-microservicesruntime-wpm:10.15

WORKDIR /opt/softwareag/wpm

RUN /opt/softwareag/wpm/bin/wpm.sh install -ws https://packages.webmethods.io -wr public -j <jwt token generated above from packages.wbmethods.io> packageName
RUN /opt/softwareag/wpm/bin/wpm.sh install -u <github username>-p <github cloassic token>-r https://github.com/<git hub userID> packageName 

WORKDIR /

  • Note:
    • In our case I am pulling ShipmentPackage from github and WxCloudReadinessAnalyzer from package registry
    • If there is requirement to pull the multiple packages from github we can pass the multiple package name on the same command 
      • for example  RUN /opt/softwareag/wpm/bin/wpm.sh install -u <github username>-p <github cloassic token>-r https://github.com/<git hub userID>  ShipmentPackage PackageName2 PackageName3

Points to Remember:  Even though we are building this image on our windows laptop, still we are using wpm.sh install command instead of wpm.bat command. This is because these commands are executed while creation of image and the command are executed on linux setup.

  • Build the image using the command docker build -t webmethods-microservicesruntimecustom .

  • Run the docker image command
    • docker run -d -p 7272:5555  webmethods-microservicesruntimecustom
    • Once the image is running you can browse the on the https://localhost:7272.
    • Provide the username as Administrator and Password as manage
    • You should be able to see the custom packages under the packages tab.

Validation:

  • Navigate inside the container 
    • docker exec -it <continerID> sh
  •  cd /opt/softwareag/IntegrationServer/packages
  • ls
  • In the above screenshot you should see the custom packages which have been pulled from the different sources. In our case we have pulled ShipmentPackage from github and WxCloudReadinessAnalyzer from package registry. 

Statistics
0 Favorited
26 Views
1 Files
0 Shares
2 Downloads
Attachment(s)
zip file
WPM zip file used in the abive article for demonstration   29.67 MB   1 version
Uploaded - Mon January 06, 2025
WPM is client used for pulling the custom packages from git repo and inbuilt package from package registry