Skip to content
Anandkumar Patel edited this page Apr 28, 2016 · 10 revisions

Swarm Celsitudo

Herein lies the incantations, most arcane, that are required to setup and use swarm on your local computing machina.

Setup

  1. Install docker-toolbox
  2. Clone devops-scripts GitHub repository (note the full installation path for step 4)
  3. Copy devops-scripts/ansible/roles/docker_client/ca.pem into devops-scripts/ansible/roles/docker_client/files/certs/swarm-manager
  4. Add the following to your ~/.bash_profile:
# You may already have this, if you have installed and setup docks-cli:
export DEVOPS_SCRIPTS_PATH=<path_to_devops_scripts>

# Required to setup the SSH tunnel to swarm
export DOCKER_HOST=tcp://localhost:2375
export DOCKER_CERT_PATH="${DEVOPS_SCRIPTS_PATH}/ansible/roles/docker_client/files/certs/swarm-manager"
export DOCKER_TLS_VERIFY=1

# Used to create blocking tunnel to swarm host
# usage: setupSwarm <services_host>
alias setupSwarm='ssh -NL 2375:localhost:2375'

# Sugar functions you will normally use
alias setupSwarmGamma='setupSwarm gamma-dock-services'
alias setupSwarmDelta='setupSwarm delta-swarm-manager'

Note: you will need to replace <path_to_devops_scripts> with the full path you noted in step 2.

Note: if you want, you can run the tunnels in the background:

alias setupSwarm='ssh -NL 2375:localhost:2375 -fq'
alias clearSwarm='echo "clearing all swarm tunnels." ; kill -9 `ps aux|grep 2375\: | grep -v grep | awk '"'"'{printf("%s ",$2);}'"'"'`' 

Usage

  1. Run either setupSwarmGamma or setupSwarmDelta in one shell
  • Note: you will need to dedicate one shell to run this command, it is a blocking call. To stop the tunnel simply press control + c in this shell
  1. In any other shell you are now able to run any docker commands:
  • docker ps - list all running containers across the entire environment
  • docker info - list all docks with nice info

one liners

view dock info per org

docker info | grep -B5 <org_github_id>
Clone this wiki locally