abc-epg@.service Unit File
[Unit]
Description=abc EPG Service
Wants=epg-discovery@%i.service
Before=epg-discovery@%i.service
# Requirements
Requires=etcd.service
Requires=docker.service
# Dependency ordering
After=etcd.service
After=docker.service
[Service]
User=core
# Let processes take awhile to start up (for first run Docker containers)
TimeoutStartSec=0
# Change killmode from "control-group" to "none" to let Docker remove
# work correctly.
KillMode=none
# Get CoreOS environmental variables
EnvironmentFile=/etc/environment
# Pre-start and Start
## Directives with "=-" are allowed to fail without consequence
ExecStartPre=-/usr/bin/docker kill abc-epg
ExecStartPre=-/usr/bin/docker rm abc-epg
ExecStartPre=/usr/bin/docker -D pull abcuser/abc-repository:abc-epg
ExecStart=/usr/bin/docker run --name abc-epg -p 8080:8080 abcuser/abc-repository:abc-epg
# Stop
ExecStop=/usr/bin/docker stop abc-epg
TimeoutStartSec=5m
TimeoutStopSec=20s
RestartSec=30s
[X-Fleet]
X-Conflicts=abc-epg@*.service
epg-discovery@.service Unit File
[Unit]
Description=abc etcd Service
# Requirements
Requires=etcd.service
# Dependency ordering
After=etcd.service
After=abc-epg@%i.service
BindsTo=abc-epg@%i.service
[Service]
User=core
# Let processes take awhile to start up (for first run Docker containers)
TimeoutStartSec=0
# Change killmode from "control-group" to "none" to let Docker remove
# work correctly.
KillMode=none
# Get CoreOS environmental variables
EnvironmentFile=/etc/environment
# Pre-start and Start
## Directives with "=-" are allowed to fail without consequence
ExecStart=/bin/bash -c '\
while true; do \
curl -f ${COREOS_PUBLIC_IPV4}:8080; \
if [ $? -eq 0 ]; then \
etcdctl set /services/epg/${COREOS_PUBLIC_IPV4} ${COREOS_PUBLIC_IPV4}:8080 --ttl 30; \
else \
etcdctl rm /services/epg/${COREOS_PUBLIC_IPV4}; \
fi; \
sleep 20; \
done'
[X-Fleet]
X-ConditionMachineOf=abc-epg@%i.service
With the aforementioned configuration, with wants and after, the discovery unit must be started right after the service unit right ? But eventhough the service unit is started successfully, the discovery unit is not. Any problems with my config. ?