-
Notifications
You must be signed in to change notification settings - Fork 4
30 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[Unit]
Description=HAProxy for CyCore Services
After=docker.service
After=ccproxy@%i.service
Wants=ccproxy@%i.service
[Service]
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill %p
ExecStartPre=-/usr/bin/docker rm %p
ExecStartPre=/usr/bin/mkdir -p /data/haproxy.cycore/certs
ExecStartPre=/usr/bin/touch /data/haproxy.cycore/haproxy.cfg
ExecStart=/usr/bin/docker run --rm --name %p --net=host \
-v /data/haproxy.cycore/certs:/data/certs \
-v /data/haproxy.cycore/haproxy.cfg:/etc/haproxy.cfg \
haproxy haproxy -f /etc/haproxy.cfg -p /var/run/haproxy.pid
ExecStopPost=-/usr/bin/docker kill %p
ExecStopPost=-/usr/bin/docker rm %p
# Reload does not work because:
# a) haproxy terminates and restarts its process
# b) haproxy runs as PID 1 of its container
# c) a + b => container exits
#ExecReload=/usr/bin/docker exec %p haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf
Restart=always
RestartSec=1s
TimeoutStartSec=120
TimeoutStopSec=15
[X-Fleet]
MachineOf=ccproxy@%i.service