Creating a Mashery Local Cluster

To create a Swarm cluster in Azure:
  1. Download the Docker 18.03.0-ce template from: https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fdownload.docker.com%2Fazure%2Fstable%2F18.03.0%2FDocker.tmpl
    Note: 18.03.0-ce is an older Docker template. We recommend using the older template. Using the latest template results in the following error:
    {
      "error": {
        "code": "ImageNotFound",
        "target": "imageReference",
        "message": "The platform image 'docker:docker-ce:docker-ce:1.0.12' is not available. Verify that all fields in the storage profile are correct."
      }
    }
  2. Fill the following fields in the template:
    • Choose the Resource Group from the list, for example: spswarm
    • AD ServicePrincipal App ID
    • AD ServicePrincipal App Secret
    • Linux SSH Public Key: Use the contents from ~/.ssh/azswarm_rsa.pub
    Click the Purchase link. It normally takes around 5 minutes for the Docker swarm deployment.



Configure the SSH Agent forwarding, this is required to communicate between manage nodes and worker nodes.

  1. Run the following command to get the list of identities added to the agent.
    ssh-add -L
  2. If you don't see any identities added to agent, then run this command.
    ssh-add ~/.ssh/your_key
  3. Get the Manager IP and Port Number from the Deployed template. Go to the deployed Microsoft template under the resource group and get the SSH TARGETS URL and browse to retrieve the IP of the manager node and port number.



  4. Enable SSH forwarding per session by using -A flag:
    ssh -A -p <portNumber> docker@<manager_ip>
  5. After step 3, now you will be able to connect to worker node from master:
    ssh -v -i /home/docker/azureswarm_rsa  docker@<internal IP of Worker Node>
    Note: You cannot directly connect to worker nodes from outside. To get the IP address of the Manager Node:
    docker node inspect swarm-worker000000
    [
        {
            "ID": "pjkshdm81l08ed4ulxzqdn7nu",
            "Version": {
                "Index": 15
            },
            "CreatedAt": "2019-04-09T19:21:13.136204206Z",
            "UpdatedAt": "2019-04-09T19:21:13.200455345Z",
            "Spec": {
                "Labels": {},
                "Role": "worker",
                "Availability": "active"
            },
            "Description": {
                "Hostname": "swarm-worker000000",
                "Platform": {
                    "Architecture": "x86_64",
                    "OS": "linux"
                },
                "Resources": {
                    "NanoCPUs": 2000000000,
                    "MemoryBytes": 7284375552
                },
     
                "Engine": {
     
                    "EngineVersion": "18.03.0-ce",
     
                    "Plugins": [
     
                        {
     
                            "Type": "Log",
     
                            "Name": "awslogs"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "fluentd"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "gcplogs"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "gelf"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "journald"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "json-file"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "logentries"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "splunk"
     
                        },
     
                        {
     
                            "Type": "Log",
     
                            "Name": "syslog"
     
                        },
     
                        {
     
                            "Type": "Network",
     
                            "Name": "bridge"
     
                        },
     
                        {
     
                            "Type": "Network",
     
                            "Name": "host"
     
                        },
     
                        {
     
                            "Type": "Network",
     
                            "Name": "macvlan"
     
                        },
     
                        {
     
                            "Type": "Network",
     
                            "Name": "null"
     
                        },
     
                        {
     
                            "Type": "Network",
     
                            "Name": "overlay"
     
                        },
     
                        {
     
                            "Type": "Volume",
     
                            "Name": "local"
     
                        }
     
                    ]
     
                },
     
                "TLSInfo": {
     
                    "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBazCCARCgAwIBAgIUaB6YJMZU6IjDTfwYx4VGlThDQHMwCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTkwNDA5MTkxNTAwWhcNMzkwNDA0MTkx\nNTAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABDQAnPubVV2vycHq7gvRU7HBMinP+g1lW33cverMb56fl+v46/k3fUd1BhW3\nDY5FHI3jtwXsAcWuRy3wjoHQV7OjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBTLECxSNQXj34kV9A0Mi+nLh94CSTAKBggqhkjO\nPQQDAgNJADBGAiEAii9OnMsptZnRuHCdEqylSz76Q24LLoWuWQCqJzkMUM8CIQCR\n0eiXyQudxgbv2thUFCKY9hUZY8o5VxELZBm9BM3RYw==\n-----END CERTIFICATE-----\n",
     
                    "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh",
     
                    "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENACc+5tVXa/JweruC9FTscEyKc/6DWVbfdy96sxvnp+X6/jr+Td9R3UGFbcNjkUcjeO3BewBxa5HLfCOgdBXsw=="
     
                }
     
            },
     
            "Status": {
     
                "State": "ready",
     
                "Addr": "10.0.0.4"
     
            }
     
        }
     
    ]
     
    swarm-manager000000:~$ ssh -i /home/docker/azureswarm_rsa docker@^C
    swarm-manager000000:~$ ssh docker@10.0.0.4
    The authenticity of host '10.0.0.4 (10.0.0.4)' can't be established.
    RSA key fingerprint is SHA256:uVVgZN5YsLkyGSWco+GZvRYcrrOzbVCZKtL3NCuD1Ws.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '10.0.0.4' (RSA) to the list of known hosts.
    Welcome to Docker!
  6. After building the Mashery Local images, transfer the Mashery Local Images to Master machine and Worker Machine.
    1. To transfer the images to Manager Node:
      scp -i ~/.ssh/<your_key> -P 50000 <Image_Name> docker@<Manager_IP>/home/docker
      scp -i ~/.ssh/azureswarm_rsa -P 50000 tml-cache.tar.gz docker@x.x.125.164:/home/docker
       
      tml-cache.tar.gz                                                                                                                                                        100%  251MB  12.5MB/s   00:20   
      scp -i ~/.ssh/azureswarm_rsa -P 50000 tml-cm.tar.gz docker@x.x.125.164:/home/docker
       
      tml-cm.tar.gz                                                                                                                                                           100%  223MB   8.0MB/s   00:28   
       
      scp -i ~/.ssh/azureswarm_rsa -P 50000 tml-log.tar.gz docker@x.x.125.164:/home/docker
       
      tml-log.tar.gz                                                                                                                                                          100%  257MB  12.8MB/s   00:20   
       
      scp -i ~/.ssh/azureswarm_rsa -P 50000 tml-sql.tar.gz docker@x.x.125.164:/home/docker
       
      tml-sql.tar.gz                                                                                                                                                          100%  532MB   8.6MB/s   01:02   
       
       scp -i ~/.ssh/azureswarm_rsa -P 50000 tml-nosql.tar.gz docker@x.x.125.164:/home/docker
       
      tml-nosql.tar.gz                                                                                                                                                         66%  169MB  10.8MB/s   00:07 ETA^tml-nosql.tar.gz                                                                                                                                                        100%  255MB  11.6MB/s   00:22   
       
      scp -i ~/.ssh/azureswarm_rsa -P 50000 tml-tm.tar.gz docker@x.x.125.164:/home/docker
       
      tml-tm.tar.gz                                                                                                                                                           100%  290MB  12.6MB/s   00:23   
       
      scp -i ~/.ssh/azureswarm_rsa -P 50000 tmgc-deploy.tgz docker@x.x.125.164:/home/docker
       
      tmgc-deploy.tgz           
    2. To transfer the images from Manager Node to Worker Node:
      1. Copy the private key into Master Node and use that to connect to Worker Node. Get the IP address of the Worker Node by going to resource group > spawarm > dockerswarm-vnet.

      2. Login to Manager Node:
        ssh -A -i ~/.ssh/azure_rsa -p <portNumber> docker@<manager_ip>
      3. From Manager Node Login to Worker Node:
        scp -i /azure_rsa <Image_Name> docker@<internal IP of Worker Node>:/home/docker