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