mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-09 08:35:05 +02:00
Merge pull request #238 from zabbix/master
Removed supervisord from single application images
This commit is contained in:
@ -7,13 +7,13 @@ ARG VCS_REF
|
||||
ARG APK_FLAGS_COMMON="-q"
|
||||
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --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.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.build-date="${BUILD_DATE}" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
@ -51,19 +51,18 @@ RUN addgroup zabbix && \
|
||||
net-snmp-agent-libs \
|
||||
openipmi-libs \
|
||||
sqlite-libs \
|
||||
supervisor \
|
||||
unixodbc && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ARG MAJOR_VERSION=3.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}.14
|
||||
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" \
|
||||
org.label-schema.version="${ZBX_VERSION}" \
|
||||
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 \
|
||||
alpine-sdk \
|
||||
@ -92,8 +91,8 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
|
||||
--sysconfdir=/etc/zabbix \
|
||||
--prefix=/usr \
|
||||
--enable-agent \
|
||||
--enable-proxy \
|
||||
--with-${DB_TYPE} \
|
||||
--enable-${ZBX_TYPE} \
|
||||
--with-${ZBX_DB_TYPE} \
|
||||
--with-ldap \
|
||||
--with-libcurl \
|
||||
--with-libxml2 \
|
||||
@ -106,10 +105,10 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
|
||||
--silent && \
|
||||
make -j"$(nproc)" -s dbschema 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_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 && \
|
||||
cd /tmp/ && \
|
||||
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 ["/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/"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["proxy", "sqlite3"]
|
||||
|
@ -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
|
@ -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
|
@ -11,13 +11,13 @@ fi
|
||||
|
||||
# Type of Zabbix component
|
||||
# Possible values: [server, proxy, agent, web, dev]
|
||||
zbx_type="$1"
|
||||
zbx_type=${ZBX_TYPE}
|
||||
# Type of Zabbix database
|
||||
# Possible values: [mysql, postgresql]
|
||||
zbx_db_type="$2"
|
||||
zbx_db_type=${ZBX_DB_TYPE}
|
||||
# Type of web-server. Valid only with zbx_type = web
|
||||
# Possible values: [apache, nginx]
|
||||
zbx_opt_type="$3"
|
||||
zbx_opt_type=${ZBX_OPT_TYPE}
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Used only by Zabbix web-interface
|
||||
@ -872,8 +872,8 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$zbx_db_type" ]; then
|
||||
if [ -n "$zbx_opt_type" ]; then
|
||||
if [ "$zbx_db_type" != "none" ]; then
|
||||
if [ "$zbx_opt_type" != "none" ]; then
|
||||
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
|
||||
else
|
||||
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_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_type" == "java-gateway" ] && prepare_java_gateway
|
||||
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
echo "** Executing supervisord"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
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"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
else
|
||||
echo "Unknown instructions. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#################################################
|
||||
|
@ -7,13 +7,13 @@ ARG VCS_REF
|
||||
ARG YUM_FLAGS_COMMON="--quiet -y"
|
||||
ARG YUM_FLAGS_PERSISTANT="${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.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.build-date="${BUILD_DATE}" \
|
||||
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/ssl_ca && \
|
||||
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_DEV} install epel-release && \
|
||||
yum ${YUM_FLAGS_PERSISTANT} install \
|
||||
fping \
|
||||
libcurl \
|
||||
@ -51,7 +50,6 @@ RUN groupadd --system zabbix && \
|
||||
openldap \
|
||||
openssl-libs \
|
||||
pcre \
|
||||
supervisor \
|
||||
unixODBC && \
|
||||
yum ${YUM_FLAGS_PERSISTANT} clean all && \
|
||||
rm -rf /var/cache/yum/
|
||||
@ -59,12 +57,12 @@ RUN groupadd --system zabbix && \
|
||||
ARG MAJOR_VERSION=3.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}.14
|
||||
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" \
|
||||
org.label-schema.version="${ZBX_VERSION}" \
|
||||
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 && \
|
||||
yum ${YUM_FLAGS_DEV} install \
|
||||
@ -94,8 +92,8 @@ RUN yum --quiet makecache && \
|
||||
--sysconfdir=/etc/zabbix \
|
||||
--prefix=/usr \
|
||||
--enable-agent \
|
||||
--enable-proxy \
|
||||
--with-${DB_TYPE} \
|
||||
--enable-${ZBX_TYPE} \
|
||||
--with-${ZBX_DB_TYPE} \
|
||||
--with-ldap \
|
||||
--with-libcurl \
|
||||
--with-libxml2 \
|
||||
@ -108,10 +106,10 @@ RUN yum --quiet makecache && \
|
||||
--silent && \
|
||||
make -j"$(nproc)" -s dbschema 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_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 && \
|
||||
cd /tmp/ && \
|
||||
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
|
||||
@ -130,10 +128,7 @@ WORKDIR /var/lib/zabbix
|
||||
|
||||
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"]
|
||||
|
||||
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
||||
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["proxy", "sqlite3"]
|
||||
|
@ -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
|
@ -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
|
@ -11,13 +11,13 @@ fi
|
||||
|
||||
# Type of Zabbix component
|
||||
# Possible values: [server, proxy, agent, web, dev]
|
||||
zbx_type="$1"
|
||||
zbx_type=${ZBX_TYPE}
|
||||
# Type of Zabbix database
|
||||
# Possible values: [mysql, postgresql]
|
||||
zbx_db_type="$2"
|
||||
zbx_db_type=${ZBX_DB_TYPE}
|
||||
# Type of web-server. Valid only with zbx_type = web
|
||||
# Possible values: [apache, nginx]
|
||||
zbx_opt_type="$3"
|
||||
zbx_opt_type=${ZBX_OPT_TYPE}
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Used only by Zabbix web-interface
|
||||
@ -872,8 +872,8 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$zbx_db_type" ]; then
|
||||
if [ -n "$zbx_opt_type" ]; then
|
||||
if [ "$zbx_db_type" != "none" ]; then
|
||||
if [ "$zbx_opt_type" != "none" ]; then
|
||||
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
|
||||
else
|
||||
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_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_type" == "java-gateway" ] && prepare_java_gateway
|
||||
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
echo "** Executing supervisord"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
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"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
else
|
||||
echo "Unknown instructions. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#################################################
|
||||
|
@ -7,14 +7,14 @@ ARG VCS_REF
|
||||
ARG APT_FLAGS_COMMON="-qq -y"
|
||||
ARG APT_FLAGS_PERSISTANT="${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 \
|
||||
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.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.build-date="${BUILD_DATE}" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
@ -56,7 +56,6 @@ RUN locale-gen $LC_ALL && \
|
||||
libssl1.0.0 \
|
||||
libxml2 \
|
||||
snmp-mibs-downloader \
|
||||
supervisor \
|
||||
unixodbc 1>/dev/null && \
|
||||
apt-get ${APT_FLAGS_COMMON} autoremove && \
|
||||
apt-get ${APT_FLAGS_COMMON} clean && \
|
||||
@ -65,12 +64,12 @@ RUN locale-gen $LC_ALL && \
|
||||
ARG MAJOR_VERSION=3.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}.14
|
||||
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" \
|
||||
org.label-schema.version="${ZBX_VERSION}" \
|
||||
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 && \
|
||||
apt-get ${APT_FLAGS_DEV} install \
|
||||
@ -102,8 +101,8 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
|
||||
--sysconfdir=/etc/zabbix \
|
||||
--prefix=/usr \
|
||||
--enable-agent \
|
||||
--enable-proxy \
|
||||
--with-${DB_TYPE} \
|
||||
--enable-${ZBX_TYPE} \
|
||||
--with-${ZBX_DB_TYPE} \
|
||||
--with-ldap \
|
||||
--with-libcurl \
|
||||
--with-libxml2 \
|
||||
@ -116,10 +115,10 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \
|
||||
--silent && \
|
||||
make -j"$(nproc)" -s dbschema 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_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 && \
|
||||
cd /tmp/ && \
|
||||
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 ["/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/"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["proxy", "sqlite3"]
|
||||
|
@ -11,13 +11,13 @@ fi
|
||||
|
||||
# Type of Zabbix component
|
||||
# Possible values: [server, proxy, agent, web, dev]
|
||||
zbx_type="$1"
|
||||
zbx_type=${ZBX_TYPE}
|
||||
# Type of Zabbix database
|
||||
# Possible values: [mysql, postgresql]
|
||||
zbx_db_type="$2"
|
||||
zbx_db_type=${ZBX_DB_TYPE}
|
||||
# Type of web-server. Valid only with zbx_type = web
|
||||
# Possible values: [apache, nginx]
|
||||
zbx_opt_type="$3"
|
||||
zbx_opt_type=${ZBX_OPT_TYPE}
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Used only by Zabbix web-interface
|
||||
@ -872,8 +872,8 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$zbx_db_type" ]; then
|
||||
if [ -n "$zbx_opt_type" ]; then
|
||||
if [ "$zbx_db_type" != "none" ]; then
|
||||
if [ "$zbx_opt_type" != "none" ]; then
|
||||
echo "** Deploying Zabbix $zbx_type ($zbx_opt_type) with $zbx_db_type database"
|
||||
else
|
||||
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_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_type" == "java-gateway" ] && prepare_java_gateway
|
||||
@ -904,7 +904,37 @@ clear_deploy "$zbx_type"
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
echo "** Executing supervisord"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
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"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
else
|
||||
echo "Unknown instructions. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#################################################
|
||||
|
Reference in New Issue
Block a user