tiredofit / docker-wordpress

Dockerized Content Management System many with customizable options
MIT License
35 stars 7 forks source link

php5.6 image is broken #13

Open juanluisbaptiste opened 4 years ago

juanluisbaptiste commented 4 years ago

Hi Dave,

I was testing the php5.6 image and init is currently failing with this error:

+ '[' '' '!=' FALSE ']'

++ ls -l /etc/cont-init.d/00-timezone /etc/cont-init.d/01-permissions /etc/cont-init.d/02-zabbix /etc/cont-init.d/03-cron /etc/cont-init.d/04-smtp /etc/cont-init.d/10-nginx /etc/cont-init.d/20-php-fpm /etc/cont-init.d/30-wordpress /etc/cont-init.d/99-container

++ grep -v '^d'

++ wc -l

+ files_init=9

++ expr 9 - 1

+ files_init=8

++ ls -l /tmp/state/00-timezone-init /tmp/state/01-permissions-init /tmp/state/02-zabbix-init /tmp/state/03-cron-init /tmp/state/04-smtp-init /tmp/state/10-nginx-init /tmp/state/20-php-fpm-init

++ grep -v '^d'

++ wc -l

+ init_complete=7

+ '[' 8 '!=' 7 ']'

+ echo '**********************************************************************************************************************'

**********************************************************************************************************************

+ echo '**********************************************************************************************************************'

**********************************************************************************************************************

+ echo '****                                                                                                              ****'

****                                                                                                              ****

+ echo '****       ERROR - All scripts have not initialized properly - All services are now halted                        ****'

****       ERROR - All scripts have not initialized properly - All services are now halted                        ****

+ echo '****             - Please enter the container find out why the missing *-init state file hasn'\''t been written      ****'

****             - Please enter the container find out why the missing *-init state file hasn't been written      ****

+ echo '****                                                                                                              ****'

****                                                                                                              ****

+ echo '**********************************************************************************************************************'

**********************************************************************************************************************

+ echo '**********************************************************************************************************************'

**********************************************************************************************************************

It seems there's an init file missing ?

tiredofit commented 4 years ago

Interesting - I will fire up a local copy. Reading through that it appears the /etc/cont-init.d/30-wordpress file didn't execute properly (if it did it would make a /tmp/state/30-wordpress-init). Hang on and let me see if I can recreate.

juanluisbaptiste commented 4 years ago

thanks for your uber quick response as usual hehe.

tiredofit commented 4 years ago

tiredofit:wordpress:php5.6 now pushed to registry. There was a missing if statement I fixed in all other branches but for some reason this one didn't get the fix. Tested and all is well!

juanluisbaptiste commented 4 years ago

Thanks, it works. Now I'm trying to figure out why the website works with the php7.0 image and why with this one it does not.

juanluisbaptiste commented 4 years ago

I think php-fpm is failing to start, on this image:

# ps aux|grep php
   33 root      0:00 s6-supervise 20-php-fpm
 1598 root      0:00 grep php

On a php7.0 image:


bash-4.3# ps aux|grep php
   33 root       2:43 s6-supervise 20-php-fpm
 1621 nginx      0:04 {php-fpm7} php-fpm: pool www
 1622 nginx      0:04 {php-fpm7} php-fpm: pool www
 1626 nginx      0:01 {php-fpm7} php-fpm: pool www
tiredofit commented 4 years ago

That unfortunately I can't recreate. Can you try inside the container to execute /usr/bin/php-fpm5 and see if it outputs any errors for you?

juanluisbaptiste commented 4 years ago

I get this:

[20-Jan-2020 13:44:46] ALERT: [pool www] user has not been defined
[20-Jan-2020 13:44:46] ERROR: failed to post process the configuration
[20-Jan-2020 13:44:46] ERROR: FPM initialization failed
tiredofit commented 4 years ago

Here's the contents of my /etc/php5/php-fpm.conf - strictly using defaults for container:

bash-4.4# cat php-fpm.conf 
error_log = /www/logs/php-fpm/php-fpm.log
log_level = notice

[www]
listen = 0.0.0.0:9000
listen.owner = nginx
listen.group = www-data
pm = dynamic
pm.max_children = 75
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.status_path = /php-fpm_status
ping.path = /ping

pm.process_idle_timeout = 10s
pm.max_requests = 500
php_flag[display_errors] = on
php_admin_value[memory_limit] = 128M
php_admin_value[post_max_size] = 2G
php_admin_value[upload_max_filesize] = 2G
php_admin_value[output_buffering] = 0
php_admin_value[openssl.cafile] = /etc/ssl/certs/ca-certificates.crt
php_admin_value[openssl.capath] = /etc/ssl/certs
php_admin_value[max_input_nesting_level] = 256
php_admin_value[max_input_vars] = 10000
php_admin_value[max_execution_time] = 180
catch_workers_output = yes

