Skip to content

Instantly share code, notes, and snippets.

@ngoclamtran
Created November 19, 2021 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngoclamtran/a71da99437dfd8a14f8e80a4dee49c73 to your computer and use it in GitHub Desktop.
Save ngoclamtran/a71da99437dfd8a14f8e80a4dee49c73 to your computer and use it in GitHub Desktop.
temporal.nomad
job "dc1_temporal" {
datacenters = [
"dc1",
]
type = "service"
constraint {
attribute = "${node.class}"
value = "compute"
}
update {
max_parallel = "1"
min_healthy_time = "10s"
healthy_deadline = "2m"
progress_deadline = "5m"
auto_revert = "true"
}
group "temporal" {
count = 3
constraint {
operator = "distinct_hosts"
value = "true"
}
restart {
attempts = "1"
interval = "5m"
delay = "25s"
mode = "delay"
}
task "frontend" {
driver = "docker"
template {
data = <<EOH
nameserver {{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/resolv.conf"
}
template {
data = <<EOH
MYSQL_SEEDS={{ key "env/v1/temporal/MYSQL_SEEDS" }}
MYSQL_USER={{ key "env/v1/temporal/MYSQL_USER" }}
MYSQL_PWD={{ key "env/v1/temporal/MYSQL_PWD" }}
TEMPORAL_BROADCAST_ADDRESS={{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/env"
env = true
splay = "30s"
}
env {
SERVICES = "frontend"
BIND_ON_IP = "0.0.0.0"
LOG_LEVEL = "info"
DB = "mysql"
PROMETHEUS_ENDPOINT = "0.0.0.0:8000"
PUBLIC_FRONTEND_ADDRESS = "temporal-frontend.service.consul:7233"
}
config {
image = "temporalio/server:1.13.1"
port_map {
grpc = 7233
membership = 6933
prom = 8000
}
labels = {
"com.datadoghq.tags.service" = "temporal_frontend"
"com.datadoghq.tags.version" = "1.13.1"
}
volumes = [
"/etc/localtime:/etc/localtime:ro",
"etc/resolv.conf:/etc/resolv.conf",
]
}
resources {
cpu = "500"
memory = "1024"
network {
port "grpc" {
static = 7233
}
port "membership" {
static = 6933
}
port "prom" {
static = 8000
}
}
}
service {
name = "temporal-frontend"
port = "grpc"
tags = [
"temporal",
"frontend",
]
check {
type = "tcp"
port = "grpc"
interval = "5s"
timeout = "5s"
check_restart {
limit = 5
grace = "20s"
}
}
}
}
task "history" {
driver = "docker"
template {
data = <<EOH
nameserver {{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/resolv.conf"
}
template {
data = <<EOH
MYSQL_SEEDS={{ key "env/v1/temporal/MYSQL_SEEDS" }}
MYSQL_USER={{ key "env/v1/temporal/MYSQL_USER" }}
MYSQL_PWD={{ key "env/v1/temporal/MYSQL_PWD" }}
TEMPORAL_BROADCAST_ADDRESS={{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/env"
env = true
splay = "30s"
}
env {
SERVICES = "history"
BIND_ON_IP = "0.0.0.0"
LOG_LEVEL = "info"
DB = "mysql"
PROMETHEUS_ENDPOINT = "0.0.0.0:8001"
PUBLIC_FRONTEND_ADDRESS = "temporal-frontend.service.consul:7233"
}
config {
image = "temporalio/server:1.13.1"
port_map {
grpc = 7234
membership = 6934
prom = 8001
}
labels = {
"com.datadoghq.tags.service" = "temporal_history"
"com.datadoghq.tags.version" = "1.13.1"
}
volumes = [
"/etc/localtime:/etc/localtime:ro",
"etc/resolv.conf:/etc/resolv.conf",
]
}
resources {
cpu = "500"
memory = "1024"
network {
port "grpc" {
static = 7234
}
port "membership" {
static = 6934
}
port "prom" {
static = 8001
}
}
}
service {
name = "temporal-history"
port = "grpc"
tags = [
"temporal",
"history",
]
check {
type = "tcp"
port = "grpc"
interval = "5s"
timeout = "5s"
check_restart {
limit = 5
grace = "20s"
}
}
}
}
task "matching" {
driver = "docker"
template {
data = <<EOH
nameserver {{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/resolv.conf"
}
template {
data = <<EOH
MYSQL_SEEDS={{ key "env/v1/temporal/MYSQL_SEEDS" }}
MYSQL_USER={{ key "env/v1/temporal/MYSQL_USER" }}
MYSQL_PWD={{ key "env/v1/temporal/MYSQL_PWD" }}
TEMPORAL_BROADCAST_ADDRESS={{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/env"
env = true
splay = "30s"
}
env {
SERVICES = "matching"
BIND_ON_IP = "0.0.0.0"
LOG_LEVEL = "info"
DB = "mysql"
PROMETHEUS_ENDPOINT = "0.0.0.0:8002"
PUBLIC_FRONTEND_ADDRESS = "temporal-frontend.service.consul:7233"
}
config {
image = "temporalio/server:1.13.1"
port_map {
grpc = 7235
membership = 6935
prom = 8002
}
labels = {
"com.datadoghq.tags.service" = "temporal_matching"
"com.datadoghq.tags.version" = "1.13.1"
}
volumes = [
"/etc/localtime:/etc/localtime:ro",
"etc/resolv.conf:/etc/resolv.conf",
]
}
resources {
cpu = "500"
memory = "1024"
network {
port "grpc" {
static = 7235
}
port "membership" {
static = 6935
}
port "prom" {
static = 8002
}
}
}
service {
name = "temporal-matching"
port = "grpc"
tags = [
"temporal",
"matching",
]
check {
type = "tcp"
port = "grpc"
interval = "5s"
timeout = "5s"
check_restart {
limit = 5
grace = "20s"
}
}
}
}
task "worker" {
driver = "docker"
template {
data = <<EOH
nameserver {{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/resolv.conf"
}
template {
data = <<EOH
MYSQL_SEEDS={{ key "env/v1/temporal/MYSQL_SEEDS" }}
MYSQL_USER={{ key "env/v1/temporal/MYSQL_USER" }}
MYSQL_PWD={{ key "env/v1/temporal/MYSQL_PWD" }}
TEMPORAL_BROADCAST_ADDRESS={{ env "attr.unique.network.ip-address" }}
EOH
destination = "etc/env"
env = true
splay = "30s"
}
env {
SERVICES = "worker"
BIND_ON_IP = "0.0.0.0"
LOG_LEVEL = "info"
DB = "mysql"
PROMETHEUS_ENDPOINT = "0.0.0.0:8003"
PUBLIC_FRONTEND_ADDRESS = "temporal-frontend.service.consul:7233"
}
config {
image = "temporalio/server:1.13.1"
port_map {
grpc = 7239
membership = 6939
prom = 8003
}
labels = {
"com.datadoghq.tags.service" = "temporal_worker"
"com.datadoghq.tags.version" = "1.13.1"
}
volumes = [
"/etc/localtime:/etc/localtime:ro",
"etc/resolv.conf:/etc/resolv.conf",
]
}
resources {
cpu = "500"
memory = "1024"
network {
port "grpc" {
static = 7239
}
port "membership" {
static = 6939
}
port "prom" {
static = 8003
}
}
}
service {
name = "temporal-worker"
port = "grpc"
tags = [
"temporal",
"worker",
]
check {
type = "tcp"
port = "grpc"
interval = "5s"
timeout = "5s"
check_restart {
limit = 5
grace = "20s"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment