Last active
August 29, 2015 14:14
-
-
Save mdobson/04246d9eff9b94d7b0b8 to your computer and use it in GitHub Desktop.
Zetta Fleet Service
This file contains hidden or 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
[Unit] | |
Description=Zetta API | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
TimeoutStartSec=0 | |
ExecStartPre=-/usr/bin/docker kill zetta | |
ExecStartPre=-/usr/bin/docker rm zetta | |
ExecStartPre=/usr/bin/docker pull mdobson/zetta-docker | |
ExecStart=/usr/bin/docker run -rm --name zetta -p 80:3000 mdobson/zetta-docker | |
ExecStop=/usr/bin/docker stop zetta | |
[X-Fleet] | |
Conflicts=zetta@*.service |
This file contains hidden or 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
[Unit] | |
Description=Zetta Sidekick Process | |
Requires=etcd.service | |
Requires=zetta@%i.service | |
After=etcd.service | |
After=zetta@%i.service | |
BindsTo=zetta@%i.service | |
[Service] | |
EnvironmentFile=/etc/environment | |
ExecStart=/bin/bash -c '\ | |
while true; do \ | |
curl -f ${COREOS_PUBLIC_IPV4}:80; \ | |
if [ $? -eq 0]; then \ | |
etcdctl set /services/zetta/${COREOS_PUBLIC_IPV4} \'{"host": "%H", "ipv4_addr":${COREOS_PUBLIC_IPV4}, "port": 80}\' --ttl 30; \ | |
else \ | |
etcdctl rm /services/zetta/${COREOS_PUBLIC_IPV4}; \ | |
fi; \ | |
sleep 20; \ | |
done' | |
ExecStop=/usr/bin/etcdctl rm /services/zetta/${COREOS_PUBLIC_IPV4} | |
[X-Fleet] | |
X-ConditionMachineOf=zetta@%i.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment