I currently use environment variables for all configuration settings in my containers.
It works ok, but a lot of the configuration is copied, such as SERVICE_DISCOVERY_URL. I have that in almost every container. If I want to change the URL for whatever reason, it means I have to update every service one by one.
What do ya’ll use for configuration inside a container? Any recommendations?
This is obviously Rancher-specific and there isn’t UI for it (for no particular reason), but one option is to use metadata on a certain service. You can store arbitrary key/values (from the API, or compose) and get them from any container with
curl http://rancher-metadata/2016-07-29/stacks/<STACK>/services/<SERVICE>/metadata/<KEY>
or all of it as JSON: curl -H 'Accept: application/json' http://rancher-metadata/2016-07-29/stacks/<STACK>/services/<SERVICE>/metadata
1 Like