An IaaS Docker Swarm Consumer Edition
PreRequisites
Requires the use of direnv. Requires the use of Azure CLI. Requires the use of Docker.
Environment Settings are stored in the .envrc file. When installing the swarm this file will be automatically created that then keeps locally the Service Principal information.
# SSH to the Manager Node
ResourceGroup="demo-swarm"
IPName="$ResourceGroup-nat-ip"
NatLB="$(az network public-ip show --resource-group $ResourceGroup --name $IPName --query ipAddress -otsv)"
ssh docker@$NatLB -p 50000
# Transfer Keys to the Manager to enable SSH to workers
scp -P 50000 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub docker@$NatLB:/home/docker/.ssh
# Deploying and Updating Docker Stacks
docker stack deploy -c <path_to_your_compose> <stackname>
docker stack up deploy -c <path_to_your_compose> <stackname>
# Startup the Visualizer Service
docker service create \
--name=viz \
--publish=8080:8080/tcp \
--constraint=node.role==manager \
--mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
dockersamples/visualizer
curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
docker stack deploy --compose-file=portainer-agent-stack.yml portainer
docker service create \
--name portainer \
--publish 9000:9000 \
--replicas=1 \
--constraint 'node.role == manager' \
--mount type=bind,src=$(pwd)/data,dst=/data \
portainer/portainer
Configure the CloudStor Plugin on all the servers
STORAGE_NAME=""
STORAGE_KEY=""
docker plugin set cloudstor:azure \
AZURE_STORAGE_ACCOUNT=$STORAGE_NAME
AZURE_STORAGE_ACCOUNT_KEY=$STORAGE_KEY
docker plugin enable cloudstor:azure
# Startup Voting App
wget https://raw.githubusercontent.com/danielscholl/docker-for-azure/master/apps/docker-compose-votingapp.yml && \
docker stack deploy \
-c docker-compose-votingapp.yml \
votingapp
# Startup Voting App
URL="https://raw.githubusercontent.com/danielscholl/docker-for-azure/master/apps/docker-compose-votingapp.yml"
wget $URL && \
docker stack deploy \
-c docker-compose-votingapp.yml \
votingapp
- Vote: http://swarmLB:5002/
- Voting Results: http://swarmLB:5003