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

44 lines
1.1 KiB
SYSTEMD
Raw Normal View History

[Unit]
Description=%p-%i
2014-10-27 12:32:21 +00:00
# Requirements
Requires=docker.service
2015-01-11 19:04:01 +00:00
Requires=init@%i.service
Requires=discovery@%i.service
2014-11-04 16:04:55 +00:00
Requires=backup@%i.timer
2014-10-27 12:32:21 +00:00
# Dependency ordering
After=docker.service
2015-01-11 19:04:01 +00:00
After=init@%i.service
Before=discovery@%i.service
2015-01-11 19:04:01 +00:00
Before=backup@%i.timer
[Service]
Restart=always
EnvironmentFile=/data/domains/%i/.env
ExecStartPre=-/usr/bin/docker kill %i
ExecStartPre=-/usr/bin/docker rm %i
2015-01-11 19:04:01 +00:00
ExecStartPre=/bin/bash -euxc ' \
application_folder=/data/domains/%i/%p/www-content; \
2015-01-11 19:04:01 +00:00
if [ ! -d $application_folder ]; then \
mkdir -p $application_folder; \
echo Hello %i > $application_folder/index.html; \
fi'
2015-01-11 19:04:01 +00:00
2014-10-27 12:32:21 +00:00
ExecStart=/usr/bin/docker run \
--name %i \
-v /data/domains/%i/%p/www-content:/app \
2015-01-05 16:35:46 +00:00
pierreozoux/nginx
ExecReload=/bin/bash -euxc ' \
/usr/bin/docker restart %i; \
systemctl restart discovery@%i.service; \
systemctl restart backup@%i.timer;'
ExecStop=/bin/bash -euxc ' \
systemctl stop init@%i.service; \
systemctl stop discovery@%i.service; \
systemctl stop backup@%i.timer; \
/usr/bin/docker stop %i;'
[Install]
WantedBy=multi-user.target