51 lines
1.4 KiB
HCL
51 lines
1.4 KiB
HCL
resource "docker_container" "wp" {
|
|
image = "${docker_image.wp.latest}"
|
|
name = "kaarana-wordpress"
|
|
|
|
restart = "always"
|
|
must_run = true
|
|
|
|
labels {
|
|
"traefik.enable" = "true"
|
|
|
|
# Redirect Setup
|
|
"traefik.http.routers.kaarana-insecure.rule" = "Host(`kaarana.captnemo.in`)"
|
|
"traefik.http.routers.kaarana-insecure.entrypoints" = "web"
|
|
"traefik.http.routers.kaarana-insecure.middlewares" = "redirect"
|
|
"traefik.http.middlewares.redirect.redirectScheme.scheme" = "https"
|
|
|
|
"traefik.http.routers.kaarana" = "true"
|
|
"traefik.http.routers.kaarana.priority" = "2" #Doesn't help
|
|
"traefik.http.routers.kaarana.entrypoints" = "web-secure"
|
|
"traefik.http.routers.kaarana.rule" = "Host(`kaarana.captnemo.in`)"
|
|
"traefik.http.routers.kaarana.tls.certResolver" = "default"
|
|
}
|
|
|
|
env = [
|
|
"WORDPRESS_DB_HOST=${local.db_hostname}",
|
|
"WORDPRESS_DB_USER=${local.username}",
|
|
"WORDPRESS_DB_PASSWORD=${var.db_password}",
|
|
"WORDPRESS_DB_NAME=${local.database}",
|
|
"WORDPRESS_TABLE_PREFIX=",
|
|
]
|
|
|
|
volumes {
|
|
host_path = "/mnt/disk/kaarana-wp"
|
|
container_path = "/var/www/html"
|
|
}
|
|
|
|
networks_advanced = [
|
|
{
|
|
name = "kaarana-db"
|
|
},
|
|
{
|
|
// TODO: Once configuration/plugins have stabilized
|
|
// remove internet access from wordpress
|
|
name = "bridge"
|
|
},
|
|
{
|
|
name = "traefik"
|
|
},
|
|
]
|
|
}
|