diff --git a/web-apache-mysql/centos/Dockerfile b/web-apache-mysql/centos/Dockerfile index 42164b39e..26ab71f26 100644 --- a/web-apache-mysql/centos/Dockerfile +++ b/web-apache-mysql/centos/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:centos7 +FROM centos:centos8 LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -17,30 +17,35 @@ RUN set -eux && \ zabbix && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ - yum --quiet makecache && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install epel-release && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ dejavu-sans-fonts \ curl \ httpd \ mariadb \ mod_ssl \ php \ + php-fpm \ php-bcmath \ php-gd \ php-ldap \ php-mbstring \ - php-mysql \ - php-xml && \ + php-mysqlnd \ + php-json \ + php-xml \ + supervisor && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ + rm -f /etc/php-fpm.d/www.conf && \ sed -ri \ -e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - yum -y clean all && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki ARG MAJOR_VERSION=5.0 ARG ZBX_VERSION=${MAJOR_VERSION} @@ -55,8 +60,10 @@ LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentati COPY ["conf/etc/", "/etc/"] RUN set -eux && \ - yum --quiet makecache && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ + glibc-locale-source && \ + dnf -y install --setopt=tsflags=nodocs \ gettext \ git && \ cd /usr/share/ && \ @@ -75,16 +82,17 @@ RUN set -eux && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/conf/ && \ chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/conf/ && \ chmod -R g=u /etc/zabbix/ /usr/share/zabbix/conf/ && \ - chown --quiet -R zabbix:root /etc/httpd/ /etc/php.d/ /etc/php.ini && \ - chgrp -R 0 /etc/httpd/ /etc/php.d/ /etc/php.ini && \ - chmod -R g=u /etc/httpd/ /etc/php.d/ /etc/php.ini && \ + chown --quiet -R zabbix:root /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \ + chgrp -R 0 /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \ + chmod -R g=u /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \ chown --quiet -R zabbix:root /run/httpd/ /var/lib/php/session/ && \ chgrp -R 0 /run/httpd/ /var/lib/php/session/ && \ chmod -R g=u /run/httpd/ /var/lib/php/session/ && \ - yum -y history undo `yum -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - yum -y clean all && \ + dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ + dnf -y erase glibc-locale-source glibc-langpack-en && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki EXPOSE 8080/TCP 8443/TCP @@ -97,5 +105,3 @@ COPY ["docker-entrypoint.sh", "/usr/bin/"] USER 1997 ENTRYPOINT ["docker-entrypoint.sh"] - -CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] diff --git a/web-apache-mysql/centos/conf/etc/php-fpm.conf b/web-apache-mysql/centos/conf/etc/php-fpm.conf new file mode 100644 index 000000000..ce0225346 --- /dev/null +++ b/web-apache-mysql/centos/conf/etc/php-fpm.conf @@ -0,0 +1,9 @@ +include=/etc/php-fpm.d/*.conf + +[global] + +pid = /tmp/php-fpm.pid + +error_log = /dev/fd/2 + +daemonize = no diff --git a/web-apache-mysql/centos/conf/etc/php-fpm.d/zabbix.conf b/web-apache-mysql/centos/conf/etc/php-fpm.d/zabbix.conf new file mode 100644 index 000000000..a4926f4ae --- /dev/null +++ b/web-apache-mysql/centos/conf/etc/php-fpm.d/zabbix.conf @@ -0,0 +1,25 @@ +[zabbix] + +listen = /tmp/php-fpm.sock + +pm = dynamic +pm.max_children = 50 +pm.start_servers = 5 +pm.min_spare_servers = 5 +pm.max_spare_servers = 35 + +slowlog = /dev/fd/1 + +php_admin_value[error_log] = /dev/fd/2 +php_admin_flag[log_errors] = on + +php_value[session.save_handler] = files +php_value[session.save_path] = /var/lib/php/session + +php_value[max_execution_time]= 300 +php_value[memory_limit]= 128M +php_value[post_max_size]= 16M +php_value[upload_max_filesize]= 2M +php_value[max_input_time]= 300 +php_value[max_input_vars]= 10000 +; php_value[date.timezone]= Europe/Riga diff --git a/web-apache-mysql/centos/conf/etc/php.d/99-zabbix.ini b/web-apache-mysql/centos/conf/etc/php.d/99-zabbix.ini deleted file mode 100644 index de8fc6904..000000000 --- a/web-apache-mysql/centos/conf/etc/php.d/99-zabbix.ini +++ /dev/null @@ -1,8 +0,0 @@ -max_execution_time=300 -memory_limit=128M -post_max_size=16M -upload_max_filesize=2M -max_input_time=300 -always_populate_raw_post_data=-1 -max_input_vars=10000 -; date.timezone=Europe/Riga diff --git a/web-apache-mysql/centos/conf/etc/supervisor/conf.d/supervisord_zabbix.conf b/web-apache-mysql/centos/conf/etc/supervisor/conf.d/supervisord_zabbix.conf new file mode 100644 index 000000000..103d56271 --- /dev/null +++ b/web-apache-mysql/centos/conf/etc/supervisor/conf.d/supervisord_zabbix.conf @@ -0,0 +1,30 @@ +[supervisord] +nodaemon = true + +[program:httpd] +command = /usr/sbin/%(program_name)s -D FOREGROUND +auto_start = true +autorestart = true + +startsecs=2 +startretries=3 +stopsignal=TERM +stopwaitsecs=2 + +redirect_stderr=true +stdout_logfile = /dev/stdout +stdout_logfile_maxbytes = 0 + +[program:php-fpm] +command = /usr/sbin/%(program_name)s -F -c /etc/%(program_name)s.conf +auto_start = true +autorestart = true + +startsecs=2 +startretries=3 +stopsignal=TERM +stopwaitsecs=2 + +redirect_stderr=true +stdout_logfile = /dev/stdout +stdout_logfile_maxbytes = 0 diff --git a/web-apache-mysql/centos/conf/etc/supervisor/supervisord.conf b/web-apache-mysql/centos/conf/etc/supervisor/supervisord.conf new file mode 100644 index 000000000..f8d80e461 --- /dev/null +++ b/web-apache-mysql/centos/conf/etc/supervisor/supervisord.conf @@ -0,0 +1,35 @@ +; supervisor config file + +[unix_http_server] +file = /tmp/supervisor.sock ; (the path to the socket file) +chmod = 0700 ; sockef file mode (default 0700) +username = zbx +password = password + +[supervisord] +logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log) +pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP) +critical = critical +;user = zabbix +logfile_maxbytes = 0 +logfile_backupcount = 0 +loglevel = info + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/web-apache-mysql/centos/conf/etc/zabbix/apache.conf b/web-apache-mysql/centos/conf/etc/zabbix/apache.conf index 36def0c29..8f61ef1ef 100644 --- a/web-apache-mysql/centos/conf/etc/zabbix/apache.conf +++ b/web-apache-mysql/centos/conf/etc/zabbix/apache.conf @@ -9,6 +9,10 @@ Options FollowSymLinks AllowOverride None Require all granted + + + SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost" + diff --git a/web-apache-mysql/centos/conf/etc/zabbix/apache_ssl.conf b/web-apache-mysql/centos/conf/etc/zabbix/apache_ssl.conf index 20cfd2841..758cd462c 100644 --- a/web-apache-mysql/centos/conf/etc/zabbix/apache_ssl.conf +++ b/web-apache-mysql/centos/conf/etc/zabbix/apache_ssl.conf @@ -31,6 +31,10 @@ Listen 8443 Options FollowSymLinks AllowOverride None Require all granted + + + SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost" + diff --git a/web-apache-mysql/centos/docker-entrypoint.sh b/web-apache-mysql/centos/docker-entrypoint.sh index af2dbbf21..d7c3f7641 100755 --- a/web-apache-mysql/centos/docker-entrypoint.sh +++ b/web-apache-mysql/centos/docker-entrypoint.sh @@ -108,8 +108,9 @@ update_config_var() { return fi - # Escaping characters in parameter value + # Escaping characters in parameter value and name var_value=$(escape_spec_char "$var_value") + var_name=$(escape_spec_char "$var_name") if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path" @@ -217,14 +218,14 @@ prepare_zbx_web_config() { ZBX_WWW_ROOT="/usr/share/zabbix" ZBX_WEB_CONFIG="$ZABBIX_ETC_DIR/web/zabbix.conf.php" - PHP_CONFIG_FILE="/etc/php.d/99-zabbix.ini" + PHP_CONFIG_FILE="/etc/php-fpm.d/zabbix.conf" - update_config_var "$PHP_CONFIG_FILE" "max_execution_time" "${ZBX_MAXEXECUTIONTIME:-"600"}" - update_config_var "$PHP_CONFIG_FILE" "memory_limit" "${ZBX_MEMORYLIMIT:-"128M"}" - update_config_var "$PHP_CONFIG_FILE" "post_max_size" "${ZBX_POSTMAXSIZE:-"16M"}" - update_config_var "$PHP_CONFIG_FILE" "upload_max_filesize" "${ZBX_UPLOADMAXFILESIZE:-"2M"}" - update_config_var "$PHP_CONFIG_FILE" "max_input_time" "${ZBX_MAXINPUTTIME:-"300"}" - update_config_var "$PHP_CONFIG_FILE" "date.timezone" "${PHP_TZ}" + update_config_var "$PHP_CONFIG_FILE" "php_value[max_execution_time]" "${ZBX_MAXEXECUTIONTIME:-"600"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[memory_limit]" "${ZBX_MEMORYLIMIT:-"128M"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[post_max_size]" "${ZBX_POSTMAXSIZE:-"16M"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[upload_max_filesize]" "${ZBX_UPLOADMAXFILESIZE:-"2M"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" ZBX_HISTORYSTORAGETYPES=${ZBX_HISTORYSTORAGETYPES:-"[]"} @@ -245,6 +246,12 @@ prepare_zbx_web_config() { -e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \ -e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \ -e "s/{ZBX_SERVER_NAME}/$server_name/g" \ + -e "s/{ZBX_DB_ENCRYPTION}/${ZBX_DB_ENCRYPTION:-"false"}/g" \ + -e "s/{ZBX_DB_KEY_FILE}/${ZBX_DB_KEY_FILE}/g" \ + -e "s/{ZBX_DB_CERT_FILE}/${ZBX_DB_CERT_FILE}/g" \ + -e "s/{ZBX_DB_CA_FILE}/${ZBX_DB_CA_FILE}/g" \ + -e "s/{ZBX_DB_VERIFY_HOST}/${ZBX_DB_VERIFY_HOST:-"false"}/g" \ + -e "s/{ZBX_DB_CIPHER_LIST}/${ZBX_DB_CIPHER_LIST}/g" \ -e "s/{ZBX_HISTORYSTORAGEURL}/$history_storage_url/g" \ -e "s/{ZBX_HISTORYSTORAGETYPES}/$history_storage_types/g" \ "$ZBX_WEB_CONFIG" @@ -261,7 +268,6 @@ prepare_web() { prepare_zbx_web_config } - ################################################# echo "** Deploying Zabbix web-interface (Apache) with MySQL database" @@ -277,9 +283,9 @@ echo "########################################################" if [ "$1" != "" ]; then echo "** Executing '$@'" exec "$@" -elif [ -f "/usr/sbin/httpd" ]; then - echo "** Executing HTTPD" - exec /usr/sbin/httpd -D FOREGROUND +elif [ -f "/usr/bin/supervisord" ]; then + echo "** Executing supervisord" + exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf else echo "Unknown instructions. Exiting..." exit 1 diff --git a/web-apache-pgsql/centos/Dockerfile b/web-apache-pgsql/centos/Dockerfile index ee21337c4..adada8512 100644 --- a/web-apache-pgsql/centos/Dockerfile +++ b/web-apache-pgsql/centos/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:centos7 +FROM centos:centos8 LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -17,30 +17,35 @@ RUN set -eux && \ zabbix && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ - yum --quiet makecache && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install epel-release && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ dejavu-sans-fonts \ curl \ httpd \ mod_ssl \ php \ + php-fpm \ php-bcmath \ php-gd \ php-ldap \ php-mbstring \ php-pgsql \ + php-json \ php-xml \ - postgresql && \ + postgresql \ + supervisor && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ + rm -f /etc/php-fpm.d/www.conf && \ sed -ri \ -e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - yum -y clean all && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki ARG MAJOR_VERSION=5.0 ARG ZBX_VERSION=${MAJOR_VERSION} @@ -55,8 +60,10 @@ LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentati COPY ["conf/etc/", "/etc/"] RUN set -eux && \ - yum --quiet makecache && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ + glibc-locale-source && \ + dnf -y install --setopt=tsflags=nodocs \ gettext \ git && \ cd /usr/share/ && \ @@ -75,16 +82,17 @@ RUN set -eux && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/conf/ && \ chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/conf/ && \ chmod -R g=u /etc/zabbix/ /usr/share/zabbix/conf/ && \ - chown --quiet -R zabbix:root /etc/httpd/ /etc/php.d/ /etc/php.ini && \ - chgrp -R 0 /etc/httpd/ /etc/php.d/ /etc/php.ini && \ - chmod -R g=u /etc/httpd/ /etc/php.d/ /etc/php.ini && \ + chown --quiet -R zabbix:root /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \ + chgrp -R 0 /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \ + chmod -R g=u /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \ chown --quiet -R zabbix:root /run/httpd/ /var/lib/php/session/ && \ chgrp -R 0 /run/httpd/ /var/lib/php/session/ && \ chmod -R g=u /run/httpd/ /var/lib/php/session/ && \ - yum -y history undo `yum -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - yum -y clean all && \ + dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ + dnf -y erase glibc-locale-source && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki EXPOSE 8080/TCP 8443/TCP @@ -97,5 +105,3 @@ COPY ["docker-entrypoint.sh", "/usr/bin/"] USER 1997 ENTRYPOINT ["docker-entrypoint.sh"] - -CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] diff --git a/web-apache-pgsql/centos/conf/etc/php-fpm.conf b/web-apache-pgsql/centos/conf/etc/php-fpm.conf new file mode 100644 index 000000000..ce0225346 --- /dev/null +++ b/web-apache-pgsql/centos/conf/etc/php-fpm.conf @@ -0,0 +1,9 @@ +include=/etc/php-fpm.d/*.conf + +[global] + +pid = /tmp/php-fpm.pid + +error_log = /dev/fd/2 + +daemonize = no diff --git a/web-apache-pgsql/centos/conf/etc/php-fpm.d/zabbix.conf b/web-apache-pgsql/centos/conf/etc/php-fpm.d/zabbix.conf new file mode 100644 index 000000000..a4926f4ae --- /dev/null +++ b/web-apache-pgsql/centos/conf/etc/php-fpm.d/zabbix.conf @@ -0,0 +1,25 @@ +[zabbix] + +listen = /tmp/php-fpm.sock + +pm = dynamic +pm.max_children = 50 +pm.start_servers = 5 +pm.min_spare_servers = 5 +pm.max_spare_servers = 35 + +slowlog = /dev/fd/1 + +php_admin_value[error_log] = /dev/fd/2 +php_admin_flag[log_errors] = on + +php_value[session.save_handler] = files +php_value[session.save_path] = /var/lib/php/session + +php_value[max_execution_time]= 300 +php_value[memory_limit]= 128M +php_value[post_max_size]= 16M +php_value[upload_max_filesize]= 2M +php_value[max_input_time]= 300 +php_value[max_input_vars]= 10000 +; php_value[date.timezone]= Europe/Riga diff --git a/web-apache-pgsql/centos/conf/etc/php.d/99-zabbix.ini b/web-apache-pgsql/centos/conf/etc/php.d/99-zabbix.ini deleted file mode 100644 index de8fc6904..000000000 --- a/web-apache-pgsql/centos/conf/etc/php.d/99-zabbix.ini +++ /dev/null @@ -1,8 +0,0 @@ -max_execution_time=300 -memory_limit=128M -post_max_size=16M -upload_max_filesize=2M -max_input_time=300 -always_populate_raw_post_data=-1 -max_input_vars=10000 -; date.timezone=Europe/Riga diff --git a/web-apache-pgsql/centos/conf/etc/supervisor/conf.d/supervisord_zabbix.conf b/web-apache-pgsql/centos/conf/etc/supervisor/conf.d/supervisord_zabbix.conf new file mode 100644 index 000000000..103d56271 --- /dev/null +++ b/web-apache-pgsql/centos/conf/etc/supervisor/conf.d/supervisord_zabbix.conf @@ -0,0 +1,30 @@ +[supervisord] +nodaemon = true + +[program:httpd] +command = /usr/sbin/%(program_name)s -D FOREGROUND +auto_start = true +autorestart = true + +startsecs=2 +startretries=3 +stopsignal=TERM +stopwaitsecs=2 + +redirect_stderr=true +stdout_logfile = /dev/stdout +stdout_logfile_maxbytes = 0 + +[program:php-fpm] +command = /usr/sbin/%(program_name)s -F -c /etc/%(program_name)s.conf +auto_start = true +autorestart = true + +startsecs=2 +startretries=3 +stopsignal=TERM +stopwaitsecs=2 + +redirect_stderr=true +stdout_logfile = /dev/stdout +stdout_logfile_maxbytes = 0 diff --git a/web-apache-pgsql/centos/conf/etc/supervisor/supervisord.conf b/web-apache-pgsql/centos/conf/etc/supervisor/supervisord.conf new file mode 100644 index 000000000..f8d80e461 --- /dev/null +++ b/web-apache-pgsql/centos/conf/etc/supervisor/supervisord.conf @@ -0,0 +1,35 @@ +; supervisor config file + +[unix_http_server] +file = /tmp/supervisor.sock ; (the path to the socket file) +chmod = 0700 ; sockef file mode (default 0700) +username = zbx +password = password + +[supervisord] +logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log) +pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP) +critical = critical +;user = zabbix +logfile_maxbytes = 0 +logfile_backupcount = 0 +loglevel = info + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/web-apache-pgsql/centos/conf/etc/zabbix/apache.conf b/web-apache-pgsql/centos/conf/etc/zabbix/apache.conf index 36def0c29..8f61ef1ef 100644 --- a/web-apache-pgsql/centos/conf/etc/zabbix/apache.conf +++ b/web-apache-pgsql/centos/conf/etc/zabbix/apache.conf @@ -9,6 +9,10 @@ Options FollowSymLinks AllowOverride None Require all granted + + + SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost" + diff --git a/web-apache-pgsql/centos/conf/etc/zabbix/apache_ssl.conf b/web-apache-pgsql/centos/conf/etc/zabbix/apache_ssl.conf index 20cfd2841..758cd462c 100644 --- a/web-apache-pgsql/centos/conf/etc/zabbix/apache_ssl.conf +++ b/web-apache-pgsql/centos/conf/etc/zabbix/apache_ssl.conf @@ -31,6 +31,10 @@ Listen 8443 Options FollowSymLinks AllowOverride None Require all granted + + + SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost" + diff --git a/web-apache-pgsql/centos/docker-entrypoint.sh b/web-apache-pgsql/centos/docker-entrypoint.sh index 51d016e74..c093dbc31 100755 --- a/web-apache-pgsql/centos/docker-entrypoint.sh +++ b/web-apache-pgsql/centos/docker-entrypoint.sh @@ -108,13 +108,9 @@ update_config_var() { return fi - # Use full path to a file for TLS related configuration parameters - if [[ $var_name =~ ^TLS.*File$ ]]; then - var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value - fi - - # Escaping characters in parameter value + # Escaping characters in parameter value and name var_value=$(escape_spec_char "$var_value") + var_name=$(escape_spec_char "$var_name") if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path" @@ -219,14 +215,14 @@ prepare_zbx_web_config() { ZBX_WWW_ROOT="/usr/share/zabbix" ZBX_WEB_CONFIG="$ZABBIX_ETC_DIR/web/zabbix.conf.php" - PHP_CONFIG_FILE="/etc/php.d/99-zabbix.ini" + PHP_CONFIG_FILE="/etc/php-fpm.d/zabbix.conf" - update_config_var "$PHP_CONFIG_FILE" "max_execution_time" "${ZBX_MAXEXECUTIONTIME:-"600"}" - update_config_var "$PHP_CONFIG_FILE" "memory_limit" "${ZBX_MEMORYLIMIT:-"128M"}" - update_config_var "$PHP_CONFIG_FILE" "post_max_size" "${ZBX_POSTMAXSIZE:-"16M"}" - update_config_var "$PHP_CONFIG_FILE" "upload_max_filesize" "${ZBX_UPLOADMAXFILESIZE:-"2M"}" - update_config_var "$PHP_CONFIG_FILE" "max_input_time" "${ZBX_MAXINPUTTIME:-"300"}" - update_config_var "$PHP_CONFIG_FILE" "date.timezone" "${PHP_TZ}" + update_config_var "$PHP_CONFIG_FILE" "php_value[max_execution_time]" "${ZBX_MAXEXECUTIONTIME:-"600"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[memory_limit]" "${ZBX_MEMORYLIMIT:-"128M"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[post_max_size]" "${ZBX_POSTMAXSIZE:-"16M"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[upload_max_filesize]" "${ZBX_UPLOADMAXFILESIZE:-"2M"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" + update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" ZBX_HISTORYSTORAGETYPES=${ZBX_HISTORYSTORAGETYPES:-"[]"} @@ -247,6 +243,12 @@ prepare_zbx_web_config() { -e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \ -e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \ -e "s/{ZBX_SERVER_NAME}/$server_name/g" \ + -e "s/{ZBX_DB_ENCRYPTION}/${ZBX_DB_ENCRYPTION:-"false"}/g" \ + -e "s/{ZBX_DB_KEY_FILE}/${ZBX_DB_KEY_FILE}/g" \ + -e "s/{ZBX_DB_CERT_FILE}/${ZBX_DB_CERT_FILE}/g" \ + -e "s/{ZBX_DB_CA_FILE}/${ZBX_DB_CA_FILE}/g" \ + -e "s/{ZBX_DB_VERIFY_HOST}/${ZBX_DB_VERIFY_HOST:-"false"}/g" \ + -e "s/{ZBX_DB_CIPHER_LIST}/${ZBX_DB_CIPHER_LIST}/g" \ -e "s/{ZBX_HISTORYSTORAGEURL}/$history_storage_url/g" \ -e "s/{ZBX_HISTORYSTORAGETYPES}/$history_storage_types/g" \ "$ZBX_WEB_CONFIG" @@ -263,7 +265,6 @@ prepare_web() { prepare_zbx_web_config } - ################################################# echo "** Deploying Zabbix web-interface (Apache) with MySQL database" @@ -279,9 +280,9 @@ echo "########################################################" if [ "$1" != "" ]; then echo "** Executing '$@'" exec "$@" -elif [ -f "/usr/sbin/httpd" ]; then - echo "** Executing HTTPD" - exec /usr/sbin/httpd -D FOREGROUND +elif [ -f "/usr/bin/supervisord" ]; then + echo "** Executing supervisord" + exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf else echo "Unknown instructions. Exiting..." exit 1 diff --git a/web-nginx-mysql/centos/Dockerfile b/web-nginx-mysql/centos/Dockerfile index ec7ec65c9..32ae7a5d7 100644 --- a/web-nginx-mysql/centos/Dockerfile +++ b/web-nginx-mysql/centos/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:centos7 +FROM centos:centos8 LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -17,9 +17,9 @@ RUN set -eux && \ zabbix && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ - yum --quiet makecache && \ - yum -y install epel-release && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install epel-release && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ curl \ mariadb \ nginx \ @@ -28,14 +28,15 @@ RUN set -eux && \ php-gd \ php-ldap \ php-mbstring \ - php-mysql \ + php-mysqlnd \ + php-json \ php-xml \ supervisor && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - yum -y clean all && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki ARG MAJOR_VERSION=5.0 ARG ZBX_VERSION=${MAJOR_VERSION} @@ -50,8 +51,10 @@ LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentati COPY ["conf/etc/", "/etc/"] RUN set -eux && \ - yum --quiet makecache && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ + glibc-locale-source && \ + dnf -y install --setopt=tsflags=nodocs \ gettext \ git && \ cd /usr/share/ && \ @@ -73,10 +76,11 @@ RUN set -eux && \ chown --quiet -R zabbix:root /etc/nginx/ /etc/php.d/ /etc/php.ini && \ chgrp -R 0 /etc/nginx/ /etc/php.d/ /etc/php.ini && \ chmod -R g=u /etc/nginx/ /etc/php.d/ /etc/php.ini && \ - yum -y history undo `yum -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - yum -y clean all && \ + dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ + dnf -y erase glibc-locale-source && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki EXPOSE 8080/TCP 8443/TCP diff --git a/web-nginx-pgsql/centos/Dockerfile b/web-nginx-pgsql/centos/Dockerfile index d76c8af10..e7546baaa 100644 --- a/web-nginx-pgsql/centos/Dockerfile +++ b/web-nginx-pgsql/centos/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:centos7 +FROM centos:centos8 LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -17,9 +17,9 @@ RUN set -eux && \ zabbix && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ - yum --quiet makecache && \ - yum -y install epel-release && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install epel-release && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ supervisor \ curl \ nginx \ @@ -30,12 +30,13 @@ RUN set -eux && \ php-ldap \ php-mbstring \ php-pgsql \ + php-json \ php-xml && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - yum -y clean all && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki ARG MAJOR_VERSION=5.0 ARG ZBX_VERSION=${MAJOR_VERSION} @@ -50,8 +51,10 @@ LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentati COPY ["conf/etc/", "/etc/"] RUN set -eux && \ - yum --quiet makecache && \ - yum -y install --setopt=tsflags=nodocs \ + dnf --quiet makecache && \ + dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ + glibc-locale-source && \ + dnf -y install --setopt=tsflags=nodocs \ gettext \ git && \ cd /usr/share/ && \ @@ -73,10 +76,11 @@ RUN set -eux && \ chown --quiet -R zabbix:root /etc/nginx/ /etc/php.d/ /etc/php.ini && \ chgrp -R 0 /etc/nginx/ /etc/php.d/ /etc/php.ini && \ chmod -R g=u /etc/nginx/ /etc/php.d/ /etc/php.ini && \ - yum -y history undo `yum -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - yum -y clean all && \ + dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ + dnf -y erase glibc-locale-source glibc-langpack-en && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /etc/udev/hwdb.bin /root/.pki + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki EXPOSE 8080/TCP 8443/TCP