-
Notifications
You must be signed in to change notification settings - Fork 846
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
Ability to specify the value of the hostname an app task is running on. #2679
Comments
+1 We also need a similar feature for logging purposes, we would need to be able to set parameters on our docker containers like: |
Have a look at the wild discussions here: #1828 @jeromegn: It probably makes sense to use separate issues for substituting variables (which have to be known to Marathon BEFORE the task launch) in the env variables and in other places. I can completely understand the usefulness of this. It is hard to do right and might not be worked on soon by us. In the meantime, you can work around most of these issues by creating your own docker images which set the desired environment variables before starting the main process. |
Thanks @kolloch. It so happens that you can specify some variables to be interpolated in the parameters (like the short container ID via "your-app/{{.ID}}".) For now that satisfies our needs. |
+1 A valid use case would be setting the hostname of a container to the hostname of the machine it is started on. For example: "parameters": [
{ "key": "hostname", "value": "$HOSTNAME" }
] |
Do we have any plans on this issue? |
+1 |
2 similar comments
+1 |
+1 |
+1 Having the docker host, that a container was placed on by Marathon, available in an ENV variable to the container would significantly simplify some of our routing and service discovery mechanisms, without the need to build custom base images with customized logic for discovering that very information before the main application in the container executes. |
+1 |
9 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
@jasongilanfarr indirectly related to template discussion |
Note: This issue has been migrated to https://jira.mesosphere.com/browse/MARATHON-4203. For more information see https://groups.google.com/forum/#!topic/marathon-framework/khtvf-ifnp8. |
Perhaps I am mistaken, but it seems there is currently no way to dynamically reference the hostname of a task and use it as an env variable value. I'm sure the use cases for this are obvious and many.
Edit:
To be specific: currently, the json usage
"env": {
"CASSANDRA_BROADCAST_ADDRESS":"$HOSTNAME"
}
will set CASSANDRA_BROADCAST_ADDRESS to the value "$HOSTNAME", instead of trying to resolve it to a valid hostname based on the machine the task is then run on.
/Edit
This is exceptionally useful when working with docker apps that will use the conatiner's hostname as a default for some env variable, and it needs to be overridden to the actual machine's hostname.
A good example: https://hub.docker.com/_/cassandra/
Edit:
Using the value "CASSANDRA_BROADCAST_ADDRESS":"auto" would set the value to the container hostname, instead of the machine hostname.
The text was updated successfully, but these errors were encountered: