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

Populate an INSTANCE_NUM env var #1039

Closed
dsmiley opened this issue Sep 26, 2016 · 4 comments · Fixed by #1042
Closed

Populate an INSTANCE_NUM env var #1039

dsmiley opened this issue Sep 26, 2016 · 4 comments · Fixed by #1042

Comments

@dsmiley
Copy link

dsmiley commented Sep 26, 2016

Please populate an environment variable with the instance number of the service. Some software, like Apache ZooKeeper and Apache Kafka, for example, want to know which instance they are to know who's who.

@jnummelin
Copy link
Contributor

It's already populated at the container labels so makes sense to have it in the envs also.

@dsmiley
Copy link
Author

dsmiley commented Sep 27, 2016

Not only an env var (very useful, but it would be good to be able to reference it in the kontena.yml for, say, affinity rules or volume references, just as (presumably) ${project} can be used today. At least I think project can be used like that. In this way, I might have nodes with label or machine names containing the service name and instance number with attached storage that this service is expecting to put its data on.

Sorry for possible scope creep :-)

@jnummelin
Copy link
Contributor

For the volume references we do have support for, see: https://github.com/kontena/examples/blob/master/wordpress-cluster/kontena.yml#L41

You just have to make sure that you do have same amount of instances defined for both services, obviously. :)

@dsmiley
Copy link
Author

dsmiley commented Sep 27, 2016

woah... what is the syntax of this? (is it documented)? Can I use this syntax in any kontena.yml value or just for certain keys (which would apparently include volumes_from)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants