github.com/hernad/nomad@v1.6.112/e2e/servicediscovery/input/checks_task_restart_main.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "checks_task_restart" {
     5    datacenters = ["dc1"]
     6    type        = "service"
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13    group "group" {
    14      network {
    15        mode = "host"
    16        port "http" {}
    17      }
    18  
    19      service {
    20        provider = "nomad"
    21        name     = "nsd-checks-task-restart-test"
    22        port     = "http"
    23        check {
    24          name     = "alive"
    25          type     = "http"
    26          path     = "/nsd-checks-task-restart-test.txt"
    27          interval = "2s"
    28          timeout  = "1s"
    29          check_restart {
    30            limit = 10
    31            grace = "1s"
    32          }
    33        }
    34      }
    35  
    36      task "python" {
    37        driver = "raw_exec"
    38        user   = "nobody"
    39        config {
    40          command = "python3"
    41          args    = ["-m", "http.server", "${NOMAD_PORT_http}", "--directory", "/tmp"]
    42        }
    43        resources {
    44          cpu    = 50
    45          memory = 64
    46        }
    47      }
    48    }
    49  }