Skip to content
Wahed Hemati edited this page Aug 11, 2020 · 9 revisions

This manual describes how to install the head node and agents. If you have already installed the head-node, you can jump to Agent.

Head Node

Requierments

  1. Docker
  2. docker-compose
  3. sshfs plugin (https://github.com/vieux/docker-volume-sshfs)

Installation

Docker Swarm

Initialize Swarm on Head node

docker swarm init --advertise-addr [host]

This will initialize a swarm on the Head node. A join-token is printed.

Join Swarm with workers (check docker ports and firewall)

docker swarm join-token worker

Verify swarm (on head node)

docker node ls

This should print all available nodes in the swarm

Install docker plugin sshfs on every node

docker plugin install vieux/sshfs

Local Docker Registry

Start a Docker registry as a service in the swarm

docker service create --replicas 1 --constraint 'node.hostname==head-node' --mount source=registry_data,target=/var/lib/registry --name registry --publish 5000:5000 registry:2

Allow connections to this registry

Edit /etc/docker/daemon.json on all workers and add the following:

{
    "insecure-registries": ["head-node:5000"]
}

Build TextImager Server and Agent Docker Image

cd ducc/
docker build -t head-node:5000/textimager-server:0.1 .
cd ../ducc-agent/ 
docker build -t head-node:5000/textimager-agent:0.1 .
cd ..

Push TextImager Server and Agent Images to the registry

docker push head-node:5000/textimager-server:0.1
docker push head-node:5000/textimager-agent:0.1

Deploy TextImager stack

Network shared storage

Create two network shared storage directories to be mounted via sshfs later. In this example, we use the following:

ducc@storage-server:/home/ducc/ducc_swarm_shared
ducc@storage-server:/home/ducc/ducc_corpora

Prepare .env file

cp .env.example .env

Open the file and change the password to allow sshfs mounting and the registry url:

REGISTRY=head-node:5000
SSHFS_PASSWORD=password

Prepare stack.yml file

This file contains everything about how to setup the TextImager stack.

You need to modify the placement.constraings of the textimager-server as well as the agents textimager-agent-*. Remove or add new agent blocks depending on your amount of servers.

(Update the sshcmd option of the two volumes).

Deploy the TextImager stack

cd /path/to/textimager-server/
docker stack deploy -c <(docker-compose -f stack.yml config) textimager

You can check on the status of the stack with docker service ls and remove it again with docker stack rm textimager. Check the running Docker containers on the workers with docker ps -a and view the logfile of the server: docker logs -f [id-of-textimager-server-container].

Agent

Requierments (Agent)

  1. docker
  2. docker-compose
  3. sshfs plugin (https://github.com/vieux/docker-volume-sshfs)

Installation

Install docker plugin sshfs on every node

docker plugin install vieux/sshfs

Get Swarm join token:

  1. go to head-node
  2. Get Join token from head node

Allow connections to this registry

Edit /etc/docker/daemon.json on all workers and add the following (replace "xxxxx" with ip-address of head-node):

{
    "insecure-registries": ["xxxxx:5000"]
}

Restart docker deamon

service docker restart

Update stack.yml

  1. go to head-node
  2. update stack.yml on Head Node
  3. deploy stack.yml on Head Node