Sets up traefik

This commit is contained in:
Nemo 2017-11-05 02:57:00 +05:30
parent 791dd9ca33
commit 59d2a40c0e
4 changed files with 63 additions and 1 deletions

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
env.sh
.terraform
*.tfstate
*.tfstate
*.tfstate.backup
*.out

11
docker/conf/traefik.toml Normal file
View File

@ -0,0 +1,11 @@
################################################################
# Web configuration backend
################################################################
[web]
address = ":1111"
################################################################
# Docker configuration backend
################################################################
[docker]
domain = "docker.in.bb8.fun"
watch = true

View File

@ -16,4 +16,8 @@ data "docker_registry_image" "flexget" {
data "docker_registry_image" "couchpotato" {
name = "linuxserver/couchpotato:latest"
}
data "docker_registry_image" "traefik" {
name = "traefik:latest"
}

View File

@ -23,6 +23,11 @@ resource "docker_image" "couchpotato" {
pull_triggers = ["${data.docker_registry_image.couchpotato.sha256_digest}"]
}
resource "docker_image" "traefik" {
name = "${data.docker_registry_image.traefik.name}"
pull_triggers = ["${data.docker_registry_image.traefik.sha256_digest}"]
}
resource "docker_volume" "mariadb_volume" {
name = "mariadb_volume"
}
@ -204,3 +209,43 @@ resource "docker_container" "couchpotato" {
"TZ=Asia/Kolkata",
]
}
resource "docker_container" "traefik" {
name = "traefik"
image = "${docker_image.traefik.latest}"
ports {
internal = 1111
external = 1111
ip = "192.168.1.111"
}
ports {
internal = 80
external = 8888
ip = "192.168.1.111"
}
provisioner "file" {
source = "./docker/conf/traefik.toml"
destination = "/mnt/xwing/config/traefik/traefik.toml"
connection {
type = "ssh"
user = "nemo"
password = ""
host = "192.168.1.111"
timeout = 5
}
}
volumes {
host_path = "/mnt/xwing/config/traefik"
container_path = "/etc/traefik"
}
volumes {
host_path = "/var/run/docker.sock"
container_path = "/var/run/docker.sock"
}
}