1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-24 08:52:31 +02:00
dockerfiles/graphite
Pratik raj b113da5d19 chore: Use --no-cache-dir flag to pip in Dockerfiles, to save space
Using "--no-cache-dir" flag in pip install ,make sure dowloaded packages
by pip don't cached on system . This is a best practise which make sure
to fetch ftom repo instead of using local cached one . Further , in case
of Docker Containers , by restricing caching , we can reduce image size.
In term of stats , it depends upon the number of python packages
multiplied by their respective size . e.g for heavy packages with a lot
of dependencies it reduce a lot by don't caching pip packages.

Further , more detail information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
2021-07-02 01:02:49 +05:30
..
data graphite: populate STATIC_ROOT 2019-04-11 14:29:43 +08:00
docker-compose.yml fix graphite 2020-03-24 16:27:11 +08:00
Dockerfile chore: Use --no-cache-dir flag to pip in Dockerfiles, to save space 2021-07-02 01:02:49 +05:30
nginx.conf update graphite 2020-03-24 16:26:40 +08:00
README.md update 2020-03-25 15:35:26 +08:00
supervisord.conf update graphite 2020-03-24 16:26:40 +08:00

graphite

Graphite does three things:

  • Kick ass.
  • Chew bubblegum.
  • Make it easy to store and graph metrics.

docker-compose.yml

graphite:
  image: vimagick/graphite
  ports:
    - "2003:2003"
    - "2003:2003/udp"
    - "2004:2004"
    - "2023:2023"
    - "2024:2024"
    - "7002:7002"
    - "8080:8080"
    - "9001:9001"
  volumes:
    - ./data/conf:/opt/graphite/conf
    - ./data/storage:/opt/graphite/storage
    - ./data/storage/log/webapp:/opt/graphite/storage/log/webapp
  restart: unless-stopped

Up and Running

$ cd ~/fig/graphite

$ 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
>>> 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/
│   │   ├── aggregation-rules.conf
│   │   ├── carbon.conf
│   │   ├── rewrite-rules.conf
│   │   └── storage-schemas.conf
│   └── storage/
│       ├── carbon-aggregator-a.pid
│       ├── carbon-cache-a.pid
│       ├── graphite.db
│       ├── log/
│       │   └── webapp/
│       └── whisper/
│           └── carbon/
└── docker-compose.yml

$ curl http://localhost:8080

⚠️ Stale pid files may prevent services from starting. Please delete these pid files manually before restarting or upgrading container.

storage-schemas.conf

[carbon]
pattern = ^carbon\.
retentions = 60:90d

[test_1day_for_1year]
pattern = ^test\.
retentions = 1d:1y

[default_1min_for_1day]
pattern = .*
retentions = 60s:1d

Resize Whisper

$ docker-compose exec graphite sh
>>> cd storage/whisper/test
>>> find . -type f -name '*.wsp' -exec whisper-resize.py --nobackup {} 1d:1y \;