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

Update dependencies and simplify build process #4

Merged
merged 3 commits into from
Sep 12, 2021
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
69 changes: 23 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:14.04
FROM ubuntu:20.04

# ---------------- #
# Installation #
Expand All @@ -7,49 +7,26 @@ FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive

# Install all prerequisites
RUN apt-get -y update
RUN apt-get -y install software-properties-common
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get -y update
RUN apt-get -y install python-django-tagging python-simplejson python-memcache python-ldap python-cairo python-pysqlite2 python-support \
python-pip gunicorn supervisor nginx-light nodejs git wget curl openjdk-7-jre build-essential python-dev

RUN pip install Twisted==11.1.0
RUN pip install Django==1.5
RUN pip install pytz
RUN npm install ini chokidar

# Checkout the stable branches of Graphite, Carbon and Whisper and install from there
RUN mkdir /src
RUN git clone https://github.com/graphite-project/whisper.git /src/whisper &&\
cd /src/whisper &&\
git checkout 0.9.x &&\
python setup.py install

RUN git clone https://github.com/graphite-project/carbon.git /src/carbon &&\
cd /src/carbon &&\
git checkout 0.9.x &&\
python setup.py install


RUN git clone https://github.com/graphite-project/graphite-web.git /src/graphite-web &&\
cd /src/graphite-web &&\
git checkout 0.9.x &&\
python setup.py install

# Install StatsD
RUN git clone https://github.com/etsy/statsd.git /src/statsd &&\
cd /src/statsd &&\
git checkout v0.8.0


# Install Grafana
RUN mkdir /src/grafana &&\
mkdir /opt/grafana &&\
wget https://dl.grafana.com/oss/release/grafana-6.4.4.linux-amd64.tar.gz -O /src/grafana/grafana.tar.gz &&\
tar -xzf /src/grafana/grafana.tar.gz -C /opt/grafana --strip-components=1 &&\
rm /src/grafana/grafana.tar.gz

RUN apt-get -y update

# See https://grafana.com/docs/grafana/latest/installation/debian/
RUN apt-get install -y apt-transport-https
RUN apt-get install -y software-properties-common curl
RUN curl -sSf https://packages.grafana.com/gpg.key | apt-key add -
RUN echo "deb https://packages.grafana.com/oss/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list
RUN apt-get -y update
RUN apt-get -y install supervisor nginx-light grafana build-essential

# The official original statsd package https://www.npmjs.com/package/statsd
RUN apt-get -y install nodejs npm
RUN npm install statsd

# See https://github.com/graphite-project/graphite-web/blob/1.1.x/docs/install-pip.rst
RUN apt-get -y install python3-pip gunicorn python3-dev libffi-dev libcairo2
ENV PYTHONPATH="/opt/graphite/lib/:/opt/graphite/webapp/"
RUN pip install --no-binary=:all: https://github.com/graphite-project/whisper/tarball/master && \
pip install --no-binary=:all: https://github.com/graphite-project/carbon/tarball/master && \
pip install --no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/master

# ----------------- #
# Configuration #
Expand All @@ -69,10 +46,10 @@ RUN touch /opt/graphite/storage/graphite.db /opt/graphite/storage/index
RUN chown -R www-data /opt/graphite/storage
RUN chmod 0775 /opt/graphite/storage /opt/graphite/storage/whisper
RUN chmod 0664 /opt/graphite/storage/graphite.db
RUN cd /opt/graphite/webapp/graphite && python manage.py syncdb --noinput
RUN django-admin migrate --settings=graphite.settings

# Configure Grafana
ADD ./grafana/custom.ini /opt/grafana/conf/custom.ini
ADD ./grafana/custom.ini /etc/grafana/grafana.ini

# Add the default dashboards
RUN mkdir /src/dashboards
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# StatsD + Graphite + Grafana 6.4.4
# StatsD + Graphite + Grafana 8

[![dokku/docker-grafana-graphite](http://dockeri.co/image/dokku/docker-grafana-graphite)](https://registry.hub.docker.com/u/dokku/docker-grafana-graphite/)

Expand All @@ -8,7 +8,7 @@ There are two ways for using this image:

## Using the Docker Index

All you eed as a prerequisite is having `docker`, `docker-compose`, and `make` installed on your machine. The container exposes the following ports:
All you need as a prerequisite is having `docker`, `docker-compose`, and `make` installed on your machine. The container exposes the following ports:

- `80`: the Grafana web interface.
- `81`: the Graphite web port
Expand Down
14 changes: 13 additions & 1 deletion grafana/set-local-graphite-source.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
#!/bin/bash
set -e

# sleeping for 10 seconds to let grafana get up and running
sleep 10 && curl 'http://admin:admin@localhost:80/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"Local Graphite","type":"graphite","url":"http://localhost:8000","access":"proxy","isDefault":true}'
sleep 10

curl -X POST 'http://admin:admin@localhost:80/api/datasources' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-binary '{
"name":"Local Graphite",
"type":"graphite",
"url":"http://localhost:8000",
"access":"proxy",
"isDefault":true
}'
9 changes: 4 additions & 5 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ stderr_logfile = /var/log/supervisor/%(program_name)s.log
autorestart = true

[program:grafana-webapp]
;user = www-data
directory = /opt/grafana/
command = /opt/grafana/bin/grafana-server
;user = grafana
command = grafana-server -config /etc/grafana/grafana.ini -homepath /usr/share/grafana
stdout_logfile = /var/log/supervisor/%(program_name)s.log
stderr_logfile = /var/log/supervisor/%(program_name)s.log
autorestart = true
Expand All @@ -27,14 +26,14 @@ autorestart = true
;user = www-data
directory = /opt/graphite/webapp
environment = PYTHONPATH='/opt/graphite/webapp'
command = /usr/bin/gunicorn_django -b127.0.0.1:8000 -w2 graphite/settings.py
command = gunicorn3 -b127.0.0.1:8000 -w2 graphite.wsgi
stdout_logfile = /var/log/supervisor/%(program_name)s.log
stderr_logfile = /var/log/supervisor/%(program_name)s.log
autorestart = true

[program:statsd]
;user = www-data
command = /usr/bin/node /src/statsd/stats.js /src/statsd/config.js
command = node /node_modules/statsd/stats.js /src/statsd/config.js
stdout_logfile = /var/log/supervisor/%(program_name)s.log
stderr_logfile = /var/log/supervisor/%(program_name)s.log
autorestart = true
Expand Down