2018-03-15 08:27:12 +00:00
|
|
|
data "docker_registry_image" "timemachine" {
|
|
|
|
name = "odarriba/timemachine:latest"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "docker_image" "timemachine" {
|
2021-10-15 12:54:13 +00:00
|
|
|
name = data.docker_registry_image.timemachine.name
|
|
|
|
pull_triggers = [data.docker_registry_image.timemachine.sha256_digest]
|
2018-03-15 08:27:12 +00:00
|
|
|
}
|
|
|
|
|
2018-04-22 12:39:44 +00:00
|
|
|
resource "docker_container" "timemachine" {
|
2018-03-15 08:27:12 +00:00
|
|
|
name = "timemachine"
|
2022-12-26 07:16:09 +00:00
|
|
|
image = docker_image.timemachine.image_id
|
2018-03-15 08:27:12 +00:00
|
|
|
|
|
|
|
volumes {
|
|
|
|
host_path = "/mnt/xwing/data/timemachine"
|
|
|
|
container_path = "/timemachine"
|
|
|
|
}
|
|
|
|
|
|
|
|
ports {
|
|
|
|
internal = 548
|
|
|
|
external = 548
|
2021-10-15 12:54:13 +00:00
|
|
|
ip = var.ips["eth0"]
|
2018-03-15 08:27:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ports {
|
|
|
|
internal = 636
|
|
|
|
external = 636
|
2021-10-15 12:54:13 +00:00
|
|
|
ip = var.ips["eth0"]
|
2018-03-15 08:27:12 +00:00
|
|
|
}
|
|
|
|
|
2018-03-30 04:59:26 +00:00
|
|
|
upload {
|
2021-10-15 12:54:13 +00:00
|
|
|
content = data.template_file.timemachine-entrypoint.rendered
|
2018-03-30 04:59:26 +00:00
|
|
|
file = "/entrypoint-custom.sh"
|
|
|
|
}
|
|
|
|
|
|
|
|
entrypoint = [
|
2018-03-30 18:18:26 +00:00
|
|
|
"/bin/sh",
|
2018-03-30 04:59:26 +00:00
|
|
|
"/entrypoint-custom.sh",
|
|
|
|
]
|
|
|
|
|
2018-03-15 08:27:12 +00:00
|
|
|
restart = "unless-stopped"
|
|
|
|
destroy_grace_seconds = 10
|
|
|
|
must_run = true
|
|
|
|
}
|
2018-03-30 04:59:26 +00:00
|
|
|
|
|
|
|
data "template_file" "timemachine-entrypoint" {
|
2021-10-15 12:54:13 +00:00
|
|
|
template = file("${path.module}/entrypoint.sh.tpl")
|
2018-03-30 04:59:26 +00:00
|
|
|
|
2021-10-15 12:54:13 +00:00
|
|
|
vars = {
|
|
|
|
username-1 = var.username-1
|
|
|
|
password-1 = var.password-1
|
|
|
|
username-2 = var.username-2
|
|
|
|
password-2 = var.password-2
|
2018-03-30 04:59:26 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-15 12:54:13 +00:00
|
|
|
|