Skip to content

Port to Py3, enable supervisor, adjust statsd conf, add schemas #134

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

Open
wants to merge 1 commit 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
35 changes: 19 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,54 @@ FROM alpine
# ---------------- #

# Install all prerequisites
RUN apk add --update --no-cache nginx nodejs nodejs-npm git curl wget gcc ca-certificates \
python-dev py-pip musl-dev libffi-dev cairo supervisor bash \
py-pyldap py-rrd &&\
RUN apk add --update --no-cache nginx nodejs npm git curl wget gcc ca-certificates \
py3-pip musl-dev libffi-dev cairo supervisor bash \
py3-pyldap python3-dev &&\
apk --no-cache add ca-certificates wget &&\
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub &&\
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk &&\
apk add glibc-2.28-r0.apk &&\
rm glibc-2.28-r0.apk &&\
adduser -D -u 1000 -g 'www' www &&\
pip install -U pip pytz gunicorn six &&\
ln -sf python3 /usr/bin/python &&\
python3 -m ensurepip &&\
python3 -m pip install -U pip pytz gunicorn six wheel &&\
npm install -g wizzy &&\
npm cache clean --force


# Checkout the master branches of Graphite, Carbon and Whisper and install from there
RUN mkdir /src &&\
git clone --depth=1 --branch master https://github.com/graphite-project/whisper.git /src/whisper &&\
cd /src/whisper &&\
pip install . &&\
python setup.py install
python3 -m pip install . &&\
python3 setup.py install

RUN git clone --depth=1 --branch master https://github.com/graphite-project/carbon.git /src/carbon &&\
cd /src/carbon &&\
pip install . &&\
python setup.py install
python3 -m pip install . &&\
python3 setup.py install

RUN git clone --depth=1 --branch master https://github.com/graphite-project/graphite-web.git /src/graphite-web &&\
cd /src/graphite-web &&\
pip install . &&\
python setup.py install &&\
pip install -r requirements.txt &&\
python check-dependencies.py
python3 -m pip install . &&\
python3 setup.py install &&\
python3 -m pip install -r requirements.txt &&\
python3 check-dependencies.py

# Install StatsD
RUN git clone --depth=1 --branch master https://github.com/etsy/statsd.git /src/statsd

# Install Grafana
RUN mkdir /src/grafana &&\
mkdir /opt/grafana &&\
curl https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.2.linux-amd64.tar.gz \
-o /src/grafana.tar.gz &&\
curl -L https://dl.grafana.com/oss/release/grafana-8.4.2.linux-amd64.tar.gz -o /src/grafana.tar.gz &&\
tar -xzf /src/grafana.tar.gz -C /opt/grafana --strip-components=1 &&\
rm /src/grafana.tar.gz


# Cleanup Compile Dependencies
RUN apk del --no-cache git curl wget gcc python-dev musl-dev libffi-dev
#RUN apk del --no-cache git curl wget gcc python3-dev musl-dev libffi-dev


# ----------------- #
Expand Down Expand Up @@ -94,7 +96,8 @@ ADD ./grafana/export-datasources-and-dashboards.sh /src/

# Configure nginx and supervisord
ADD ./nginx/nginx.conf /etc/nginx/nginx.conf
RUN mkdir /var/log/supervisor
RUN mkdir /var/log/supervisor /var/tmp/nginx &&\
chown www.www -R /var/tmp/nginx
ADD ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf


Expand Down
2 changes: 1 addition & 1 deletion graphite/storage-schemas.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[default]
pattern = .*
retentions = 10s:7d
retentions = 10s:7d,1m:60d,10m:1y,1h:5y,4h:10y
2 changes: 2 additions & 0 deletions statsd/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
graphiteHost: "127.0.0.1",
flushInterval: 10000,

deleteIdleStats: true,

backends: ['./backends/graphite'],
graphite: {
legacyNamespace: false
Expand Down
25 changes: 17 additions & 8 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
nodaemon = true
environment = GRAPHITE_STORAGE_DIR='/opt/graphite/storage',GRAPHITE_CONF_DIR='/opt/graphite/conf'

[unix_http_server]
file=/run/supervisord.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///run/supervisord.sock

[program:nginx]
command = /usr/sbin/nginx
stdout_logfile = /var/log/supervisor/%(program_name)s.log
Expand All @@ -10,7 +19,7 @@ autorestart = true

[program:carbon-cache]
;user = www
command = /opt/graphite/bin/carbon-cache.py --pidfile /var/run/carbon-cache-a.pid --debug start
command = /usr/bin/python /opt/graphite/bin/carbon-cache.py --nodaemon start
stdout_logfile = /var/log/supervisor/%(program_name)s.log
stderr_logfile = /var/log/supervisor/%(program_name)s.log
autorestart = true
Expand Down Expand Up @@ -39,10 +48,10 @@ stdout_logfile = /var/log/supervisor/%(program_name)s.log
stderr_logfile = /var/log/supervisor/%(program_name)s.log
autorestart = true

[program:export-datasources-and-dashboards]
directory = /src
command = /bin/bash export-datasources-and-dashboards.sh
stdout_logfile = /var/log/supervisor/%(program_name)s.log
stderr_logfile = /var/log/supervisor/%(program_name)s.log
exitcodes = 0
autorestart = unexpected
#[program:export-datasources-and-dashboards]
#directory = /src
#command = /bin/bash export-datasources-and-dashboards.sh
#stdout_logfile = /var/log/supervisor/%(program_name)s.log
#stderr_logfile = /var/log/supervisor/%(program_name)s.log
#exitcodes = 0
#autorestart = unexpected