github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/servicediscovery/input/simple_lb_clients.nomad (about)

     1  job "simple_lb_clients" {
     2    datacenters = ["dc1"]
     3    type        = "batch"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "client_1" {
    11      task "cat" {
    12        driver = "raw_exec"
    13        config {
    14          command = "bash"
    15          args    = ["-c", "sleep 15000"]
    16        }
    17        resources {
    18          cpu    = 10
    19          memory = 16
    20        }
    21        template {
    22          destination = "output.txt"
    23          data        = <<EOH
    24  {{$allocID := env "NOMAD_ALLOC_ID" -}}
    25  {{range nomadService 1 $allocID "db"}}
    26    server {{ .Address }}:{{ .Port }}
    27  {{- end}}
    28  EOH
    29        }
    30      }
    31    }
    32  
    33    group "client_2" {
    34      task "cat" {
    35        driver = "raw_exec"
    36        config {
    37          command = "bash"
    38          args    = ["-c", "sleep 15000"]
    39        }
    40        resources {
    41          cpu    = 10
    42          memory = 16
    43        }
    44        template {
    45          destination = "output.txt"
    46          data        = <<EOH
    47  {{$allocID := env "NOMAD_ALLOC_ID" -}}
    48  {{range nomadService 2 $allocID "db"}}
    49    server {{ .Address }}:{{ .Port }}
    50  {{- end}}
    51  EOH
    52        }
    53      }
    54    }
    55  }