homelab-nomad/adminer.nomad

78 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-02-16 17:56:18 +00:00
variable "base_hostname" {
type = string
description = "Base hostname to serve content from"
default = "dev.homelab"
}
job "adminer" {
datacenters = ["dc1"]
type = "service"
group "adminer" {
count = 1
# Some affinity to stateful hosts?
network {
mode = "bridge"
port "adminer" {
2022-02-17 22:03:42 +00:00
host_network = "loopback"
2022-02-16 17:56:18 +00:00
to = 8080
}
}
service {
port = "adminer"
connect {
sidecar_service {
proxy {
2022-02-17 22:03:42 +00:00
local_service_port = 8080
2022-02-16 17:56:18 +00:00
upstreams {
destination_name = "mysql-server"
# TODO: how do I get these to not bind to the host eth0 address
local_bind_port = 4040
}
2022-02-17 22:03:42 +00:00
2022-02-16 17:56:18 +00:00
config {
protocol = "tcp"
}
}
}
2022-02-17 22:03:42 +00:00
sidecar_task {
resources {
cpu = 50
memory = 25
}
}
2022-02-16 17:56:18 +00:00
}
tags = [
"traefik.enable=true",
"traefik.http.routers.adminer.entrypoints=web,websecure",
"traefik.http.routers.adminer.rule=Host(`adminer.${var.base_hostname}`)",
"traefik.http.routers.adminer.tls=true",
]
}
task "adminer" {
driver = "docker"
config {
image = "adminer"
ports = ["adminer"]
}
env = {
"ADMINER_DEFAULT_SERVER" = "${NOMAD_UPSTREAM_ADDR_mysql_server}"
}
resources {
cpu = 50
memory = 50
}
}
}
}