homelab-nomad/blocky/blocky.nomad

75 lines
1.3 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"
}
variable "base_hostname" {
type = string
description = "Base hostname to serve content from"
default = "dev.homelab"
}
job "blocky" {
datacenters = ["dc1"]
type = "service"
group "blocky" {
count = 1
network {
mode = "bridge"
port "dns" {
static = "53"
}
port "web" {
to = "4000"
}
}
service {
name = "dns"
port = "dns"
}
service {
name = "web"
port = "web"
tags = [
"traefik.enable=true",
"traefik.consulcatalog.connect=false",
"traefik.http.routers.blocky.entrypoints=web,websecure",
"traefik.http.routers.blocky.rule=Host(`blocky.${var.base_hostname}`)",
"traefik.http.routers.blocky.tls=true",
]
}
task "main" {
driver = "docker"
config {
image = "ghcr.io/0xerr0r/blocky"
ports = ["dns", "web"]
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"
}
}
}
}