Zato distributed environment under Docker

The steps below go through the process of setting up a Docker-based distributed environment from scratch, including installation and configuration of all the additional dependencies required.

The instructions assume the usage of Ubuntu 14.04 LTS but any system supported by Docker can be used.

The end result is the same sort of cluster that quickstart uses but spread over multiple Dockerfiles.

Requirements

  • Docker 1.0.1+

Installation steps

Preparations

  • Enable forwarding in sysctl.conf so that Docker can bind to IPv4:
host# echo "net.ipv6.conf.all.forwarding=1" >> /etc/sysctl.conf
host# sysctl -p
  • Install PostgreSQL and Redis (instructions for Ubuntu 14.04).
$ apt-get install -y postgresql redis-server
$ echo "host all  all    0.0.0.0/0  md5" >> /etc/postgresql/9.3/main/pg_hba.conf
$ echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
$ service postgresql restart
$ sudo su - postgres
$ createuser --no-superuser --no-createdb --no-createrole zato2
$ createdb --owner=zato2 zato2
$ psql --dbname zato2 --command="ALTER ROLE zato2 WITH PASSWORD 'zato2'"
  • Configure Redis to listen on all interfaces
$ sed 's/bind 127./#bind 127./g' /etc/redis/redis.conf \
    | sudo tee /etc/redis/redis.conf >/dev/null
$ service redis-server restart

Create Zato ODB and cluster

  • Create Zato ODB and a cluster in PostgreSQL.
  • Alternatively, execute the following commands. This will create the Zato ODB and cluster for you:
  1. Get Dockerfile and all required config files:
$ mkdir -p ~/zato-docker-odb-dev && cd ~/zato-docker-odb-dev \
    && wget https://zato.io/download/docker/2.0/components/odb/Dockerfile \
    && wget https://zato.io/download/docker/2.0/components/odb/zato_odb.config \
    && wget https://zato.io/download/docker/2.0/components/odb/zato_cluster.config
  1. Pass your parameters to the config files and run:
$ sudo docker build --no-cache -t zato-odb-2.0.8 .
  1. Create certificates which will be needed for Zato components. You can also create self-signed certificates by using the following script:
$ mkdir -p ~/zato-cert-dev && cd ~/zato-cert-dev \
    && wget https://zato.io/download/docker/2.0/components/gencert.sh \
    && chmod +x gencert.sh && ./gencert.sh

By default, the script creates certificates for two servers. If a different number of certificates needs to be created, just pass it th erelevant number in the range of 1-10.

  1. Copy the certificates to destination directories.

Create and start Zato components

  • After creating Zato ODB, cluster and certificates, you can start building Zato components.
  1. Build Zato load-balancer image:
$ URL_COMPONENT=https://zato.io/download/docker/2.0/components/load-balancer
$ mkdir -p ~/zato-docker-lb-dev && cd ~/zato-docker-lb-dev \
    && wget $URL_COMPONENT/Dockerfile \
    && wget $URL_COMPONENT/zato_load_balancer.config
$ sudo docker build --no-cache -t zato-lb-2.0.8 .
  1. Create a container in which Zato load balancer will be launched:
$ sudo docker run -it -p 11223:11223 -p 20151:20151 zato-lb-2.0.8
  1. Build Zato web-admin image:
$ URL_COMPONENT=https://zato.io/download/docker/2.0/components/web-admin
$ mkdir -p ~/zato-docker-wa-dev && cd ~/zato-docker-wa-dev \
    && wget $URL_COMPONENT/Dockerfile \
    && wget $URL_COMPONENT/zato_web_admin.config \
    && wget $URL_COMPONENT/zato_update_password.config
$ sudo docker build --no-cache -t zato-wa-2.0.8 .
  1. Create a container in which Zato web-admin will be launched:
$ sudo docker run -it -p 8183:8183 zato-wa-2.0.8
  1. To check the password to log into web-admin with, run:
$ sudo docker run -it zato-wa-2.0.8 cat web_admin_password
  1. Build Zato server1 image:
$ mkdir -p ~/zato-docker-srv1-dev && cd ~/zato-docker-srv1-dev \
    && wget https://zato.io/download/docker/2.0/components/server1/Dockerfile \
    && wget https://zato.io/download/docker/2.0/components/server1/zato_server.config
$ sudo docker build --no-cache -t zato-srv1-2.0.8 .
  1. Create a container in which Zato server1 will be launched:
$ sudo docker run -it -p 17010:17010 zato-srv1-2.0.8
  1. Build Zato server2 image:
$ mkdir -p ~/zato-docker-srv2-dev && cd ~/zato-docker-srv2-dev \
    && wget https://zato.io/download/docker/2.0/components/server2/Dockerfile \
    && wget https://zato.io/download/docker/2.0/components/server2/zato_server.config
$ sudo docker build --no-cache -t zato-srv2-2.0.8 .
  1. Create a container in which Zato server2 will be launched:
$ sudo docker run -it -p 17011:17011 zato-srv2-2.0.8

The steps completed, a web-admin instance is running on http://localhost:8183 and you can log into it with the username 'admin' using the password printed on the terminal above.

You can also connect via SSH to the container under which Zato is running. User: zato. Password: second one of the two printed on terminal above.

That concludes the process, you can refer to the main documentation index now.