Open samcro1967 opened 2 months ago
Hey,
Admittedly I'm not much into DevOps so I'm not familiar with the different use cases for Docker labels. Could you provide some examples of how they could be used by Glance? Is it just to specify different properties of the config from within your docker compose file?
Great question. I should have been more specific with an example. The example below automatically adds Gitea to the Plugsy dashboard:
labels:
- plugsy.name=Gitea
- plugsy.category=CI/CD Pipeline
- plugsy.link=http://local.gitea:3069/
- plugsy.icon=https://docs.gitea.io/images/gitea.png
A similiar approach could be used to automatically add things to a Glance page with either a bookmark or a monitor:
labels:
- galnce.page.name=Links
- glance.widget.type=monitor
- glance.widget.name=CI/CD Pipeline
- glance.widget.sites.title=Gitea
- glance.widget.sites.url=http://local.gitea:3069/
- glance.widget.sites.icon=https://docs.gitea.io/images/gitea.png
Glance then monitors docker.sock, detects the new labels when the container is created, and automatically add Gitea to the Links page under the sites for the CI/CD Pipeline monitor.
Thanks for providing some examples!
I'm not sure whether doing this in Glance is very practical as the configuration is fairly deep in terms of nesting and position dependent. With your example from above it's not easy to derive where the widget should get placed - which page, column, order, etc. It would probably have to look more like this, which is quite verbose and ugly:
glance.page[0].name=Links
glance.page[0].columns[0].widgets[0].type=monitor
glance.page[0].columns[0].widgets[0].sites[0].title=Gitea
glance.page[0].columns[0].widgets[0].sites[0].url=http://local.gitea:3069/
glance.page[0].columns[0].widgets[0].sites[0].icon=https://docs.gitea.io/images/gitea.png
When I have seen this implemented with other apps, there would still be a glance.yml file where the "stub" and manual entries would be added. You would use the labels to determine where the stub is and add them there. You would know which page and widget to add them to from the labels. Order would have to be worked out. Do you just add them at the end, sort alphabetically by default (my preference), add a property to monitor and bookmarks so users can specify order manually themselves, give multiple sorting options, etc.
In the example below, a container would just be added right after the Router entry below with the labels I suggested above.
pages:
- name: Home
columns:
- size: small
widgets:
- type: search
search-engine: google
bangs:
- title: YouTube
shortcut: "!yt"
url: https://www.youtube.com/results?search_query={QUERY}
- type: clock
hour-format: 24h
timezones:
- timezone: America/New_York
label: Eastern
- timezone: America/Denver
label: Mountain
- timezone: America/Los_Angeles
label: Pacific
- type: calendar
- size: full
widgets:
- type: rss
limit: 10
collapse-after: 3
cache: 3h
feeds:
- url: https://lifehacker.com/rss
title: Lifehacker
- url: http://feeds.wired.com/wired/index
title: Wired
- type: videos
channels:
- UCVy16RS5eEDh8anP8j94G2A # DB Tech
- type: reddit
subreddit: selfhosted
- size: small
widgets:
- type: weather
units: imperial
hour-format: 12h
location: Chicago, United States
- type: markets
markets:
- symbol: NDAQ
name: NASDAQ
- symbol: ICE
name: NYSE
- symbol: SPY
name: S&P 500
- symbol: DIA
name: DJIA
- name: Links
columns:
- size: small
widgets:
- type: monitor
style: dynamic-columns-experimental
cache: 1m
title: CI/CD Pipeline
sites:
- title: Router
url: http://192.168.1.1
Great question. I should have been more specific with an example. The example below automatically adds Gitea to the Plugsy dashboard:
labels: - plugsy.name=Gitea - plugsy.category=CI/CD Pipeline - plugsy.link=http://local.gitea:3069/ - plugsy.icon=https://docs.gitea.io/images/gitea.png
A similiar approach could be used to automatically add things to a Glance page with either a bookmark or a monitor:
labels: - galnce.page.name=Links - glance.widget.type=monitor - glance.widget.name=CI/CD Pipeline - glance.widget.sites.title=Gitea - glance.widget.sites.url=http://local.gitea:3069/ - glance.widget.sites.icon=https://docs.gitea.io/images/gitea.png
Glance then monitors docker.sock, detects the new labels when the container is created, and automatically add Gitea to the Links page under the sites for the CI/CD Pipeline monitor.
I've implemented some like this (for Docker containers), checkout this discussion
Hi,
First off, love the app—amazing work!
I typically avoid apps that require configuration solely through config files. Over time, many such apps I've used change their config formats, leading to "out of date" local config files that need manual updates to stay in sync with the latest version.
I've found a good balance with apps that support using Docker labels. This approach keeps the config file relatively small and easier to manage as new releases become available. Generally, I only need to update "global" options in the config file, while most of my container-specific configurations are handled via Docker labels. This method allows me to add new containers by simply including a few labels in the Docker Compose file, without needing to update another config file manually.
Here are a couple of projects that implement this effectively: Plugsy Caddy-Docker-Proxy
I particularly like how caddy-docker-proxy handles it: you provide a global CaddyFile, it collects the rest of the config from Docker labels, and generates a combined CaddyFile for debugging purposes.
I would appreciate your consideration of this feature in future updates. Keep up the fantastic work!
Best regards