Multi-node Docker deployments
This article provides a sample approach that you can follow to setup the database and other infrastructure of your choice.
Note:
- 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.
- 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. The folders you mount needs to be owned by user 10001, for example, you can runsudo chown -R 10001 xl-deploy-master
if you want 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
- 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
The production setup for Deploy as mentioned here can be performed using Docker compose as described in the steps below. Follow the steps to deploy the sample:
- Create a directory "xl-deploy-ha" and download the docker-compose-xld-ha.yaml and docker-compose-xld-ha-workers.yaml files.
- Create a directory rabbitmq in "xl-deploy-ha" directory and download the enabled_plugins.
- To set up using automated scripts, use the run_master.sh and run_worker.sh scripts. For manual setup, follow the steps described below. Note: Change the passwords as required whether you run automated scripts, or perform manual setup.
- To shut down and clean the Docker container, run the cleanup.sh script.
# 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.
docker-compose -f docker-compose-xld-ha.yaml up --scale xl-deploy-master=3 -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)
export XLD_MASTER_3=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' xl-deploy-ha_xl-deploy-master_3)
export XLD_LB=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' xl-deploy-lb)
# Deploy the worker nodes (if required, you can change the number of nodes here)
docker-compose -f docker-compose-xld-ha-workers.yaml up --scale xl-deploy-worker=3 -d
# Print the status
docker-compose -f docker-compose-xld-ha.yaml -f docker-compose-xld-ha-workers.yaml ps
- To view the logs of individual containers, run the
docker logs <container_name> -f
command. - To access Deploy UI, go to
http://localhost:8080
. - To shut down the setup, run:
# 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 more information about upgrading a multi-node Deploy using Docker Compose, see Multi-node docker deployments