Microgateway 10.11 | webMethods Microgateway Help | Microgateway Provisioning | Instance-based Provisioning
 
Instance-based Provisioning
You can create a Microgateway package from an existing installation and copy it to multiple target machines. A Microgateway instance package is a self-contained zip file that contains all artifacts for running a Microgateway. The contents of the zip file are:
*JRE
*Microgateway server
*Microgateway CLI
*Configuration files
*One or more exported API Gateway asset archives
After copying the zip file , you have to extract the zip file contents and run the commandline scripts of the Microgateway CLI to start the Microgateway. A package is configured based on a Microgateway configuration file. The configuration file either points to an API Gateway or to one or more API Gateway asset archives for asset promotion. The asset promotion is performed when you start the Microgateway within the package.
Note:
On Linux it is required that certain permissions must be set after the package has been extracted from the zip. This should be done with the provided script: ./setpermissions.sh
The figure illustrates creating a Microgateway package from an existing installation and copying it to multiple target machines.
Creating a Microgateway Instance
For the package-based provisioning the Microgateway CLI provides the createInstance command. The command creates a Microgateway package that can be transferred to any target environment. The command has the following parameters:
*config: optional Microgateway configuration file
*instance: the required file or path name of the Microgateway package.
Instance-based Provisioning Flow
A sample sequence for executing an instance-based provisioning is as follows:
1. Create API Gateway archives and set the configuration file accordingly.
---
ports:
http: 5554
https: 5553

api_gateway:
url: host:port
user: Administrator
password: password

archive:
file: asset.zip


---
2. Create a Microgateway instance.
microgateway.bat createInstance -config/config custom-settings.yml
--instance c:/tmp/Microgateway.zip -os win
The provided custom-settings.yml is added to the root of MyMicrogateway.zip that can be used for server startup.
3. Copy the Microgateway instance to the target environment.
4. Extract the contents of the zip file using the unzip command and start the Microgateway instance.
cd c:/tmp/myinst
unzip c:/tmp/MyMicrogateway.zip
microgateway.bat start --config custom-settings.yml
The unzip operation creates the sub-folders of the Microgateway. The start command picks up the custom settings file from the base location. Ensure that on the necessary files the execute-bit is set by applying the setpermissons.sh command (linux-only):
*microgateway.sh
*microgateway-jre-linux/bin/java
A Sample workflow for Instance-based Provisioning with Custom Settings
You can establish a Microgateway instance with a customized configuration setting environment. On start the Microgateway server picks up the specified customized settings. A sample sequence for instance-based provisioning with custom settings looks as follows.
1. Create a Microgateway instance with settings picked up from API Gateway.
./microgateway.sh downloadSettings -gw http://hostname:port
–-output my-custom-settings.yml
./microgateway.sh createInstance –instance MyInst.zip
–-config my-custom-settings.yml
2. Publish the Microgateway instance and start it.
unzip MyInst.zip –d /tmp/inst
cd /tmp/inst
. ./setpermissions.sh
./microgateway.sh start –c my-custom-settings.yml
You can also save a Microgateway environment (used API and all configuration settings) in a version control system, check it out when required, and start as follows:
# Checkout a microgateway environment and start it
svn checkout http://repository/... myarchive.zip my-custom-settings.yml
./microgateway.sh start –-config my-custom-settings.yml --archive myarchive.zip
3. Once the settings are created, you can spawn multiple instances with the same settings on multiple machines.
A Sample workflow for Instance-based Provisioning by Downloading the settings from API Gateway
A sample flow is as follows:

./microgateway.sh createInstance –instance MyInst.zip –c my-base-settings.yml
unzip MyInst.zip –d /tmp/inst
/tmp/inst/microgateway.sh start –c my-base-settings.yml --download_settings true
The download_settings parameter used while starting Microgateway downloads the settings from API Gateway.