add carbonapi container

This commit is contained in:
Michael Rennecke 2017-08-06 21:10:52 +02:00
parent 64e740cdc6
commit fe13f5c72c
3 changed files with 90 additions and 0 deletions

29
carbonapi/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM golang:1.8-alpine
ENV VERSION=0.8.0
RUN mkdir -p /go/src
ADD https://github.com/go-graphite/carbonapi/archive/${VERSION}.zip /tmp/carbonapi.zip
# build carbonapi
RUN set -x \
&& apk add --update git \
&& cd /go/src \
&& unzip /tmp/carbonapi.zip \
&& mv /go/src/carbonapi-* /go/src/carbonapi \
&& cd /go/src/carbonapi \
&& go-wrapper download \
&& go-wrapper install \
&& apk del git \
&& rm -f /tmp/carbonapi.zip \
&& rm -rf /var/cache/apk/*
EXPOSE 8080
COPY entrypoint.sh /entrypoint.sh
COPY carbonapi.yaml /etc/carbonapi.yaml
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/go/bin/carbonapi", "-config", "/etc/carbonapi.yaml"]

42
carbonapi/carbonapi.yaml Normal file
View File

@ -0,0 +1,42 @@
# Need to be URL, http or https
zipper: "ZIPPER"
# Listen address, should always include hostname or ip address and a port.
listen: "0.0.0.0:8080"
# Max concurrent requests to CarbonZipper
concurency: 20
cache:
# Type of caching. Valid: "mem", "memcache", "none"
type: "null"
# Cache limit in megabytes
size_mb: 10
# Only used by memcache type of cache. List of memcache servers.
memcachedServers:
- "127.0.0.1:1234"
- "127.0.0.2:1235"
# Amount of CPUs to use. 0 - unlimited
cpus: 0
# Timezone, default - local
tz: ""
# If 'true', carbonapi will send requests as is, with globs and braces
# Otherwise for each request it will generate /metrics/find and then /render
# individual metrics.
# true - faster, but will cause carbonzipper to consume much more RAM.
sendGlobsAsIs: true
graphite:
# Host:port where to send internal metrics
# Empty = disabled
host: "GRAPHITE_HOST"
interval: "60s"
prefix: "carbon.api"
# Maximium idle connections to carbonzipper
idleConnections: 10
pidFile: ""
# See https://github.com/go-graphite/carbonzipper/blob/master/example.conf#L70-L108 for format explanation
logger:
- logger: ""
file: "stderr"
level: "debug"
encoding: "console"
encodingTime: "iso8601"
encodingDuration: "seconds"

19
carbonapi/entrypoint.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -e
if [ -z "$ZIPPER" ]
then
ZIPPER=http://localhost:8080
fi
if [ -z "GRAPHITE_HOST" ]
then
GRAPHITE_HOST=''
fi
sed -e "s#ZIPPER#$ZIPPER#g" -i /etc/carbonapi.yaml
sed -e "s#GRAPHITE_HOST#$GRAPHITE_HOST#g" -i /etc/carbonapi.yaml
$@