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

Add compose monitoring profile #1589

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion docker/batch-test.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ INTERNETNL_DOMAINNAME=internet.test
# use unique name to not conflict with integration tests
COMPOSE_PROJECT_NAME=internetnl-batch-test

COMPOSE_PROFILES=batch,cron
COMPOSE_PROFILES=cron,monitoring

ENABLE_BATCH=True

Expand Down
2 changes: 1 addition & 1 deletion docker/build.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# include all compose files
COMPOSE_FILE=docker/compose.yaml:docker/compose.build.yaml:docker/compose.development.yaml:docker/compose.integration-tests.yaml:docker/compose.test.yaml:docker/compose.tools.yaml:docker/compose.test-runner-develop.yaml:docker/compose.integration-tests.yaml
COMPOSE_PROFILES=connectiontest,cron,routinator,batch,build
COMPOSE_PROFILES=connectiontest,cron,monitoring,routinator,build

# don't expose HTTP(S) and DNS ports to the outside, this also causes issues due to being privileged ports
WEBSERVER_PORT=80
Expand Down
37 changes: 37 additions & 0 deletions docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ services:
# start_interval: 5s
start_period: 1m
retries: 10

profiles:
- connectiontest

Expand Down Expand Up @@ -752,6 +753,10 @@ services:
internal:
ipv4_address: $IPV4_IP_GRAFANA_INTERNAL

profiles:
- alertmanager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think alertmanager needs to be specified here (and the others). Thought doesn't make sense to enable alertmanager profile without the monitoring profile also enabled. It might be better to keep them separated.

- monitoring

prometheus:
image: ${DOCKER_IMAGE_PROMETHEUS}

Expand Down Expand Up @@ -782,6 +787,10 @@ services:
volumes:
- prometheus-data:/prometheus

profiles:
- alertmanager
- monitoring

alertmanager:
image: ${DOCKER_IMAGE_PROMETHEUS_ALERTMANAGER}

Expand Down Expand Up @@ -824,6 +833,10 @@ services:
networks:
- internal

profiles:
- alertmanager
- monitoring

redis-exporter:
image: ${DOCKER_IMAGE_REDIS_EXPORTER}

Expand All @@ -841,6 +854,10 @@ services:
networks:
- internal

profiles:
- alertmanager
- monitoring

statsd-exporter:
image: ${DOCKER_IMAGE_STATSD_EXPORTER}

Expand All @@ -862,6 +879,10 @@ services:
aliases:
- statsd

profiles:
- alertmanager
- monitoring

celery-exporter:
image: ${DOCKER_IMAGE_CELERY_EXPORTER}
command:
Expand All @@ -883,6 +904,10 @@ services:
rabbitmq:
condition: service_healthy

profiles:
- alertmanager
- monitoring

# https://github.com/prometheus/node_exporter#docker
node-exporter:
image: ${DOCKER_IMAGE_NODE_EXPORTER}
Expand Down Expand Up @@ -913,6 +938,10 @@ services:
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
- prometheus-textfile-directory:/prometheus-textfile-directory

profiles:
- alertmanager
- monitoring

docker_stats_exporter:
# https://github.com/jan4843/docker_stats_exporter
image: ${DOCKER_IMAGE_DOCKER_STATSD_EXPORTER}
Expand All @@ -932,6 +961,10 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock

profiles:
- alertmanager
- monitoring

nginx_logs_exporter:
image: ${DOCKER_IMAGE_NGINX_LOGS_EXPORTER}
command:
Expand All @@ -953,6 +986,10 @@ services:
volumes:
- nginx-logs-exporter:/var/log/nginx/prometheus-nginxlog-exporter/

profiles:
- alertmanager
- monitoring

volumes:
postgres: {}
postgres-backups: {}
Expand Down
2 changes: 1 addition & 1 deletion docker/defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ COMPOSE_PROJECT_NAME=internetnl
COMPOSE_FILE=docker/compose.yaml

# enable all services and crons
COMPOSE_PROFILES=connectiontest,cron,routinator
COMPOSE_PROFILES=connectiontest,cron,monitoring,routinator

# interval for batch processing
BATCH_SCHEDULER_INTERVAL=1
Expand Down
2 changes: 1 addition & 1 deletion docker/develop.env
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ INTERNETNL_BRANDING=False
NGINX_PROXY_CACHE=off

# only enable application services
COMPOSE_PROFILES=connectiontest
COMPOSE_PROFILES=connectiontest,monitoring
4 changes: 2 additions & 2 deletions documentation/Docker-metrics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metrics

The Docker deployment includes a metrics collection system which is available on production as well as development/test environments. It consists of a Prometheus metrics server which scrapes metrics from various exporters. Grafana is provided as frontend to visualise metrics and create graphs/dashboards.
The Docker deployment includes a metrics collection system which is available on production as well as development/test environments. It consists of a Prometheus metrics server which scrapes metrics from various exporters. Grafana is provided as frontend to visualise metrics and create graphs/dashboards. The various exporters, Prometheus and Grafana containers can be disabled by not loading the `monitoring` profile, by overriding the default profiles with e.g. `COMPOSE_PROFILES=cron` in `local.env`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should refrain from giving these kinds of instructions for COMPOSE_PROFILES completely (for which I'm guilty of as well). And go with @mxsasha idea #1589 (comment) and have 1 place in the documentation to refer to with a table with all possible permutations of COMPOSE_PROFILES (that are sane at least) and have them copy pasteable so there is no ambiguity.


To view metrics and graphs visit the `/grafana/` endpoint. Eg: `http://localhost:8080/grafana/` for development and `https://example.com/grafana/` for production. For development the user/password is set to `test/test`, for production users can be configured using the `MONITORING_AUTH_RAW` variable in `docker/local.env` (see `docker/defaults.env` for information).

Expand All @@ -26,4 +26,4 @@ The Grafana service is used because Prometheus does not include curl. The URL's

**notice**: Please note that Grafana (and the rest of the monitoring containers) are not connected to the public interface and don't have internet access. So adding Dashboards via "Import via grafana.com" does not work. Dashboard from grafana.com can be imported using the JSON model.

Dashboard can be manually created through the Grafana web interface and can be saved there. Existing Dashboard cannot be modified this way as they are provisioned from the Docker image. Either duplicate the Dashboard with your own modifications or export the Dashboard JSON Model and update the files at: https://github.com/internetstandards/Internet.nl/tree/docker/docker/monitoring/grafana/dashboards
Dashboard can be manually created through the Grafana web interface and can be saved there. Existing Dashboard cannot be modified this way as they are provisioned from the Docker image. Either duplicate the Dashboard with your own modifications or export the Dashboard JSON Model and update the files at: https://github.com/internetstandards/Internet.nl/tree/main/docker/monitoring/grafana/dashboards
Loading