diff --git a/CHANGELOG.md b/CHANGELOG.md index b75182f..ee68a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 7.5.0 2023-03-15 + + ### Changed + - Quiet down output when loading defaults (xxx is already loaded! warnings) + - Rework initialization + - Fix a weird opcache issue + + ## 7.4.2 2023-02-21 ### Changed diff --git a/Dockerfile b/Dockerfile index 3abd701..43f2169 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ ARG DISTRO=alpine -ARG DISTRO_VARIANT=3.17 +ARG DISTRO_VARIANT=edge FROM docker.io/tiredofit/nginx:${DISTRO}-${DISTRO_VARIANT} LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)" ARG PHP_BASE -ENV PHP_BASE=${PHP_BASE:-"8.1"} \ +ENV PHP_BASE=${PHP_BASE:-"8.2"} \ PHP_ENABLE_APCU=TRUE \ PHP_ENABLE_BCMATH=TRUE \ PHP_ENABLE_BZ2=TRUE \ @@ -813,8 +813,11 @@ RUN case "${PHP_BASE}" in \ #### Disabling any but core extensions - When using this image as a base for other images, you'll want to turn turn them on before running composer with the inverse of phpdisomd (phpenmod) to keep things clean set +x && \ for module in /etc/php${php_folder}/conf.d/*.ini; do if [ ! -L "${module}" ] ; then if [ "$(echo $(basename $module) | grep -c '^[0-9][0-9].*')" = "0" ] ; then mv "${module}" "$(dirname ${module})/20_$(basename ${module})" ; module="$(dirname ${module})/20_$(basename ${module})"; fi ; if ! grep -w -i -q ";priority" "$module"; then echo ";priority=$(basename $module .ini | cut -d _ -f1)" >> $module ; mv "${module}" /etc/php${php_folder}/mods-available/$(basename ${module} .ini | cut -c 4-).ini; fi; fi; done; \ + rm -rf /etc/php${php_folder}/conf.d/* && \ + sed -i "s|;priority=00|;priority=10|g" /etc/php${php_folder}/mods-available/opcache.ini && \ php_env_plugins_enabled="$(set | sort | grep PHP_ENABLE_ | grep -i TRUE | cut -d _ -f 3 | cut -d = -f 1 | tr [A-Z] [a-z])" && \ + cat /etc/php${php_folder}/mods-available/opcache.ini && \ for module in $php_env_plugins_enabled ; do if [ -f "/etc/php${php_folder}/mods-available/${module}.ini" ] ; then priority=$(cat /etc/php${php_folder}/mods-available/${module}.ini | grep ";priority" | cut -d = -f2) ; ln -sf "/etc/php${php_folder}/mods-available/${module}.ini" /etc/php${php_folder}/conf.d/${priority}-${module}.ini ; fi ; done ; \ if [ "${PHP_BASE:0:1}" != "8" ] ; then priority=$(cat /etc/php${PHP_BASE:0:1}/mods-available/json.ini | grep ";priority" | cut -d = -f2) ; ln -sf "/etc/php${PHP_BASE:0:1}/mods-available/json.ini" /etc/php${PHP_BASE:0:1}/conf.d/${priority}-json.ini ; fi ; \ set -x && \ diff --git a/README.md b/README.md index c31bd54..53d21ed 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ The following directories are used for configuration and can be mapped for persi #### Base Images used -This image relies on an [Alpine Linux](https://hub.docker.com/r/tiredofit/alpine) or [Debian Linux](https://hub.docker.com/r/tiredofit/debian) base image that relies on an [init system](https://github.com/just-containers/s6-overlay) for added capabilities. Outgoing SMTP capabilities are handlded via `msmtp`. Individual container performance monitoring is performed by [zabbix-agent](https://zabbix.org). Additional tools include: `bash`,`curl`,`less`,`logrotate`, `nano`,`vim`. +This image relies on an [Alpine Linux](https://hub.docker.com/r/tiredofit/alpine) or [Debian Linux](https://hub.docker.com/r/tiredofit/debian) base image that relies on an [init system](https://github.com/just-containers/s6-overlay) for added capabilities. Outgoing SMTP capabilities are handlded via `msmtp`. Individual container performance monitoring is performed by [zabbix-agent](https://zabbix.org). Additional tools include: `bash`,`curl`,`less`,`logrotate`, `nano`. Be sure to view the following repositories to understand all the customizable options: | Image | Description | diff --git a/install/assets/defaults/20-php-fpm b/install/assets/defaults/20-php-fpm index 0dc1652..4ac3e5b 100755 --- a/install/assets/defaults/20-php-fpm +++ b/install/assets/defaults/20-php-fpm @@ -33,7 +33,7 @@ PHP_OPCACHE_REVALIDATE_FREQ=${PHP_OPCACHE_REVALIDATE_FREQ:-"60"} PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE:-"2G"} PHP_TIMEOUT=${PHP_TIMEOUT:-"180"} PHP_UPLOAD_MAX_SIZE=${PHP_UPLOAD_MAX_SIZE:-"2G"} -PHP_VERSION=${PHP_VERSION:-$(php -v | head -n 1 | awk '{print $2}')} +PHP_VERSION=${PHP_VERSION:-$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}')} PHP_WEBROOT=${PHP_WEBROOT:-$NGINX_WEBROOT} #Xdebug 2 diff --git a/install/assets/functions/20-php-fpm b/install/assets/functions/20-php-fpm index 732a905..3af3cb0 100755 --- a/install/assets/functions/20-php-fpm +++ b/install/assets/functions/20-php-fpm @@ -12,12 +12,12 @@ phpfpm_bootstrap() { php_prefix="/etc/php82/" ;; * ) - php_prefix="/etc/php$(php -v | head -n 1 | awk '{print $2}' | cut -c 1)/" + php_prefix="/etc/php$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}' | cut -c 1)/" ;; esac ;; "debian" ) - php_prefix="/etc/php/$(php -v | head -n 1 | awk '{print $2}' | cut -c 1-3)/" + php_prefix="/etc/php/$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}' | cut -c 1-3)/" ;; esac @@ -132,26 +132,6 @@ EOF EOF fi fi - - if var_false "${PHP_KITCHENSINK}" ; then - php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP} - unset PHP_ENABLE_CREATE_SAMPLE_PHP # legacy - php_env_plugins_enabled=$(set -o posix; set | sort | grep PHP_ENABLE_ | grep -i TRUE |sed -e 's/PHP_ENABLE_//g' | sed -e 's/=TRUE//g' | awk -vRS="" -vOFS=', ' '$1=$1' | tr A-Z a-z) - for module in $(echo "${php_env_plugins_enabled}" | tr "," "\n" ) ; do - if [ -f "${php_prefix}"/mods-available/"${module}".ini ]; then - print_debug "Enabling ${module}" - silent php-ext enable "${module}" - php_actual_plugins_enabled="${php_actual_plugins_enabled} ${module}" - else - print_error "Requested enabling ${module} however it doesn't exist!" - fi - done - print_notice "PHP-FPM Preparing to start with the following plugins enabled: ${php_actual_plugins_enabled}" - else - php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP} - print_warn "Enabling Kitchen Sink mode and allowing all plugins to be active" - silent php-ext enable all - fi } phpfpm_configure_logging() { @@ -325,6 +305,17 @@ EOF } phpfpm_post_init() { + case ${os} in + "alpine" ) + cp -R /assets/php-fpm/cli/php.ini "${php_prefix}"/ + cp -R /assets/php-fpm/mods-available/* "${php_prefix}"/mods-available/ + cp -R /assets/php-fpm/fpm/php-fpm.conf "${php_prefix}"/ + ;; + "debian" ) + cp -R /assets/php-fpm/* "${php_prefix}" + ;; + esac + case ${os} in "alpine" ) ### Weird Opcache issue @@ -340,16 +331,25 @@ phpfpm_post_init() { ;; esac - case ${os} in - "alpine" ) - cp -R /assets/php-fpm/cli/php.ini "${php_prefix}"/ - cp -R /assets/php-fpm/mods-available/* "${php_prefix}"/mods-available/ - cp -R /assets/php-fpm/fpm/php-fpm.conf "${php_prefix}"/ - ;; - "debian" ) - cp -R /assets/php-fpm/* "${php_prefix}" - ;; - esac + if var_false "${PHP_KITCHENSINK}" ; then + php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP} + unset PHP_ENABLE_CREATE_SAMPLE_PHP # legacy + php_env_plugins_enabled=$(set -o posix; set | sort | grep PHP_ENABLE_ | grep -i TRUE |sed -e 's/PHP_ENABLE_//g' | sed -e 's/=TRUE//g' | awk -vRS="" -vOFS=', ' '$1=$1' | tr A-Z a-z) + for module in $(echo "${php_env_plugins_enabled}" | tr "," "\n" ) ; do + if [ -f "${php_prefix}"/mods-available/"${module}".ini ]; then + print_debug "Enabling ${module}" + silent php-ext enable "${module}" + php_actual_plugins_enabled="${php_actual_plugins_enabled} ${module}" + else + print_error "Requested enabling ${module} however it doesn't exist!" + fi + done + print_debug "PHP-FPM Preparing to start with the following extensions enabled: ${php_actual_plugins_enabled}" + else + php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP} + print_warn "Enabling Kitchen Sink mode and allowing all plugins to be active" + silent php-ext enable all + fi chmod -R 0755 "${php_prefix}" chown -R root:"${NGINX_GROUP}" "${php_prefix}" diff --git a/install/usr/sbin/php-ext b/install/usr/sbin/php-ext index c4bb572..796db6b 100755 --- a/install/usr/sbin/php-ext +++ b/install/usr/sbin/php-ext @@ -18,16 +18,16 @@ case ${os} in php_prefix="/etc/php82/" ;; * ) - php_prefix="/etc/php$(php -v | head -n 1 | awk '{print $2}' | cut -c 1)/" + php_prefix="/etc/php$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}' | cut -c 1)/" ;; esac ;; "debian" ) - php_prefix="/etc/php/$(php -v | head -n 1 | awk '{print $2}' | cut -c 1-3)/" + php_prefix="/etc/php/$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}' | cut -c 1-3)/" ;; esac -if [ "${PHP_ENABLE_OPENSSL,,}" = "true" ] && [ ! -f "${php_prefix}mods-available/openssl.ini" ]; then +if [ "${PHP_ENABLE_OPENSSL,,}" = "true" ] && [ ! -f "${php_prefix}/mods-available/openssl.ini" ]; then export PHP_ENABLE_OPENSSL=FALSE fi