feat: Add KAMAL_HOST to app and accessory containers#1471
Merged
djmb merged 1 commit intobasecamp:mainfrom May 20, 2025
Merged
Conversation
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.
Collaborator
|
Following up with passing tests in #1564 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, androles.)edit: Looks like this change does need me to update some of the tests so we can probably skip running the workflow for now.