From 14e26a8af7ab060a69cf7aa9f61905689ddb6c9c Mon Sep 17 00:00:00 2001 From: kev Date: Sat, 11 Mar 2017 18:05:03 +0800 Subject: [PATCH] add graphite --- README.md | 1 + graphite/Dockerfile | 57 +++++++++++++++++++++++++++++++++++++ graphite/README.md | 10 +++++++ graphite/docker-compose.yml | 9 ++++++ graphite/supervisord.conf | 22 ++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 graphite/Dockerfile create mode 100644 graphite/README.md create mode 100644 graphite/docker-compose.yml create mode 100644 graphite/supervisord.conf diff --git a/README.md b/README.md index 50cd716..c10af21 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ A collection of delicious docker recipes. - [x] collectd - [x] errbot :octocat: - [x] freeradius +- [x] graphite - [x] h2o - [x] httpbin :+1: - [x] hubot :octocat: diff --git a/graphite/Dockerfile b/graphite/Dockerfile new file mode 100644 index 0000000..0238db3 --- /dev/null +++ b/graphite/Dockerfile @@ -0,0 +1,57 @@ +# +# Dockerfile for graphite +# + +FROM alpine +MAINTAINER kev + +ENV PATH=$PATH:/opt/graphite/bin +ENV PYTHONPATH=/opt/graphite/lib:/opt/graphite/webapp +ENV GRAPHITE_CONF_DIR=/opt/graphite/conf +ENV GRAPHITE_STORAGE_DIR=/opt/graphite/storage + +WORKDIR /opt/graphite + +RUN set -xe \ + && apk update \ + && apk add build-base \ + cairo \ + curl \ + git \ + libffi-dev \ + python \ + python-dev \ + && curl -sSL https://bootstrap.pypa.io/get-pip.py | python \ + && pip install gunicorn \ + supervisor \ + https://github.com/graphite-project/whisper/tarball/master \ + https://github.com/graphite-project/carbon/tarball/master \ + https://github.com/graphite-project/graphite-web/tarball/master \ + -r https://github.com/graphite-project/graphite-web/raw/master/requirements.txt \ + && cd conf \ + && cp carbon.conf.example carbon.conf \ + && cp storage-schemas.conf.example storage-schemas.conf \ + && cd ../webapp \ + && echo "SECRET_KEY = '$(head -c 16 /dev/urandom | base64)'" > graphite/local_settings.py \ + && curl -sSL https://github.com/graphite-project/graphite-web/raw/master/webapp/manage.py > manage.py \ + && python manage.py migrate --run-syncdb --noinput \ + && apk del build-base \ + curl \ + git \ + libffi-dev \ + python-dev \ + && rm -rf /root/.cache/pip \ + /var/cache/apk/* + +COPY supervisord.conf /etc/supervisor/ + +VOLUME $GRAPHITE_CONF_DIR \ + $GRAPHITE_STORAGE_DIR + +EXPOSE 2003 \ + 2004 \ + 7002 \ + 8080 \ + 9001 + +CMD ["supervisord", "-n"] diff --git a/graphite/README.md b/graphite/README.md new file mode 100644 index 0000000..f644dd4 --- /dev/null +++ b/graphite/README.md @@ -0,0 +1,10 @@ +graphite +======== + +[Graphite][1] does three things: + +- Kick ass. +- Chew bubblegum. +- Make it easy to store and graph metrics. + +[1]: http://graphiteapp.org/ diff --git a/graphite/docker-compose.yml b/graphite/docker-compose.yml new file mode 100644 index 0000000..22ca3e9 --- /dev/null +++ b/graphite/docker-compose.yml @@ -0,0 +1,9 @@ +graphite: + image: vimagick/graphite + ports: + - 2003:2003 + - 2004:2004 + - 7002:7002 + - 8080:8080 + - 9001:9001 + restart: always diff --git a/graphite/supervisord.conf b/graphite/supervisord.conf new file mode 100644 index 0000000..f9b8ada --- /dev/null +++ b/graphite/supervisord.conf @@ -0,0 +1,22 @@ +[supervisord] +loglevel=info + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[inet_http_server] +port=0.0.0.0:9001 + +[supervisorctl] +serverurl=http://127.0.0.1:9001 + +[program:carbon-cache] +command = carbon-cache.py --debug start +redirect_stderr = true +autorestart = true + +[program:graphite-webapp] +command = gunicorn -b :8080 graphite.wsgi:application +directory = /opt/graphite/webapp +redirect_stderr = true +autorestart = true