webMethods Microgateway Help 10.3 | webMethods Microgateway Help | Microgateway Provisioning | Docker-based Provisioning
 
Docker-based Provisioning
Docker based provisioning involves the creation of a Microgateway Docker file from an existing installation, building the image, and running it multiple times in a container environment as depicted in the following figure.
Microgateway Docker image
For the Docker-based provisioning the Microgateway CLI provides the createDockerFile command. The command creates a Docker file that can be consumed by docker build for creating a Docker image. The Microgateway Docker image contains an unzipped Microgateway package.
The command contains the following parameters:
*docker_from: optional base image, for adding a Microgateway layer on top of an existing image. If no base image is given, the default is alpine:3.7 (4.1.MB).
*docker_dir: Microgateway directory
*docker_file: optional docker file name. Default is Microgateway_DockerFile
Dynamic configuration is achieved through volume mapping. The config subfolder can be mapped.
You can run the Docker image to spawn a Docker container from the created docker image.
A Sample workflow for Docker-based Provisioning with Export Archive
A sample sequence for executing a Docker-based provisioning with export archive looks as follows.
1. Create API Gateway archives and set the configuration file accordingly
---
ports:
http: 5554
https: 5553

api_gateway:
url: http://<host>:<port>/rest/apigateway
user: Administrator
password: <pwd>

archive:
file: export.zip

---
2. Create Microgateway Docker file.
./microgateway.sh createDockerFile --docker_dir . -p 9090 -a <file-name>.zip
The command creates the Docker file Microgateway_DockerFile that copies the export archives referenced by the zip file into the Docker image.
The createDockerFile command allows to configure the Docker file creation through command line parameters. For example, the following command sequence creates a Docker file for a Microgateway container listening on port 9090 and with the assets from the archives apis.zip and policies.zip.
microgateway createDockerFile -p 9090 -c config.yml
-a apis.zip,policies.zip
The command line parameters take precedence over the configuration values specified in the config.yml.
3. Create the Docker image with asset archive.
docker build -t sag:mcgw-static -f Microgateway_DockerFile
The command creates the image sag:mcgw from the generated Docker file.
4. Run the Docker image.
docker run -d -p 9090:9090 --name mcgw-static sag:mcgw-static
The command spawns a Docker container from the image sag:mcgw. The contained Microgateway listens at the host port 9090.
Dynamic configuration is applied by mapping a volume holding the config folder of the Microgateway instance.
A Sample workflow for Docker-based Provisioning with pulling from API Gateway
A sample sequence for executing a Docker-based provisioning with pulling from API Gateway looks as follows.
1. Create Microgateway Docker file points to an API Gateway for pulling APIs on startup.
./microgateway.sh createDockerFile --docker_dir . -c config/config.yml
The command creates the Docker file Microgateway_DockerFile that copies the API Gateway configurations from the config.yml file into the Docker image.
2. Create the Docker image.
docker build -t sag:mcgw-dynamic -f Microgateway_DockerFile
The command creates the image sag:mcgw from the generated Docker file.
3. Run the Docker image.
docker run -d -p 9090:9090 --name mcgw-dynamic sag:mcgw-dynamic
The command spawns a Docker container from the image sag:mcgw. The contained Microgateway listens at the host port 9090.
A Sample workflow for Docker-based Provisioning with dynamic configuration
A sample sequence for executing a Docker-based provisioning with dynamic configuration looks as follows.
1. Create Docker file pointing to the config.yml file.
./microgateway.sh createDockerFile --docker_dir . -c config/config.yml -p 9090
The command creates the Docker file Microgateway_DockerFile that copies the configurations from the config.yml file into the Docker image.
2. Create the Docker image.
docker build -t sag:mcgw-dynamic -f Microgateway_DockerFile
The command creates the image sag:mcgw from the generated Docker file.
3. Provide config directory with host file system with required Microgateway configurations:
> ls ~/mcgw-conf/
config.yml keystore.jks license.xml system-settings.yml
4. Start container with volume mapping pointing to config directory in host file system.
docker run -d -v ~/mcgw-conf:/Microgateway/config
-p 9090:9090 --name mcgw-dynamic sag:mcgw-dynamic
The command spawns a Docker container from the image sag:mcgw. The contained Microgateway listens at the host port 9090.

Copyright © 2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.