coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
34.73k stars 1.9k forks source link

feat: add some new labels to every container #4324

Open Julien-R44 opened 1 week ago

Julien-R44 commented 1 week ago

Changes

I strongly encourage to read the comment that initiated this PR: https://github.com/coollabsio/coolify/discussions/3569#discussioncomment-11233242

TL;DR: The main issue is the difficulty in monitoring due to automatically generated container names. Currently, when I look at my Grafana/cAdvisor dashboard tracking CPU usage for each container managed by Coolify, I only see cuid names , which makes it impossible to identify what each container corresponds to.

So we need a way to have "human-readable" names for each container. This PR addresses the issue by adding three new labels to each container managed by Coolify :

This is my first contribution to Coolify, and I'm not familiar with PHP either, so feel free to point out any corrections or improvements I should made

( And thanks a lot for making Coolify 💙 )

Issues

peaklabs-dev commented 1 week ago

I get why this would be needed overall but I have a questions:

  1. Why does it have to be docker labels and not env variabels as we do have those COOLIFY_CONTAINER_NAME for example? And I will soon be adding things like Project name and so on as well to env vars.
Julien-R44 commented 1 week ago

Because environment variables aren't collected by cAdvisor or anything I think. I suppose there's a way to tweak something, but with labels it works straight away. cAdvisor collects them, and I can use them in my PromQL queries ( Prometheus )