Skip to content

Instantly share code, notes, and snippets.

@shoenig
Created November 14, 2024 16:45
Show Gist options
  • Save shoenig/5a74a3d42fa7b35cfdb2fd891a029cea to your computer and use it in GitHub Desktop.
Save shoenig/5a74a3d42fa7b35cfdb2fd891a029cea to your computer and use it in GitHub Desktop.
nomad connect exec2 countdash
job "countdash" {
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
sidecar_task {
driver = "exec2"
user = "nobody"
config {
command = "/opt/bin/envoy-1.30.0-linux-x86_64"
args = [
"-c",
"${NOMAD_SECRETS_DIR}/envoy_bootstrap.json",
"-l",
"${meta.connect.log_level}",
"--concurrency",
"${meta.connect.proxy_concurrency}",
"--disable-hot-restart"
]
unveil = ["rx:/opt/bin", "rwc:/dev/shm"]
}
resources {
cpu = 1000
memory = 256
}
}
}
}
task "backend" {
driver = "podman"
config {
image = "docker.io/hashicorpdev/counter-api:v3"
}
}
}
group "dashboard" {
network {
mode = "bridge"
port "http" {
static = 9002
to = 9002
}
}
service {
name = "count-dashboard"
port = "http"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "count-api"
local_bind_port = 8080
}
}
}
sidecar_task {
driver = "exec2"
user = "nobody"
config {
command = "/opt/bin/envoy-1.30.0-linux-x86_64"
args = [
"-c",
"${NOMAD_SECRETS_DIR}/envoy_bootstrap.json",
"-l",
"${meta.connect.log_level}",
"--concurrency",
"${meta.connect.proxy_concurrency}",
"--disable-hot-restart"
]
unveil = ["rx:/opt/bin", "rwc:/dev/shm"]
}
resources {
cpu = 1000
memory = 256
}
}
}
}
task "dashboard" {
driver = "podman"
env {
COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
}
config {
image = "docker.io/hashicorpdev/counter-dashboard:v3"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment