Merge env variables for standard locations

This commit is contained in:
Alexey Pustovalov
2024-12-26 15:52:37 +09:00
parent 9f46a6c37c
commit a950f484ea
96 changed files with 580 additions and 583 deletions

View File

@ -12,7 +12,8 @@ ARG ZBX_VERSION
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ENV TERM=xterm \
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
ZABBIX_CONF_DIR="/etc/zabbix"
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \
@ -75,9 +76,9 @@ RUN set -eux && \
--shell /sbin/nologin \
--home /var/lib/zabbix/ \
zabbix && \
mkdir -p /etc/zabbix && \
mkdir -p /etc/zabbix/web && \
mkdir -p /etc/zabbix/web/certs && \
mkdir -p ${ZABBIX_CONF_DIR} && \
mkdir -p ${ZABBIX_CONF_DIR}/web && \
mkdir -p ${ZABBIX_CONF_DIR}/web/certs && \
rm -f "/etc/apache2/conf.d/default.conf" && \
rm -f "/etc/apache2/conf.d/ssl.conf" && \
sed -ri \
@ -95,11 +96,11 @@ RUN set -eux && \
rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \
find /usr/share/zabbix/locale -name '*.po' | xargs rm -f && \
find /usr/share/zabbix/locale -name '*.sh' | xargs rm -f && \
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \
ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \
chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \
chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \
chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \
ln -s "${ZABBIX_CONF_DIR}/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \
ln -s "${ZABBIX_CONF_DIR}/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \
chown --quiet -R zabbix:root ${ZABBIX_CONF_DIR}/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \
chgrp -R 0 ${ZABBIX_CONF_DIR}/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \
chmod -R g=u ${ZABBIX_CONF_DIR}/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \
chown --quiet -R zabbix:root /etc/apache2/ /etc/php83/ && \
chgrp -R 0 /etc/apache2/ /etc/php83/ && \
chmod -R g=u /etc/apache2/ /etc/php83/

View File

@ -19,8 +19,6 @@ fi
: ${PHP_TZ:="Europe/Riga"}
# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
# Web interface www-root directory
ZABBIX_WWW_ROOT="/usr/share/zabbix"
# Apache main configuration file
@ -136,16 +134,16 @@ prepare_web_server() {
APACHE_SITES_DIR=/etc/apache2/conf.d
echo "** Adding Zabbix virtual host (HTTP)"
if [ -f "$ZABBIX_ETC_DIR/apache.conf" ]; then
ln -sfT "$ZABBIX_ETC_DIR/apache.conf" "$APACHE_SITES_DIR/zabbix.conf"
if [ -f "$ZABBIX_CONF_DIR/apache.conf" ]; then
ln -sfT "$ZABBIX_CONF_DIR/apache.conf" "$APACHE_SITES_DIR/zabbix.conf"
else
echo "**** Impossible to enable HTTP virtual host"
fi
if [ -f "/etc/ssl/apache2/ssl.crt" ] && [ -f "/etc/ssl/apache2/ssl.key" ]; then
echo "** Adding Zabbix virtual host (HTTPS)"
if [ -f "$ZABBIX_ETC_DIR/apache_ssl.conf" ]; then
ln -sfT "$ZABBIX_ETC_DIR/apache_ssl.conf" "$APACHE_SITES_DIR/zabbix_ssl.conf"
if [ -f "$ZABBIX_CONF_DIR/apache_ssl.conf" ]; then
ln -sfT "$ZABBIX_CONF_DIR/apache_ssl.conf" "$APACHE_SITES_DIR/zabbix_ssl.conf"
else
echo "**** Impossible to enable HTTPS virtual host"
fi
@ -218,12 +216,12 @@ prepare_zbx_web_config() {
: ${HTTP_INDEX_FILE:="index.php"}
sed -i \
-e "s/{HTTP_INDEX_FILE}/${HTTP_INDEX_FILE}/g" \
"$ZABBIX_ETC_DIR/apache.conf"
"$ZABBIX_CONF_DIR/apache.conf"
if [ -f "$ZABBIX_ETC_DIR/apache_ssl.conf" ]; then
if [ -f "$ZABBIX_CONF_DIR/apache_ssl.conf" ]; then
sed -i \
-e "s/{HTTP_INDEX_FILE}/${HTTP_INDEX_FILE}/g" \
"$ZABBIX_ETC_DIR/apache_ssl.conf"
"$ZABBIX_CONF_DIR/apache_ssl.conf"
fi
: ${ENABLE_WEB_ACCESS_LOG:="true"}