69 lines
1.3 KiB
Plaintext
69 lines
1.3 KiB
Plaintext
|
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" {
|
||
|
static = 8080
|
||
|
to = 8080
|
||
|
}
|
||
|
}
|
||
|
|
||
|
service {
|
||
|
name = "adminer"
|
||
|
port = "adminer"
|
||
|
|
||
|
connect {
|
||
|
sidecar_service {
|
||
|
proxy {
|
||
|
upstreams {
|
||
|
destination_name = "mysql-server"
|
||
|
# TODO: how do I get these to not bind to the host eth0 address
|
||
|
local_bind_port = 4040
|
||
|
}
|
||
|
config {
|
||
|
protocol = "tcp"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|