diff --git a/consul-nomad/frontend.nomad b/consul-nomad/frontend.nomad new file mode 100644 index 0000000..917a722 --- /dev/null +++ b/consul-nomad/frontend.nomad @@ -0,0 +1,131 @@ +job "frontend" { + datacenters = ["dc1"] + + type = "service" + + group "frontend" { + count = 1 + + scaling { + enabled = true + min = 1 + max = 3 + } + + consul { + namespace = "hashicups" + } + + update { + max_parallel = 1 + min_healthy_time = "30s" + healthy_deadline = "1m" + } + + network { + mode = "bridge" + port "http" { + to = 3000 + } + port "envoy_metrics" { + to = 9102 + } + } + + service { + name = "frontend" + tags = ["hashicups", "demo"] + + port = "http" + + meta { + envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}" + } + + connect { + sidecar_service { + proxy { + upstreams { + destination_name = "public-api" + local_bind_port = 8080 + } + config { + envoy_prometheus_bind_addr = "0.0.0.0:9102" + } + } + } + } + } + + task "frontend" { + driver = "docker" + + config { + // https://hub.docker.com/r/hashicorpdemoapp/frontend/tags + image = "hashicorpdemoapp/frontend:v1.0.3" + ports = ["http"] + volumes = [ + "local:/etc/nginx/conf.d", + ] + } + + template { +data = <