Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active September 27, 2020 17:54
Show Gist options
  • Save vfarcic/fa57e88faf09651c9a7e9e46c8950ef5 to your computer and use it in GitHub Desktop.
Save vfarcic/fa57e88faf09651c9a7e9e46c8950ef5 to your computer and use it in GitHub Desktop.
git clone https://github.com/vfarcic/cloud-provisioning.git
cd cloud-provisioning
scripts/dm-swarm.sh
eval $(docker-machine env swarm-1)
docker node ls
curl -o docker-compose-proxy.yml \
https://raw.githubusercontent.com/\
vfarcic/docker-flow-proxy/master/docker-compose.yml
cat docker-compose-proxy.yml
export DOCKER_IP=$(docker-machine ip swarm-1)
docker-compose -f docker-compose-proxy.yml \
up -d consul-server
curl -X PUT -d 'this is a test' \
"http://$(docker-machine ip swarm-1):8500/v1/kv/msg1"
curl "http://$(docker-machine ip swarm-1):8500/v1/kv/msg1"
curl "http://$(docker-machine ip swarm-1):8500/v1/kv/msg1?raw"
cat docker-compose-proxy.yml
export CONSUL_SERVER_IP=$(docker-machine ip swarm-1)
for i in 2 3; do
eval $(docker-machine env swarm-$i)
export DOCKER_IP=$(docker-machine ip swarm-$i)
docker-compose -f docker-compose-proxy.yml \
up -d consul-agent
done
curl "http://$(docker-machine ip swarm-2):8500/v1/kv/msg1"
curl -X PUT -d 'this is another test' \
"http://$(docker-machine ip swarm-2):8500/v1/kv/messages/msg2"
curl -X PUT -d 'this is a test with flags' \
"http://$(docker-machine ip swarm-3):8500/v1/kv/messages/msg3?flags=1234"
curl "http://$(docker-machine ip swarm-1):8500/v1/kv/?recurse"
curl -X DELETE "http://$(docker-machine ip swarm-2):8500/v1/kv/?recurse"
curl "http://$(docker-machine ip swarm-3):8500/v1/kv/?recurse"
docker-machine rm -f swarm-1 swarm-2 swarm-3
@aleskinen
Copy link

I tried this by replacing Console part with https://github.com/sdelrio/consul to be able to test consul in swarm mode. I seemd to work, but scaling did not worked. I am still quite novice with this, but should this be possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment