Apama 10.3 | Apama Documentation | Deploying and Managing Apama Applications | Deploying Apama Applications with Docker | Using the Apama image with the Docker stack
Using the Apama image with the Docker stack
Current versions of Docker include swarm mode for natively managing a cluster of Docker engines called a swarm. You can use the Docker command line interface to create a swarm, deploy application services, and manage behavior. See the Docker documentation for available commands and more detailed information regarding swarms and their management.
The top of the hierarchy of distributed applications is the stack. A stack is a group of interrelated services that share dependencies, and can be orchestrated and scaled together. A single stack is capable of defining and coordinating the functionality of an entire application (though very complex applications may want to use multiple stacks).
Using stacks is an extension of creating a Compose file and then using the docker stack deploy command. The majority of samples described in Apama samples for Docker use single service stacks running on a single host, which is not usually what takes place in production. Apama's Queries sample demonstrates how the docker stack command can be used to create multiple services related to each other, and run them on multiple machines. It uses resources available to it, but specifically it is meant to utilize the swarm mode of a Docker installation.
1. Use the following command to enable swarm mode:
docker swarm init
The init command outputs a token which can be used to add extra processing workers to the swarm using the following command:
docker swarm join --token token workeraddress
2. The docker-compose.yml configuration file is the key element to creating the deployment. To use stack commands, the version of the configuration file must be greater than 3. The image specified in the configuration file must exist because (unlike Docker Compose) the stack commands ignore build sections in the configuration file. As a consequence, building the image is a separate step and must be done before attempting to start the application.
An example docker-compose.yml file can be found in the samples/docker/applications/Queries directory of your Apama installation. For details on the Queries sample, see Apama samples for Docker.
3. Use the following command to run the application:
docker stack deploy stack --compose-file docker-compose.yml
The stack element in the above command is a name which will be prefixed to the elements of the deployment that the above command creates. It is also used in the commands for interrogating the running system, for example:
docker stack ps stack
docker stack services stack
4. Run the following command to cleanly shut down the running application when you are finished:
docker stack rm stack

Copyright © 2013-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.