Closed TheAnachronism closed 2 years ago
@TheAnachronism Thanks for reporting this, really appreciated!
I wasn't aware of that as I was just copy-pasting stuff from various places. I'll have a look at it and will improve the example. Alternatively, if you got some spare time, feel free to create a PR with a suggestion.
Sadly I have no idea how prometheus or grafana work so I don't know which ports are required and how I test if everything actually works... I guess both have at least their default port exposed
Prometheus and Grafana need to have one port exposed to make their UIs accessible. In addition to that, Grafana must be able to access Prometheus via HTTP, and Prometheus needs access to all containers (Prometheus scrapes metrics from the other containers, Grafana then queries Prometheus to provide visualizations to the end user). If I only expose ports like in #52, the containers can't access each other. As far as I understand, it now uses the default bridge as network and that doesn't allow communication between containers. So I would need to use a user defined bridge?
Found the issue. In the configs for Prometheus and Grafana, I was using 127.0.0.1
to address the containers. Of course that's not possible anymore. Instead I have to use the container names.
The confirmation that it works is that http://localhost:9090/targets shows a lot of green badges saying UP
(if the config for the build statuses container is correct) as well as Grafana saying that the Prometheus datasource is accessible
Yeah this looks quite good, thx for the quick work and response
The docker-compose example uses network_mode: host multiple times and the different applications want to bind to all kinds of ports then. In an environment that already has many containers running this can produce many conflicts. It would be better if it was setup with docker networks and only had to use host ports which are actually required (e.g. the 8282 port binding for the actual app.)