Docker: Add Prometheus as an optional service

This commit is contained in:
Gernot Schulz 2021-02-17 14:38:18 +01:00
parent 500b773ee1
commit 614e0f2d5f
7 changed files with 37 additions and 0 deletions

View File

@ -13,5 +13,7 @@ import endpoint
reverse_proxy /media/* media:8000
reverse_proxy /prometheus/* prometheus:9090
reverse_proxy client:4200
}

View File

@ -94,3 +94,10 @@ REDIS_SLAVE_WAIT_TIMEOUT=
DJANGO_LOG_LEVEL=
OPENSLIDES_LOG_LEVEL=
RESET_PASSWORD_VERBOSE_ERRORS=
# Optional services
# -----------------
# If enabled, Prometheus will be accessible at /prometheus/ without any
# built-in access controls! Please make sure to use it in a controlled
# development environment or to set up access controls independently.
PROMETHEUS_ENABLED=

View File

@ -8,6 +8,7 @@ TARGETS=(
[server]="$(dirname "${BASH_SOURCE[0]}")/../server/docker/"
[proxy]="$(dirname "${BASH_SOURCE[0]}")/../caddy/"
[autoupdate]="$(dirname "${BASH_SOURCE[0]}")/../autoupdate/"
[prometheus]="$(dirname "${BASH_SOURCE[0]}")/../prometheus/"
[media]="https://github.com/OpenSlides/openslides-media-service.git"
[pgbouncer]="https://github.com/OpenSlides/openslides-docker-compose.git#:pgbouncer"
[postfix]="https://github.com/OpenSlides/openslides-docker-compose.git#:postfix"

View File

@ -240,6 +240,11 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
# Override command to run more workers per task
# command: ["gunicorn", "-w", "4", "--preload", "-b",
# "0.0.0.0:8000", "src.mediaserver:app"]
ifelse(read_env(`PROMETHEUS_ENABLED'), 1, `'
prometheus:
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-prometheus:latest
networks:
- back)
volumes:
dbdata1:

View File

@ -270,6 +270,11 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
# Override command to run more workers per task
# command: ["gunicorn", "-w", "4", "--preload", "-b",
# "0.0.0.0:8000", "src.mediaserver:app"]
ifelse(read_env(`PROMETHEUS_ENABLED'), 1, `'
prometheus:
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-prometheus:latest
networks:
- back)
volumes:
dbdata1:

9
prometheus/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM prom/prometheus:v2.24.0
ADD prometheus.yml /etc/prometheus/
CMD [ "--config.file=/etc/prometheus/prometheus.yml", \
"--storage.tsdb.path=/prometheus", \
"--web.console.libraries=/usr/share/prometheus/console_libraries", \
"--web.console.templates=/usr/share/prometheus/consoles", \
"--web.external-url=http://localhost:9090/prometheus" ]

View File

@ -0,0 +1,8 @@
global:
evaluation_interval: 15s
scrape_configs:
- job_name: openslides3-autoupdate
static_configs:
- targets:
- autoupdate:8002