mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-06-30 14:51:11 +02:00
Merge env variables for standard locations
This commit is contained in:
@ -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" \
|
||||
@ -65,9 +66,9 @@ RUN --mount=type=cache,target=/var/cache/apt/,sharing=locked \
|
||||
--shell /sbin/nologin \
|
||||
--home-dir /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/sites-available/* && \
|
||||
rm -f /etc/apache2/sites-enabled/* && \
|
||||
/usr/sbin/a2enmod ssl && \
|
||||
@ -89,17 +90,17 @@ RUN --mount=type=cache,target=/var/cache/apt/,sharing=locked \
|
||||
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" && \
|
||||
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" && \
|
||||
mkdir -p /var/lib/locales/supported.d/ && \
|
||||
rm -f /var/lib/locales/supported.d/local && \
|
||||
cat /usr/share/zabbix/include/locales.inc.php | grep display | grep true | awk '{$1=$1};1' | \
|
||||
cut -d"'" -f 2 | sort | \
|
||||
xargs -I '{}' bash -c 'echo "{}.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local' && \
|
||||
dpkg-reconfigure locales && \
|
||||
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/ && \
|
||||
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/php/8.3/ && \
|
||||
chgrp -R 0 /etc/apache2/ /etc/php/8.3/ && \
|
||||
chmod -R g=u /etc/apache2/ /etc/php/8.3/
|
||||
|
@ -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
|
||||
@ -137,19 +135,19 @@ check_db_connect() {
|
||||
prepare_web_server() {
|
||||
APACHE_SITES_DIR="/etc/apache2/sites-enabled"
|
||||
|
||||
ln -sfT "$ZABBIX_ETC_DIR/apache_envvars" "/etc/apache2/envvars"
|
||||
ln -sfT "$ZABBIX_CONF_DIR/apache_envvars" "/etc/apache2/envvars"
|
||||
|
||||
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
|
||||
@ -222,12 +220,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"}
|
||||
|
Reference in New Issue
Block a user