[Unit]
Description=App Redis Sidekick
Requires=docker.service
Requires=etcd.service
After=docker.service
After=etcd.service
After=app-redis.service
BindsTo=app-redis.service
[Service]
EnvironmentFile=/etc/environment
User=core
TimeoutStartSec=0
ExecStart=/bin/bash -c '\
while true; do \
port=$(docker inspect --format=\'{{(index (index .NetworkSettings.Ports "6379/tcp") 0).HostPort}}\' app-redis.service); \
etcdctl set /services/app-redis/dfw ${COREOS_PRIVATE_IPV4}:$port --ttl 10; \
sleep 5; \
done'
ExecStop=/usr/bin/etcdctl rm /services/app-redis/dfw
[X-Fleet]
MachineOf=app-redis.service