Skip to content

Instantly share code, notes, and snippets.

@ingoclaro
Created April 20, 2017 22:30
Show Gist options
  • Save ingoclaro/16b742952ffe3288f8182c5db99902aa to your computer and use it in GitHub Desktop.
Save ingoclaro/16b742952ffe3288f8182c5db99902aa to your computer and use it in GitHub Desktop.
dkron inside docker
export HOST=xxxxx
# run this on every node
sudo docker run -p 8946:8946 -p 8946:8946/udp -p 6868:6868 \
--label "traefik.port=8080" \
--label "traefik.frontend.rule=PathPrefixStrip: /dkron" \
-v /usr/local/bin/docker:/usr/local/bin/docker \
-v /var/run/docker.sock:/var/run/docker.sock \
dkron/dkron \
agent -server \
-backend=etcd \
-backend-machine=$(hostname -i):2379 \
-tag role=executor \
-advertise=$(hostname -i) \
-join=${HOST}:8946
curl -X POST -d '{"name": "date-test", "schedule": "*/5 * * * * *", "command": "docker run centos date", "tags":{"role":"executor:1"}, "concurrenty": "disallow"}' http://${HOST}/dkron/v1/jobs
export ETCD_DISCOVERY=$(curl https://discovery.etcd.io/new?size=2)
echo $ETCD_DISCOVERY
#export ETCD_DISCOVERY=
# run this on every node with the same discovery environment variable
sudo docker run -d -p 2380:2380 -p 2379:2379 --name etcd \
-v /etc/ssl/certs/:/etc/ssl/certs \
quay.io/coreos/etcd \
etcd --name $(hostname) \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://$(hostname -i):2379 \
--listen-peer-urls https://0.0.0.0:2380 \
--initial-advertise-peer-urls https://$(hostname -i):2380 \
--peer-auto-tls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment