mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-01-22 05:09:36 +02:00
update graphite
This commit is contained in:
parent
37127da205
commit
aa3b8728b9
@ -8,7 +8,8 @@ MAINTAINER EasyPi Software Foundation
|
||||
ENV GRAPHITE_VERSION=1.1.7
|
||||
ENV GRAPHITE_CONF_DIR=/opt/graphite/conf
|
||||
ENV GRAPHITE_STORAGE_DIR=/opt/graphite/storage
|
||||
ENV PATH=$PATH:/opt/graphite/bin
|
||||
ENV DJANGO_SETTINGS_MODULE=graphite.settings
|
||||
ENV PATH=/opt/graphite/bin:$PATH
|
||||
ENV PYTHONPATH=/opt/graphite/lib:/opt/graphite/webapp
|
||||
|
||||
WORKDIR /opt/graphite
|
||||
@ -18,32 +19,36 @@ RUN set -xe \
|
||||
&& 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 scandir supervisor whisper==$GRAPHITE_VERSION \
|
||||
&& pip install -r https://github.com/graphite-project/graphite-web/raw/$GRAPHITE_VERSION/requirements.txt \
|
||||
&& pip install carbon==$GRAPHITE_VERSION --install-option="--install-lib=/opt/graphite/lib" \
|
||||
&& pip install graphite-web==$GRAPHITE_VERSION --install-option="--prefix=/opt/graphite" --install-option="--install-lib=/opt/graphite/webapp" \
|
||||
&& cd conf \
|
||||
nginx \
|
||||
python3 \
|
||||
python3-dev \
|
||||
&& curl -sSL https://bootstrap.pypa.io/get-pip.py | python3 \
|
||||
&& pip3 install gunicorn supervisor \
|
||||
&& pip3 install --install-option=--prefix=/opt/graphite \
|
||||
--install-option=--install-lib=/opt/graphite/lib \
|
||||
whisper==$GRAPHITE_VERSION \
|
||||
carbon==$GRAPHITE_VERSION \
|
||||
&& pip3 install --install-option=--prefix=/opt/graphite \
|
||||
--install-option=--install-lib=/opt/graphite/webapp \
|
||||
graphite-web==$GRAPHITE_VERSION \
|
||||
&& cd ./webapp \
|
||||
&& echo "SECRET_KEY = '$(head -c 16 /dev/urandom | base64)'" >> graphite/local_settings.py \
|
||||
&& 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 \
|
||||
&& chmod +x manage.py \
|
||||
&& ./manage.py collectstatic --noinput --settings=graphite.settings \
|
||||
&& ./manage.py migrate --noinput --run-syncdb \
|
||||
&& cp aggregation-rules.conf.example aggregation-rules.conf \
|
||||
&& cd .. \
|
||||
&& django-admin collectstatic --noinput \
|
||||
&& django-admin migrate --noinput --run-syncdb \
|
||||
&& apk del build-base \
|
||||
curl \
|
||||
git \
|
||||
libffi-dev \
|
||||
python-dev \
|
||||
&& rm -rf /root/.cache/pip \
|
||||
/var/cache/apk/*
|
||||
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY supervisord.conf /etc/supervisor/
|
||||
|
||||
VOLUME $GRAPHITE_CONF_DIR \
|
||||
|
@ -24,26 +24,32 @@ graphite:
|
||||
volumes:
|
||||
- ./data/conf:/opt/graphite/conf
|
||||
- ./data/storage:/opt/graphite/storage
|
||||
restart: always
|
||||
- ./data/storage/log/webapp:/opt/graphite/storage/log/webapp
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
## Up and Running
|
||||
|
||||
```bash
|
||||
$ cd ~/fig/graphite
|
||||
$ mkdir -p data/storage/log/webapp
|
||||
|
||||
$ docker-compose run --rm graphite sh
|
||||
>>> django-admin migrate --noinput --run-syncdb
|
||||
>>> django-admin createsuperuser
|
||||
>>> django-admin changepassword
|
||||
>>> exit
|
||||
|
||||
$ docker-compose up -d
|
||||
|
||||
$ docker-compose exec graphite sh
|
||||
>>> vi conf/storage-schemas.conf
|
||||
>>> python webapp/manage.py migrate --noinput --run-syncdb
|
||||
>>> python webapp/manage.py createsuperuser
|
||||
>>> python webapp/manage.py changepassword
|
||||
>>> supervisorctl restart
|
||||
>>> supervisorctl restart all
|
||||
>>> supervisorctl status
|
||||
carbon-aggregator RUNNING pid 9, uptime 0:00:13
|
||||
carbon-cache RUNNING pid 8, uptime 0:00:22
|
||||
graphite-webapp RUNNING pid 7, uptime 0:00:24
|
||||
>>> exit
|
||||
|
||||
$ tree -F -L 4
|
||||
├── data/
|
||||
│ ├── conf/
|
||||
@ -59,6 +65,7 @@ $ tree -F -L 4
|
||||
│ └── whisper/
|
||||
│ └── carbon/
|
||||
└── docker-compose.yml
|
||||
|
||||
$ curl http://localhost:8080
|
||||
```
|
||||
|
||||
|
@ -7,9 +7,10 @@ graphite:
|
||||
- "2023:2023"
|
||||
- "2024:2024"
|
||||
- "7002:7002"
|
||||
- "8080:8080"
|
||||
- "48080:8080"
|
||||
- "9001:9001"
|
||||
volumes:
|
||||
- ./data/conf:/opt/graphite/conf
|
||||
- ./data/storage:/opt/graphite/storage
|
||||
restart: always
|
||||
- ./data/storage/log/webapp:/opt/graphite/storage/log/webapp
|
||||
restart: unless-stopped
|
||||
|
23
graphite/nginx.conf
Normal file
23
graphite/nginx.conf
Normal file
@ -0,0 +1,23 @@
|
||||
server {
|
||||
listen 8080 default_server;
|
||||
|
||||
location = /favicon.ico {
|
||||
return 204;
|
||||
}
|
||||
|
||||
location /static {
|
||||
alias /opt/graphite/static;
|
||||
expires max;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass_header Server;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_connect_timeout 10;
|
||||
proxy_read_timeout 10;
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
}
|
||||
}
|
@ -14,14 +14,22 @@ serverurl = http://127.0.0.1:9001
|
||||
command = carbon-cache.py --debug start
|
||||
redirect_stderr = true
|
||||
autorestart = true
|
||||
priority = 1
|
||||
|
||||
[program:carbon-aggregator]
|
||||
command = carbon-aggregator.py --debug start
|
||||
redirect_stderr = true
|
||||
autorestart = true
|
||||
priority = 2
|
||||
|
||||
[program:graphite-webapp]
|
||||
command = gunicorn -b :8080 graphite.wsgi:application
|
||||
directory = /opt/graphite/webapp
|
||||
command = gunicorn -b 127.0.0.1:8000 graphite.wsgi:application
|
||||
redirect_stderr = true
|
||||
autorestart = true
|
||||
priority = 3
|
||||
|
||||
[program:nginx]
|
||||
command = nginx -g "daemon off; pid /run/nginx.pid;"
|
||||
redirect_stderr = true
|
||||
autorestart = true
|
||||
priority = 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user