Creating a Mashery Local Cluster

Note: TIBCO Mashery Local on a Swarm cluster relies on host pinning to achieve statefulness, for example, you need to specify the host name where you want to run Mashery Local stateful components (NoSQL, Log, SQL and Cache) in the corresponding deployment file, and then run deployment step by step.
Follow the steps below for each zone:
  1. Note: Cluster deployment requires root level privileges in order for the Mashery Local containers to run. Log in as root to perform the tml-cluster deployment.
    Deploy NoSQL components first. The first NoSQL container is deployed as seed. Open the file tmgc-nosql.yml and replace ${HOST_NAME} with name of host. Name of the host is the value shown under HOSTNAME column in the output of docker node ls command. In case of on-premises VirtualBox, you can replace this with "master" as we create a VM with name "master" and execute the following command:
    docker stack deploy -c tmgc-nosql.yml nosqlstack --with-registry-auth
    Run docker service ls and output should be as below. Make sure it gets deployed successfully before proceeding.
    k6rpc2tmey91        nosqlstack_nosql_seed   replicated      0/1    tmlbuilder.company.com/tml/tml-nosql:v5.2.0.160
    Run docker service ls and successful output should show nosqlstack_nosql_seed is replicated.
    If you have more than one NoSQL component and you want each of them to be deployed on separate node, then open the file tmgc-nosql-ring.yml and replace ${HOST_NAME} with the desired host and make replicas equal to 1 (replicas: 1 ) on line 6 and run below command after each change.
    docker stack deploy -c tmgc-nosql-ring.yml nosqlnonseedstack --with-registry-auth
    Successful output should show nosqlnonseedstack_nosql_nonseed is replicated.
    Note: Make sure to provide a different stack name (should start with nosqlnonseedstack, nosqlnonseedstack2 for the second container, and so on) as well for each instance, using the following command:
    docker stack deploy -c tmgc-nosql-ring.yml nosqlnonseedstack2 --with-registry-auth
  2. Deploy Configuration Manager (CM). Run the following command:
    docker stack deploy -c tmgc-cm.yml cmstack --with-registry-auth 
    Run "docker service ls" and output should be as below. Make sure it gets deployed successfully (showing "1/1" in 4th column of the output) before proceeding.
        ID             NAME           MODE     REPLICAS      IMAGE  					
    j4x64bis9qmb   cmstack_tmlcm   replicated   1/1   tmlbuilder.company.com/tml/tml-cm:v5.2.0.160
  3. Create a tar.gz of the resources folder by executing the following:
    tar -czf resources.tar.gz "resources/"
  4. Deploy Log Service. Open the file tmgc-log.yml and replace ${HOST_NAME} with the desired host for each instance of log deployment and make replicas equal to 1 (replicas: 1 ) on line 6 and run the following command after each change.
    docker stack deploy -c tmgc-log.yml logstack --with-registry-auth
    Note: Make sure to provide a different stack name (should start with logstack, logstack2 for the second container, and so on) as well for each instance, using the following command:
    docker stack deploy -c tmgc-log.yml logstack2 --with-registry-auth
  5. Deploy SQL Service. Open the file tmgc-sql.yml and replace ${HOST_NAME} with the desired host where you want deploy SQL service and run the following command. As per design, you can only have one SQL per zone.
    docker stack deploy -c tmgc-sql.yml sqlstack --with-registry-auth
  6. Deploy Cache Service. Open the file tmgc-cache.yml and replace ${HOST_NAME} with the desired host for each instance of cache deployment and make replicas equal to 1 (replicas: 1 ) on line 6 and run the following command after each change.
    docker stack deploy -c tmgc-cache.yml cachestack --with-registry-auth
    Note: Make sure to provide a different stack name (should start with cachestack, cachestack2 for the second container, and so on) as well for each instance, using the following command:
    docker stack deploy -c tmgc-cache.yml cachestack2 --with-registry-auth
  7. Deploy Traffic Manager (TM) Service. Run the following command. TM will be distributed by Swarm Manager among available nodes.
    ./deploy-tm-pod.sh
Sample successful output:
n98j8554s6h    tmstack_h   replicated   1/1     tmlbuilder.company.com/tml/tml-tm:v5.2.0.1   *:80->80/tcp, *443->443/tcp,  *8083->8083/tcp
On successful deployment, the output for docker service ls is