DEV Community

Tech Community for Software AG Tech Community

Posted on • Originally published at tech.forums.softwareag.com on

Configuring webMethods Microservices Runtime in a Docker container

Overview

webMethods Microservices Runtime provides scripts that allows to generate Dockerfile and Docker images. In previous articles, we described ways to create Docker images and run Docker containers. In the earlier versions of Microservices Runtime, it was required to embed configurations inside a Docker image and one can only update an existing configuration using configuration variables template. In version 10.11 and latest fixes of earlier versions, Microservices Runtime allows creation of configurations using configuration variable template. This article provides an overview on how same Docker image of Microservices Runtime can be used across different stages in the development lifecycle with different configurations.

Prerequisites

  • You have some familiarity with the Docker technology.

  • You have Docker installed in your environment and it is running as a daemon.

  • You have familiarity with support of Docker in webMethods Microservices Runtime. More information about this can be found at Microservices Runtime with Docker

Environment Variables Support in Microservices Runtime

Microservices Runtime supports different environment variables that can be supplied when starting a Docker container. These environment variables allow to supply License file (SAG_IS_LICENSE_FILE) for the container, setting minimum (JAVA_MIN_MEM) and maximum (JAVA_MAX_MEM) heap size for the container and providing configuration variables template (SAG_IS_CONFIG_PROPERTIES). More information about these environment variables can be found at Environment Variables

Configuration Variables Support in Microservices Runtime

Configuration variables template is a way to configure container running Microservices Runtime. For this article, we will use the Docker image of Microservices Runtime that is published on Dockerhub Docker Hub, however you can also use Docker images created in your environment. One of the ways in which configuration variables template can be supplied to a container is using SAG_IS_CONFIG_PROPERTIES environment variable.

Configuration Variable template is Java properties file containing key-value pairs, where key represents a particular asset’s property for which you can specify a value. Value specified for individual keys can have one of the following formats

  • Plain text

  • Environment variable, as an example value can be $env{JDBC_URL}, where JDBC_URL is the environment variable containing the actual value that will be substituted at startup time

  • Encrypted Value, as an example value can be {AES}CszC/…, you can use Microservices Runtime’s Admin UI to generate encrypted value. Documentation here provides more information on this.

  • Kubernetes Secrets, as an example value can be $secret{jdbcurl}, where jdbcurl is the secret stored in Kubernetes.

Specifying Configuration Variables Template in Microservices Runtime

Following command can be used to supply configuration variables template to Docker container.

docker run -d --name msrcontainer -p 5555:5555 -v /opt/data/customapp.properties:/opt/data/customapp.properties -e SAG_IS_CONFIG_PROPERTIES=/opt/data/customapp.properties store/softwareag/webmethods-microservicesruntime:10.11.0.0

Enter fullscreen mode Exit fullscreen mode

Please note that in the example above, you will need to create customapp.properties file in your HOST machine under /opt/data directory with content as below.

globalvariable.variable1.value=newTestValue
globalvariable.variable2.value={AES}4LxEGBJV9ULP3Im7L8mrMzyKlsk7mNcMZh5J5LN9h+gZemVaEDK/i1nOfIdbbWyk
globalvariable.variable2.isSecure=true
proxyserver.proxyAlias.host=DummyHost
proxyserver.proxyAlias.password={AES}Y5IgMqjfvkgbg7p5VUZztw==
proxyserver.proxyAlias.port=7777
proxyserver.proxyAlias.username=proxyProdUser
jdbc.Oracle.dbURL=$env{JDBC_URL}
jdbc.Oracle.password={AES}Z00ucoomUFviQLodMDpoJg\=\=
jdbc.Oracle.userid=testuser
settings.watt.server.threadPool=100
settings.watt.server.threadPoolMin=10

Enter fullscreen mode Exit fullscreen mode

Once container is up and running, Microservices Runtime will have the following configurations created

  • JDBC Pool with Oracle as alias, testuser as user ID and URL is updated with the value specified in JDBC_URL environment variable
  • Global Variable variable1 with value as newTestValue
  • Global Variable vairable2 with value provided as encrypted value and it is configured as password
  • Extended Settings for threadPool and threadPoolMin are set as 100 and 10 respectively
  • Proxy Server alias with alias as proxyAlias, host as DummyHost, port as 7777

You can login to Admin UI to check if execution and steps are described above are successful in your environment.

Proxy Servers UI will display configuration for Proxy server as below – http://localhost:5555/WmAdmin/#/integration/dsp/settings-network.dsp

image

Global Variables UI will display configuration for Configuration Variables as below – http://localhost:5555/WmAdmin/#/integration/dsp/settings-global-variables.dsp

image

Similarly, you can check configurations created for other artifacts in their respective screens.

Note : Please note that not all configurations can be created using this approach. List of configuration assets that can be created are specified in Documentation. If there are any configurations that is missing, provide us your inputs and we will add those configurations in future versions of Microservices Runtime.

Generate Configuration Variables Template in Microservices Runtime

Microservice Runtime’s Admin UI allows creation of template from running Microservices Runtime.

You can use Administration => Configuration variables => Generate Configuration Variables Template from Admin UI to create sample configuration variables template. Documentation provides more details on this action.

Conclusion

This article described a way to configure Microservices Runtime in a container. By doing this, you can reuse your Docker image of a Microservices Runtime across multiple stages in the development lifecycle.

Check original article

Top comments (0)