Zankaria
2 months ago
6 changed files with 131 additions and 40 deletions
@ -1,31 +1,32 @@ |
|||||
#!/bin/sh |
#!/bin/sh |
||||
|
|
||||
set -eu |
#set -eu |
||||
|
# |
||||
install -m 544 -o www-data -g www-data -d /var/www |
#install -m 544 -o www-data -g www-data -d /var/www |
||||
ln -s \ |
#ln -s \ |
||||
/code/banners/ \ |
# /code/banners/ \ |
||||
/code/static/ \ |
# /code/static/ \ |
||||
/code/stylesheets/ \ |
# /code/stylesheets/ \ |
||||
/code/tools/ \ |
# /code/tools/ \ |
||||
/code/walls/ \ |
# /code/walls/ \ |
||||
/code/*.php \ |
# /code/*.php \ |
||||
/code/404.html \ |
# /code/404.html \ |
||||
/code/LICENSE.* \ |
# /code/LICENSE.* \ |
||||
/code/robots.txt \ |
# /code/robots.txt \ |
||||
/code/install.sql \ |
# /code/install.sql \ |
||||
/var/www/ |
# /var/www/ |
||||
|
# |
||||
install -m 540 -o www-data -g www-data -d /var/tmp/leftypol |
#install -m 540 -o www-data -g www-data -d /var/tmp/leftypol |
||||
install -m 540 -o www-data -g www-data -d /var/tmp/leftypol/cache |
#install -m 540 -o www-data -g www-data -d /var/tmp/leftypol/cache |
||||
ln -s /var/tmp/leftypol /var/www/tmp |
#ln -s /var/tmp/leftypol /var/www/tmp |
||||
|
# |
||||
install -m 544 -o www-data -g www-data -d /var/www/js |
#install -m 544 -o www-data -g www-data -d /var/www/js |
||||
ln -s /code/js/* /var/www/js/ |
#ln -s /code/js/* /var/www/js/ |
||||
|
# |
||||
install -m 544 -o www-data -g www-data -d /var/www/templates |
#install -m 544 -o www-data -g www-data -d /var/www/templates |
||||
install -m 544 -o www-data -g www-data -d /var/www/templates/cache |
#install -m 544 -o www-data -g www-data -d /var/www/templates/cache |
||||
ln -s /code/templates/* /var/www/templates/ |
#ln -s /code/templates/* /var/www/templates/ |
||||
|
# |
||||
install -m 544 -o www-data -g www-data -d /var/www/inc |
#install -m 544 -o www-data -g www-data -d /var/www/inc |
||||
ln -s /code/inc/* /var/www/inc/ |
#ln -s /code/inc/* /var/www/inc/ |
||||
|
# |
@ -0,0 +1,4 @@ |
|||||
|
The `php-fpm` process runs containerized. |
||||
|
The php application always uses `/var/www` as it's work directory and home folder, and if `/var/www` is bind mounted it |
||||
|
is necessary to adjust the path passed via FastCGI to `php-fpm` by changing the root directory to `/var/www`. |
||||
|
This can achieved in nginx by setting the `fastcgi_param SCRIPT_FILENAME` to `/var/www/$fastcgi_script_name;` |
@ -0,0 +1,74 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
set -eu |
||||
|
|
||||
|
if ! mountpoint -q /var/www; then |
||||
|
echo "WARNING: '/var/www' is not a mountpoint. All the data will remain inside the container!" |
||||
|
fi |
||||
|
|
||||
|
if [ ! -w /var/www ] ; then |
||||
|
echo "ERROR: '/var/www' is not writable. Closing." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Link the entrypoints from the exposed directory. |
||||
|
ln -nfs \ |
||||
|
/code/banners/ \ |
||||
|
/code/static/ \ |
||||
|
/code/stylesheets/ \ |
||||
|
/code/tools/ \ |
||||
|
/code/walls/ \ |
||||
|
/code/*.php \ |
||||
|
/code/LICENSE.* \ |
||||
|
/code/404.html \ |
||||
|
/code/install.sql \ |
||||
|
/var/www/ |
||||
|
# Ensure correct permissions are set, since this might be bind mount. |
||||
|
chown www-data /var/www |
||||
|
chgrp www-data /var/www |
||||
|
|
||||
|
# Initialize robots.txt with the default if it doesn't exist. |
||||
|
cp -n /code/robots.txt /var/www |
||||
|
|
||||
|
# Link the cache and tmp files directory. |
||||
|
ln -nfs /var/tmp/leftypol /var/www/tmp |
||||
|
|
||||
|
# Link the javascript directory. |
||||
|
ln -nfs /code/js /var/www/ |
||||
|
|
||||
|
# Link the html templates directory and it's cache. |
||||
|
ln -nfs /code/templates /var/www/ |
||||
|
ln -nfs -T /var/cache/template-cache /var/www/templates/cache |
||||
|
chown -h www-data /var/www/templates/cache |
||||
|
chgrp -h www-data /var/www/templates/cache |
||||
|
|
||||
|
# Link the generic cache. |
||||
|
ln -nfs -T /var/cache/gen-cache /var/www/tmp/cache |
||||
|
chown -h www-data /var/www/tmp/cache |
||||
|
chgrp -h www-data /var/www/tmp/cache |
||||
|
|
||||
|
# Create the included files directory and link them |
||||
|
install -d -m 700 -o www-data -g www-data /var/www/inc |
||||
|
for file in /code/inc/*; do |
||||
|
file="${file##*/}" |
||||
|
if [ ! -e /var/www/inc/$file ]; then |
||||
|
ln -s /code/inc/$file /var/www/inc/ |
||||
|
fi |
||||
|
done |
||||
|
# Copy an empty instance configuration if the file is a link (it was linked because it did not exist before). |
||||
|
if [ -L '/var/www/inc/instance-config.php' ]; then |
||||
|
echo 'INFO: Resetting instance configuration' |
||||
|
rm /var/www/inc/instance-config.php |
||||
|
cp /code/inc/instance-config.php /var/www/inc/instance-config.php |
||||
|
chown www-data /var/www/inc/instance-config.php |
||||
|
chgrp www-data /var/www/inc/instance-config.php |
||||
|
chmod 600 /var/www/inc/instance-config.php |
||||
|
else |
||||
|
echo 'INFO: Using existing instance configuration' |
||||
|
fi |
||||
|
|
||||
|
# Link the composer dependencies. |
||||
|
ln -nfs /code/vendor /var/www/ |
||||
|
|
||||
|
# Start the php-fpm server. |
||||
|
exec php-fpm |
Loading…
Reference in new issue