github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/connect/input/terminating-gateway.nomad (about)

     1  job "countdash-terminating" {
     2  
     3    datacenters = ["dc1"]
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "api" {
    11      network {
    12        mode = "host"
    13        port "port" {
    14          static = "9001"
    15        }
    16      }
    17  
    18      service {
    19        name = "count-api"
    20        port = "port"
    21      }
    22  
    23      task "api" {
    24        driver = "docker"
    25  
    26        config {
    27          image        = "hashicorpdev/counter-api:v3"
    28          network_mode = "host"
    29        }
    30      }
    31    }
    32  
    33    group "gateway" {
    34      network {
    35        mode = "bridge"
    36      }
    37  
    38      service {
    39        name = "api-gateway"
    40  
    41        connect {
    42          gateway {
    43            proxy {
    44              # The following options are automatically set by Nomad if not explicitly
    45              # configured with using bridge networking.
    46              #
    47              # envoy_gateway_no_default_bind = true
    48              # envoy_gateway_bind_addresses "default" {
    49              #   address = "0.0.0.0"
    50              #   port    = <generated listener port>
    51              # }
    52              # Additional options are documented at
    53              # https://www.nomadproject.io/docs/job-specification/gateway#proxy-parameters
    54            }
    55  
    56            terminating {
    57              # Nomad will automatically manage the Configuration Entry in Consul
    58              # given the parameters in the terminating block.
    59              #
    60              # Additional options are documented at
    61              # https://www.nomadproject.io/docs/job-specification/gateway#terminating-parameters
    62              service {
    63                name = "count-api"
    64              }
    65            }
    66          }
    67        }
    68      }
    69    }
    70  
    71    group "dashboard" {
    72      network {
    73        mode = "bridge"
    74  
    75        port "http" {
    76          static = 9002
    77          to     = 9002
    78        }
    79      }
    80  
    81      service {
    82        name = "count-dashboard"
    83        port = "9002"
    84  
    85        connect {
    86          sidecar_service {
    87            proxy {
    88              upstreams {
    89                destination_name = "count-api"
    90                local_bind_port  = 8080
    91              }
    92            }
    93          }
    94        }
    95      }
    96  
    97      task "dashboard" {
    98        driver = "docker"
    99  
   100        env {
   101          COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
   102        }
   103  
   104        config {
   105          image = "hashicorpdev/counter-dashboard:v3"
   106        }
   107      }
   108    }
   109  }