Refactors directory structure

This commit is contained in:
pierreozoux 2014-11-04 19:25:39 +00:00
parent d8c82736ad
commit 4beb94f5ec
8 changed files with 25 additions and 20 deletions

Binary file not shown.

View file

@ -1,6 +0,0 @@
#!/bin/bash -eux
if [ ! -d "/data/domains/$DOMAIN/mysql/data" ]; then
mkdir -p /data/domains/$DOMAIN/mysql/data
echo MYSQL_PASS=`echo $RANDOM ${date} | md5sum | base64 | cut -c-10` > /data/domains/$DOMAIN/mysql/.env
fi

View file

@ -1,8 +0,0 @@
#!/bin/bash -eux
if [ ! -d "/data/domains/$DOMAIN/wordpress/data" ]; then
cd /data/domains/$DOMAIN/
tar xvzf /data/indiehosters/blueprints/wordpress.tgz
fi
cat /data/domains/$DOMAIN/mysql/.env | sed s/MYSQL_PASS/DB_PASS/ > /data/domains/$DOMAIN/wordpress/.env

View file

@ -10,8 +10,14 @@ BindsTo=mysql@%i.service
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
Environment=DOMAIN=%i ExecStart=/bin/bash -euxc ' \
ExecStart=/data/indiehosters/importers/mysql.sh folder=/data/domains/%i/mysql; \
if [ ! -d $folder ]; then \
mkdir -p $folder; \
pass=`echo $RANDOM ${date} | md5sum | base64 | cut -c-10`; \
echo MYSQL_PASS=$pass > $folder/.env; \
fi; \
mkdir -p /data/runtime/domains/%i/mysql/db_files'
[Install] [Install]
WantedBy=mysql@%i.service WantedBy=mysql@%i.service

View file

@ -15,7 +15,7 @@ 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/domains/%i/%p/data:/var/lib/mysql \ -v /data/runtime/domains/%i/%p/db_files:/var/lib/mysql \
--env-file /data/domains/%i/%p/.env \ --env-file /data/domains/%i/%p/.env \
indiehosters/mysql indiehosters/mysql
ExecReload=/usr/bin/docker restart %p-%i ExecReload=/usr/bin/docker restart %p-%i

View file

@ -8,11 +8,13 @@ Before=static-git@%i.service
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/bin/bash -euxc ' \ ExecStart=/bin/bash -euxc ' \
domain_folder=/data/domains/%i; \
cp $domain_folder/TLS/%i.pem /data/runtime/haproxy/approved-certs/%i.pem; \
runtime_folder=/data/runtime/domains/%i/static-git; \ runtime_folder=/data/runtime/domains/%i/static-git; \
mkdir -p $runtime_folder; \ mkdir -p $runtime_folder; \
git_folder=$runtime_folder/www-content; \ git_folder=$runtime_folder/www-content; \
if [ ! -d $git_folder/.git ]; then \ if [ ! -d $git_folder/.git ]; then \
git clone `cat /data/domains/%i/static-git/GITURL` $git_folder; \ git clone `cat $domain_folder/static-git/GITURL` $git_folder; \
fi;' fi;'
[Install] [Install]

View file

@ -8,7 +8,9 @@ Before=static@%i.service
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/bin/bash -euxc ' \ ExecStart=/bin/bash -euxc ' \
folder=/data/domains/%i/static/www-content; \ domain_folder=/data/domains/%i; \
cp $domain_folder/TLS/%i.pem /data/runtime/haproxy/approved-certs/%i.pem; \
folder=$domain_folder/static/www-content; \
mkdir -p $folder; \ mkdir -p $folder; \
if [ ! -f $folder/index.html ]; then \ if [ ! -f $folder/index.html ]; then \
echo Hello %i > $folder/index.html; \ echo Hello %i > $folder/index.html; \

View file

@ -12,7 +12,16 @@ BindsTo=wordpress@%i.service
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
Environment=DOMAIN=%i Environment=DOMAIN=%i
ExecStart=/data/indiehosters/importers/wordpress.sh ExecStart=/bin/bash -euxc ' \
domain_folder=/data/domains/%i; \
cp $domain_folder/TLS/%i.pem /data/runtime/haproxy/approved-certs/%i.pem; \
if [ ! -d $domain_folder/wordpress/wp-content ]; then \
mkdir -p $domain_folder/wordpress/; \
cd $domain_folder/wordpress/; \
tar xvzf /data/indiehosters/blueprints/wordpress.tgz; \
fi; \
cat $domain_folder/mysql/.env | sed s/MYSQL_PASS/DB_PASS/ > $domain_folder/wordpress/.env'
[Install] [Install]
WantedBy=wordpress@%i.service WantedBy=wordpress@%i.service