github.com/manicqin/nomad@v0.9.5/command/assets/connect-short.nomad (about) 1 job "countdash" { 2 datacenters = ["dc1"] 3 4 group "api" { 5 network { 6 mode = "bridge" 7 } 8 9 service { 10 name = "count-api" 11 port = "9001" 12 13 connect { 14 sidecar_service {} 15 } 16 } 17 18 task "web" { 19 driver = "docker" 20 21 config { 22 image = "hashicorpnomad/counter-api:v1" 23 } 24 } 25 } 26 27 group "dashboard" { 28 network { 29 mode = "bridge" 30 31 port "http" { 32 static = 9002 33 to = 9002 34 } 35 } 36 37 service { 38 name = "count-dashboard" 39 port = "9002" 40 41 connect { 42 sidecar_service { 43 proxy { 44 upstreams { 45 destination_name = "count-api" 46 local_bind_port = 8080 47 } 48 } 49 } 50 } 51 } 52 53 task "dashboard" { 54 driver = "docker" 55 56 env { 57 COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}" 58 } 59 60 config { 61 image = "hashicorpnomad/counter-dashboard:v1" 62 } 63 } 64 } 65 }