Docker Swarm
Prerequisites
To install L7|ESP onto a Docker Swarm cluster, you must have:
At least 3 VMs with Docker Engine installed.
Note
As Docker Swarm is a distributed system, you must maintain a quorum of at least 3 nodes if you wish to be able to tolerate the failure of one of these nodes.
See Add manager nodes for fault tolerance in the official documentation for more information.
Creating the cluster
On the first node, run the following command to create the cluster:
$ docker swarm init
On the other nodes, run the following command to join the cluster:
$ docker swarm join-token manager
Note
It is recommended that the first two nodes are added as managers, per the fault tolerance recommendations above. Additional nodes can be added as workers also.
Compose file
Docker Swarm will take a Compose file as configuration so you should use the docker-compose.prod.yml
file in root of your project, which will look something like this:
version: "3.2" services: server: image: project_name/l7esp:3.0.0-sdk.1 environment: L7ESP_PASSWORD: admin ports: - published: 8002 target: 8002 protocol: tcp mode: host volumes: - type: volume source: data target: /opt/l7esp/data volumes: data: {}
Deploy Compose stack
From the project folder, run the following command to deploy the stack.
$ docker stack deploy --compose-file=./docker-compose.prod.yml l7esp-example
Validate Resource Creation
From a Swarm manager node, run the following command. Remember that the password is ‘vagrant’.
$ ssh manager.swarm.example.com manager.swarm.example.com:~$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION ri27kwen3bu9s8384cl45rq2w * docker-manager Ready Active Leader 20.10.16 i87w5vzik6qag5ia3e79d46c9 docker-worker1 Ready Active 20.10.16
Validate L7|ESP Service
From a Swarm manager node, run the following command to validate that the L7|ESP container is running in the Swarm cluster:
$ ssh manager.swarm.example.com manager.swarm.example.com:~$ docker node ps $(docker node ls -q) ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS e2fgtesxlrv9 esp_server.1 l7esp/server:3.0.0-sdk.2 docker-worker1 Running Running 1 minute ago