I try to replace my docker-gen (single host) with rancher-gen (multi host, rancher environment). With the docker-gen I have a simple shell script to send a sigusr1 signal to a docker container via docker.sock.
#!/bin/sh
set -x
REVPROXY_CADDY=${REVPROXY_CADDY:-"REVPROXY_CADDY"}
DOCKER_HOST=${DOCKER_HOST:-"/tmp/docker.sock"}
DOCKER_SOCK=${DOCKER_HOST#unix://}
CONTAINER=$(echo -e "GET /containers/json?filters={\"label\":[\"$REVPROXY_CADDY\"]} HTTP/1.0\r\n" | nc -U $DOCKER_SOCK | grep -o '"Id":".*","Names"' | sed 's/^"Id":"//' | sed 's/","Names"//')
echo -e "POST /containers/$CONTAINER/kill?signal=SIGUSR1 HTTP/1.0\r\n" | nc -U $DOCKER_SOCK
How to do it the rancher way?