Fully Managed Configuration Example
The following example shows how to use the Configuration Importer to fully manage a Traffic Manager’s configuration within Docker, and additionally how to invoke the Configuration Importer on standard deployments.
The example given here uses the same sample YAML configuration document shown in the one-time import example, saved at the same filesystem location: "./import/config/example-config.yaml".
Example Docker Deployment
When you deploy a Traffic Manager container, mount the import directory as a volume and specify the mount path in the ZEUS_WATCHED_CONFIG environment variable. After installing the Traffic Manager, the container imports the configuration documents stored in the "config" subdirectory of the mounted volume. The Configuration Importer continuously watches for changes in the ZEUS_WATCHED_CONFIG directory and automatically imports the updated configuration when such a change is detected.
To deploy a fully configuration-managed Traffic Manager inside a Docker container, use the following command:
# Assumes the sample configuration document is saved as
# /import/config/example-config.yaml
docker run --name=vtm-config-example \
-v `pwd`/import:/import \
-p 8080:80 \
-p 9090:9090 \
-e ZEUS_WATCHED_CONFIG=/import \
-e ZEUS_EULA=accept \
-e ZEUS_PASS=admin \
--privileged \
--init \
-t \
-d \
pulsesecure/vtm:21.4
The above example launches a Traffic Manager container named "vtm-config-example" that is populated with the configuration specified in the watched directory (in this case, "/import/config/example-config.yaml"). To verify that the deployment was successful, make an HTTP request to port 8080 on your Traffic Manager’s primary IP address or hostname. This should result in a "Hello World" response.
To see that the configuration has been correctly applied, access the Administration Interface (Admin UI) of the Traffic Manager instance on port 9090.
Next, edit "./import/config/example-config.yaml" and change the rules section to:
rules:
- name: basic-response
content: |
http.sendResponse("200 OK", "text/plain", "Hello New World\n", "X-Served-By: Ivanti vTM");
Observe that the configuration has been updated by making a further HTTP request to port 8080, which should now return "Hello New World".
Example with Standard Deployments
To watch for changes to configuration documents with software or virtual appliance deployments, use the "watch-directory" tool supplied with the Traffic Manager. Specify the directory to watch, followed by the command to run when any files in the directory change.
To watch for changes in the "/import" directory, and then apply those changes, run the following command:
$ZEUSHOME/zxtm/bin/watch-directory /import -- $ZEUSHOME/zxtm/bin/config-import \
--chdir /import ./config