176 lines
3.4 KiB
HCL
176 lines
3.4 KiB
HCL
job "openfaas" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
group "openfaas-gateway" {
|
|
count = 1
|
|
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
operator = "regexp"
|
|
value = "(master|ash3c|hcp)"
|
|
}
|
|
|
|
task "openfaas-gateway" {
|
|
driver = "podman"
|
|
|
|
config {
|
|
image = "ghcr.io/openfaas/gateway:0.2.35"
|
|
ports = ["http", "ui"]
|
|
env = {
|
|
"functions_provider_url" = "http://${NOMAD_IP_http}:8080"
|
|
"read_timeout" = "60s"
|
|
"write_timeout" = "60s"
|
|
"upstream_timeout" = "60s"
|
|
"direct_functions" = "true"
|
|
"faas_nats_address" = "nats://localhost:4222"
|
|
"faas_nats_streaming" = "true"
|
|
"basic_auth" = "true"
|
|
"secret_mount_path" = "/run/secrets"
|
|
"scale_from_zero" = "true"
|
|
}
|
|
}
|
|
|
|
resources {
|
|
network {
|
|
mbits = 10
|
|
port "http" { static = 8080 }
|
|
port "ui" { static = 8081 }
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "openfaas-gateway"
|
|
port = "http"
|
|
check {
|
|
type = "http"
|
|
path = "/healthz"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group "nats" {
|
|
count = 1
|
|
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
operator = "regexp"
|
|
value = "(master|ash3c|hcp)"
|
|
}
|
|
|
|
task "nats" {
|
|
driver = "podman"
|
|
|
|
config {
|
|
image = "nats-streaming:0.25.3"
|
|
ports = ["nats"]
|
|
args = [
|
|
"-p",
|
|
"4222",
|
|
"-m",
|
|
"8222",
|
|
"-hbi",
|
|
"5s",
|
|
"-hbt",
|
|
"5s",
|
|
"-hbf",
|
|
"2",
|
|
"-SD",
|
|
"-cid",
|
|
"openfaas"
|
|
]
|
|
}
|
|
|
|
resources {
|
|
network {
|
|
mbits = 10
|
|
port "nats" { static = 4222 }
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "nats"
|
|
port = "nats"
|
|
check {
|
|
type = "tcp"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group "queue-worker" {
|
|
count = 1
|
|
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
operator = "regexp"
|
|
value = "(master|ash3c|hcp)"
|
|
}
|
|
|
|
task "queue-worker" {
|
|
driver = "podman"
|
|
|
|
config {
|
|
image = "ghcr.io/openfaas/queue-worker:0.12.2"
|
|
env = {
|
|
"gateway_url" = "http://${NOMAD_IP_http}:8080"
|
|
"faas_nats_address" = "nats://localhost:4222"
|
|
"faas_nats_streaming" = "true"
|
|
"ack_wait" = "5m"
|
|
"write_debug" = "true"
|
|
}
|
|
}
|
|
|
|
resources {
|
|
network {
|
|
mbits = 10
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group "prometheus" {
|
|
count = 1
|
|
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
operator = "regexp"
|
|
value = "(master|ash3c|hcp)"
|
|
}
|
|
|
|
task "prometheus" {
|
|
driver = "podman"
|
|
|
|
config {
|
|
image = "prom/prometheus:v2.35.0"
|
|
ports = ["prometheus"]
|
|
volumes = [
|
|
"/opt/openfaas/prometheus.yml:/etc/prometheus/prometheus.yml"
|
|
]
|
|
}
|
|
|
|
resources {
|
|
network {
|
|
mbits = 10
|
|
port "prometheus" { static = 9090 }
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "prometheus"
|
|
port = "prometheus"
|
|
check {
|
|
type = "http"
|
|
path = "/-/healthy"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |