Rejig nginx & php-fpm runits
This commit is contained in:
parent
69d3a7cb64
commit
db2d03893c
6 changed files with 22 additions and 13 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -117,8 +117,14 @@ RUN apt-get -qq update && \
|
||||||
mv /conf/NginxDefault /etc/nginx/sites-enabled/default && \
|
mv /conf/NginxDefault /etc/nginx/sites-enabled/default && \
|
||||||
mkdir /etc/service/nginx && \
|
mkdir /etc/service/nginx && \
|
||||||
mkdir /etc/service/php-fpm && \
|
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/nginx.runit /etc/service/nginx/run && \
|
||||||
mv /conf/php-fpm.runit /etc/service/php-fpm/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 && \
|
chmod +x /etc/service/*/run && \
|
||||||
rm -R /conf && \
|
rm -R /conf && \
|
||||||
sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/nginx/sites-enabled/default && \
|
sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/nginx/sites-enabled/default && \
|
||||||
|
|
@ -126,7 +132,9 @@ RUN apt-get -qq update && \
|
||||||
# Enable status panel
|
# Enable status panel
|
||||||
sed -i -e "s|;pm.status_path|pm.status_path|g" /etc/php/*/fpm/pool.d/www.conf && \
|
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!
|
# 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 ports.
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
|
||||||
2
php+nginx/logs-nginx-access.runit
Normal file
2
php+nginx/logs-nginx-access.runit
Normal 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
|
||||||
2
php+nginx/logs-nginx-error.runit
Normal file
2
php+nginx/logs-nginx-error.runit
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
tail -f /var/log/nginx/error.log
|
||||||
6
php+nginx/logs-phpfpm-error.runit
Normal file
6
php+nginx/logs-phpfpm-error.runit
Normal 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
|
||||||
|
|
@ -1,8 +1,3 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
sleep 3;
|
|
||||||
/usr/sbin/nginx
|
/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
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
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}} -F -R
|
||||||
/usr/sbin/php-fpm{{PHP}}
|
|
||||||
sleep 3;
|
|
||||||
tail -f /var/log/php*-fpm.log
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue