{"action":"created","issue":{"url":"https://api.github.com/repos/joyent/containerpilot/issues/258","repository_url":"https://api.github.com/repos/joyent/containerpilot","labels_url":"https://api.github.com/repos/joyent/containerpilot/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/joyent/containerpilot/issues/258/comments","events_url":"https://api.github.com/repos/joyent/containerpilot/issues/258/events","html_url":"https://github.com/joyent/containerpilot/issues/258","id":194445832,"number":258,"title":"Multiple private IPs - set advertise address","user":{"login":"neuroserve","id":3615844,"avatar_url":"https://avatars.githubusercontent.com/u/3615844?v=3","gravatar_id":"","url":"https://api.github.com/users/neuroserve","html_url":"https://github.com/neuroserve","followers_url":"https://api.github.com/users/neuroserve/followers","following_url":"https://api.github.com/users/neuroserve/following{/other_user}","gists_url":"https://api.github.com/users/neuroserve/gists{/gist_id}","starred_url":"https://api.github.com/users/neuroserve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neuroserve/subscriptions","organizations_url":"https://api.github.com/users/neuroserve/orgs","repos_url":"https://api.github.com/users/neuroserve/repos","events_url":"https://api.github.com/users/neuroserve/events{/privacy}","received_events_url":"https://api.github.com/users/neuroserve/received_events","type":"User","site_admin":false},"labels":[{"id":361880854,"url":"https://api.github.com/repos/joyent/containerpilot/labels/usage","name":"usage","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-08T21:12:24Z","updated_at":"2016-12-13T21:02:58Z","closed_at":null,"body":"I don't know, whether this is a variant of issue #226 but in environments with containers having multiple nics with rfc1918 addresses, consul-agent cannot decide to which of the nics it should bind in order to talk to the consul-master/cluster: \r\n\r\n\"Error starting agent: Failed to get advertise address: Multiple private IPs found. Please configure one. [/usr/local/bin/consul agent -data-dir=/data -config-dir=/config -rejoin -retry-join consul.cluster -retry-max 10 -retry-interval 10s] exited: exit status 1\"\r\n\r\nIs there an easy way to determine the respective ip address and configure consul-agent accordingly?"},"comment":{"url":"https://api.github.com/repos/joyent/containerpilot/issues/comments/266861024","html_url":"https://github.com/joyent/containerpilot/issues/258#issuecomment-266861024","issue_url":"https://api.github.com/repos/joyent/containerpilot/issues/258","id":266861024,"user":{"login":"tgross","id":1409219,"avatar_url":"https://avatars.githubusercontent.com/u/1409219?v=3","gravatar_id":"","url":"https://api.github.com/users/tgross","html_url":"https://github.com/tgross","followers_url":"https://api.github.com/users/tgross/followers","following_url":"https://api.github.com/users/tgross/following{/other_user}","gists_url":"https://api.github.com/users/tgross/gists{/gist_id}","starred_url":"https://api.github.com/users/tgross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgross/subscriptions","organizations_url":"https://api.github.com/users/tgross/orgs","repos_url":"https://api.github.com/users/tgross/repos","events_url":"https://api.github.com/users/tgross/events{/privacy}","received_events_url":"https://api.github.com/users/tgross/received_events","type":"User","site_admin":false},"created_at":"2016-12-13T21:02:58Z","updated_at":"2016-12-13T21:02:58Z","body":"It's slightly tricky because you can't use the value inside the containerpilot.json file -- the value doesn't exist at the time we do the config loading because we haven't loaded the config yet! (We want to make this possible in a future ContainerPilot version.)\r\n\r\nSo what you can do is to have the `preStart` update the Consul configuration file and use that. There's an example of this in the [autopilotpattern/vault](https://github.com/autopilotpattern/vault) blueprint.  The [ContainerPilot `preStart`](https://github.com/autopilotpattern/vault/blob/d8318b8bc3fce54a9c63f23f58647c6fd4e7954e/etc/containerpilot.json#L3) calls a [bash script](https://github.com/autopilotpattern/vault/blob/d8318b8bc3fce54a9c63f23f58647c6fd4e7954e/bin/vault-manage#L21) which rewrites the Consul configuration in [consul.json](https://github.com/autopilotpattern/vault/blob/d8318b8bc3fce54a9c63f23f58647c6fd4e7954e/etc/consul.json#L2) with plain ol' `sed`."}}
{"actor":{"display_login":"tgross"}}