Skip to content

Instantly share code, notes, and snippets.

@shivannakarthik
Forked from initcron/swarm_tutorial_v3.md
Created August 8, 2017 08:33
Show Gist options
  • Save shivannakarthik/a2bc4dcdb9093e61c7343a0b32c0a879 to your computer and use it in GitHub Desktop.
Save shivannakarthik/a2bc4dcdb9093e61c7343a0b32c0a879 to your computer and use it in GitHub Desktop.

Revisions

  1. @initcron initcron revised this gist Jun 29, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Lab : Orchestrating and deploying app in Production with SWARM

    ## Deploying Application Stack with Swarm Mode and Stack version "3" specification


  2. @initcron initcron revised this gist Jun 29, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -61,7 +61,7 @@ docker service inspect
    ```

    ```
    docker service update --publish-add 80:5000 vote
    docker service update --publish-add 80:80 vote
    ```

    Try accessing port 80 on any of the nodes in the swarm cluster to validate.
  3. @initcron initcron revised this gist Jun 16, 2017. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -91,7 +91,7 @@ docker network inspect custom-01
    docker service rm vote
    ```

    ## Creating Docker Stack Definition
    ## Orchestrating Applications with Stack Deploy

    Copy compose file v3 into docker stack file

    @@ -121,5 +121,8 @@ docker service ls
    docker service scale voting_vote=4
    ```

    ### Creating Deploy Specs




  4. @initcron initcron revised this gist Jun 16, 2017. 1 changed file with 55 additions and 0 deletions.
    55 changes: 55 additions & 0 deletions swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,61 @@ docker swarm init --advertise-addr _IPADDR_

    Note down the command sequence to join swarm node, and execute it on all the other nodes which will form this swarm cluster. Verify the swarm is created by checking the visualizer.

    To recall join tokens for worker nodes, you could use
    ```
    docker swarm join-token worker
    ```

    [Sample Output]
    ```
    docker swarm join \
    --token SWMTKN-1-07fyl870ztlnrk8i2d58jn1igtrldahiwb2o6plf87dasa34dq-4ej0sofwoy4e62vgu6rvpcfys \
    138.197.71.9:2377
    ```

    ## Deploying Service with swarm - The imperative way

    ```sh
    docker service create --name vote schoolofdevops/vote
    ```


    ```sh
    docker service ls
    docker service inspect

    ```

    ```
    docker service update --publish-add 80:5000 vote
    ```

    Try accessing port 80 on any of the nodes in the swarm cluster to validate.



    #### Scaling a service
    ```
    docker service scale vote=4
    docker service ls
    docker service scale vote=2
    ```
    #### Adding service to a overlay network

    ```
    docker network ls
    docker network create --driver overlay custom-01
    docker network ls
    docker service update --network-add custom-01 vote
    docker network inspect custom-01
    ```

    #### Cleaning Up

    ```
    docker service rm vote
    ```

    ## Creating Docker Stack Definition

  5. @initcron initcron revised this gist May 23, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Deploying Application Stack with Swarm Mode and Stack version "3" specification


    ### Launch a Visualizer
    ### Launch a Visualizer on Master (SWARM Manager)


    ```
  6. @initcron initcron revised this gist Mar 2, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,9 @@ Copy compose file v3 into docker stack file
    cp docker-compose-v3.yml docker-stack.yml
    ```

    Edit docker-stack.yml and update network driver from **bridge** to **overlay**


    Deploy a stack

    ```
  7. @initcron initcron revised this gist Feb 3, 2017. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -36,5 +36,32 @@ docker swarm init --advertise-addr _IPADDR_
    Note down the command sequence to join swarm node, and execute it on all the other nodes which will form this swarm cluster. Verify the swarm is created by checking the visualizer.


    ## Creating Docker Stack Definition

    Copy compose file v3 into docker stack file

    ```
    cp docker-compose-v3.yml docker-stack.yml
    ```

    Deploy a stack

    ```
    docker stack deploy --compose-file docker-stack.yml voting
    ```

    Validate

    ```
    docker stack ls
    docker stack services voting
    docker service ls
    docker service scale voting_vote=4
    ```



  8. @initcron initcron revised this gist Feb 3, 2017. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ## Create a Docker Swarm Cluster

    ## Deploying Application Stack with Swarm Mode and Stack version "3" specification

    ### Launch a Visualizer

    @@ -23,7 +23,7 @@ ip addr
    Note down the IP address, lets call it as _IPADDR_


    ### Setup Master
    ### Setup Swarm Cluster

    On the master node, initialize swarm

    @@ -33,3 +33,8 @@ docker swarm init --advertise-addr _IPADDR_
    ```

    Note down the command sequence to join swarm node, and execute it on all the other nodes which will form this swarm cluster. Verify the swarm is created by checking the visualizer.




  9. @initcron initcron created this gist Feb 3, 2017.
    35 changes: 35 additions & 0 deletions swarm_tutorial_v3.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ## Create a Docker Swarm Cluster


    ### Launch a Visualizer


    ```
    docker run -itd -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock schoolofdevops/visualizer
    ```

    Find out the IP address of the node which would be designated as master

    ```
    ifconfig
    or
    ip addr
    ```

    Note down the IP address, lets call it as _IPADDR_


    ### Setup Master

    On the master node, initialize swarm

    ```
    docker swarm init --advertise-addr _IPADDR_
    ```