Removed supervisord from single application images

This commit is contained in:
root 2018-02-22 12:07:15 -08:00
parent cfcad63159
commit 6a382c3f34
108 changed files with 1415 additions and 1766 deletions

View File

@ -7,9 +7,10 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ENV TERM=xterm ENV TERM=xterm \
ZBX_TYPE=agent ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-agent-alpine" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ org.label-schema.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \
@ -35,8 +36,7 @@ RUN addgroup zabbix && \
apk add ${APK_FLAGS_PERSISTANT} \ apk add ${APK_FLAGS_PERSISTANT} \
bash \ bash \
iputils \ iputils \
libldap \ libldap && \
supervisor && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
@ -47,7 +47,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-agent --link zabbix-server:zabbix-server -p 10050:10050 -d zabbix-agent:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10050:10050 -d zabbix-${ZBX_TYPE}:alpine-${ZBX_VERSION}"
RUN apk update && \ RUN apk update && \
apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
@ -87,7 +87,8 @@ RUN apk update && \
apk del ${APK_FLAGS_COMMON} --purge \ apk del ${APK_FLAGS_COMMON} --purge \
build-dependencies && \ build-dependencies && \
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
rm -rf /root/.subversion rm -rf /root/.subversion && \
rm -rf /var/svn
EXPOSE 10050/TCP EXPOSE 10050/TCP
@ -95,9 +96,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/etc/zabbix/zabbix_agentd.d", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules"] VOLUME ["/etc/zabbix/zabbix_agentd.d", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["agentd", "none"]

View File

@ -1,17 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_agentd]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=2
startretries=3
stopsignal=TERM
stopwaitsecs=2
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,9 +7,10 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ENV TERM=xterm ENV TERM=xterm \
ZBX_TYPE=agent ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-agent-centos" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ org.label-schema.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \
@ -32,11 +33,9 @@ RUN groupadd --system zabbix && \
mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/modules && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
libldap \ libldap \
openssl-libs \ openssl-libs && \
supervisor && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
@ -48,7 +47,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-agent --link zabbix-server:zabbix-server -p 10050:10050 -d zabbix-agent:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10050:10050 -d zabbix-${ZBX_TYPE}:centos-${ZBX_VERSION}"
RUN yum --quiet makecache && \ RUN yum --quiet makecache && \
yum ${YUM_FLAGS_DEV} install \ yum ${YUM_FLAGS_DEV} install \
@ -100,9 +99,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/etc/zabbix/zabbix_agentd.d", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules"] VOLUME ["/etc/zabbix/zabbix_agentd.d", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["agentd", "none"]

View File

@ -16,6 +16,11 @@ fi
if [ "$version" != "latest" ]; then if [ "$version" != "latest" ]; then
VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'` VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'`
else
MAJOR_VERSION=`cat Dockerfile | grep "ARG MAJOR_VERSION" | cut -f2 -d"="`
MINOR_VERSION=`cat Dockerfile | grep "ARG ZBX_VERSION" | cut -f2 -d"."`
VCS_REF=$MAJOR_VERSION.$MINOR_VERSION
fi fi
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 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 .

View File

@ -1,17 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_agentd]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=2
startretries=3
stopsignal=TERM
stopwaitsecs=2
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,9 +7,10 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
ZBX_TYPE=agent ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-agent-ubuntu" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ org.label-schema.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \
@ -35,8 +36,6 @@ RUN locale-gen $LC_ALL && \
mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/modules && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \
supervisor 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
@ -49,7 +48,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-agent --link zabbix-server:zabbix-server -p 10050:10050 -d zabbix-agent:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10050:10050 -d zabbix-${ZBX_TYPE}:ubuntu-${ZBX_VERSION}"
RUN apt-get ${APT_FLAGS_COMMON} update && \ RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \ apt-get ${APT_FLAGS_DEV} install \
@ -107,9 +106,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/etc/zabbix/zabbix_agentd.d", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules"] VOLUME ["/etc/zabbix/zabbix_agentd.d", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["agentd", "none"]

View File

@ -1,17 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_agentd]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=2
startretries=3
stopsignal=TERM
stopwaitsecs=2
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -122,7 +122,7 @@ services:
zabbix-proxy-mysql: zabbix-proxy-mysql:
build: build:
context: ./proxy-pgsql/alpine context: ./proxy-mysql/alpine
cache_from: cache_from:
- alpine:3.4 - alpine:3.4
image: zabbix-proxy-mysql:alpine-local image: zabbix-proxy-mysql:alpine-local

View File

@ -7,9 +7,10 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ENV TERM=xterm PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ JAVA_HOME=/usr/lib/jvm/default-jvm ENV TERM=xterm PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ JAVA_HOME=/usr/lib/jvm/default-jvm \
ZBX_TYPE=java-gateway ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-java-gateway-alpine" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
@ -30,8 +31,7 @@ RUN addgroup zabbix && \
apk update && \ apk update && \
apk add ${APK_FLAGS_COMMON} \ apk add ${APK_FLAGS_COMMON} \
bash \ bash \
openjdk8-jre-base \ openjdk8-jre-base && \
supervisor && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
@ -42,7 +42,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-java-gateway --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-java-gateway:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-${ZBX_TYPE}:alpine-${ZBX_VERSION}"
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
autoconf \ autoconf \
@ -82,11 +82,8 @@ EXPOSE 10052/TCP
WORKDIR /var/lib/zabbix WORKDIR /var/lib/zabbix
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"] COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"]
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"] COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["java-gateway", "none"]

View File

@ -20,5 +20,5 @@ fi
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 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 zabbix-$app_component
#docker run --name zabbix-$app_component -t -d --link zabbix-server:zabbix-server zabbix-$app_component:$os-$version docker run --name zabbix-$app_component -t -d zabbix-$app_component:$os-$version

View File

@ -1,17 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_java_gateway]
command = /bin/bash /usr/sbin/%(program_name)s
user = zabbix
auto_start = true
autorestart = true
startsecs=3
startretries=3
stopsignal=INT
stopwaitsecs=2
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,9 +7,10 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ENV TERM=xterm ENV TERM=xterm \
ZBX_TYPE=java-gateway ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-java-gateway-centos" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
@ -28,10 +29,8 @@ RUN groupadd --system zabbix && \
mkdir -p /etc/zabbix/ && \ mkdir -p /etc/zabbix/ && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
java-1.8.0-openjdk-headless \ java-1.8.0-openjdk-headless && \
supervisor && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
@ -43,7 +42,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-java-gateway --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-java-gateway:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-${ZBX_TYPE}:centos-${ZBX_VERSION}"
RUN yum --quiet makecache && \ RUN yum --quiet makecache && \
yum ${YUM_FLAGS_DEV} install \ yum ${YUM_FLAGS_DEV} install \
@ -87,11 +86,8 @@ EXPOSE 10052/TCP
WORKDIR /var/lib/zabbix WORKDIR /var/lib/zabbix
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"] COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"]
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"] COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["java-gateway", "none"]

View File

@ -1,17 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_java_gateway]
command = /bin/bash /usr/sbin/%(program_name)s
user = zabbix
auto_start = true
autorestart = true
startsecs=3
startretries=3
stopsignal=INT
stopwaitsecs=2
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,9 +7,10 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
ZBX_TYPE=java-gateway ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-java-gateway-ubuntu" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
@ -33,7 +34,6 @@ RUN locale-gen $LC_ALL && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \ apt-get ${APT_FLAGS_PERSISTANT} install \
supervisor \
openjdk-7-jre-headless 1>/dev/null && \ openjdk-7-jre-headless 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -47,7 +47,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-java-gateway --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-java-gateway:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-${ZBX_TYPE}:ubuntu-${ZBX_VERSION}"
RUN apt-get ${APT_FLAGS_COMMON} update && \ RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \ apt-get ${APT_FLAGS_DEV} install \
@ -98,11 +98,8 @@ EXPOSE 10052/TCP
WORKDIR /var/lib/zabbix WORKDIR /var/lib/zabbix
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"] COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"]
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"] COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["java-gateway", "none"]

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,13 +7,13 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=mysql ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ZBX_TYPE=proxy ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix proxy with MySQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with MySQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -39,7 +39,7 @@ RUN addgroup zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-proxy-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
apk update && \ apk update && \
apk add ${APK_FLAGS_PERSISTANT} \ apk add ${APK_FLAGS_PERSISTANT} \
bash \ bash \
@ -52,7 +52,6 @@ RUN addgroup zabbix && \
mariadb-client-libs \ mariadb-client-libs \
net-snmp-agent-libs \ net-snmp-agent-libs \
openipmi-libs \ openipmi-libs \
supervisor \
unixodbc \ unixodbc \
fping && \ fping && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
@ -60,12 +59,12 @@ RUN addgroup zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-proxy-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-proxy-${DB_TYPE}:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:alpine-${ZBX_VERSION}"
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
autoconf \ autoconf \
@ -94,8 +93,8 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--prefix=/usr \ --prefix=/usr \
--enable-agent \ --enable-agent \
--enable-proxy \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
--with-libxml2 \ --with-libxml2 \
@ -108,14 +107,14 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-proxy-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apk del ${APK_FLAGS_COMMON} --purge \ apk del ${APK_FLAGS_COMMON} --purge \
@ -130,9 +129,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"] VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"]
VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["proxy", "mysql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_proxy]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/zabbix_proxy.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=5
startretries=3
stopsignal=INT
stopwaitsecs=5
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,13 +7,13 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=mysql ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ZBX_TYPE=proxy ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix proxy with MySQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with MySQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -39,9 +39,8 @@ RUN groupadd --system zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-proxy-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
fping \ fping \
libcurl \ libcurl \
@ -52,7 +51,6 @@ RUN groupadd --system zabbix && \
openldap \ openldap \
openssl-libs \ openssl-libs \
pcre \ pcre \
supervisor \
unixODBC && \ unixODBC && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
@ -60,12 +58,12 @@ RUN groupadd --system zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-proxy-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-proxy-${DB_TYPE}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:centos-${ZBX_VERSION}"
RUN yum --quiet makecache && \ RUN yum --quiet makecache && \
yum ${YUM_FLAGS_DEV} install \ yum ${YUM_FLAGS_DEV} install \
@ -95,8 +93,8 @@ RUN yum --quiet makecache && \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--prefix=/usr \ --prefix=/usr \
--enable-agent \ --enable-agent \
--enable-proxy \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
--with-libxml2 \ --with-libxml2 \
@ -109,14 +107,14 @@ RUN yum --quiet makecache && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-proxy-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \ yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \
@ -135,9 +133,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"] VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"]
VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["proxy", "mysql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_proxy]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/zabbix_proxy.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=5
startretries=3
stopsignal=INT
stopwaitsecs=5
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -9,12 +9,13 @@ ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ARG DB_TYPE=mysql 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 \ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_TYPE=proxy ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix proxy with MySQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with MySQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -45,7 +46,7 @@ RUN locale-gen $LC_ALL && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-proxy-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \ apt-get ${APT_FLAGS_PERSISTANT} install \
fping \ fping \
@ -58,7 +59,6 @@ RUN locale-gen $LC_ALL && \
libxml2 \ libxml2 \
mysql-client \ mysql-client \
snmp-mibs-downloader \ snmp-mibs-downloader \
supervisor \
unixodbc 1>/dev/null && \ unixodbc 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -67,12 +67,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-proxy-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-proxy-${DB_TYPE}:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:ubuntu-${ZBX_VERSION}"
RUN apt-get ${APT_FLAGS_COMMON} update && \ RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \ apt-get ${APT_FLAGS_DEV} install \
@ -104,8 +104,8 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--prefix=/usr \ --prefix=/usr \
--enable-agent \ --enable-agent \
--enable-proxy \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
--with-libxml2 \ --with-libxml2 \
@ -118,14 +118,14 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-proxy-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apt-get ${APT_FLAGS_COMMON} purge \ apt-get ${APT_FLAGS_COMMON} purge \
@ -155,9 +155,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"] VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"]
VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["proxy", "mysql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_proxy]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/zabbix_proxy.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=5
startretries=3
stopsignal=INT
stopwaitsecs=5
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,13 +7,13 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=sqlite3 ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ZBX_TYPE=proxy ZBX_DB_TYPE=sqlite3 ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix proxy with SQLite3 database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with SQLite3 database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -51,19 +51,18 @@ RUN addgroup zabbix && \
net-snmp-agent-libs \ net-snmp-agent-libs \
openipmi-libs \ openipmi-libs \
sqlite-libs \ sqlite-libs \
supervisor \
unixodbc && \ unixodbc && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-proxy-${DB_TYPE} --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-proxy-${DB_TYPE}:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:alpine-${ZBX_VERSION}"
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
alpine-sdk \ alpine-sdk \
@ -92,8 +91,8 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--prefix=/usr \ --prefix=/usr \
--enable-agent \ --enable-agent \
--enable-proxy \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
--with-libxml2 \ --with-libxml2 \
@ -106,10 +105,10 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
@ -125,9 +124,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"] VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"]
VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["proxy", "sqlite3"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_proxy]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/zabbix_proxy.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=5
startretries=3
stopsignal=INT
stopwaitsecs=5
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,13 +7,13 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=sqlite3 ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ZBX_TYPE=proxy ZBX_DB_TYPE=sqlite3 ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix proxy with SQLite3 database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with SQLite3 database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -39,9 +39,8 @@ RUN groupadd --system zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-proxy-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
fping \ fping \
libcurl \ libcurl \
@ -51,7 +50,6 @@ RUN groupadd --system zabbix && \
openldap \ openldap \
openssl-libs \ openssl-libs \
pcre \ pcre \
supervisor \
unixODBC && \ unixODBC && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
@ -59,12 +57,12 @@ RUN groupadd --system zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-proxy-${DB_TYPE} --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-proxy-${DB_TYPE}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:centos-${ZBX_VERSION}"
RUN yum --quiet makecache && \ RUN yum --quiet makecache && \
yum ${YUM_FLAGS_DEV} install \ yum ${YUM_FLAGS_DEV} install \
@ -94,8 +92,8 @@ RUN yum --quiet makecache && \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--prefix=/usr \ --prefix=/usr \
--enable-agent \ --enable-agent \
--enable-proxy \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
--with-libxml2 \ --with-libxml2 \
@ -108,10 +106,10 @@ RUN yum --quiet makecache && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
@ -131,9 +129,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"] VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"]
VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["proxy", "sqlite3"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_proxy]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/zabbix_proxy.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=5
startretries=3
stopsignal=INT
stopwaitsecs=5
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,14 +7,14 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ARG DB_TYPE=sqlite3
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_TYPE=proxy ZBX_DB_TYPE=sqlite3 ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix proxy with SQLite3 database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with SQLite3 database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -56,7 +56,6 @@ RUN locale-gen $LC_ALL && \
libssl1.0.0 \ libssl1.0.0 \
libxml2 \ libxml2 \
snmp-mibs-downloader \ snmp-mibs-downloader \
supervisor \
unixodbc 1>/dev/null && \ unixodbc 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -65,12 +64,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-proxy-${DB_TYPE} --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-proxy-${DB_TYPE}:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link zabbix-server:zabbix-server -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:ubuntu-${ZBX_VERSION}"
RUN apt-get ${APT_FLAGS_COMMON} update && \ RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \ apt-get ${APT_FLAGS_DEV} install \
@ -102,8 +101,8 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--prefix=/usr \ --prefix=/usr \
--enable-agent \ --enable-agent \
--enable-proxy \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
--with-libxml2 \ --with-libxml2 \
@ -116,10 +115,10 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
@ -150,9 +149,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"] VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/snmptraps"]
VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["proxy", "sqlite3"]

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,13 +7,13 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=mysql ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ZBX_TYPE=server ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-server-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix server with MySQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with MySQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -41,7 +41,7 @@ RUN addgroup zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
apk update && \ apk update && \
apk add ${APK_FLAGS_PERSISTANT} \ apk add ${APK_FLAGS_PERSISTANT} \
bash \ bash \
@ -55,19 +55,18 @@ RUN addgroup zabbix && \
mariadb-client-libs \ mariadb-client-libs \
net-snmp-agent-libs \ net-snmp-agent-libs \
openipmi-libs \ openipmi-libs \
supervisor \
unixodbc && \ unixodbc && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-server-${DB_TYPE} --link mysql-server:mysql -p 10051:10051 -d zabbix-server-${DB_TYPE}:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:alpine-${ZBX_VERSION}"
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
alpine-sdk \ alpine-sdk \
@ -96,8 +95,8 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--enable-agent \ --enable-agent \
--enable-server \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
# Does not support stable iksemel library # Does not support stable iksemel library
# --with-jabber \ # --with-jabber \
--with-ldap \ --with-ldap \
@ -112,16 +111,16 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-server-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apk del ${APK_FLAGS_COMMON} --purge \ apk del ${APK_FLAGS_COMMON} --purge \
@ -136,9 +135,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"] VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server", "mysql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_server]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=10
startretries=3
stopsignal=INT
stopwaitsecs=10
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -8,12 +8,13 @@ ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=mysql ARG DB_TYPE=mysql
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_TYPE=server ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-server-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix server with MySQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with MySQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -40,9 +41,8 @@ RUN groupadd --system zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
fping \ fping \
iksemel \ iksemel \
@ -54,7 +54,6 @@ RUN groupadd --system zabbix && \
openldap \ openldap \
openssl-libs \ openssl-libs \
pcre \ pcre \
supervisor \
unixODBC && \ unixODBC && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
@ -62,12 +61,12 @@ RUN groupadd --system zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-server-${DB_TYPE} --link mysql-server:mysql -p 10051:10051 -d zabbix-server-${DB_TYPE}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:centos-${ZBX_VERSION}"
RUN yum --quiet makecache && \ RUN yum --quiet makecache && \
yum ${YUM_FLAGS_DEV} install \ yum ${YUM_FLAGS_DEV} install \
@ -98,8 +97,8 @@ RUN yum --quiet makecache && \
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--enable-agent \ --enable-agent \
--enable-server \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-jabber \ --with-jabber \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
@ -113,16 +112,16 @@ RUN yum --quiet makecache && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-server-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \ yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \
@ -141,9 +140,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"] VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server", "mysql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_server]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=10
startretries=3
stopsignal=INT
stopwaitsecs=10
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,14 +7,14 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" 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 \ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_TYPE=server ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix server with MySQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with MySQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -47,7 +47,7 @@ RUN locale-gen $LC_ALL && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \ apt-get ${APT_FLAGS_PERSISTANT} install \
fping \ fping \
@ -61,7 +61,6 @@ RUN locale-gen $LC_ALL && \
libxml2 \ libxml2 \
mysql-client \ mysql-client \
snmp-mibs-downloader \ snmp-mibs-downloader \
supervisor \
unixodbc 1>/dev/null && \ unixodbc 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -70,12 +69,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-server-${DB_TYPE} --link mysql-server:mysql -p 10051:10051 -d zabbix-server-${DB_TYPE}:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql -p 10051:10051 -d zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}:ubuntu-${ZBX_VERSION}"
RUN apt-get ${APT_FLAGS_COMMON} update && \ RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \ apt-get ${APT_FLAGS_DEV} install \
@ -108,8 +107,8 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--enable-agent \ --enable-agent \
--enable-server \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-jabber \ --with-jabber \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
@ -123,16 +122,16 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-server-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apt-get ${APT_FLAGS_COMMON} purge \ apt-get ${APT_FLAGS_COMMON} purge \
@ -163,9 +162,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"] VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server", "mysql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_server]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=10
startretries=3
stopsignal=INT
stopwaitsecs=10
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,13 +7,13 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=postgresql ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ZBX_TYPE=server ZBX_DB_TYPE=postgresql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-server-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix server with PostgreSQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with PostgreSQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -41,7 +41,7 @@ RUN addgroup zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
apk update && \ apk update && \
apk add ${APK_FLAGS_PERSISTANT} \ apk add ${APK_FLAGS_PERSISTANT} \
bash \ bash \
@ -55,19 +55,18 @@ RUN addgroup zabbix && \
openipmi-libs \ openipmi-libs \
postgresql-client \ postgresql-client \
postgresql-libs \ postgresql-libs \
supervisor \
unixodbc && \ unixodbc && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-server-${DB_TYPE} --link postgres-server:postgres -p 10051:10051 -d zabbix-server-${DB_TYPE}:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-pgsql --link postgres-server:postgres -p 10051:10051 -d zabbix-${ZBX_TYPE}-pgsql:alpine-${ZBX_VERSION}"
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
alpine-sdk \ alpine-sdk \
@ -96,8 +95,8 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--enable-agent \ --enable-agent \
--enable-server \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
# Does not support stable iksemel library # Does not support stable iksemel library
# --with-jabber \ # --with-jabber \
--with-ldap \ --with-ldap \
@ -112,16 +111,16 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-server-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apk del ${APK_FLAGS_COMMON} --purge \ apk del ${APK_FLAGS_COMMON} --purge \
@ -136,9 +135,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"] VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server", "postgresql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_server]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=10
startretries=3
stopsignal=INT
stopwaitsecs=10
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,14 +7,14 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=postgresql
ENV TERM=xterm ENV TERM=xterm
ENV MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL ENV MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_TYPE=server ZBX_DB_TYPE=postgresql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-server-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix server with PostgreSQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with PostgreSQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -41,9 +41,8 @@ RUN groupadd --system zabbix && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
fping \ fping \
iksemel \ iksemel \
@ -56,7 +55,6 @@ RUN groupadd --system zabbix && \
pcre \ pcre \
postgresql \ postgresql \
postgresql-libs \ postgresql-libs \
supervisor \
unixODBC && \ unixODBC && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
@ -64,12 +62,12 @@ RUN groupadd --system zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-server-${DB_TYPE} --link postgres-server:postgres -p 10051:10051 -d zabbix-server-${DB_TYPE}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-pgsql --link postgres-server:postgres -p 10051:10051 -d zabbix-${ZBX_TYPE}-pgsql:centos-${ZBX_VERSION}"
RUN yum --quiet makecache && \ RUN yum --quiet makecache && \
yum ${YUM_FLAGS_DEV} install \ yum ${YUM_FLAGS_DEV} install \
@ -100,8 +98,8 @@ RUN yum --quiet makecache && \
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--enable-agent \ --enable-agent \
--enable-server \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-jabber \ --with-jabber \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
@ -115,16 +113,16 @@ RUN yum --quiet makecache && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-server-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \ yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \
@ -143,9 +141,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"] VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server", "postgresql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_server]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=10
startretries=3
stopsignal=INT
stopwaitsecs=10
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,14 +7,14 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ARG DB_TYPE=postgresql
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL MIBDIRS=/var/lib/mibs/iana:/var/lib/mibs/ietf:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_TYPE=server ZBX_DB_TYPE=postgresql ZBX_OPT_TYPE=none
LABEL org.label-schema.name="zabbix-proxy-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix server with PostgreSQL database support" \ org.label-schema.description="Zabbix ${ZBX_TYPE} with PostgreSQL database support" \
org.label-schema.vcs-ref="${VCS_REF}" \ org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \
@ -47,7 +47,7 @@ RUN locale-gen $LC_ALL && \
mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \ chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE} && \
apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \ apt-get ${APT_FLAGS_PERSISTANT} install \
fping \ fping \
@ -61,7 +61,6 @@ RUN locale-gen $LC_ALL && \
libxml2 \ libxml2 \
postgresql-client \ postgresql-client \
snmp-mibs-downloader \ snmp-mibs-downloader \
supervisor \
unixodbc 1>/dev/null && \ unixodbc 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -70,12 +69,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-server-${DB_TYPE} --link postgres-server:postgres -p 10051:10051 -d zabbix-server-${DB_TYPE}:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-${ZBX_TYPE}-pgsql --link postgres-server:postgres -p 10051:10051 -d zabbix-${ZBX_TYPE}-pgsql:ubuntu-${ZBX_VERSION}"
RUN apt-get ${APT_FLAGS_COMMON} update && \ RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \ apt-get ${APT_FLAGS_DEV} install \
@ -108,8 +107,8 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/zabbix \ --sysconfdir=/etc/zabbix \
--enable-agent \ --enable-agent \
--enable-server \ --enable-${ZBX_TYPE} \
--with-${DB_TYPE} \ --with-${ZBX_DB_TYPE} \
--with-jabber \ --with-jabber \
--with-ldap \ --with-ldap \
--with-libcurl \ --with-libcurl \
@ -123,16 +122,16 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
--silent && \ --silent && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \ make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \ make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ cp src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE} && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ cp conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \ cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
gzip database/${DB_TYPE}/create.sql && \ gzip database/${ZBX_DB_TYPE}/create.sql && \
cp database/${DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-server-${DB_TYPE}/ && \ cp database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apt-get ${APT_FLAGS_COMMON} purge \ apt-get ${APT_FLAGS_COMMON} purge \
@ -162,9 +161,6 @@ WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"] VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server", "postgresql"]

View File

@ -1,18 +0,0 @@
[supervisord]
nodaemon = true
[program:zabbix_server]
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/%(program_name)s.conf
user = zabbix
auto_start = true
autorestart = true
startsecs=10
startretries=3
stopsignal=INT
stopwaitsecs=10
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=mysql ENV TERM=xterm \
ENV TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=apache
LABEL org.label-schema.name="zabbix-web-apache-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ org.label-schema.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \
@ -47,19 +47,18 @@ RUN addgroup zabbix && \
php5-mysqli \ php5-mysqli \
php5-sockets \ php5-sockets \
php5-xmlreader \ php5-xmlreader \
supervisor \
ttf-dejavu && \ ttf-dejavu && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-web-apache-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-apache-${DB_TYPE}:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}:alpine-${ZBX_VERSION}"
ADD conf/tmp/font-config /tmp/font-config ADD conf/tmp/font-config /tmp/font-config
@ -88,7 +87,6 @@ WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"] VOLUME ["/etc/ssl/apache2"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"] COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
@ -96,5 +94,3 @@ COPY ["conf/etc/php5/conf.d/99-zabbix.ini", "/etc/php5/conf.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "mysql", "apache"]

View File

@ -1,16 +0,0 @@
[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

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=mysql ENV TERM=xterm \
ENV TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=apache
LABEL org.label-schema.name="zabbix-web-apache-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ org.label-schema.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \
@ -30,7 +30,6 @@ RUN groupadd --system zabbix && \
mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web && \
chown --quiet -R zabbix:root /etc/zabbix && \ chown --quiet -R zabbix:root /etc/zabbix && \
yum ${YUM_FLAGS_COMMON} makecache && \ yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \ yum ${YUM_FLAGS_PERSISTANT} install \
dejavu-sans-fonts \ dejavu-sans-fonts \
httpd \ httpd \
@ -41,20 +40,19 @@ RUN groupadd --system zabbix && \
php-ldap \ php-ldap \
php-mbstring \ php-mbstring \
php-mysql \ php-mysql \
php-xml \ php-xml && \
supervisor && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-web-apache-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-apache-${DB_TYPE}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}:centos-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -89,7 +87,6 @@ WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"] VOLUME ["/etc/ssl/apache2"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"] COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
@ -97,5 +94,3 @@ COPY ["conf/etc/php.d/99-zabbix.ini", "/etc/php.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "mysql", "apache"]

View File

@ -1,16 +0,0 @@
[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

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" 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 \
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=apache
LABEL org.label-schema.name="zabbix-web-apache-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ org.label-schema.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \
@ -42,7 +42,6 @@ RUN locale-gen $LC_ALL && \
php5-json \ php5-json \
php5-ldap \ php5-ldap \
php5-mysql \ php5-mysql \
supervisor \
ttf-dejavu-core 1>/dev/null && \ ttf-dejavu-core 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -51,12 +50,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-web-apache-${DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-apache-${DB_TYPE}:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}:ubuntu-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -99,7 +98,6 @@ WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"] VOLUME ["/etc/ssl/apache2"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"] COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
@ -107,5 +105,3 @@ COPY ["conf/etc/php5/apache2/conf.d/99-zabbix.ini", "/etc/php5/apache2/conf.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "mysql", "apache"]

View File

@ -1,16 +0,0 @@
[supervisord]
nodaemon = true
[program:apache2]
command = /bin/bash -c "source /etc/apache2/envvars && /usr/sbin/apache2ctl -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

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=postgresql ENV TERM=xterm \
ENV TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=postgresql ZBX_OPT_TYPE=apache
LABEL org.label-schema.name="zabbix-web-apache-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ org.label-schema.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \
@ -46,19 +46,18 @@ RUN addgroup zabbix && \
php5-sockets \ php5-sockets \
php5-xmlreader \ php5-xmlreader \
postgresql-client \ postgresql-client \
supervisor \
ttf-dejavu && \ ttf-dejavu && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-web-apache-${DB_TYPE} --link postgres-server:postgres --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-apache-${DB_TYPE}:alpine-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-pgsql --link postgres-server:postgres --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-pgsql:alpine-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -87,7 +86,6 @@ WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"] VOLUME ["/etc/ssl/apache2"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"] COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
@ -95,5 +93,3 @@ COPY ["conf/etc/php5/conf.d/99-zabbix.ini", "/etc/php5/conf.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "postgresql", "apache"]

View File

@ -1,16 +0,0 @@
[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

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=postgresql ENV TERM=xterm \
ENV TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=postgresql ZBX_OPT_TYPE=apache
LABEL org.label-schema.name="zabbix-web-apache-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ org.label-schema.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \
@ -41,20 +41,19 @@ RUN groupadd --system zabbix && \
php-mbstring \ php-mbstring \
php-pgsql \ php-pgsql \
php-xml \ php-xml \
postgresql \ postgresql && \
supervisor && \
yum ${YUM_FLAGS_PERSISTANT} clean all && \ yum ${YUM_FLAGS_PERSISTANT} clean all && \
rm -rf /var/cache/yum/ rm -rf /var/cache/yum/
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-web-apache-${DB_TYPE} --link postgres-server:postgres --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-apache-${DB_TYPE}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-pgsql --link postgres-server:postgres --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-pgsql:centos-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -89,7 +88,6 @@ WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"] VOLUME ["/etc/ssl/apache2"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"] COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
@ -97,5 +95,3 @@ COPY ["conf/etc/php.d/99-zabbix.ini", "/etc/php.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "postgresql", "apache"]

View File

@ -1,16 +0,0 @@
[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

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ARG DB_TYPE=postgresql ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=postgresql ZBX_OPT_TYPE=apache
LABEL org.label-schema.name="zabbix-web-apache-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ org.label-schema.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \
@ -42,7 +42,6 @@ RUN locale-gen $LC_ALL && \
php5-ldap \ php5-ldap \
php5-pgsql \ php5-pgsql \
postgresql-client \ postgresql-client \
supervisor \
ttf-dejavu-core 1>/dev/null && \ ttf-dejavu-core 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \ apt-get ${APT_FLAGS_COMMON} clean && \
@ -51,12 +50,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-web-apache-${DB_TYPE} --link postgres-server:postgres --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-apache-${DB_TYPE}:ubuntu-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-pgsql --link postgres-server:postgres --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-pgsql:ubuntu-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -99,7 +98,6 @@ WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"] VOLUME ["/etc/ssl/apache2"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"] COPY ["conf/etc/zabbix/apache_ssl.conf", "/etc/zabbix/"]
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"] COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
@ -107,5 +105,3 @@ COPY ["conf/etc/php5/apache2/conf.d/99-zabbix.ini", "/etc/php5/apache2/conf.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "postgresql", "apache"]

View File

@ -1,16 +0,0 @@
[supervisord]
nodaemon = true
[program:apache2]
command = /bin/bash -c "source /etc/apache2/envvars && /usr/sbin/apache2ctl -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

View File

@ -1,35 +0,0 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
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
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///var/run/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

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG APK_FLAGS_COMMON="-q" ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=mysql ENV TERM=xterm \
ENV TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=nginx
LABEL org.label-schema.name="zabbix-web-nginx-${DB_TYPE}-alpine" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-alpine" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ 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.description="Zabbix web-interface based on Nginx web server with MySQL database support" \
@ -53,12 +53,12 @@ RUN addgroup zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ 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}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}:alpine-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -98,5 +98,3 @@ COPY ["conf/etc/php5/conf.d/99-zabbix.ini", "/etc/php5/conf.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "mysql", "nginx"]

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y" ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}" ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ARG DB_TYPE=mysql ENV TERM=xterm \
ENV TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=nginx
LABEL org.label-schema.name="zabbix-web-nginx-${DB_TYPE}-centos" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-centos" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ 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.description="Zabbix web-interface based on Nginx web server with MySQL database support" \
@ -52,12 +52,12 @@ RUN groupadd --system zabbix && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ 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}:centos-${ZBX_VERSION}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}:centos-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -102,5 +102,3 @@ COPY ["conf/etc/php.d/99-zabbix.ini", "/etc/php.d/99-zabbix.ini"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "mysql", "nginx"]

View File

@ -11,13 +11,13 @@ fi
# Type of Zabbix component # Type of Zabbix component
# Possible values: [server, proxy, agent, web, dev] # Possible values: [server, proxy, agent, web, dev]
zbx_type="$1" zbx_type=${ZBX_TYPE}
# Type of Zabbix database # Type of Zabbix database
# Possible values: [mysql, postgresql] # Possible values: [mysql, postgresql]
zbx_db_type="$2" zbx_db_type=${ZBX_DB_TYPE}
# Type of web-server. Valid only with zbx_type = web # Type of web-server. Valid only with zbx_type = web
# Possible values: [apache, nginx] # Possible values: [apache, nginx]
zbx_opt_type="$3" zbx_opt_type=${ZBX_OPT_TYPE}
# Default Zabbix installation name # Default Zabbix installation name
# Used only by Zabbix web-interface # Used only by Zabbix web-interface
@ -872,8 +872,8 @@ else
exit 1 exit 1
fi fi
if [ -n "$zbx_db_type" ]; then if [ "$zbx_db_type" != "none" ]; then
if [ -n "$zbx_opt_type" ]; then if [ "$zbx_opt_type" != "none" ]; then
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
else else
echo "** Deploying Zabbix $zbx_type with $zbx_db_type database" echo "** Deploying Zabbix $zbx_type with $zbx_db_type database"
@ -894,7 +894,7 @@ prepare_system "$zbx_type" "$zbx_opt_type"
[ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type [ "$zbx_type" == "frontend" ] && prepare_web $zbx_opt_type $zbx_db_type
[ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB} [ "${ZBX_ADD_WEB}" == "true" ] && prepare_web ${ZBX_WEB_SERVER} ${ZBX_MAIN_DB}
[ "$zbx_type" == "agentd" ] && prepare_agent [ "$zbx_type" == "agent" ] && prepare_agent
[ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent [ "${ZBX_ADD_AGENT}" == "true" ] && prepare_agent
[ "$zbx_type" == "java-gateway" ] && prepare_java_gateway [ "$zbx_type" == "java-gateway" ] && prepare_java_gateway
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
echo "########################################################" echo "########################################################"
if [ "$1" != "" ]; then
echo "** Executing '$@'"
exec "$@"
elif [ "$zbx_type" == "agent" ]; then
echo "** Starting Zabbix agent"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
elif [ "$zbx_type" == "proxy" ]; then
echo "** Starting Zabbix proxy"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
elif [ "$zbx_type" == "server" ]; then
echo "** Starting Zabbix server"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
elif [ "$zbx_type" == "java-gateway" ]; then
echo "** Starting Zabbix Java Gateway"
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
elif [ "$zbx_type" == "frontend" ] && [ "$zbx_opt_type" == "apache" ]; then
echo "** Starting Zabbix frontend"
if [ -f "/usr/sbin/httpd" ]; then
exec /usr/sbin/httpd -D FOREGROUND
elif [ -f "/usr/sbin/apache2ctl" ]; then
exec source /etc/apache2/envvars && /usr/sbin/apache2ctl -D FOREGROUND
else
echo "Unknown Web-server. Exiting..."
exit 1
fi
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord" echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi
################################################# #################################################

View File

@ -7,10 +7,10 @@ ARG VCS_REF
ARG APT_FLAGS_COMMON="-qq -y" ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" 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 \
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm ZBX_TYPE=frontend ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=nginx
LABEL org.label-schema.name="zabbix-web-nginx-${DB_TYPE}-ubuntu" \ LABEL org.label-schema.name="zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
org.label-schema.vendor="Zabbix LLC" \ org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \ 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.description="Zabbix web-interface based on Nginx web server with MySQL database support" \
@ -37,8 +37,8 @@ RUN locale-gen $LC_ALL && \
apt-get ${APT_FLAGS_COMMON} install \ apt-get ${APT_FLAGS_COMMON} install \
wget 1>/dev/null && \ wget 1>/dev/null && \
DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \
wget -q http://nginx.org/keys/nginx_signing.key -O- | apt-key add - && \ wget -q https://nginx.org/keys/nginx_signing.key -O- | apt-key add - && \
echo "deb http://nginx.org/packages/ubuntu/ $DISTRIB_CODENAME nginx" >> /etc/apt/sources.list.d/nginx.list && \ echo "deb https://nginx.org/packages/ubuntu/ $DISTRIB_CODENAME nginx" >> /etc/apt/sources.list.d/nginx.list && \
apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \ apt-get ${APT_FLAGS_PERSISTANT} install \
mysql-client \ mysql-client \
@ -62,12 +62,12 @@ RUN locale-gen $LC_ALL && \
ARG MAJOR_VERSION=master ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \ org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \ 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}" org.label-schema.docker.cmd="docker run --name zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE} --link mysql-server:mysql --link zabbix-server:zabbix-server -p 80:80 -d zabbix-web-${ZBX_OPT_TYPE}-${ZBX_DB_TYPE}:ubuntu-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"] COPY ["conf/tmp/font-config", "/tmp/font-config"]
@ -119,5 +119,3 @@ COPY ["conf/etc/php5/fpm/conf.d/99-zabbix.ini", "/etc/php5/fpm/conf.d/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["frontend", "mysql", "nginx"]

Some files were not shown because too many files have changed in this diff Show More