radicale: Migrate to container module
This commit is contained in:
parent
2f08ef00a4
commit
840ce49e98
1
main.tf
1
main.tf
|
@ -56,7 +56,6 @@ module "opml" {
|
||||||
module "radicale" {
|
module "radicale" {
|
||||||
source = "radicale"
|
source = "radicale"
|
||||||
domain = "radicale.bb8.fun"
|
domain = "radicale.bb8.fun"
|
||||||
traefik-labels = "${var.traefik-common-labels}"
|
|
||||||
traefik-network-id = "${module.docker.traefik-network-id}"
|
traefik-network-id = "${module.docker.traefik-network-id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,50 +1,39 @@
|
||||||
data "docker_registry_image" "radicale" {
|
module "container" {
|
||||||
name = "tomsquest/docker-radicale:latest"
|
name = "radicale"
|
||||||
}
|
source = "../modules/container"
|
||||||
|
image = "tomsquest/docker-radicale:latest"
|
||||||
|
|
||||||
resource "docker_image" "radicale" {
|
web {
|
||||||
name = "${data.docker_registry_image.radicale.name}"
|
expose = true
|
||||||
pull_triggers = ["${data.docker_registry_image.radicale.sha256_digest}"]
|
port = 5232
|
||||||
}
|
host = "${var.domain}"
|
||||||
|
|
||||||
resource "docker_container" "radicale" {
|
|
||||||
name = "radicale"
|
|
||||||
image = "${docker_image.radicale.latest}"
|
|
||||||
|
|
||||||
labels = "${merge(
|
|
||||||
var.traefik-labels, map(
|
|
||||||
"traefik.port", 5232,
|
|
||||||
"traefik.frontend.rule","Host:${var.domain}"
|
|
||||||
))}"
|
|
||||||
|
|
||||||
volumes {
|
|
||||||
host_path = "/mnt/xwing/data/radicale"
|
|
||||||
container_path = "/data"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
volumes {
|
volumes = [
|
||||||
host_path = "/mnt/xwing/config/radicale"
|
{
|
||||||
container_path = "/config"
|
host_path = "/mnt/xwing/data/radicale"
|
||||||
}
|
container_path = "/data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
host_path = "/mnt/xwing/config/radicale"
|
||||||
|
container_path = "/config"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
upload {
|
uploads = [
|
||||||
content = "${file("${path.module}/config")}"
|
{
|
||||||
file = "/config/config"
|
content = "${file("${path.module}/config")}"
|
||||||
}
|
file = "/config/config"
|
||||||
|
},
|
||||||
upload {
|
{
|
||||||
content = "${file("${path.module}/logging.conf")}"
|
content = "${file("${path.module}/logging.conf")}"
|
||||||
file = "/config/logging"
|
file = "/config/logging"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
upload {
|
content = "${file("${path.module}/users")}"
|
||||||
content = "${file("${path.module}/users")}"
|
file = "/config/users"
|
||||||
file = "/config/users"
|
},
|
||||||
}
|
]
|
||||||
|
|
||||||
networks = ["${var.traefik-network-id}"]
|
networks = ["${var.traefik-network-id}"]
|
||||||
|
|
||||||
restart = "unless-stopped"
|
|
||||||
destroy_grace_seconds = 10
|
|
||||||
must_run = true
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,4 @@ variable "domain" {
|
||||||
type = "string"
|
type = "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "traefik-labels" {
|
|
||||||
type = "map"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "traefik-network-id" {}
|
variable "traefik-network-id" {}
|
||||||
|
|
Loading…
Reference in New Issue