github.com/hernad/nomad@v1.6.112/e2e/consul/input/on_update_2.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "test" {
     5    datacenters = ["dc1"]
     6    type        = "service"
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13  
    14    group "test" {
    15      count = 3
    16  
    17      network {
    18        port "db" {
    19          to = 6379
    20        }
    21      }
    22  
    23      update {
    24        health_check      = "checks"
    25        progress_deadline = "45s"
    26        healthy_deadline  = "30s"
    27      }
    28  
    29      service {
    30        name = "echo-service"
    31        port = "db"
    32  
    33        check {
    34          name     = "tcp"
    35          type     = "tcp"
    36          port     = "db"
    37          interval = "10s"
    38          timeout  = "2s"
    39        }
    40  
    41        check {
    42          name      = "script-check"
    43          type      = "script"
    44          command   = "/bin/bash"
    45          interval  = "30s"
    46          timeout   = "10s"
    47          task      = "server"
    48          on_update = "ignore"
    49  
    50          args = [
    51            "-c",
    52            "echo 'this check errors'; exit 2;",
    53          ]
    54  
    55        }
    56      }
    57  
    58      task "server" {
    59        driver = "docker"
    60  
    61        env {
    62          a = "b"
    63        }
    64  
    65        config {
    66          image = "redis"
    67          ports = ["db"]
    68        }
    69      }
    70    }
    71  }
    72  
    73