Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.11.6 as base
FROM alpine:3.12.0 as base
LABEL maintainer="Denys Zhdanov <denis.zhdanov@gmail.com>"

RUN true \
Expand All @@ -25,6 +25,8 @@ RUN true \
mysql-client \
postgresql-dev \
postgresql-client \
librdkafka \
jansson \
&& rm -rf \
/etc/nginx/conf.d/default.conf \
&& mkdir -p \
Expand All @@ -42,15 +44,18 @@ RUN true \
pkgconfig \
py3-cairo \
py3-pip \
py3-virtualenv==16.7.8-r0 \
openldap-dev \
python3-dev \
rrdtool-dev \
wget \
go==1.13.11-r0 \
jansson-dev \
librdkafka-dev \
&& pip3 install virtualenv==16.7.10 \
&& virtualenv /opt/graphite \
&& . /opt/graphite/bin/activate \
&& pip3 install \
django==2.2.12 \
django==2.2.13 \
django-statsd-mozilla \
fadvise \
gunicorn==20.0.4 \
Expand Down Expand Up @@ -92,7 +97,7 @@ RUN . /opt/graphite/bin/activate \
&& pip3 install -r requirements.txt \
&& python3 ./setup.py install

# install statsd (as we have to use this ugly way)
# install statsd
ARG statsd_version=0.8.6
ARG statsd_repo=https://github.com/statsd/statsd.git
WORKDIR /opt
Expand All @@ -101,11 +106,32 @@ RUN git clone "${statsd_repo}" \
&& git checkout tags/v"${statsd_version}" \
&& npm install

# build go-carbon w/pickle patch (experimental)
# https://github.com/lomik/go-carbon/pull/340
ARG gocarbon_version=0.14.0
ARG gocarbon_repo=https://github.com/lomik/go-carbon.git
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
RUN git clone "${gocarbon_repo}" /usr/local/src/go-carbon \
&& cd /usr/local/src/go-carbon \
&& git checkout tags/v"${gocarbon_version}" \
&& curl https://patch-diff.githubusercontent.com/raw/lomik/go-carbon/pull/340.patch | git apply \
&& make \
&& chmod +x go-carbon && mkdir -p /opt/graphite/bin/ \
&& cp -fv go-carbon /opt/graphite/bin/go-carbon

# install brubeck (experimental)
ARG brubeck_repo=https://github.com/lukepalmer/brubeck.git
ENV BRUBECK_NO_HTTP=1
RUN git clone "${brubeck_repo}" /usr/local/src/brubeck \
&& cd /usr/local/src/brubeck && ./script/bootstrap \
&& chmod +x brubeck && mkdir -p /opt/graphite/bin/ \
&& cp -fv brubeck /opt/graphite/bin/brubeck

COPY conf/opt/graphite/conf/ /opt/defaultconf/graphite/
COPY conf/opt/graphite/webapp/graphite/local_settings.py /opt/defaultconf/graphite/local_settings.py

# config graphite
COPY conf/opt/graphite/conf/*.conf /opt/graphite/conf/
COPY conf/opt/graphite/conf/* /opt/graphite/conf/
COPY conf/opt/graphite/webapp/graphite/local_settings.py /opt/graphite/webapp/graphite/local_settings.py
WORKDIR /opt/graphite/webapp
RUN mkdir -p /var/log/graphite/ \
Expand All @@ -121,7 +147,7 @@ ENV STATSD_INTERFACE udp

COPY conf /

# copy /opt from build image
# copy from build image
COPY --from=build /opt /opt

# defaults
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,19 @@ docker-compose up
## Running through Kubernetes
You can use this 3-rd party repo with Graphite Helm chart - https://github.com/kiwigrid/helm-charts/tree/master/charts/graphite

## About `root` process

This image uses `runit` as init system, to run multiple processes in single container. It's not against Docker guidelines but bit against Docker philosophy. Also, `runit` require root privileges to run, so, it's not possible to stop using root privileges, without completely rewrite this image. This is possible, of course, but it's better to use separate images per component then, and having separate repository for this new project.

## Experimental Features
### go-carbon

Use `GOCARBON=1` environment variable to enable [go-carbon](https://github.com/lomik/go-carbon) instance instead of normal Carbon. Please note that it will disable carbon-aggregator too. Use `GRAPHITE_CLUSTER_SERVERS="127.0.0.1:8000"` if you want also use [carbonserver](https://github.com/grobian/carbonserver) feature.

### brubeck

Use `BRUBECK=1` environment variable to enable [brubeck]() instance of normal Statsd. Please note that brubeck has different config format and not fully compatible with original statsd.


## Additional Reading

Expand Down
4 changes: 2 additions & 2 deletions conf/etc/logrotate.d/graphite-statsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/var/log/*.log /var/log/*/*.log {
weekly
daily
size 50M
missingok
rotate 10
rotate 14
compress
delaycompress
notifempty
Expand Down
5 changes: 5 additions & 0 deletions conf/etc/service/brubeck/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

[[ -n "${BRUBECK}" ]] || exit 1

exec /opt/graphite/bin/brubeck --config=/opt/graphite/conf/brubeck.json 2>&1
3 changes: 3 additions & 0 deletions conf/etc/service/carbon-aggregator/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/sh

# disable if go-carbon enabled
[[ -n "${GOCARBON}" ]] && exit 1

exec python3 /opt/graphite/bin/carbon-aggregator.py start --debug 2>&1
3 changes: 3 additions & 0 deletions conf/etc/service/carbon/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/sh

# disable if go-carbon enabled
[[ -n "${GOCARBON}" ]] && exit 1

exec python3 /opt/graphite/bin/carbon-cache.py start --debug 2>&1
5 changes: 5 additions & 0 deletions conf/etc/service/go-carbon/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

[[ -n "${GOCARBON}" ]] || exit 1

exec /opt/graphite/bin/go-carbon -config="/opt/graphite/conf/go-carbon.conf" -daemon=false 2>&1
2 changes: 2 additions & 0 deletions conf/etc/service/statsd/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

[[ -n "${BRUBECK}" ]] && exit 1

if folder_empty /opt/statsd/config/; then
cp /opt/defaultconf/statsd/config/*.js /opt/statsd/config/
fi
Expand Down
24 changes: 24 additions & 0 deletions conf/opt/graphite/conf/brubeck.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"sharding" : false,
"server_name" : "brubeck",
"dumpfile" : "/tmp/brubeck.dump",
"capacity" : 15,
"backends" : [
{
"type" : "carbon",
"address" : "localhost",
"port" : 2003,
"frequency" : 10
}
],
"samplers" : [
{
"type" : "statsd",
"address" : "0.0.0.0",
"port" : 8125,
"workers" : 4,
"multisock" : true,
"multimsg" : 8
}
]
}
Loading