github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/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 "cache" {
    27      count = 3
    28  
    29      restart {
    30        attempts = 2
    31        interval = "30m"
    32        delay    = "15s"
    33        mode     = "fail"
    34      }
    35  
    36      ephemeral_disk {
    37        size = 300
    38      }
    39  
    40      task "redis" {
    41        driver = "docker"
    42  
    43        config {
    44          image = "redis:3.2"
    45  
    46          port_map {
    47            db = 6379
    48          }
    49        }
    50  
    51        resources {
    52          cpu    = 500 # 500 MHz
    53          memory = 256 # 256MB
    54  
    55          network {
    56            mbits = 10
    57            port  "db"  {}
    58          }
    59        }
    60  
    61        service {
    62          name = "redis-cache"
    63          tags = ["global", "cache"]
    64          port = "db"
    65  
    66          check {
    67            name     = "alive"
    68            type     = "tcp"
    69            interval = "10s"
    70            timeout  = "2s"
    71          }
    72        }
    73      }
    74    }
    75  }