Codestyle

This commit is contained in:
pierreozoux 2014-10-28 16:24:00 +00:00
parent 0907750c79
commit c5a51e7fe8
5 changed files with 35 additions and 25 deletions

View file

@ -1,18 +1,23 @@
[Unit]
Description=%p-%i
After=docker.service
After=%p-importer@%i.service
# Requirements
Requires=docker.service
Requires=%p-importer@%i.service
# Dependency ordering
After=docker.service
After=%p-importer@%i.service
[Service]
Restart=always
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStart=/usr/bin/docker run\
--name %p-%i\
-v /data/per-user/%i/%p/data:/var/lib/mysql\
--env-file /data/per-user/%i/%p/.env\
indiehosters/mysql
ExecStart=/usr/bin/docker run \
--name %p-%i \
-v /data/per-user/%i/%p/data:/var/lib/mysql \
--env-file /data/per-user/%i/%p/.env \
indiehosters/mysql
ExecReload=/usr/bin/docker restart %p-%i
ExecStop=/usr/bin/docker stop %p-%i

View file

@ -5,16 +5,17 @@ Description=%p for %i etcd registration
Requires=etcd.service
Requires=wordpress@%i.service
# Dependency ordering and binding
# Dependency ordering
After=etcd.service
After=wordpress@%i.service
# Dependency binding
BindsTo=wordpress@%i.service
[Service]
# Start
## Test whether service is accessible and then register useful information
ExecStart=/bin/bash -c '\
ExecStart=/bin/bash -c ' \
sleep 3; \
while true; do \
app=`echo %p | cut -d"-" -f1`; \
@ -29,6 +30,6 @@ ExecStart=/bin/bash -c '\
done'
# Stop
ExecStop=/bin/bash -ceux '\
app=`echo %p | cut -d"-" -f1`;\
ExecStop=/bin/bash -ceux ' \
app=`echo %p | cut -d"-" -f1`; \
/usr/bin/etcdctl rm /services/$app/%i

View file

@ -1,5 +1,7 @@
[Unit]
Description=WordPress importer
# Dependency ordering
After=mysql-importer@%i.service
Before=wordpress@%i.service

View file

@ -1,14 +1,16 @@
[Unit]
Description=%p-%i
After=docker.service
Requires=etcd.service
# Requirements
Requires=docker.service
Requires=etcd.service
Requires=mysql@%i.service
After=mysql@%i.service
Requires=%p-importer@%i.service
Requires=%p-discovery@%i.service
# Dependency ordering
After=docker.service
After=mysql@%i.service
After=%p-importer@%i.service
Before=%p-discovery@%i.service
@ -16,13 +18,13 @@ Before=%p-discovery@%i.service
Restart=always
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStart=/usr/bin/docker run\
--name %p-%i\
--link mysql-%i:db\
-v /data/per-user/%i/%p/data/wp-content:/app/wp-content\
-v /data/per-user/%i/%p/data/.htaccess:/app/.htaccess\
--env-file /data/per-user/%i/%p/.env\
indiehosters/wordpress
ExecStart=/usr/bin/docker run \
--name %p-%i \
--link mysql-%i:db \
-v /data/per-user/%i/%p/data/wp-content:/app/wp-content \
-v /data/per-user/%i/%p/data/.htaccess:/app/.htaccess \
--env-file /data/per-user/%i/%p/.env \
indiehosters/wordpress
ExecReload=/usr/bin/docker restart %p-%i
ExecStop=/usr/bin/docker stop %p-%i