Debugging template rendering. NOMAD_IP


What sort of tools are there to debug problems in failure-to-launch stage? Specifically, if there is an error in template rendering that causes a task to terminate, there isn’t many mechanism to get info on what failed, I’d try to browse the files, but those appear to be cleared out after the job fails, and I’m left with only the allocation log, which isn’t always helpful.

Specifically in this case, I have a template with this {{ env "NOMAD_IP_http" }} in it, and thr group has a network stanza:
network {
port “http” {
static = 80

This seems like it should work, but there is limited documentation, and appear to be very few debugging facilities.

So, my specific problem was resolved by moving the network stanza into a resources stanza inside of my task. But that is really missed in the documentation.

In the docs the Network stanza is only showed having placement in group:

and does reference the env variable:
NOMAD_IP_foo - The IP to bind on for the given port label.
Suggesting it should work…

And the resources stanza has no mention of the network stanza at all: resources Stanza - Job Specification | Nomad by HashiCorp

Other than digging through tons of examples, there is really no indication that you can/should but a network stanza under resources, no less that such is required for NOMAD_IP_ to work…

I seem to continue to encounter this sort of problem working through nomad. Am I just missing some very fundamental resource for Nomad?

The network stanza inside of resources is deprecated. Sadly it was just removed from docs without mention. The docs are missing versioning and it really shows.

I believe you are hitting this bug: internal IP not exposed to tasks w/ group bridge networking · Issue #9781 · hashicorp/nomad · GitHub (or some kind of variation of it)

So, it’s only possible to get the ip of the current task by using a deprecated network field?