Rejig nginx & php-fpm runits

This commit is contained in:
Greyscale 2019-11-09 01:13:01 +01:00
parent 69d3a7cb64
commit db2d03893c
6 changed files with 22 additions and 13 deletions

View file

@ -117,8 +117,14 @@ RUN apt-get -qq update && \
mv /conf/NginxDefault /etc/nginx/sites-enabled/default && \
mkdir /etc/service/nginx && \
mkdir /etc/service/php-fpm && \
mkdir /etc/service/logs-nginx-access && \
mkdir /etc/service/logs-nginx-error && \
mkdir /etc/service/logs-phpfpm-error && \
mv /conf/nginx.runit /etc/service/nginx/run && \
mv /conf/php-fpm.runit /etc/service/php-fpm/run && \
mv /conf/logs-nginx-access.runit /etc/service/logs-nginx-access/run && \
mv /conf/logs-nginx-error.runit /etc/service/logs-nginx-error/run && \
mv /conf/logs-phpfpm-error.runit /etc/service/logs-phpfpm-error/run && \
chmod +x /etc/service/*/run && \
rm -R /conf && \
sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/nginx/sites-enabled/default && \
@ -126,7 +132,9 @@ RUN apt-get -qq update && \
# Enable status panel
sed -i -e "s|;pm.status_path|pm.status_path|g" /etc/php/*/fpm/pool.d/www.conf && \
# Using environment variables in config files works, it would seem. Neat!
sed -i -e "s|pm.max_children = 5|pm.max_children = \${PHPFPM_MAX_CHILDREN}|g" /etc/php/*/fpm/pool.d/www.conf
sed -i -e "s|pm.max_children = 5|pm.max_children = \${PHPFPM_MAX_CHILDREN}|g" /etc/php/*/fpm/pool.d/www.conf && \
# Disable daemonising in nginx
sed -i '1s;^;daemon off\;\n;' /etc/nginx/nginx.conf
# Expose ports.
EXPOSE 80

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
tail -f /var/log/nginx/access.log | sed --unbuffered 's|.*\[.*\] |[NGINX] |g' | grep -v /v1/ping

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
tail -f /var/log/nginx/error.log

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
if [[ -f /var/log/php*-fpm.log ]]; then
tail -f /var/log/php*-fpm.log
else
sleep 1
fi

View file

@ -1,8 +1,3 @@
#!/bin/bash
sleep 3;
#!/usr/bin/env bash
/usr/sbin/nginx
sleep 3;
tail -f /var/log/nginx/error.log &
tail -f /var/log/nginx/access.log | sed --unbuffered 's|.*\[.*\] |[NGINX] |g' | grep -v /v1/ping

View file

@ -1,9 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
sleep 3;
env | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" > /etc/php/{{PHP}}/fpm/conf.d/env.conf
cat /etc/php/{{PHP}}/fpm/conf.d/env.conf
/usr/sbin/php-fpm{{PHP}}
sleep 3;
tail -f /var/log/php*-fpm.log
/usr/sbin/php-fpm{{PHP}} -F -R