From 2bb22582b035943d4852ea01a0fb367f61b0a5ff Mon Sep 17 00:00:00 2001 From: JPantsjoha Date: Fri, 19 Jul 2019 20:48:14 +0100 Subject: [PATCH 1/3] Dockerfile to make this exporter run out of the box. following up with misc files --- Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0b9c898 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM ruby:2.5.3-slim +MAINTAINER + +# Metadata +ENV \ + EXPORTER_APPDIR=/opt/twemproxy_exporter \ + USER=exporter + +# Prep and copy +RUN mkdir $EXPORTER_APPDIR && \ + useradd $USER +COPY . $EXPORTER_APPDIR +WORKDIR $EXPORTER_APPDIR + +RUN apt-get update -y && \ + apt-get install git bundler -y && \ + bundle && \ + rm -rf /var/lib/apt/lists/* && \ + chown -R $USER $EXPORTER_APPDIR && \ + chmod 755 $EXPORTER_APPDIR/bin/* + +USER $USER +EXPOSE 9876 +CMD "/opt/twemproxy_exporter/bin/run.sh" From 8b50b9840d735e2e8f000269699d874ed77ac048 Mon Sep 17 00:00:00 2001 From: JPantsjoha Date: Fri, 19 Jul 2019 20:51:14 +0100 Subject: [PATCH 2/3] Demo config.yaml ready for the likes of serviceMonitor scraping with kubernetes prometheus stack --- conf/config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 conf/config.yaml diff --git a/conf/config.yaml b/conf/config.yaml new file mode 100644 index 0000000..59cc108 --- /dev/null +++ b/conf/config.yaml @@ -0,0 +1,6 @@ +bind: 0.0.0.0 +port: 9876 +interval: 10 +timeout: 3 +proxies: +- twemproxy.namespace.svc.cluster.local:22222 From 9773a53c79d7cb6ba27396129cb9904f6edc1c4e Mon Sep 17 00:00:00 2001 From: JPantsjoha Date: Fri, 19 Jul 2019 20:51:54 +0100 Subject: [PATCH 3/3] Docker run.sh file --- bin/run.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bin/run.sh diff --git a/bin/run.sh b/bin/run.sh new file mode 100644 index 0000000..591c773 --- /dev/null +++ b/bin/run.sh @@ -0,0 +1,2 @@ +export EXPORTER_APPDIR=/opt/twemproxy_exporter +$EXPORTER_APPDIR/bin/twemproxy_exporter -f $EXPORTER_APPDIR/conf/config.yaml