github.com/hernad/nomad@v1.6.112/e2e/connect/input/demo.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "countdash" {
     5    datacenters = ["dc1"]
     6  
     7    constraint {
     8      attribute = "${attr.kernel.name}"
     9      value     = "linux"
    10    }
    11  
    12    group "api" {
    13      network {
    14        mode = "bridge"
    15      }
    16  
    17      service {
    18        name = "count-api"
    19        port = "9001"
    20  
    21        connect {
    22          sidecar_service {}
    23        }
    24  
    25        check {
    26          expose   = true
    27          name     = "api-health"
    28          type     = "http"
    29          path     = "/health"
    30          interval = "5s"
    31          timeout  = "3s"
    32        }
    33      }
    34  
    35      task "web" {
    36        driver = "docker"
    37  
    38        config {
    39          image = "hashicorpdev/counter-api:v3"
    40        }
    41      }
    42    }
    43  
    44    group "dashboard" {
    45      network {
    46        mode = "bridge"
    47  
    48        port "http" {
    49          static = 9002
    50          to     = 9002
    51        }
    52      }
    53  
    54      service {
    55        name = "count-dashboard"
    56        port = "9002"
    57  
    58        connect {
    59          sidecar_service {
    60            proxy {
    61              upstreams {
    62                destination_name = "count-api"
    63                local_bind_port  = 8080
    64              }
    65            }
    66          }
    67        }
    68      }
    69  
    70      task "dashboard" {
    71        driver = "docker"
    72  
    73        env {
    74          COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
    75        }
    76  
    77        config {
    78          image = "hashicorpdev/counter-dashboard:v3"
    79        }
    80      }
    81    }
    82  }