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

     1  job "consul-example" {
     2    datacenters = ["dc1"]
     3    type        = "service"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    update {
    11      max_parallel      = 1
    12      min_healthy_time  = "10s"
    13      healthy_deadline  = "3m"
    14      progress_deadline = "10m"
    15      auto_revert       = false
    16      canary            = 0
    17    }
    18  
    19    migrate {
    20      max_parallel     = 1
    21      health_check     = "checks"
    22      min_healthy_time = "10s"
    23      healthy_deadline = "5m"
    24    }
    25  
    26    group "group" {
    27      count = 3
    28  
    29      network {
    30        port "db" {}
    31      }
    32  
    33      restart {
    34        attempts = 2
    35        interval = "30m"
    36        delay    = "15s"
    37        mode     = "fail"
    38      }
    39  
    40      ephemeral_disk {
    41        size = 300
    42      }
    43  
    44      task "example" {
    45        driver = "docker"
    46  
    47        config {
    48          image   = "busybox:1"
    49          command = "nc"
    50          args    = ["-ll", "-p", "1234", "-e", "/bin/cat"]
    51  
    52          ports = ["db"]
    53        }
    54  
    55        resources {
    56          cpu    = 100
    57          memory = 100
    58        }
    59  
    60        service {
    61          name = "consul-example"
    62          tags = ["global", "cache"]
    63          port = "db"
    64  
    65          check {
    66            name     = "alive"
    67            type     = "tcp"
    68            interval = "10s"
    69            timeout  = "2s"
    70          }
    71        }
    72      }
    73    }
    74  }