2019-09-20 23:29:39 +00:00
|
|
|
// Create a small database network
|
|
|
|
resource "docker_network" "traefik" {
|
|
|
|
name = "traefik"
|
|
|
|
|
|
|
|
labels = {
|
|
|
|
internal = "true"
|
|
|
|
role = "ingress"
|
|
|
|
}
|
|
|
|
|
|
|
|
internal = true
|
|
|
|
}
|
2019-09-21 02:25:55 +00:00
|
|
|
|
|
|
|
resource "docker_container" "traefik" {
|
|
|
|
name = "traefik"
|
2021-10-15 12:54:13 +00:00
|
|
|
image = docker_image.traefik.latest
|
2019-09-21 02:25:55 +00:00
|
|
|
|
|
|
|
# Do not offer HTTP2
|
|
|
|
# https://community.containo.us/t/traefikv2-http-2-0/1199
|
|
|
|
env = [
|
|
|
|
"GODEBUG=http2client=0",
|
|
|
|
]
|
|
|
|
|
|
|
|
upload {
|
2021-10-15 12:54:13 +00:00
|
|
|
content = file("${path.module}/traefik.toml")
|
2019-09-21 02:25:55 +00:00
|
|
|
file = "/etc/traefik/traefik.toml"
|
|
|
|
}
|
|
|
|
|
|
|
|
volumes {
|
|
|
|
host_path = "/var/run/docker.sock"
|
|
|
|
container_path = "/var/run/docker.sock"
|
|
|
|
read_only = true
|
|
|
|
}
|
|
|
|
|
|
|
|
volumes {
|
|
|
|
host_path = "/mnt/disk/traefik"
|
|
|
|
container_path = "/acme"
|
|
|
|
}
|
|
|
|
|
|
|
|
ports {
|
|
|
|
internal = 443
|
|
|
|
external = 8443
|
|
|
|
ip = "139.59.22.234"
|
|
|
|
}
|
|
|
|
|
|
|
|
ports {
|
|
|
|
internal = 80
|
|
|
|
external = 80
|
|
|
|
ip = "139.59.22.234"
|
|
|
|
}
|
|
|
|
|
|
|
|
memory = 256
|
|
|
|
restart = "always"
|
|
|
|
destroy_grace_seconds = 10
|
|
|
|
must_run = true
|
|
|
|
|
2021-10-15 12:54:13 +00:00
|
|
|
networks_advanced {
|
|
|
|
name = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
networks_advanced {
|
|
|
|
name = "traefik"
|
|
|
|
}
|
2019-09-21 02:25:55 +00:00
|
|
|
}
|
2021-10-15 12:54:13 +00:00
|
|
|
|