From 06836ad5b6fc59575a3afc393e032428c4b6c5b2 Mon Sep 17 00:00:00 2001 From: Lens0021 / Leslie Date: Sun, 6 Oct 2024 18:06:33 +0900 Subject: [PATCH] Use EBS for Caddy on the green cluster (#298) --- jobs/http.nomad | 87 ++++++++---------------------------------- terraform/mediawiki.tf | 8 ++-- terraform/volumes.tf | 38 ++++++++++++++++++ 3 files changed, 57 insertions(+), 76 deletions(-) diff --git a/jobs/http.nomad b/jobs/http.nomad index d6ffbfd9..9f396659 100644 --- a/jobs/http.nomad +++ b/jobs/http.nomad @@ -17,48 +17,29 @@ job "http" { datacenters = ["dc1"] group "http" { - dynamic "volume" { - for_each = local.main ? [{}] : [] - labels = ["caddycerts"] - content { - type = "csi" - source = "caddycerts" - read_only = false - access_mode = "single-node-writer" - attachment_mode = "file-system" - } + volume "caddycerts" { + type = "csi" + source = local.main ? "caddycerts" : "caddycerts_green" + read_only = false + access_mode = "single-node-writer" + attachment_mode = "file-system" } task "http" { driver = "docker" - dynamic "volume_mount" { - for_each = local.main ? [{}] : [] - content { - volume = "caddycerts" - destination = "/etc/caddycerts" - read_only = false - } + volume_mount { + volume = "caddycerts" + destination = "/etc/caddycerts" + read_only = false } - dynamic "artifact" { - for_each = local.main ? [{}] : [] - - content { - source = "https://github.com/femiwiki/nomad/raw/main/caddy/Caddyfile" - destination = "local/Caddyfile" - mode = "file" - - options { checksum = "md5:ee0300e384afa6aca74f09a44323ee6e" } - } - } - dynamic "template" { - for_each = var.test ? [{}] : [] + artifact { + source = "https://github.com/femiwiki/nomad/raw/main/caddy/Caddyfile" + destination = "local/Caddyfile" + mode = "file" - content { - data = var.caddyfile_for_test - destination = "local/Caddyfile" - } + options { checksum = "md5:ee0300e384afa6aca74f09a44323ee6e" } } artifact { @@ -184,41 +165,3 @@ job "http" { auto_revert = true } } - -variable "caddyfile_for_test" { - type = string - default = <