compose-website/unit-files/web@.service

37 lines
1.1 KiB
SYSTEMD
Raw Normal View History

2015-01-15 17:17:26 +00:00
[Unit]
Description=%p-%i
# Requirements
Requires=docker.service
Requires=backup@%i.timer
# Dependency ordering
After=docker.service
Before=backup@%i.timer
[Service]
Restart=always
2015-01-15 16:37:11 +00:00
RestartSec=20
2015-01-16 10:01:44 +00:00
TimeoutStartSec=0
2015-01-15 17:17:26 +00:00
Type=notify
NotifyAccess=all
EnvironmentFile=/data/domains/%i/.env
Environment=URL=%i
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker
ExecStartPre=-/usr/bin/docker kill %i
ExecStartPre=-/usr/bin/docker rm %i
ExecStartPre=/bin/cp /data/domains/%i/TLS/%i.pem /data/runtime/haproxy/approved-certs/%i.pem
ExecStart=/bin/bash -euxc ' \
/opt/bin/systemd-docker --env run \
--rm \
--name %i \
2015-02-16 16:33:03 +00:00
-v /data/runtime/domains/%i/log/apache2:/var/log/apache2 \
2015-01-15 17:17:26 +00:00
${DOCKER_ARGUMENTS} \
pierreozoux/${APPLICATION}'
2015-02-11 16:57:50 +00:00
ExecStartPost=/bin/bash -c ' \
ip=`docker inspect --format \'{{.NetworkSettings.IPAddress}}\' %i`; \
/usr/bin/etcdctl --peers 172.17.42.1:4001 set /services/web/%i \'{"ip":"\'$ip\'", "port":"80"}\'
2015-01-15 17:17:26 +00:00
ExecStop=/usr/bin/docker stop %i
2015-02-11 16:57:50 +00:00
ExecStopPost=-/usr/bin/etcdctl --peers 172.17.42.1:4001 rm /services/web/%i
2015-01-15 17:17:26 +00:00