Example: Using Parametrized Configuration Files

The following code snippets show how to parametrize the front end URL for a IBM My webMethods Server cluster in the cluster.xml file and supply different values for the parameter at container startup:

<?xml version="1.0" encoding="UTF-8"?>
<Cluster clusterId="-934813058" container="true" frontEndUrl="${sys:myURL}">
<!-- lists all physical servers in the cluster -->
   <Category name="servers">
      <Component class="com.webmethods.portal.system.cluster.impl.Server" enabled="true" name="default" nodeType="MWS">
         <Properties host="edc88f09c054" name="http" port="8585"/>
         <Properties host="edc88f09c054" name="https" port="0"/>
         ...
         ...
 

To supply a specific value for the front end URL, add the following custom JVM property in the custom_wrapper.conf file:

wrapper.java.additional.nnn=-DmyURL=customURL
Place the custom_wrapper.conf file in a volume, mapped to the profile_cfg directory, and the cluster.xml file in a volume, mapped to the cluster_cfg directory, then start the IBM My webMethods Server container.

For more information about how to supply configuration files in IBM My webMethods Server, see Modifying the Configuration of a Container.

When parametrizing properties in a configuration file for use with the Docker CLI environment variables, use the env prefix, as follows:

<?xml version="1.0" encoding="UTF-8"?>
<Cluster clusterId="-934813058" container="true" frontEndUrl="${env:myURL}">
<!-- lists all physical servers in the cluster -->
   <Category name="servers">
      <Component class="com.webmethods.portal.system.cluster.impl.Server" enabled="true" name="default" nodeType="MWS">
         <Properties host="edc88f09c054" name="http" port="8585"/>
         <Properties host="edc88f09c054" name="https" port="0"/>
         ...
         ...
 

The following command demonstrates how to substitute parametrized values in the xmlImport files during container startup using environment variables. Before running the container, you must place the cluster.xml file in a subdirectory named cluster_cfg in the mounted directory.

docker run -e DB_URL="jdbc:wm:sqlserver://dbhost:1439;databaseName=MWSDOCKER;user=wmuser;password=manage"
-e DB_TYPE=ms -v /home/myvm/myconfigs:/opt/softwareag/MWS/configs 
-e myURL="http://mymws:8585" -p 8585:8585 webM1015