variable "config_data" { type = string description = "Plain text config file for blocky" } job "blocky" { datacenters = ["dc1"] type = "system" priority = 100 update { max_parallel = 1 # TODO: maybe switch to service job from system so we can use canary and autorollback # auto_revert = true } group "blocky" { network { mode = "bridge" port "dns" { static = "53" } port "api" { host_network = "wesher" to = "4000" } dns { # Set expclicit DNS servers because tasks, by default, use this task servers = ["1.1.1.1", "1.0.0.1"] } } service { name = "blocky-dns" provider = "nomad" port = "dns" } service { name = "blocky-api" provider = "nomad" port = "api" tags = [ "prometheus.scrape", "traefik.enable=true", "traefik.http.routers.blocky-api.entryPoints=websecure", ] check { name = "api-health" port = "api" type = "http" path = "/" interval = "10s" timeout = "3s" } } task "blocky" { driver = "docker" config { image = "ghcr.io/0xerr0r/blocky" args = ["-c", "${NOMAD_TASK_DIR}/config.yml"] ports = ["dns", "api"] } resources { cpu = 50 memory = 50 memory_max = 100 } template { data = var.config_data destination = "${NOMAD_TASK_DIR}/config.yml" splay = "1m" wait { min = "10s" max = "20s" } } } task "redis-stunnel" { driver = "docker" config { image = "alpine:3.17" ports = ["tls"] args = ["/bin/sh", "${NOMAD_TASK_DIR}/start.sh"] } resources { cpu = 20 memory = 100 } template { data = <