From d1d3506e7b94bc4cd0470944394807ad41ca9d81 Mon Sep 17 00:00:00 2001 From: Nemo <me@captnemo.in> Date: Fri, 18 Jan 2019 17:15:22 +0530 Subject: [PATCH] Some minor updates for Docker provider upgrade --- .gitignore | 1 + pulse.tf | 28 ++++++++++++++++++++++++++++ docker/data.tf | 2 +- docker/traefik.tf | 5 +++++ opml/main.tf | 2 +- opml/redis.tf | 1 - modules/container/locals.tf | 2 +- modules/container/main.tf | 2 +- 8 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 167018c..d2ef326 100644 --- a/.gitignore +++ a/.gitignore @@ -6,3 +6,4 @@ *.out *.backup secrets +k8s/ diff --git a/pulse.tf b/pulse.tf new file mode 100644 index 0000000..eca1b81 100644 --- /dev/null +++ a/pulse.tf @@ -1,0 +1,28 @@ +module "pulse-pshtt" { + name = "pulse-pshtt" + source = "modules/container" + image = "dhsncats/pshtt:0.5.2" + + volumes = [ + { + host_path = "/mnt/xwing/data/pulse" + container_path = "/home/pshtt" + }, + ] + + web { + expose = false + host = "" + } + + command = ["--debug", "--timeout=3", "--cache-third-parties=./cache", "domains.csv"] + must_run = "false" + restart = "no" + + # nameserver = "192.168.1.1" + networks = ["bridge"] + + resource = { + memory = 2048 + } +} diff --git a/docker/data.tf b/docker/data.tf index eb7a06d..d63133e 100644 --- a/docker/data.tf +++ a/docker/data.tf @@ -1,7 +1,7 @@ data "docker_registry_image" "traefik" { # Critical and I like upgrading it # for updating config for new features - name = "traefik:1.7-alpine" + name = "traefik:1.7" } data "docker_registry_image" "wikijs" { diff --git a/docker/traefik.tf b/docker/traefik.tf index 2064c1a..37e9f1f 100644 --- a/docker/traefik.tf +++ a/docker/traefik.tf @@ -87,10 +87,15 @@ // https://github.com/terraform-providers/terraform-provider-docker/issues/10 networks = [ "${docker_network.traefik.id}", + "${data.docker_network.bridge.id}", ] env = [ "CLOUDFLARE_EMAIL=${var.cloudflare_email}", "CLOUDFLARE_API_KEY=${var.cloudflare_key}", ] +} + +data "docker_network" "bridge" { + name = "bridge" } diff --git a/opml/main.tf b/opml/main.tf index 24094de..58df927 100644 --- a/opml/main.tf +++ a/opml/main.tf @@ -6,7 +6,7 @@ web { expose = true - host = "opml.${var.domain}" + host = "${var.domain}" } env = [ diff --git a/opml/redis.tf b/opml/redis.tf index 83b2363..1b44491 100644 --- a/opml/redis.tf +++ a/opml/redis.tf @@ -7,7 +7,6 @@ # ThisSucks web { expose = "false" - host = "" } resource { diff --git a/modules/container/locals.tf b/modules/container/locals.tf index 36da5d0..c97f35f 100644 --- a/modules/container/locals.tf +++ a/modules/container/locals.tf @@ -5,7 +5,7 @@ web { "traefik.port" = "${lookup(var.web, "port", "80")}" - "traefik.frontend.rule" = "Host:${lookup(var.web, "host")}" + "traefik.frontend.rule" = "Host:${lookup(var.web, "host", "example.invalid")}" "traefik.protocol" = "${lookup(var.web, "protocol", "http")}" } diff --git a/modules/container/main.tf b/modules/container/main.tf index 451c1b6..b6b8aca 100644 --- a/modules/container/main.tf +++ a/modules/container/main.tf @@ -25,7 +25,7 @@ // Only attach the traefik network if // service is exposed to the web - networks = ["${concat(var.networks,split(",",lookup(var.web, "expose", "false") == "false" ? "" :"${data.docker_network.traefik.id}"))}"] + networks = ["${concat(var.networks,compact(split(",",lookup(var.web, "expose", "false") == "false" ? "" :"${data.docker_network.traefik.id}")))}"] memory = "${local.resource["memory"]}" -- rgit 0.1.5