Add a pid cleaner in case container was killed unexpectedly

This commit is contained in:
Joe Ferguson
2014-12-19 14:23:06 -08:00
parent 61918f0fd6
commit a51c16e5f9
10 changed files with 29 additions and 92 deletions

View File

@ -67,8 +67,9 @@ RUN buildDeps=" \
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
COPY apache2-foreground /usr/local/bin/
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2", "-DFOREGROUND"]
CMD ["apache2-foreground"]
##</autogenerated>##

7
5.4/apache/apache2-foreground Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
exec apache2 -DFOREGROUND

View File

@ -67,8 +67,9 @@ RUN buildDeps=" \
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
COPY apache2-foreground /usr/local/bin/
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2", "-DFOREGROUND"]
CMD ["apache2-foreground"]
##</autogenerated>##

7
5.5/apache/apache2-foreground Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
exec apache2 -DFOREGROUND

View File

@ -67,8 +67,9 @@ RUN buildDeps=" \
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
COPY apache2-foreground /usr/local/bin/
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2", "-DFOREGROUND"]
CMD ["apache2-foreground"]
##</autogenerated>##

7
5.6/apache/apache2-foreground Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
exec apache2 -DFOREGROUND

View File

@ -1,4 +1,5 @@
COPY apache2-foreground /usr/local/bin/
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2", "-DFOREGROUND"]
CMD ["apache2-foreground"]

View File

@ -1,62 +0,0 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
DocumentRoot /var/www/html
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# Multiple DirectoryIndex directives within the same context will add
# to the list of resources to look for rather than replace
# https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
DirectoryIndex disabled
DirectoryIndex index.php index.html

View File

@ -1,23 +0,0 @@
; This file was initially adapated from the output of: (on PHP 5.6)
; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
[global]
error_log = /proc/self/fd/2
daemonize = no
[www]
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2
user = www-data
group = www-data
listen = [::]:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

View File

@ -51,9 +51,6 @@ for version in "${versions[@]}"; do
s/^(ENV PHP_VERSION) .*/\1 '"$fullVersion"'/;
s/^(RUN gpg .* --recv-keys) [0-9a-fA-F ]*$/\1 '"$gpgKey"'/
' "$version/Dockerfile" "$version/"*/Dockerfile
cp apache2.conf "$version/apache/"
cp php-fpm.conf "$version/fpm/"
)
done