Created
November 20, 2014 18:13
-
-
Save cap10morgan/70f6f4d059c26b41da29 to your computer and use it in GitHub Desktop.
Systemd dependent units
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This one is running on all 3 CoreOS hosts | |
# consul@.service | |
[Unit] | |
Description=Consul | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
EnvironmentFile=/etc/environment | |
TimeoutStartSec=0 | |
ExecStartPre=mkdir -p /var/lib/consul | |
ExecStartPre=-/usr/bin/docker kill consul | |
ExecStartPre=-/usr/bin/docker rm consul | |
ExecStartPre=/usr/bin/docker pull cap10morgan/consul-coreos | |
ExecStart=/bin/bash -c 'MACHINE_ID=$(</etc/machine-id); /usr/bin/docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock cap10morgan/consul-coreos ${COREOS_PRIVATE_IPV4} $${MACHINE_ID}' | |
ExecStop=/usr/bin/docker stop consul | |
ExecStopPost=/bin/bash -c 'MACHINE_ID=$(</etc/machine-id); /usr/bin/etcdctl rm /consul.io/bootstrap/machines/$${MACHINE_ID}' | |
[X-Fleet] | |
Conflicts=consul@*.service | |
# But this one is not | |
# registrator@.service | |
[Unit] | |
Description=Registrator | |
After=consul.service | |
Requires=consul.service | |
[Service] | |
ExecStartPre=-/usr/bin/docker kill registrator | |
ExecStartPre=-/usr/bin/docker rm registrator | |
ExecStartPre=/usr/bin/docker pull progrium/registrator | |
ExecStart=/usr/bin/docker run --volume /var/run/docker.sock:/var/run/docker.sock --hostname ${HOSTNAME} --name registrator progrium/registrator consul: | |
ExecStop=/usr/bin/docker stop registrator | |
[X-Fleet] | |
Conflicts=registrator@*.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment