Skip to content

Instantly share code, notes, and snippets.

@suryakencana007
Last active July 21, 2020 02:24
Show Gist options
  • Save suryakencana007/3f0dd010dc1fffd35bb8e982ac530e6e to your computer and use it in GitHub Desktop.
Save suryakencana007/3f0dd010dc1fffd35bb8e982ac530e6e to your computer and use it in GitHub Desktop.
machine and swarm
#!/bin/bash
docker-machine create --driver generic --generic-ip-address=<ip-vps> --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user=ubuntu node-neo-01
#!/bin/bash
for i in 1 2 3; do
docker-machine rm -f swarm-$i
done
#!/bin/bash
docker-machine create -d virtualbox --virtualbox-memory 6144 swarm-1
for i in 2 3; do
docker-machine create -d virtualbox swarm-$i
done
eval "$(docker-machine env swarm-1)"
docker swarm init --advertise-addr $(docker-machine ip swarm-1)
docker-machine ssh swarm-1 "sudo mkdir -p /data/elasticsearch/data && sudo chown -R 1000.1000 /data"
docker-machine ssh swarm-1 "echo 'vm.max_map_count=262144' | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"
docker-machine ssh swarm-1 "sudo mkdir -p /data/prometheus/data && sudo chown -R 1000.1000 /data"
docker-machine ssh swarm-1 "sudo mkdir -p /data/grafana/data && sudo chown -R 1000.1000 /data"
JOIN_TOKEN=$(docker swarm join-token -q worker)
for i in 2 3; do
eval "$(docker-machine env swarm-$i)"
docker swarm join --token $JOIN_TOKEN \
--advertise-addr $(docker-machine ip swarm-$i) \
$(docker-machine ip swarm-1):2377
done
eval "$(docker-machine env swarm-1)"
echo '
input {
syslog { port => 51415 }
}
output {
elasticsearch {
hosts => ["http://elasticsearch:9200"]
}
}
' | docker config create logstash.conf -
docker network create -d overlay monitor
docker stack deploy -c logging-stack.yml logging
docker stack deploy -c exporters-stack.yml exporte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment