Skip to content

Advanced Installation of Traefik Enterprise Edition on Swarm with Compose Files

This installation guide is for experts who want to fine tune their TraefikEE (Traefik Enterprise Edition) installation.

It covers how to install TraefikEE using docker compose files in a Docker Swarm cluster.

Swarm Knowledge

Assistance with configuring or setting up a Docker Swarm cluster is not included in this guide. If you need more information related to Docker Swarm, start with the following resources:

Requirements

  • A Docker Swarm (swarm mode) cluster:
    • Version: >= 1.13 (minimum API version 1.25)
    • At least 3 manager nodes, and 1 worker node
  • Docker client
    • Version: >= 1.13 (minimum API version 1.25)
    • Configured to communicate with your swarm cluster by setting correctly the --host flag or the DOCKER_HOST environment variable, and the security options according to your setup. For more information see here.

Download and extract compose files

curl -sSL \
    https://s3.amazonaws.com/traefikee/examples/v1.0.0-beta21/swarm/traefikee-swarm-v1.0.0-beta21.tar.gz | tar xvz
./bootstrap-node.yml
./control-node.yml
./data-node-global.yml
./data-node-replicated.yml

Create the TraefikEE network

Create the network being used by TraefikEE to communicate internally.

docker network create --driver=overlay traefikee-net
pmvxcxzucmcshro6tfpta7az2 # newly created network ID, differs per execution

Note

You can personalize the network name being used, however make sure to report it in the following commands.

Create the TraefikEE license secret

Create the docker swarm secret containing your license.

# With the TRAEFIKEE_LICENSE_KEY environment variable previously defined
echo -n ${TRAEFIKEE_LICENSE_KEY} | docker secret create traefikee-license -
g7akfclckt71e0sej85doj8x4 # newly created secret ID, will difer per execution

Create the Bootstrap Node

  • Open the file ./bootstrap-node.yml with your favorite editor:
    • Replace the ${TRAEFIKEE_SWARM_NETWORK} variable with traefikee-net (or the one you chose).
    • Replace the ${TRAEFIKEE_EXPECTED_CONTROL_NODES} variable with the number of swarm managers in your cluster.
    • Replace the ${TRAEFIKEE_LOG_LEVEL} variable with the desired log level (among DEBUG, INFO, ERROR and WARN)
    • Replace the line --timeout=120 with --timeout=600
  • Save the file.

Note

Instead of replacing environment variables in the file, you can export them in your shell.

Create the bootstrap node to initialize the cluster:

docker stack deploy --compose-file=./bootstrap-node.yml traefikee
Creating service traefikee_bootstrap-node

Validate that your bootstrap node is up and running:

docker service ls
ID                  NAME                       MODE                REPLICAS            IMAGE                                PORTS
zlo1lgc0u436        traefikee_bootstrap-node   replicated          1/1                 containous/traefikee:v1.0.0-beta13

Connect traefikeectl to the new cluster

Connect the traefikeectl command to the new cluster

traefikeectl connect --swarm
Saving cluster configuration

Check if the bootstrap node started correctly by listing the cluster nodes.

The bootstrap node's role should be Control Node (Current Leader), and its status should be READY:

traefikeectl list-nodes
Name           Role
----           --------------
bootstrap      Control Node (Current Leader)

Create the Control Nodes

  • Open the file ./control-node.yml with your favorite editor:
    • Replace the ${TRAEFIKEE_SWARM_NETWORK} variable with traefikee-net (or the one you chose).
    • Replace the ${TRAEFIKEE_PEER_ADDRESSES} variable with traefikee_bootstrap-node:4242,traefikee_control-node:4242,task.traefikee_control-node:4242
    • Replace the ${TRAEFIKEE_LOG_LEVEL} variable with INFO (or DEBUG if needed)
  • Save the file.

Note

Instead of replacing environment variables in the file, you can export them in your shell.

docker stack deploy --compose-file=./control-node.yml traefikee
Creating service traefikee_control-node

Validate that your control nodes are up and running:

docker service ls
ID                  NAME                       MODE                REPLICAS            IMAGE                                 PORTS
t84ssl5lix70        traefikee_bootstrap-node   replicated          1/1                 containous/traefikee:v1.0.0-beta13
t37nf8xvpw3b        traefikee_control-node     global              3/3                 containous/traefikee:v1.0.0-beta13   *:8080->8080/tcp

