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] [Unit]
Description=%p-%i Description=%p-%i
After=docker.service
After=%p-importer@%i.service # Requirements
Requires=docker.service Requires=docker.service
Requires=%p-importer@%i.service Requires=%p-importer@%i.service
# Dependency ordering
After=docker.service
After=%p-importer@%i.service
[Service] [Service]
Restart=always Restart=always
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStart=/usr/bin/docker run\ ExecStart=/usr/bin/docker run \
--name %p-%i\ --name %p-%i \
-v /data/per-user/%i/%p/data:/var/lib/mysql\ -v /data/per-user/%i/%p/data:/var/lib/mysql \
--env-file /data/per-user/%i/%p/.env\ --env-file /data/per-user/%i/%p/.env \
indiehosters/mysql indiehosters/mysql
ExecReload=/usr/bin/docker restart %p-%i ExecReload=/usr/bin/docker restart %p-%i
ExecStop=/usr/bin/docker stop %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=etcd.service
Requires=wordpress@%i.service Requires=wordpress@%i.service
# Dependency ordering and binding # Dependency ordering
After=etcd.service After=etcd.service
After=wordpress@%i.service After=wordpress@%i.service
# Dependency binding
BindsTo=wordpress@%i.service BindsTo=wordpress@%i.service
[Service] [Service]
# Start # Start
## Test whether service is accessible and then register useful information ## Test whether service is accessible and then register useful information
ExecStart=/bin/bash -c '\ ExecStart=/bin/bash -c ' \
sleep 3; \ sleep 3; \
while true; do \ while true; do \
app=`echo %p | cut -d"-" -f1`; \ app=`echo %p | cut -d"-" -f1`; \
@ -29,6 +30,6 @@ ExecStart=/bin/bash -c '\
done' done'
# Stop # Stop
ExecStop=/bin/bash -ceux '\ ExecStop=/bin/bash -ceux ' \
app=`echo %p | cut -d"-" -f1`;\ app=`echo %p | cut -d"-" -f1`; \
/usr/bin/etcdctl rm /services/$app/%i /usr/bin/etcdctl rm /services/$app/%i

View file

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

View file

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