Skip to content
Snippets Groups Projects
Commit 7f691ee8 authored by ale's avatar ale
Browse files

Add a Prometheus exporter, use s6

parent 4253e651
No related branches found
No related tags found
1 merge request!1Add a Prometheus exporter, use s6
Pipeline #43154 passed
FROM debian:stable-slim
FROM debian:stable-slim AS exporter_build
COPY build.sh /tmp/build.sh
WORKDIR /tmp
RUN apt-get -q update && \
env DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends curl ca-certificates
RUN /tmp/build.sh && rm /tmp/build.sh
RUN MEMCACHED_EXPORTER_VERSION=0.10.0 && \
curl -vsfL https://github.com/prometheus/memcached_exporter/releases/download/v${MEMCACHED_EXPORTER_VERSION}/memcached_exporter-${MEMCACHED_EXPORTER_VERSION}.linux-amd64.tar.gz | tar xzf - && \
cp memcached_exporter-${MEMCACHED_EXPORTER_VERSION}.linux-amd64/memcached_exporter /usr/bin/memcached_exporter && \
rm -fr memcached_exporter*
ENTRYPOINT ["/bin/sh", "-c", "/usr/bin/memcached -m ${MEM:-64} -c ${MAXCONN:-16384} -p ${PORT:-11211} ${ENABLE_SASL:+-S}"]
FROM registry.git.autistici.org/ai3/docker/s6-base:master
RUN apt-get -q update && \
env DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends curl memcached && \
apt-get clean && \
rm -fr /var/lib/apt/lists/*
COPY --from=exporter_build /usr/bin/memcached_exporter /usr/bin/memcached_exporter
COPY services.d/ /etc/services.d/
......@@ -10,3 +10,6 @@ The server can be configured with environment variables:
(a valid */etc/sasldb2* should be mounted into the container for it
to work).
The container will run a Prometheus exporter on PORT + 1, this can
be overridden with the `EXPORTER_PORT` environment variable.
#!/bin/sh
#
# Install script for memcached inside a Docker container.
#
# The default bitnami/minideb image defines an 'install_packages'
# command which is just a convenient helper. Define our own in
# case we are using some other Debian image.
if [ "x$(which install_packages)" = "x" ]; then
install_packages() {
env DEBIAN_FRONTEND=noninteractive apt-get install -qy -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --no-install-recommends "$@"
}
fi
die() {
echo "ERROR: $*" >&2
exit 1
}
set -x
apt -q update
# Install memcached.
install_packages memcached \
|| die "could not install packages"
# Clean up.
apt-get autoremove -y
apt-get clean
rm -fr /var/lib/apt/lists/*
#!/bin/sh
default_exporter_port=$(expr ${PORT:-11211} + 1)
exec /usr/bin/memcached_exporter --memcached.address=127.0.0.1:${PORT:-11211} --web.listen-address=:${EXPORTER_PORT:-${default_exporter_port}}
#!/usr/bin/execlineb -S0
s6-svscanctl -t /var/run/s6/services
#!/bin/sh
exec /usr/bin/memcached -m ${MEM:-64} -c ${MAXCONN:-16384} -p ${PORT:-11211} ${ENABLE_SASL:+-S}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment