17 lines
416 B
Desktop File
17 lines
416 B
Desktop File
[Unit]
|
|
Description=%p for %i etcd registration
|
|
|
|
# Requirements
|
|
Requires=etcd.service
|
|
|
|
# Dependency binding
|
|
BindsTo=web@%i.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
ExecStart=/bin/bash -euxc ' \
|
|
ip=`docker inspect --format \'{{.NetworkSettings.IPAddress}}\' %i`; \
|
|
etcdctl --peers 172.17.42.1:4001 set /services/web/%i \'{"ip":"\'$ip\'", "port":"80"}\';'
|
|
ExecStop=-/usr/bin/etcdctl rm /services/web/%i
|
|
|