homelab-nomad/blocky/blocky.nomad

102 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-02-28 20:07:34 +00:00
variable "config_data" {
type = string
description = "Plain text config file for blocky"
}
job "blocky" {
datacenters = ["dc1"]
2022-05-18 18:29:00 +00:00
type = "system"
2022-02-28 20:07:34 +00:00
group "blocky" {
network {
mode = "bridge"
port "dns" {
static = "53"
}
port "api" {
2022-02-28 20:07:34 +00:00
to = "4000"
}
}
service {
2022-03-13 17:13:19 +00:00
name = "blocky-dns"
2022-02-28 20:07:34 +00:00
port = "dns"
}
service {
2022-03-13 17:13:19 +00:00
name = "blocky-api"
port = "api"
meta {
metrics_addr = "${NOMAD_ADDR_api}"
}
connect {
sidecar_service {
proxy {
local_service_port = 400
expose {
path {
path = "/metrics"
protocol = "http"
local_path_port = 4000
listener_port = "api"
}
}
upstreams {
destination_name = "redis"
local_bind_port = 6379
}
}
}
sidecar_task {
resources {
cpu = 50
memory = 50
}
}
}
check {
name = "api-health"
port = "api"
type = "http"
path = "/"
interval = "10s"
timeout = "3s"
}
2022-02-28 20:07:34 +00:00
}
task "main" {
driver = "docker"
config {
image = "ghcr.io/0xerr0r/blocky"
ports = ["dns", "api"]
2022-02-28 20:07:34 +00:00
mount {
type = "bind"
target = "/app/config.yml"
source = "app/config.yml"
}
}
resources {
cpu = 50
memory = 100
}
template {
data = var.config_data
destination = "app/config.yml"
}
}
}
}