Remove the Bootstrap Node

After the deployment of control nodes, the bootstrap node will stop automatically. Please wait until it is properly stopped.

Once it is, you can run the following command to remove it from your swarm cluster.

docker service rm traefikee_bootstrap-node
traefikee_bootstrap-node

Create the Data Nodes

Two options are available here:

  • Global mode: will spawn one data node per swarm worker.
  • Replicated mode: will spawn a specific amount of data nodes.

Global mode

  • Open the file ./data-node-global.yml with your favorite editor:
    • Replace the ${TRAEFIKEE_SWARM_NETWORK} variable with traefikee-net (or the one you chose).
    • Replace the ${TRAEFIKEE_PEER_ADDRESSES} variable with traefikee_bootstrap-node:4242,traefikee_control-node:4242,task.traefikee_control-node:4242
    • Replace the ${TRAEFIKEE_LOG_LEVEL} variable with INFO (or DEBUG if needed)
    • Replace the ${TRAEFIKEE_HTTP_PORT} variable with 80 (or any other port you want)
    • Replace the ${TRAEFIKEE_HTTPS_PORT} variable with 443 (or any other port you want)
  • Save the file.

Note

Instead of replacing environment variables in the file, you can export them in your shell.

docker stack deploy --compose-file=./data-node-global.yml traefikee
Creating service traefikee_data-node

Validate that your data node is up and running:

docker service ls
ID                  NAME                     MODE                REPLICAS            IMAGE                                 PORTS
t37nf8xvpw3b        traefikee_control-node   global              3/3                 containous/traefikee-private:latest   *:8080->8080/tcp
khcwbiffzocq        traefikee_data-node      global              2/2                 containous/traefikee-private:latest   *:80->80/tcp, *:443->443/tcp

Replicated mode

  • Open the file ./data-node-replicated.yml with your favorite editor:
    • Replace the ${TRAEFIKEE_SWARM_NETWORK} variable with traefikee-net (or the one you chose).
    • Replace the ${TRAEFIKEE_PEER_ADDRESSES} variable with traefikee_bootstrap-node:4242,traefikee_control-node:4242,task.traefikee_control-node:4242
    • Replace the ${TRAEFIKEE_DATA_NODE_REPLICAS_COUNT} variable with the amount of data nodes you want.
    • Replace the ${TRAEFIKEE_LOG_LEVEL} variable with INFO (or DEBUG if needed)
    • Replace the ${TRAEFIKEE_HTTP_PORT} variable with 80 (or any other port you want)
    • Replace the ${TRAEFIKEE_HTTPS_PORT} variable with 443 (or any other port you want)
  • Save the file.

Note

Instead of replacing environment variables in the file, you can export them in your shell.

docker stack deploy --compose-file=./data-node-replicated.yml traefikee
Creating service traefikee_data-node

Validate that your data node is up and running:

docker service ls
ID                  NAME                     MODE                REPLICAS            IMAGE                                 PORTS
t37nf8xvpw3b        traefikee_control-node   global              3/3                 containous/traefikee-private:latest   *:8080->8080/tcp
c4e7eqjir9gk        traefikee_data-node      replicated          1/1                 containous/traefikee-private:latest   *:80->80/tcp, *:443->443/tcp

Validate your deployment

You can use traefikeectl list-nodes from inside a control node container to see the nodes of your TraefikEE cluster.

# on a swarm manager node
traefikeectl list-nodes
Name          Role
----          ----
e8f9ead1e90a  CONTROL NODE
27789ff9d312  CONTROL NODE
99cfba70a061  DATA NODE
14ac0fbcc5db  CONTROL NODE (Current Leader)

Configure your TraefikEE cluster

You can use traefikeectl deploy to configure your cluster.

## on a swarm manager node
traefikeectl deploy --docker.swarmmode

Note

At the moment the routing page refers to the traefikeectl deploy command instead of traefikee. Unfortunately there is no way to use traefikeectl with a manual installation at the moment (we're working on it, stay tuned!). However, you can still use traefikee deploy which exposes the same flags as traefikeectl deploy.