Optimized Java Gateway build process

This commit is contained in:
Alexey Pustovalov 2021-09-13 17:53:32 +02:00
commit e7971dcf4a
20 changed files with 31 additions and 87 deletions

View File

@ -45,7 +45,7 @@ Please also follow usage instructions of each Zabbix component image:
* [zabbix-proxy-sqlite3](https://hub.docker.com/r/zabbix/zabbix-proxy-sqlite3/) - Zabbix proxy with SQLite3 database support * [zabbix-proxy-sqlite3](https://hub.docker.com/r/zabbix/zabbix-proxy-sqlite3/) - Zabbix proxy with SQLite3 database support
* [zabbix-proxy-mysql](https://hub.docker.com/r/zabbix/zabbix-proxy-mysql/) - Zabbix proxy with MySQL database support * [zabbix-proxy-mysql](https://hub.docker.com/r/zabbix/zabbix-proxy-mysql/) - Zabbix proxy with MySQL database support
* [zabbix-java-gateway](https://hub.docker.com/r/zabbix/zabbix-java-gateway/) - Zabbix Java Gateway * [zabbix-java-gateway](https://hub.docker.com/r/zabbix/zabbix-java-gateway/) - Zabbix Java Gateway
* [zabbix-zabbix-web-service](https://hub.docker.com/r/zabbix/zabbix-web-service/) - Zabbix web servce for performing various tasks using headless web browser (for example, reporting) * [zabbix-zabbix-web-service](https://hub.docker.com/r/zabbix/zabbix-web-service/) - Zabbix web service for performing various tasks using headless web browser (for example, reporting)
* [zabbix-snmptraps](https://hub.docker.com/r/zabbix/zabbix-snmptraps/) - Additional container image for Zabbix server and Zabbix proxy to support SNMP traps * [zabbix-snmptraps](https://hub.docker.com/r/zabbix/zabbix-snmptraps/) - Additional container image for Zabbix server and Zabbix proxy to support SNMP traps
## Issues and Wiki ## Issues and Wiki

View File

@ -48,7 +48,8 @@ RUN set -eux && \
apk add --clean-protected --no-cache \ apk add --clean-protected --no-cache \
bash \ bash \
openjdk8-jre-base && \ openjdk8-jre-base && \
rm -rf /usr/sbin/zabbix_java/lib/*.xml && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \
mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \
chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \
chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \
chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \

View File

@ -1,15 +0,0 @@
<configuration scan="true" scanPeriod="15 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -18,14 +18,10 @@ prepare_java_gateway_config() {
ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml
if [ -n "${ZBX_DEBUGLEVEL}" ]; then : ${ZBX_DEBUGLEVEL:="info"}
echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
if [ -f "$ZBX_GATEWAY_CONFIG" ]; then echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG" sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG"
else
echo "**** Zabbix Java Gateway log configuration file '$ZBX_GATEWAY_CONFIG' not found"
fi
fi
} }
prepare_java_gateway() { prepare_java_gateway() {

View File

@ -38,8 +38,6 @@ LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentati
org.opencontainers.image.version="${ZBX_VERSION}" \ org.opencontainers.image.version="${ZBX_VERSION}" \
org.opencontainers.image.source="${ZBX_SOURCES}" org.opencontainers.image.source="${ZBX_SOURCES}"
COPY ["conf/etc/", "/etc/"]
RUN set -eux && \ RUN set -eux && \
dnf --quiet makecache && \ dnf --quiet makecache && \
dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \
@ -67,7 +65,8 @@ RUN set -eux && \
mkdir -p /usr/sbin/zabbix_java/ && \ mkdir -p /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \ cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \ cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \
rm -rf /usr/sbin/zabbix_java/lib/*.xml && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \
mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \
cd /tmp/ && \ cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \

View File

@ -1,15 +0,0 @@
<configuration scan="true" scanPeriod="15 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -18,14 +18,10 @@ prepare_java_gateway_config() {
ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml
if [ -n "${ZBX_DEBUGLEVEL}" ]; then : ${ZBX_DEBUGLEVEL:="info"}
echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
if [ -f "$ZBX_GATEWAY_CONFIG" ]; then echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG" sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG"
else
echo "**** Zabbix Java Gateway log configuration file '$ZBX_GATEWAY_CONFIG' not found"
fi
fi
} }
prepare_java_gateway() { prepare_java_gateway() {

View File

@ -46,7 +46,8 @@ RUN set -eux && \
apt-get -y update && \ apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
openjdk-8-jre-headless && \ openjdk-8-jre-headless && \
rm -rf /usr/sbin/zabbix_java/lib/*.xml && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \
mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \
apt-get -y autoremove && \ apt-get -y autoremove && \
apt-get -y clean && \ apt-get -y clean && \
chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \

View File

@ -1,15 +0,0 @@
<configuration scan="true" scanPeriod="15 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -18,14 +18,10 @@ prepare_java_gateway_config() {
ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml
if [ -n "${ZBX_DEBUGLEVEL}" ]; then : ${ZBX_DEBUGLEVEL:="info"}
echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
if [ -f "$ZBX_GATEWAY_CONFIG" ]; then echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG" sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG"
else
echo "**** Zabbix Java Gateway log configuration file '$ZBX_GATEWAY_CONFIG' not found"
fi
fi
} }
prepare_java_gateway() { prepare_java_gateway() {

View File

@ -16,7 +16,7 @@ LABEL org.opencontainers.image.title="Zabbix web service" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \ org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.description="Zabbix web servce for performing various tasks using headless web browser" \ org.opencontainers.image.description="Zabbix web service for performing various tasks using headless web browser" \
org.opencontainers.image.licenses="GPL v2.0" \ org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.opencontainers.image.version="${ZBX_VERSION}" \ org.opencontainers.image.version="${ZBX_VERSION}" \

View File

@ -10,7 +10,7 @@ For more information and related downloads for Zabbix components, please visit h
# What is Zabbix web service? # What is Zabbix web service?
Zabbix web servce for performing various tasks using headless web browser (for example, reporting). Zabbix web service for performing various tasks using headless web browser (for example, reporting).
# Zabbix web service images # Zabbix web service images

View File

@ -4,7 +4,7 @@ LABEL org.opencontainers.image.title="Zabbix web service" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \ org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.description="Zabbix web servce for performing various tasks using headless web browser" \ org.opencontainers.image.description="Zabbix web service for performing various tasks using headless web browser" \
org.opencontainers.image.licenses="GPL v2.0" org.opencontainers.image.licenses="GPL v2.0"
STOPSIGNAL SIGTERM STOPSIGNAL SIGTERM

View File

@ -10,7 +10,7 @@ For more information and related downloads for Zabbix components, please visit h
# What is Zabbix web service? # What is Zabbix web service?
Zabbix web servce for performing various tasks using headless web browser (for example, reporting). Zabbix web service for performing various tasks using headless web browser (for example, reporting).
# Zabbix web service images # Zabbix web service images

View File

@ -16,7 +16,7 @@ LABEL org.opencontainers.image.title="Zabbix web service" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \ org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.description="Zabbix web servce for performing various tasks using headless web browser" \ org.opencontainers.image.description="Zabbix web service for performing various tasks using headless web browser" \
org.opencontainers.image.licenses="GPL v2.0" \ org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.opencontainers.image.version="${ZBX_VERSION}" \ org.opencontainers.image.version="${ZBX_VERSION}" \

View File

@ -10,7 +10,7 @@ For more information and related downloads for Zabbix components, please visit h
# What is Zabbix web service? # What is Zabbix web service?
Zabbix web servce for performing various tasks using headless web browser (for example, reporting). Zabbix web service for performing various tasks using headless web browser (for example, reporting).
# Zabbix web service images # Zabbix web service images

View File

@ -14,17 +14,17 @@ LABEL name="zabbix/zabbix-web-service-trunk" \
version="${MAJOR_VERSION}" \ version="${MAJOR_VERSION}" \
release="${RELEASE}" \ release="${RELEASE}" \
summary="Zabbix web service" \ summary="Zabbix web service" \
description="Zabbix web servce for performing various tasks using headless web browser" \ description="Zabbix web service for performing various tasks using headless web browser" \
url="https://www.zabbix.com/" \ url="https://www.zabbix.com/" \
run="docker run --name zabbix-web-service --link zabbix-server:zabbix-server -p 10053:10053 -d registry.connect.redhat.com/zabbix/zabbix-web-service-trunk:${ZBX_VERSION}" \ run="docker run --name zabbix-web-service --link zabbix-server:zabbix-server -p 10053:10053 -d registry.connect.redhat.com/zabbix/zabbix-web-service-trunk:${ZBX_VERSION}" \
io.k8s.description="Zabbix web servce for performing various tasks using headless web browser" \ io.k8s.description="Zabbix web service for performing various tasks using headless web browser" \
io.k8s.display-name="Zabbix web service" \ io.k8s.display-name="Zabbix web service" \
io.openshift.expose-services="10053:10053" \ io.openshift.expose-services="10053:10053" \
io.openshift.tags="zabbix,zabbix-web-service" \ io.openshift.tags="zabbix,zabbix-web-service" \
org.label-schema.name="zabbix-web-service-rhel" \ org.label-schema.name="zabbix-web-service-rhel" \
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 servce for performing various tasks using headless web browser" \ org.label-schema.description="Zabbix web service for performing various tasks using headless web browser" \
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" \

View File

@ -10,7 +10,7 @@ For more information and related downloads for Zabbix components, please visit h
# What is Zabbix web service? # What is Zabbix web service?
Zabbix web servce for performing various tasks using headless web browser (for example, reporting). Zabbix web service for performing various tasks using headless web browser (for example, reporting).
# Zabbix web service images # Zabbix web service images

View File

@ -16,7 +16,7 @@ LABEL org.opencontainers.image.title="Zabbix web service" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \ org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.description="Zabbix web servce for performing various tasks using headless web browser" \ org.opencontainers.image.description="Zabbix web service for performing various tasks using headless web browser" \
org.opencontainers.image.licenses="GPL v2.0" \ org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.opencontainers.image.version="${ZBX_VERSION}" \ org.opencontainers.image.version="${ZBX_VERSION}" \

View File

@ -10,7 +10,7 @@ For more information and related downloads for Zabbix components, please visit h
# What is Zabbix web service? # What is Zabbix web service?
Zabbix web servce for performing various tasks using headless web browser (for example, reporting). Zabbix web service for performing various tasks using headless web browser (for example, reporting).
# Zabbix web service images # Zabbix web service images