Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploy Sematext Docker Agent each node in Docker-Swarm (TLS / docker-machine)
export SPM_TOKEN=TOUR_SPM_TOKEN
export LOGSENE_TOKEN=YOUR_LOGSENE_TOKEN
export NODES=$(docker-machine ls | grep Running | grep -v error | awk '{printf $1 "\t"}')
echo Swarm nodes: "$NODES"
for node in $NODES; do
echo "get docker-machine env $node"
eval "$(docker-machine env $node)"
echo "Using docker host: $DOCKER_HOST"
echo "deploy sematext-agent-docker to $node"
docker rm -f sematext-agent 2>1 /dev/null
docker pull sematext/sematext-agent-docker > /dev/null
docker run -d --name sematext-agent --restart=always \
-e SPM_TOKEN \
-e LOGSENE_TOKEN \
-e HOSTNAME=$node \
-e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH -e DOCKER_HOST \
-v $DOCKER_CERT_PATH:$DOCKER_CERT_PATH sematext/sematext-agent-docker
sleep 2
docker logs sematext-agent | grep -e "error|fail|exception"
done
@megastef

This comment has been minimized.

Copy link
Owner Author

@megastef megastef commented Jan 11, 2016

@megastef

This comment has been minimized.

Copy link
Owner Author

@megastef megastef commented Jan 14, 2016

@Richard-Mathie

This comment has been minimized.

Copy link

@Richard-Mathie Richard-Mathie commented Apr 14, 2016

So I dont think this works on a real cluster (aws not virtualbox) as DOCKER_CERT_PATH won't be local to the host machine. If you fired up the hosts with docker-machine on aws the certs for that machine will be in /etc/docker. However cert.pem will not reside on those machines and It appears sematext-agent needs that for some reason.

Only way i got it running was through the unix socket

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