mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-07-01 07:11:09 +02:00
The big one update :-)
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
FROM alpine:3.4
|
||||
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
|
||||
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
|
||||
ARG APK_FLAGS_COMMON="-q"
|
||||
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
|
||||
@ -7,6 +10,17 @@ ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
|
||||
ARG DB_TYPE=mysql
|
||||
ENV TERM=xterm
|
||||
|
||||
LABEL org.label-schema.name="zabbix-web-nginx-${DB_TYPE}-alpine" \
|
||||
org.label-schema.vendor="Zabbix LLC" \
|
||||
org.label-schema.url="https://zabbix.com/" \
|
||||
org.label-schema.description="Zabbix web-interface based on Nginx web server with MySQL database support" \
|
||||
org.label-schema.vcs-ref="${VCS_REF}" \
|
||||
org.label-schema.build-date="${BUILD_DATE}" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.license="GPL 2.0"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
RUN addgroup zabbix && \
|
||||
adduser -S \
|
||||
-D -G zabbix \
|
||||
@ -18,21 +32,21 @@ RUN addgroup zabbix && \
|
||||
chown --quiet -R zabbix:root /etc/zabbix && \
|
||||
apk update && \
|
||||
apk add ${APK_FLAGS_PERSISTANT} \
|
||||
supervisor \
|
||||
bash \
|
||||
mariadb-client-libs \
|
||||
mariadb-client \
|
||||
mariadb-client-libs \
|
||||
nginx \
|
||||
php5-fpm \
|
||||
php5-mysqli \
|
||||
php5-bcmath \
|
||||
php5-ctype \
|
||||
php5-sockets \
|
||||
php5-fpm \
|
||||
php5-gd \
|
||||
php5-gettext \
|
||||
php5-bcmath \
|
||||
php5-xmlreader \
|
||||
php5-ldap \
|
||||
php5-json \
|
||||
php5-ldap \
|
||||
php5-mysqli \
|
||||
php5-sockets \
|
||||
php5-xmlreader \
|
||||
supervisor \
|
||||
ttf-dejavu && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
@ -41,7 +55,12 @@ ARG ZBX_VERSION=${MAJOR_VERSION}
|
||||
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
|
||||
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE}
|
||||
|
||||
ADD conf/tmp/font-config /tmp/font-config
|
||||
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.label-schema.version="${ZBX_VERSION}" \
|
||||
org.label-schema.vcs-url="${ZBX_SOURCES}" \
|
||||
org.label-schema.docker.cmd="docker run --name zabbix-web-nginx-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-nginx-${DB_TYPE}:alpine-${ZBX_VERSION}"
|
||||
|
||||
COPY ["conf/tmp/font-config", "/tmp/font-config"]
|
||||
|
||||
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
|
||||
coreutils \
|
||||
@ -59,7 +78,9 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
|
||||
ln -s /usr/share/fonts/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
apk del ${APK_FLAGS_COMMON} --purge \
|
||||
build-dependencies && \
|
||||
rm -rf /var/cache/apk/*
|
||||
rm -rf /var/cache/apk/* && \
|
||||
rm -rf /root/.subversion && \
|
||||
rm -rf /var/svn
|
||||
|
||||
EXPOSE 80/TCP 443/TCP
|
||||
|
||||
@ -67,15 +88,15 @@ WORKDIR /usr/share/zabbix
|
||||
|
||||
VOLUME ["/etc/ssl/nginx"]
|
||||
|
||||
ADD conf/etc/supervisor/ /etc/supervisor/
|
||||
ADD conf/etc/zabbix/nginx.conf /etc/zabbix/
|
||||
ADD conf/etc/zabbix/nginx_ssl.conf /etc/zabbix/
|
||||
ADD conf/etc/zabbix/web/zabbix.conf.php /etc/zabbix/web/
|
||||
ADD conf/etc/nginx/nginx.conf /etc/nginx/
|
||||
ADD conf/etc/php5/php-fpm.conf /etc/php5/
|
||||
ADD conf/etc/php5/conf.d/99-zabbix.ini /etc/php5/conf.d/
|
||||
ADD run_zabbix_component.sh /
|
||||
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
||||
COPY ["conf/etc/zabbix/nginx.conf", "/etc/zabbix/"]
|
||||
COPY ["conf/etc/zabbix/nginx_ssl.conf", "/etc/zabbix/"]
|
||||
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
|
||||
COPY ["conf/etc/nginx/nginx.conf", "/etc/nginx/"]
|
||||
COPY ["conf/etc/php5/php-fpm.conf", "/etc/php5/"]
|
||||
COPY ["conf/etc/php5/conf.d/99-zabbix.ini", "/etc/php5/conf.d/"]
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["/run_zabbix_component.sh", "frontend", "mysql", "nginx"]
|
||||
CMD ["frontend", "mysql", "nginx"]
|
||||
|
@ -1,4 +1,4 @@
|
||||

|
||||

|
||||
|
||||
# What is Zabbix?
|
||||
|
||||
@ -14,15 +14,15 @@ Zabbix web interface is a part of Zabbix software. It is used to manage resource
|
||||
|
||||
# Zabbix web interface images
|
||||
|
||||
These are the only official Zabbix web interface Docker images. They are based on latest Alpine and trusty Ubuntu images. The available versions of Zabbix web interface are:
|
||||
These are the only official Zabbix web interface Docker images. They are based on Alpine Linux v3.4, Ubuntu 14.04 (trusty) and CentOS 7 images. The available versions of Zabbix web interface are:
|
||||
|
||||
Zabbix server 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest)
|
||||
Zabbix server 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest)
|
||||
Zabbix server 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, alpine-latest, ubuntu-latest, latest)
|
||||
Zabbix server 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*)
|
||||
Zabbix server 4.0 (tags: alpine-trunk, ubuntu-trunk)
|
||||
Zabbix web interface 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix web interface 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix web interface 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest)
|
||||
Zabbix web interface 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*)
|
||||
Zabbix web interface 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest, alpine-latest, ubuntu-latest, centos-latest, latest)
|
||||
Zabbix web interface 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*)
|
||||
Zabbix web interface 4.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
|
||||
|
||||
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
|
||||
|
||||
|
@ -1,23 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
os=alpine
|
||||
os=${PWD##*/}
|
||||
|
||||
version=$1
|
||||
version=${version:-"latest"}
|
||||
|
||||
app_component=web-nginx
|
||||
app_database=mysql
|
||||
cd ../
|
||||
app_component=${PWD##*/}
|
||||
cd $os/
|
||||
|
||||
if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then
|
||||
echo "Incorrect syntax of the version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker build -t zabbix-$app_component-$app_database:$os-$version -f Dockerfile .
|
||||
if [ "$version" != "latest" ]; then
|
||||
VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'`
|
||||
fi
|
||||
|
||||
#docker rm -f zabbix-$app_component-$app_database
|
||||
docker build -t zabbix-$app_component:$os-$version --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -f Dockerfile .
|
||||
|
||||
#docker rm -f zabbix-$app_component
|
||||
#docker rm -f mysql-server
|
||||
|
||||
#docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_RANDOM_ROOT_PASSWORD=true -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin
|
||||
#docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_RANDOM_ROOT_PASSWORD=true -d mysql:5.7
|
||||
#sleep 5
|
||||
#docker run --name zabbix-$app_component-$app_database -t -d --link mysql-server:mysql --link zabbix-server:zabbix-server zabbix-$app_component-$app_database:$os-$version
|
||||
#docker run --name zabbix-$app_component -t -d --link mysql-server:mysql --link zabbix-server:zabbix-server zabbix-$app_component:$os-$version
|
||||
|
@ -2,21 +2,29 @@
|
||||
nodaemon = true
|
||||
|
||||
[program:nginx]
|
||||
command = /usr/sbin/nginx -g "daemon off;" -c /etc/nginx/nginx.conf
|
||||
command = /usr/sbin/%(program_name)s -g "daemon off;" -c /etc/nginx/%(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
|
||||
stderr_logfile = /dev/stderr
|
||||
stderr_logfile_maxbytes = 0
|
||||
|
||||
[program:php-fpm]
|
||||
command = /usr/bin/php-fpm -F -c /etc/php5/php-fpm.conf
|
||||
command = /usr/bin/%(program_name)s -F -c /etc/php5/%(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
|
||||
stderr_logfile = /dev/stderr
|
||||
stderr_logfile_maxbytes = 0
|
@ -14,6 +14,7 @@ critical = critical
|
||||
user = root
|
||||
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
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
set +e
|
||||
|
||||
# Script trace mode
|
||||
@ -126,7 +128,7 @@ check_variables_mysql() {
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and not empty"
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -216,7 +218,7 @@ check_db_connect_postgresql() {
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -l -q 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
@ -320,21 +322,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \
|
||||
zcat /usr/share/doc/zabbix-$type-mysql/create.sql.gz | mysql --silent --skip-column-names \
|
||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
|
||||
${DB_SERVER_DBNAME} 1>/dev/null
|
||||
if [ "$type" == "server" ]; then
|
||||
echo "** Fill the schema with initial data"
|
||||
cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \
|
||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
|
||||
${DB_SERVER_DBNAME} 1>/dev/null
|
||||
cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \
|
||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
|
||||
${DB_SERVER_DBNAME} 1>/dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -356,18 +347,9 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
cat /usr/share/doc/zabbix-$type-postgresql/schema.sql | psql -q \
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
if [ "$type" == "server" ]; then
|
||||
echo "** Fill the schema with initial data"
|
||||
cat /usr/share/doc/zabbix-$type-postgresql/images.sql | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
cat /usr/share/doc/zabbix-$type-postgresql/data.sql | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
fi
|
||||
@ -378,6 +360,8 @@ prepare_web_server_apache() {
|
||||
APACHE_SITES_DIR=/etc/apache2/sites-available
|
||||
elif [ -d "/etc/apache2/conf.d" ]; then
|
||||
APACHE_SITES_DIR=/etc/apache2/conf.d
|
||||
elif [ -d "/etc/httpd/conf.d" ]; then
|
||||
APACHE_SITES_DIR=/etc/httpd/conf.d
|
||||
else
|
||||
echo "**** Apache is not available"
|
||||
exit 1
|
||||
@ -390,6 +374,7 @@ prepare_web_server_apache() {
|
||||
elif [ -f "/etc/apache2/conf.d/default.conf" ]; then
|
||||
echo "** Disable default site"
|
||||
rm -f "/etc/apache2/conf.d/default.conf"
|
||||
rm -f "/etc/httpd/conf.d/welcome.conf"
|
||||
fi
|
||||
|
||||
echo "** Adding Zabbix virtual host (HTTP)"
|
||||
@ -433,6 +418,13 @@ prepare_web_server_apache() {
|
||||
"/etc/apache2/apache2.conf"
|
||||
fi
|
||||
|
||||
if [ -f "/etc/httpd/conf/httpd.conf" ]; then
|
||||
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"
|
||||
fi
|
||||
|
||||
if [ -f "/etc/apache2/httpd.conf" ]; then
|
||||
sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
@ -456,6 +448,10 @@ prepare_web_server_apache() {
|
||||
if [ -f "/var/run/apache2/apache2.pid" ]; then
|
||||
rm -f "/var/run/apache2/apache2.pid"
|
||||
fi
|
||||
|
||||
if [ -f "/var/run/httpd/httpd.pid" ]; then
|
||||
rm -f "/var/run/httpd/httpd.pid"
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_web_server_nginx() {
|
||||
@ -692,6 +688,8 @@ prepare_zbx_web_config() {
|
||||
PHP_CONFIG_FILE="/etc/php/7.0/apache2/conf.d/99-zabbix.ini"
|
||||
elif [ -f "/etc/php/7.0/fpm/conf.d/99-zabbix.ini" ]; then
|
||||
PHP_CONFIG_FILE="/etc/php/7.0/fpm/conf.d/99-zabbix.ini"
|
||||
elif [ -f "/etc/php.d/99-zabbix.ini" ]; then
|
||||
PHP_CONFIG_FILE="/etc/php.d/99-zabbix.ini"
|
||||
fi
|
||||
|
||||
if [ -n "$PHP_CONFIG_FILE" ]; then
|
@ -1,5 +1,8 @@
|
||||
FROM ubuntu:trusty
|
||||
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
|
||||
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
|
||||
ARG APT_FLAGS_COMMON="-qq -y"
|
||||
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
|
||||
@ -7,10 +10,19 @@ ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
|
||||
ARG DB_TYPE=mysql
|
||||
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm
|
||||
|
||||
RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \
|
||||
locale-gen $LC_ALL && \
|
||||
LABEL org.label-schema.name="zabbix-web-nginx-${DB_TYPE}-ubuntu" \
|
||||
org.label-schema.vendor="Zabbix LLC" \
|
||||
org.label-schema.url="https://zabbix.com/" \
|
||||
org.label-schema.description="Zabbix web-interface based on Nginx web server with MySQL database support" \
|
||||
org.label-schema.vcs-ref="${VCS_REF}" \
|
||||
org.label-schema.build-date="${BUILD_DATE}" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.license="GPL 2.0"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
RUN locale-gen $LC_ALL && \
|
||||
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \
|
||||
addgroup --system --quiet zabbix && \
|
||||
adduser --quiet \
|
||||
--system --disabled-login \
|
||||
@ -28,15 +40,17 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO
|
||||
echo "deb http://nginx.org/packages/ubuntu/ $DISTRIB_CODENAME nginx" >> /etc/apt/sources.list.d/nginx.list && \
|
||||
apt-get ${APT_FLAGS_COMMON} update && \
|
||||
apt-get ${APT_FLAGS_PERSISTANT} install \
|
||||
supervisor \
|
||||
mysql-client \
|
||||
nginx \
|
||||
php5-fpm \
|
||||
php5-mysql \
|
||||
php5-gd \
|
||||
php5-json \
|
||||
php5-ldap \
|
||||
php5-mysql \
|
||||
supervisor \
|
||||
ttf-dejavu-core 1>/dev/null && \
|
||||
apt-get ${APT_FLAGS_COMMON} purge \
|
||||
wget 1>/dev/null && \
|
||||
apt-get ${APT_FLAGS_COMMON} autoremove && \
|
||||
apt-get ${APT_FLAGS_COMMON} clean && \
|
||||
mkdir -p /var/lib/php5 && \
|
||||
@ -49,27 +63,18 @@ ARG ZBX_VERSION=${MAJOR_VERSION}
|
||||
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
|
||||
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE}
|
||||
|
||||
ADD conf/tmp/font-config /tmp/font-config
|
||||
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.label-schema.version="${ZBX_VERSION}" \
|
||||
org.label-schema.vcs-url="${ZBX_SOURCES}" \
|
||||
org.label-schema.docker.cmd="docker run --name zabbix-web-nginx-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-nginx-${DB_TYPE}:ubuntu-${ZBX_VERSION}"
|
||||
|
||||
COPY ["conf/tmp/font-config", "/tmp/font-config"]
|
||||
|
||||
RUN apt-get ${APT_FLAGS_COMMON} update && \
|
||||
apt-get ${APT_FLAGS_DEV} install \
|
||||
subversion \
|
||||
gettext \
|
||||
patch \
|
||||
gettext 1>/dev/null && \
|
||||
mkdir -p /var/lib/locales/supported.d/ && \
|
||||
echo "en_US.UTF-8 UTF-8" > /var/lib/locales/supported.d/local && \
|
||||
echo "ru_RU.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "ja_JP.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "cs_CZ.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "ko_KR.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "it_IT.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "pt_BR.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "sk_SK.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "uk_UA.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "fr_FR.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "pl_PL.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
echo "zh_CN.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local && \
|
||||
dpkg-reconfigure locales 1>/dev/null && \
|
||||
subversion 1>/dev/null && \
|
||||
cd /usr/share/ && \
|
||||
svn --quiet export ${ZBX_SOURCES}/frontends/php/ zabbix 1>/dev/null && \
|
||||
cd /usr/share/zabbix/ && \
|
||||
@ -81,13 +86,22 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
|
||||
./locale/make_mo.sh 2>/dev/null && \
|
||||
update-alternatives --install /usr/share/zabbix/fonts/graphfont.ttf \
|
||||
zabbix-frontend-font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf 10 && \
|
||||
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 1>/dev/null && \
|
||||
find /usr/share/zabbix/locale -name '*.po' | xargs rm -f && \
|
||||
find /usr/share/zabbix/locale -name '*.sh' | xargs rm -f && \
|
||||
apt-get ${APT_FLAGS_COMMON} purge \
|
||||
subversion \
|
||||
gettext \
|
||||
patch \
|
||||
gettext 1>/dev/null && \
|
||||
subversion 1>/dev/null && \
|
||||
apt-get ${APT_FLAGS_COMMON} autoremove && \
|
||||
apt-get ${APT_FLAGS_COMMON} clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /root/.subversion
|
||||
|
||||
EXPOSE 80/TCP 443/TCP
|
||||
|
||||
@ -95,14 +109,14 @@ WORKDIR /usr/share/zabbix
|
||||
|
||||
VOLUME ["/etc/ssl/nginx"]
|
||||
|
||||
ADD conf/etc/supervisor/ /etc/supervisor/
|
||||
ADD conf/etc/zabbix/nginx.conf /etc/zabbix/
|
||||
ADD conf/etc/zabbix/nginx_ssl.conf /etc/zabbix/
|
||||
ADD conf/etc/zabbix/web/zabbix.conf.php /etc/zabbix/web/
|
||||
ADD conf/etc/nginx/nginx.conf /etc/nginx/
|
||||
ADD conf/etc/php5/fpm/conf.d/99-zabbix.ini /etc/php5/fpm/conf.d/
|
||||
ADD run_zabbix_component.sh /
|
||||
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
||||
COPY ["conf/etc/zabbix/nginx.conf", "/etc/zabbix/"]
|
||||
COPY ["conf/etc/zabbix/nginx_ssl.conf", "/etc/zabbix/"]
|
||||
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
|
||||
COPY ["conf/etc/nginx/nginx.conf", "/etc/nginx/"]
|
||||
COPY ["conf/etc/php5/fpm/conf.d/99-zabbix.ini", "/etc/php5/fpm/conf.d/"]
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["/run_zabbix_component.sh", "frontend", "mysql", "nginx"]
|
||||
CMD ["frontend", "mysql", "nginx"]
|
||||
|
@ -1,4 +1,4 @@
|
||||

|
||||

|
||||
|
||||
# What is Zabbix?
|
||||
|
||||
@ -14,15 +14,15 @@ Zabbix web interface is a part of Zabbix software. It is used to manage resource
|
||||
|
||||
# Zabbix web interface images
|
||||
|
||||
These are the only official Zabbix web interface Docker images. They are based on latest Alpine and trusty Ubuntu images. The available versions of Zabbix web interface are:
|
||||
These are the only official Zabbix web interface Docker images. They are based on Alpine Linux v3.4, Ubuntu 14.04 (trusty) and CentOS 7 images. The available versions of Zabbix web interface are:
|
||||
|
||||
Zabbix server 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest)
|
||||
Zabbix server 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest)
|
||||
Zabbix server 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, alpine-latest, ubuntu-latest, latest)
|
||||
Zabbix server 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*)
|
||||
Zabbix server 4.0 (tags: alpine-trunk, ubuntu-trunk)
|
||||
Zabbix web interface 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix web interface 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix web interface 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest)
|
||||
Zabbix web interface 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*)
|
||||
Zabbix web interface 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest, alpine-latest, ubuntu-latest, centos-latest, latest)
|
||||
Zabbix web interface 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*)
|
||||
Zabbix web interface 4.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
|
||||
|
||||
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
|
||||
|
||||
|
@ -1,23 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
os=ubuntu
|
||||
os=${PWD##*/}
|
||||
|
||||
version=$1
|
||||
version=${version:-"latest"}
|
||||
|
||||
app_component=web-nginx
|
||||
app_database=mysql
|
||||
cd ../
|
||||
app_component=${PWD##*/}
|
||||
cd $os/
|
||||
|
||||
if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then
|
||||
echo "Incorrect syntax of the version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker build -t zabbix-$app_component-$app_database:$os-$version -f Dockerfile .
|
||||
if [ "$version" != "latest" ]; then
|
||||
VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'`
|
||||
fi
|
||||
|
||||
#docker rm -f zabbix-$app_component-$app_database
|
||||
docker build -t zabbix-$app_component:$os-$version --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -f Dockerfile .
|
||||
|
||||
#docker rm -f zabbix-$app_component
|
||||
#docker rm -f mysql-server
|
||||
|
||||
#docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_RANDOM_ROOT_PASSWORD=true -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin
|
||||
#docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_RANDOM_ROOT_PASSWORD=true -d mysql:5.7
|
||||
#sleep 5
|
||||
#docker run --name zabbix-$app_component-$app_database -t -d --link mysql-server:mysql --link zabbix-server:zabbix-server zabbix-$app_component-$app_database:$os-$version
|
||||
#docker run --name zabbix-$app_component -t -d --link mysql-server:mysql --link zabbix-server:zabbix-server zabbix-$app_component:$os-$version
|
||||
|
@ -1,22 +1,27 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:nginx]
|
||||
command = /usr/sbin/nginx -g "daemon off;" -c /etc/nginx/nginx.conf
|
||||
command = /usr/sbin/%(program_name)s -g "daemon off;" -c /etc/nginx/%(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
|
||||
stderr_logfile = /dev/stderr
|
||||
stderr_logfile_maxbytes = 0
|
||||
|
||||
[program:php-fpm]
|
||||
command = /usr/sbin/php5-fpm -F -c /etc/php5/fpm/php-fpm.conf
|
||||
command = /usr/sbin/%(program_name)s -F -c /etc/php5/fpm/%(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
|
||||
stderr_logfile = /dev/stderr
|
||||
stderr_logfile_maxbytes = 0
|
@ -14,6 +14,7 @@ critical = critical
|
||||
user = root
|
||||
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
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
set +e
|
||||
|
||||
# Script trace mode
|
||||
@ -126,7 +128,7 @@ check_variables_mysql() {
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and not empty"
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -216,7 +218,7 @@ check_db_connect_postgresql() {
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -l -q 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
@ -320,21 +322,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \
|
||||
zcat /usr/share/doc/zabbix-$type-mysql/create.sql.gz | mysql --silent --skip-column-names \
|
||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
|
||||
${DB_SERVER_DBNAME} 1>/dev/null
|
||||
if [ "$type" == "server" ]; then
|
||||
echo "** Fill the schema with initial data"
|
||||
cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \
|
||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
|
||||
${DB_SERVER_DBNAME} 1>/dev/null
|
||||
cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \
|
||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
|
||||
${DB_SERVER_DBNAME} 1>/dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -356,18 +347,9 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
cat /usr/share/doc/zabbix-$type-postgresql/schema.sql | psql -q \
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
if [ "$type" == "server" ]; then
|
||||
echo "** Fill the schema with initial data"
|
||||
cat /usr/share/doc/zabbix-$type-postgresql/images.sql | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
cat /usr/share/doc/zabbix-$type-postgresql/data.sql | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
fi
|
||||
@ -378,6 +360,8 @@ prepare_web_server_apache() {
|
||||
APACHE_SITES_DIR=/etc/apache2/sites-available
|
||||
elif [ -d "/etc/apache2/conf.d" ]; then
|
||||
APACHE_SITES_DIR=/etc/apache2/conf.d
|
||||
elif [ -d "/etc/httpd/conf.d" ]; then
|
||||
APACHE_SITES_DIR=/etc/httpd/conf.d
|
||||
else
|
||||
echo "**** Apache is not available"
|
||||
exit 1
|
||||
@ -390,6 +374,7 @@ prepare_web_server_apache() {
|
||||
elif [ -f "/etc/apache2/conf.d/default.conf" ]; then
|
||||
echo "** Disable default site"
|
||||
rm -f "/etc/apache2/conf.d/default.conf"
|
||||
rm -f "/etc/httpd/conf.d/welcome.conf"
|
||||
fi
|
||||
|
||||
echo "** Adding Zabbix virtual host (HTTP)"
|
||||
@ -433,6 +418,13 @@ prepare_web_server_apache() {
|
||||
"/etc/apache2/apache2.conf"
|
||||
fi
|
||||
|
||||
if [ -f "/etc/httpd/conf/httpd.conf" ]; then
|
||||
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"
|
||||
fi
|
||||
|
||||
if [ -f "/etc/apache2/httpd.conf" ]; then
|
||||
sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
@ -456,6 +448,10 @@ prepare_web_server_apache() {
|
||||
if [ -f "/var/run/apache2/apache2.pid" ]; then
|
||||
rm -f "/var/run/apache2/apache2.pid"
|
||||
fi
|
||||
|
||||
if [ -f "/var/run/httpd/httpd.pid" ]; then
|
||||
rm -f "/var/run/httpd/httpd.pid"
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_web_server_nginx() {
|
||||
@ -692,6 +688,8 @@ prepare_zbx_web_config() {
|
||||
PHP_CONFIG_FILE="/etc/php/7.0/apache2/conf.d/99-zabbix.ini"
|
||||
elif [ -f "/etc/php/7.0/fpm/conf.d/99-zabbix.ini" ]; then
|
||||
PHP_CONFIG_FILE="/etc/php/7.0/fpm/conf.d/99-zabbix.ini"
|
||||
elif [ -f "/etc/php.d/99-zabbix.ini" ]; then
|
||||
PHP_CONFIG_FILE="/etc/php.d/99-zabbix.ini"
|
||||
fi
|
||||
|
||||
if [ -n "$PHP_CONFIG_FILE" ]; then
|
Reference in New Issue
Block a user