env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
juanluisbaptiste commented 4 years ago

These are the contents of mine, I have not done any custom configuration, just switched tags on the compose file and started it again:

# cat /etc/php5/php-fpm.conf
error_log = /www/logs/php-fpm/php-fpm.log
log_level = notice

[www]
listen = 0.0.0.0:9000
listen.owner = nginx
listen.group = www-data
pm = dynamic
pm.max_children = 75
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.status_path = /php-fpm_status
ping.path = /ping

pm.process_idle_timeout = 10s
pm.max_requests = 500
php_flag[display_errors] = on
php_admin_value[memory_limit] = 128M
php_admin_value[post_max_size] = 2G
php_admin_value[upload_max_filesize] = 2G
php_admin_value[output_buffering] = 0
php_admin_value[openssl.cafile] = /etc/ssl/certs/ca-certificates.crt
php_admin_value[openssl.capath] = /etc/ssl/certs
php_admin_value[max_input_nesting_level] = 256
php_admin_value[max_input_vars] = 10000
php_admin_value[max_execution_time] = 180
catch_workers_output = yes

env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
tiredofit commented 4 years ago

Looks the exact same :) We have a mystery on our hands now as your configuration is just fine and PHP should definitely not be throwing that error :P

juanluisbaptiste commented 4 years ago

Damn... but it is just a regular wordpress site, it works perfectly with the php7.0 image but because of an unsupported plugin I need to run it on php5.6 for now.

What other info can I provide you to investigate this ?

juanluisbaptiste commented 4 years ago

These are my env_file values:


FORCE_RESET_PERMISSIONS=false
DB_HOST=mysql-db
DB_NAME=wordpress
DB_USER=wordpress
DB_PASS=xxxxxxx

WORKER_PROCESSES=1
WORKER_CONNECTIONS=512
FPM_MAX_CHILDREN=120
FPM_MAX_REQUESTS=1000
ENABLE_GZIP_COMPRESSION=false

ENABLE_HTTPS_REVERSE_PROXY=FALSE
ADMIN_EMAIL=soporte@xxxx.xxx
ADMIN_USER=admin
ADMIN_PASS=xxxxx
tiredofit commented 4 years ago

The environment variables look just fine to me. Can you try starting it up without your data emulating a fresh install to see if it continues to happen?

And you are right, short of a couple different PHP options and a different location for config those wordpress images are exactly the same. You could also try replicating it by using the base of tiredofit/nginx-php-fpm/5.6 (set your NGINX_WEBROOT var to /www/wordpress) and it should run as well. The wordpress image just does the fancy setup/config changes which if you have already installed, you shouldn't need..

juanluisbaptiste commented 4 years ago

The environment variables look just fine to me. Can you try starting it up without your data emulating a fresh install to see if it continues to happen?

Just did, same result and same error on php-fpm log:


[20-Jan-2020 13:44:46] ALERT: [pool www] user has not been defined
[20-Jan-2020 13:44:46] ERROR: failed to post process the configuration
[20-Jan-2020 13:44:46] ERROR: FPM initialization failed

You could also try replicating it by using the base of tiredofit/nginx-php-fpm/5.6 (set your NGINX_WEBROOT var to /www/wordpress) and it should run as well. The wordpress image just does the fancy setup/config changes which if you have already installed, you shouldn't need..

Now I will test this.

juanluisbaptiste commented 4 years ago

I was looking again at the container logs and noticed that the initial error is still present. I'm checking if it's that I'm still running the previous version.

juanluisbaptiste commented 4 years ago

Nope, I manually deleted the tiredofit/wordpress:php5.6 image from all the nodes, and redeployed the image, new image pulled and the error still happens.

tiredofit commented 4 years ago

I'm signing off for the day but first thing in am will try to recreate under a different environment.

tiredofit commented 4 years ago

I just can't recreate this. I rebuilt a new system and tried every which way to make this break. I found one thing that shouldn't affect anything on an existing install which was related to the database server not being fast enough to take my install on this VM. That's been resolved in the 5.6 version (and was long ago fixed in the 7.x series)..

I will ship this around to some other servers to see if I can get it to happen but I'm stuck right now.

juanluisbaptiste commented 4 years ago

Weird, I went to each swarm node and made sure there was no tiredofit/wordpress:php5.6 images present and then manually pulled the image in one of the manager nodes and launched the app. I will test locally and see what I get.