Nomad-pack job dependencies?

I have a task that reads nomad service address/port getting service name by a variable prometheus_service_name:

{{ range nomadService [[ .my.prometheus_service_name | quote ]] }}
      url="http://{{ .Address }}:{{ .Port }}/api/v1/write"
{{ end }}

How would this work if prometheus task that provides the service with name prometheus_service_name restarts, so address and port would change?

Basically service would get disconnected and my task would be failing due to service connection missing.

How can I configure a nomad job to depend on another job? I would like to restart my dependent job when parent job restart to make sure service connections are rebuilt and live again.

So the proper answer to this and my other questions for Nomad is Use Consul. Consul provides dynamic service discovery and template can restart the task when use service changes.

Unfortunately even somewhat simple infra can’t be built on Nomad without Consul.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.