Skip to content
Snippets Groups Projects
Commit 2615ba9f authored by Pierre Ozoux's avatar Pierre Ozoux
Browse files

All services modularised \o/

parent 2549a8ba
No related branches found
No related tags found
No related merge requests found
[Unit]
Description=%p-%i
# Requirements
Requires=mysql@%i.service
Requires=web@%i.service
# Dependency ordering
After=mysql@%i.service
Before=web@%i.service
# Dependency binding
BindsTo=web@%i.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/data/domains/%i/.env
ExecStart=/bin/bash -euxc ' \
application_folder=/data/domains/%i/${APPLICATION}; \
if [ ! -f $application_folder/.env ]; then \
cat /data/domains/%i/mysql/.env | sed s/MYSQL_PASS/DB_PASS/ > $application_folder/.env; \
fi;'
[Install]
WantedBy=multi-user.target
[Unit]
Description=%p-%i
# Requirements
Requires=docker.service
# Dependency ordering
After=docker.service
Before=backup@%i.timer
# Dependency binding
BindsTo=lamp@%i.service
[Service]
Restart=always
RestartSec=20
TimeoutStartSec=0
Type=notify
NotifyAccess=all
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStartPre=/bin/bash -euxc ' \
mysql_folder=/data/domains/%i/mysql; \
if [ ! -d /data/runtime/domains/%i/mysql ]; then \
mkdir -p /data/runtime/domains/%i/mysql/db_files; \
if [ ! -d $mysql_folder ]; then \
mkdir -p $mysql_folder; \
pass=`echo $RANDOM ${date} | md5sum | base64 | cut -c-10`; \
echo MYSQL_PASS=$pass > $mysql_folder/.env; \
fi; \
fi'
ExecStart=/opt/bin/systemd-docker run \
--rm \
--name %p-%i \
-v /data/runtime/domains/%i/log/mysql:/var/log/mysql \
-v /data/runtime/domains/%i/%p/db_files:/var/lib/mysql \
--env-file /data/domains/%i/%p/.env \
indiepaas/mysql
ExecReload=/usr/bin/docker restart %p-%i
ExecStop=/usr/bin/docker stop %p-%i
[Unit]
Description=%p-%i
# Requirements
Requires=web@%i.service
# Dependency ordering
Before=web@%i.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/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'
[Install]
WantedBy=multi-user.target
[Unit]
Description=%p-%i
# Requirements
Requires=docker.service
Requires=discovery@%i.service
Requires=backup@%i.timer
# Dependency ordering
After=docker.service
Before=discovery@%i.service
Before=backup@%i.timer
[Service]
Restart=always
RestartSec=10
TimeoutStartSec=60
TimeoutStopSec=15
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 \
-v /data/runtime/domains/%i/log/apache2:/var/log/apache2 \
${DOCKER_ARGUMENTS} \
indiepaas/${APPLICATION}'
ExecReload=/usr/bin/docker restart %i
ExecStop=/usr/bin/docker stop %i
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment