If I have two tasks in a job group how can I access the consul ID of each other services?
In other words: how can I create two tasks within a job, one java and one exec. In the exec one be able to run:
consul connect envoy --sidecar-for 123
Being 123 the consul service ID of the java task.
Until 0.9.1 I could query consul agent/services until some service with the ${NOMAD_PORT_javaservice_http} was registered. Now it seems that consul registration only happens after the whole group if running or some other state.
The way I did service registration with envoy sidecar proxy in Nomad for my tasks is by having a second task that runs envoy and bootstraps it using consul connect. And then a 3rd task that registers it.
This contains a few work arounds for the way Nomad and Consul interact at the moment.