Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Merge: Support statsd by brubeck and remove nginx / grafana #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
46 changes: 26 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ RUN \
apk upgrade --no-cache && \
apk add g++ git make musl-dev cairo-dev

# Install Grafana

RUN mkdir /tmp/grafana \
&& wget -P /tmp/ https://dl.grafana.com/oss/release/grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz \
&& tar xfz /tmp/grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz --strip-components=1 -C /tmp/grafana

# Install go-carbon

WORKDIR ${GOPATH}
Expand Down Expand Up @@ -57,17 +51,22 @@ RUN \
make && \
mv carbonapi /tmp/carbonapi

# ------------------------------ BRUBECK --------------------------------------
FROM alpine:3.8 AS brubeck-builder

RUN \
apk update --no-cache && \
apk upgrade --no-cache && \
apk add g++ git make musl-dev jansson-dev openssl-dev libmicrohttpd-dev git jq

RUN git clone https://github.com/github/brubeck.git

RUN cd brubeck && ./script/bootstrap
# ------------------------------ RUN IMAGE --------------------------------------
FROM alpine:3.13.2
FROM alpine:3.8

ENV TZ='Europe/Amsterdam'
ENV TZ='Etc/UTC'

COPY --from=builder /tmp/grafana/bin/grafana-cli /usr/bin/grafana-cli
COPY --from=builder /tmp/grafana/bin/grafana-server /usr/sbin/grafana-server
COPY --from=builder /tmp/grafana/conf /usr/share/grafana/conf
COPY --from=builder /tmp/grafana/public /usr/share/grafana/public
COPY --from=builder /tmp/grafana/plugins-bundled /usr/share/grafana/plugins-bundled
COPY --from=builder /tmp/grafana/scripts /usr/share/grafana/scripts
COPY --from=builder /tmp/go-carbon /usr/bin/go-carbon
COPY --from=builder /tmp/carbonapi /usr/bin/carbonapi

Expand All @@ -80,16 +79,17 @@ RUN \
cairo \
shadow \
tzdata \
nginx \
runit \
dcron \
logrotate \
libc6-compat \
ca-certificates \
su-exec \
bash \
&& rm -rf \
/etc/nginx/conf.d/default.conf /etc/nginx/sites-enabled/default && \
openssl \
jansson \
libmicrohttpd \
jq \
bash && \
cp "/usr/share/zoneinfo/${TZ}" /etc/localtime && \
echo "${TZ}" > /etc/timezone && \
/usr/sbin/useradd \
Expand All @@ -105,12 +105,18 @@ RUN \
/tmp/* \
/var/cache/apk/*

COPY --from=brubeck-builder /brubeck/brubeck /bin/brubeck

ADD conf/config.template.json /config.template.json

ADD conf/generate_config.sh /bin/generate_config.sh

WORKDIR /

VOLUME ["/etc/go-carbon", "/etc/carbonapi", "/var/lib/graphite", "/etc/nginx", "/etc/grafana", "/etc/logrotate.d", "/var/log"]
VOLUME ["/etc/go-carbon", "/etc/carbonapi", "/var/lib/graphite", "/etc/logrotate.d", "/var/log"]

ENV HOME /root

EXPOSE 80 2003 2003/udp 2004 8080 8081
EXPOSE 80 2003 2003/udp 2004 8080 8081 8125

CMD ["/entrypoint.sh"]
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ docker run -d\
--name go-graphite\
--restart=always\
-p 80:80\
-p 8080:8081\
-p 8125:8125/udp\
-p 2003-2004:2003-2004\
gographite/go-graphite
```

### Includes the following components

* [Nginx](http://nginx.org/) - reverse proxies Grafana dashboard
* [Grafana](http://www.grafana.com/) - front-end dashboard
* [Go-carbon](https://github.com/lomik/go-carbon) - Golang implementation of Graphite/Carbon server
* [Carbonapi](https://github.com/go-graphite/carbonapi) - Golang implementation of Graphite-web
* [Brubeck](https://github.com/github/brubeck) - C implementation Statsd

### Mapped Ports

Host | Container | Service
---- | --------- | -------------------------------------------------------------------------------------------------------------------
80 | 80 | [grafana](http://docs.grafana.org/)
2003 | 2003 | [carbon receiver - plaintext](http://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-plaintext-protocol)
2004 | 2004 | [carbon receiver - pickle](http://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-pickle-protocol)
8125 | 8125 | [statsd receiver - udp](https://github.com/b/statsd_spec)

### Exposed Ports

Expand All @@ -38,8 +39,6 @@ Host | Container | Notes
----------------- | -------------------------- | -------------------------------
DOCKER ASSIGNED | /etc/go-carbon | go-carbon configs (see )
DOCKER ASSIGNED | /var/lib/graphite | graphite file storage
DOCKER ASSIGNED | /etc/nginx | nginx config
DOCKER ASSIGNED | /etc/grafana | Grafana config
DOCKER ASSIGNED | /etc/carbonapi | Carbonapi config
DOCKER ASSIGNED | /etc/logrotate.d | logrotate config
DOCKER ASSIGNED | /var/log | log files
27 changes: 27 additions & 0 deletions conf/config.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"logfile" : "./log/brubeck.log",
"sharding" : false,
"server_name" : "brubeck_debug",
"dumpfile" : "./brubeck.dump",
"capacity" : 15,
"expire" : 5,
"http" : ":9090",

"backends" : [
{
"type" : "carbon",
"address" : "0.0.0.0",
"port" : 2003,
"frequency" : 10
}
],

"samplers" : [
{
"type" : "statsd",
"address" : "0.0.0.0",
"port" : 8125,
"workers" : 4
}
]
}
Loading