2024-01-25 19:13:35 +01:00
|
|
|
data "docker_registry_image" "shit" {
|
|
|
|
name = "nginx:latest"
|
|
|
|
}
|
|
|
|
|
|
|
|
data "docker_network" "traefik" {
|
|
|
|
name = "traefik"
|
|
|
|
}
|
|
|
|
|
|
|
|
locals {
|
|
|
|
labels = {
|
|
|
|
"shepherd.auto-update" = "true",
|
|
|
|
"traefik.enable" = "true"
|
|
|
|
"traefik.http.services.shit.loadbalancer.server.port" = "80",
|
|
|
|
"traefik.http.routers.shit.rule" = "Host(`shit.montage2.de`)",
|
|
|
|
"traefik.http.routers.shit.tls" = "true",
|
|
|
|
"traefik.http.routers.shit.tls.certresolver" = "default",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "docker_service" "shit" {
|
|
|
|
name = "shit"
|
|
|
|
|
|
|
|
dynamic "labels" {
|
|
|
|
for_each = local.labels
|
|
|
|
content {
|
|
|
|
label = labels.key
|
|
|
|
value = labels.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task_spec {
|
|
|
|
networks_advanced {
|
|
|
|
name = data.docker_network.traefik.id
|
|
|
|
}
|
|
|
|
|
|
|
|
container_spec {
|
|
|
|
image = "${data.docker_registry_image.shit.name}@${data.docker_registry_image.shit.sha256_digest}"
|
|
|
|
|
|
|
|
mounts {
|
|
|
|
target = "/usr/share/nginx/html/"
|
|
|
|
source = "/mnt/data/shit/html/"
|
|
|
|
type = "bind"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-25 21:27:47 +01:00
|
|
|
|
|
|
|
data "hetznerdns_zone" "primary" {
|
|
|
|
name = "montage2.de"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "hetznerdns_record" "primary" {
|
|
|
|
zone_id = data.hetznerdns_zone.primary.id
|
|
|
|
name = "shit"
|
|
|
|
value = "ax41-1.fsn.mon2.de."
|
|
|
|
type = "CNAME"
|
|
|
|
}
|