compose-website/unit-files/static@.service
2015-01-12 14:35:31 +01:00

42 lines
1 KiB
Desktop File

[Unit]
Description=%p-%i
# Requirements
Requires=docker.service
Requires=init@%i.service
Requires=discovery@%i.service
Requires=backup@%i.timer
# Dependency ordering
After=docker.service
After=init@%i.service
Before=discovery@%i.service
Before=backup@%i.timer
[Service]
Restart=always
EnvironmentFile=/data/domains/%i/.env
ExecStartPre=-/usr/bin/docker kill %i
ExecStartPre=-/usr/bin/docker rm %i
ExecStartPre=/bin/bash -euxc ' \
application_folder=/data/domains/%i/%p/www-content; \
if [ ! -d $application_folder ]; then \
mkdir -p $application_folder; \
echo Hello %i > $application_folder/index.html; \
fi'
ExecStart=/usr/bin/docker run \
--name %i \
-v /data/domains/%i/%p/www-content:/app \
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 discovery@%i.service; \
systemctl stop backup@%i.timer; \
/usr/bin/docker stop %i;'
[Install]
WantedBy=multi-user.target