Multi-node Docker deployments

This article provides a sample approach that you can follow to setup the database and other infrastructure of your choice.

The production setup for Deploy as mentioned here can be performed using Docker compose as shown below:

Note 1: For production deployments, it is advised that you use Kubernetes to orchestrate the deployment of the applications. Docker compose is not ideal for production setup. Proceed at your own risk. Use the xl up command from the official Deploy/Release CLI to install Digital.ai products using Kubernetes, for more details see Manage Deployments with XL UP

Note 2: For HA setup to work, you need to mount a license file or provide an environment variable XL_LICENSE with a license text converted to base64 for the Deploy instances

Note 3: The folders you mount needs to be owned by user 10001, for example, you can run sudo chown -R 10001 xl-deploy-master if you are going to mount directories under $PWD/xl-deploy-master folder.

Setup

The setup includes

  • A load balancer with HaProxy
  • RabbitMQ single node setup
  • PostgreSQL database single node setup
  • Deploy master nodes
  • Deploy worker nodes

Limitations

  • You can have only 2 master nodes
  • The database setup is for demo purposes, use your own setup or use an external database
  • The MQ setup is for demo purposes, use your own setup or use an external MQ
  • The HAproxy setup is for demo purposes, use your own setup

Steps

Follow the steps mentioned below to deploy the sample:

  1. Download the docker-compose-xld-ha.yaml and docker-compose-xld-ha-workers.yaml files.
  2. You can use the provided run.sh to bring up the setup or perform it manually using the steps shown below. Change the passwords as required in either case.
# Set passwords
export XLD_ADMIN_PASS=admin
export RABBITMQ_PASS=admin
export POSTGRES_PASS=admin

# Create docker network
docker network create xld-network

# deploy master nodes, load balancer, mq and database. You should not change the number of master nodes here, it must be 2
docker-compose -f docker-compose-xld-ha.yaml up --scale xl-deploy-master=2 -d

# get the IP of master nodes, change the container names if you are not inside a folder named "xl-deploy-ha"
export XLD_MASTER_1=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' xl-deploy-ha_xl-deploy-master_1)
export XLD_MASTER_2=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' xl-deploy-ha_xl-deploy-master_2)

# Deploy the worker nodes, you can change the number of nodes here if you wish
docker-compose -f docker-compose-xld-ha-workers.yaml up --scale xl-deploy-worker=2 -d

# Print out the status
docker-compose -f docker-compose-xld-ha.yaml -f docker-compose-xld-ha-workers.yaml ps
  1. You can view the logs of individual containers using the docker logs <container_name> -f command
  2. You can access Deploy UI at http://localhost:8080
  3. To shutdown the setup you can run below
# Shutdown deployments
docker-compose -f docker-compose-xld-ha.yaml -f docker-compose-xld-ha-workers.yaml down
# Remove network
docker network rm xld-network

Upgrading multi-node deployments

For details on upgrading a multi-node Deploy using Docker Compose, see Multi-node docker deployments