Step 9 – Start the API Gateway Docker container

Use the docker run command to start the API Gateway container. For example:

$ docker run -it -e EMT_ANM_HOSTS=anm:8090 -p 8080:8080 --network=api-gateway-domain api-gateway-my-group:latest

This example performs the following:

  • Starts an API Gateway container from an image named api-gateway-my-group:latest. You must specify the name of the API Gateway Docker image that you created in Step 8 – Create an API Gateway Docker image.
  • Binds the default traffic port 8080 of the container to port 8080 on the host machine, which enables you to test the API Gateway on your host machine.
  • Sets the environment variable EMT_ANM_HOSTS to anm:8090 in the container. This enables the API Gateway to communicate with the Admin Node Manager container on port 8090. The API Gateway is now visible in the API Gateway Manager UI topology view.

API Gateway container in topology view

To run the container in the background, use the -d option, for example:

$ docker run -d -e EMT_ANM_HOSTS=anm:8090 -p 8080:8080 --network=api-gateway-domain api-gateway-my-group:latest

Start a deployment-enabled API Gateway container

The following example sets the EMT_DEPLOYMENT_ENABLED environment variable to true to enable you to deploy configuration directly from Policy Studio to the running API Gateway container.

$ docker run -d -e EMT_DEPLOYMENT_ENABLED=true -e EMT_ANM_HOSTS=anm:8090 
-p 8080:8080 --network=api-gateway-domain api-gateway-my-group:latest

The EMT_DEPLOYMENT_ENABLED environment variable is provided only as a convenience for development environments:

  • Do not set EMT_DEPLOYMENT_ENABLED=true on production systems. In production environments, to deploy changes in API Gateway configuration you must export a fed file from Policy Studio, rebuild the API Gateway Docker image, and restart the API Gateway Docker container.
  • The EMT_DEPLOYMENT_ENABLED=true setting only enables you to deploy changes to a running container from Policy Studio. You cannot deploy changes using API Gateway Manager, managedomain, or projdeploy.

Mount volumes to persist logs outside the API Gateway container

You can persist API Gateway trace and event logs to a directory on your host machine.

For example, run the following docker run command to start an API Gateway container from an image named api-gateway-my-group:latest and mount volumes for trace and event logs:

$ docker run -it -v /tmp/events:/opt/Axway/apigateway/events 
-v /tmp/trace:/opt/Axway/apigateway/groups/emt-group/emt-service/trace 
-e EMT_ANM_HOSTS=anm:8090 -p 8080:8080 --network=api-gateway-domain api-gateway-my-group:latest

This example starts the API Gateway container and writes the trace and log files to /tmp/events and /tmp/trace on your host machine. The trace and log files contain the container ID of the API Gateway container in the file names.

Note   To enable an Admin Node Manager container to process the event logs from API Gateway containers, you must run the Admin Node Manager container with the same volume mounted. For more details, see Create a metrics-enabled ANM image and Start a metrics-enabled Admin Node Manager container.

Related Links