Update to 3.9.2 and cleanup metrics handling

This commit is contained in:
Daniel Berteaud 2024-03-28 15:17:04 +01:00
parent 386f22ab5b
commit b7730e98b7
4 changed files with 20 additions and 7 deletions

View File

@ -2,13 +2,14 @@ FROM [[ .docker.repo ]][[ .docker.base_images.java17.image ]] AS builder
ARG ZK_VERSION=[[ .zookeeper.version ]]
ADD https://dlcdn.apache.org/zookeeper/zookeeper-${ZK_VERSION}/apache-zookeeper-${ZK_VERSION}-bin.tar.gz /tmp
ADD https://dlcdn.apache.org/zookeeper/zookeeper-${ZK_VERSION}/apache-zookeeper-${ZK_VERSION}-bin.tar.gz.asc /tmp
ADD https://dist.apache.org/repos/dist/release/zookeeper/KEYS /tmp
RUN set -x &&\
apk --no-cache add tar gzip gnupg curl ca-certificates &&\
export GNUPGHOME="$(mktemp -d)" &&\
cd /tmp &&\
curl -sSLO https://dlcdn.apache.org/zookeeper/zookeeper-${ZK_VERSION}/apache-zookeeper-${ZK_VERSION}-bin.tar.gz &&\
curl -sSLO https://dlcdn.apache.org/zookeeper/zookeeper-${ZK_VERSION}/apache-zookeeper-${ZK_VERSION}-bin.tar.gz.asc &&\
curl https://dist.apache.org/repos/dist/release/zookeeper/KEYS | gpg --import - &&\
gpg --import KEYS &&\
gpg --batch --verify "apache-zookeeper-${ZK_VERSION}-bin.tar.gz.asc" "apache-zookeeper-${ZK_VERSION}-bin.tar.gz" &&\
tar xzf "apache-zookeeper-${ZK_VERSION}-bin.tar.gz" &&\
mv apache-zookeeper-${ZK_VERSION}-bin /opt/zookeeper &&\
@ -27,7 +28,14 @@ RUN set -eux &&\
apk --no-cache upgrade &&\
apk --no-cache add openssl bash libc6-compat gcompat &&\
addgroup -g 2181 zookeeper &&\
adduser --system --ingroup zookeeper --disabled-password --uid 2181 --home /opt/zookeeper --no-create-home --shell /sbin/nologin zookeeper &&\
adduser --system \
--ingroup zookeeper \
--disabled-password \
--uid 2181 \
--home /opt/zookeeper \
--no-create-home \
--shell /sbin/nologin \
zookeeper &&\
mkdir /data &&\
chown zookeeper.zookeeper /data &&\
chmod 700 /data

View File

@ -40,8 +40,12 @@ authProvider.sasl=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
authProvider.x509=org.apache.zookeeper.server.auth.X509AuthenticationProvider
enableEagerACLCheck=true
[[- if conv.ToBool .prometheus.enabled ]]
metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
metricsProvider.httpHost=127.0.0.1
metricsProvider.httpPort=7000
metricsProvider.exportJvmInfo=true
[[- end ]]
admin.enableServer=false

View File

@ -7,10 +7,10 @@ instance: zookeeper
zookeeper:
# Version of ZooKeeper
version: 3.9.1
version: 3.9.2
# Docker image to use
image: '[[ .docker.repo ]]zookeeper:[[ .zookeeper.version ]]-2'
image: '[[ .docker.repo ]]zookeeper:[[ .zookeeper.version ]]-1'
# Number of instances to run (should be 3 or 5 for high availability)
count: 3
@ -42,5 +42,6 @@ zookeeper:
per_alloc: true
prometheus:
enabled: '[[ .prometheus.available ]]'
# URL (from inside the container POV) where prometheus metrics are available
metrics_url: http://127.0.0.1:7000/metrics

View File

@ -17,7 +17,7 @@ job "[[ .instance ]]" {
mode = "bridge"
port "quorum" {}
port "elect" {}
[[- if $c.prometheus.enabled ]]
[[- if conv.ToBool $c.prometheus.enabled ]]
port "metrics" {}
[[- end ]]
}