github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/consul/input/checks_group_update.nomad (about)

     1  job "group_check" {
     2    datacenters = ["dc1"]
     3    type        = "service"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "group_check" {
    11      network {
    12        mode = "bridge"
    13      }
    14  
    15      service {
    16        name = "group-service-1"
    17        port = "9001"
    18  
    19        # after update, check name has changed
    20        check {
    21          name     = "alive-1a"
    22          type     = "script"
    23          task     = "test"
    24          interval = "2s"
    25          timeout  = "2s"
    26          command  = "echo"
    27          args     = ["alive-1a"]
    28        }
    29      }
    30  
    31      service {
    32        name = "group-service-2"
    33        port = "9002"
    34  
    35        check {
    36          name     = "alive-2a"
    37          type     = "script"
    38          task     = "test"
    39          interval = "2s"
    40          timeout  = "2s"
    41          command  = "echo"
    42          args     = ["alive-2a"]
    43        }
    44  
    45        # after updating, this check will always pass
    46        check {
    47          name     = "alive-2b"
    48          type     = "script"
    49          task     = "test"
    50          interval = "2s"
    51          timeout  = "2s"
    52          command  = "echo"
    53          args     = ["alive-2b"]
    54        }
    55      }
    56  
    57      service {
    58        name = "group-service-3"
    59        port = "9003"
    60  
    61        # this check should always time out and so the service
    62        # should not be marked healthy
    63        check {
    64          name     = "always-dead"
    65          type     = "script"
    66          task     = "test"
    67          interval = "2s"
    68          timeout  = "1s"
    69          command  = "sleep"
    70          args     = ["10"]
    71        }
    72      }
    73  
    74      count = 1
    75  
    76      task "test" {
    77        driver = "raw_exec"
    78  
    79        config {
    80          command = "bash"
    81          args    = ["-c", "sleep 15000"]
    82        }
    83      }
    84    }
    85  }