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

feat: Add KAMAL_HOST to app and accessory containers #1471

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakeprem
Copy link

@jakeprem jakeprem commented Mar 26, 2025

I searched existing issues and blog posts and didn't see a way to see which host a container was running on.

I'm running Opentelemetry Collector as an accessory on my hosts as a target for OTLP traces, scraper for Prometheus metrics, and using the hostmetrics receiver to grab stats about my VMs in Hetzner. Mainly for the hostmetrics I needed a way to label which VM/host it corresponds to. From what I could see apps get deployed with <host>-<container identifier> as their default hostname, but accessories just got <container identifier>.

I didn't see any other clean ways to set per-host environment variables so this seemed like the simplest solution.

Happy to have any feedback, and if this seems like a viable change I can go back and add some tests for it too. (So far I did manually testing with an accessory using host, hosts, and roles.)

edit: Looks like this change does need me to update some of the tests so we can probably skip running the workflow for now.

Adds the host the container is being deployed to as KAMAL_HOST.
My use case is to more easily tag the host for metrics tagging,
but there might be other uses as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant