From 8f7905bb827b68e03683d82438c96d8a4a79b145 Mon Sep 17 00:00:00 2001 From: lens0021 Date: Wed, 9 Oct 2024 07:35:39 +0900 Subject: [PATCH] memcached: Restore health checks --- jobs/memcached.nomad | 67 +++++++++++------------------------------- terraform/mediawiki.tf | 3 -- 2 files changed, 17 insertions(+), 53 deletions(-) diff --git a/jobs/memcached.nomad b/jobs/memcached.nomad index b61d0a8..0049c32 100644 --- a/jobs/memcached.nomad +++ b/jobs/memcached.nomad @@ -1,13 +1,3 @@ -variable "test" { - type = bool - description = "Uses jobs for the test server.." - default = false -} - -locals { - main = !var.test -} - job "memcached" { datacenters = ["dc1"] @@ -24,48 +14,25 @@ job "memcached" { } } - network { - mode = "bridge" - - dynamic "port" { - for_each = var.test ? [] : [{}] - labels = ["memcached"] - content { - static = 11211 - } - } - } + service { + name = "memcached" + port = "11211" - dynamic "service" { - for_each = local.main ? [{}] : [] - content { - provider = "nomad" - name = "memcached" - port = "memcached" - check { - type = "tcp" - interval = "10s" - timeout = "1s" - } + check { + type = "tcp" + interval = "10s" + timeout = "1s" } - } - - dynamic "service" { - for_each = var.test ? [{}] : [] - content { - name = "memcached" - port = "11211" - connect { - sidecar_service {} + connect { + sidecar_service {} - sidecar_task { - config { - memory_hard_limit = 300 - } - resources { - memory = 20 - } + sidecar_task { + config { + memory_hard_limit = 300 + } + resources { + memory = 20 } } } @@ -79,8 +46,8 @@ job "memcached" { update { auto_revert = true - auto_promote = var.test ? true : false + auto_promote = true # canary count equal to the desired count allows a Nomad job to model blue/green deployments - canary = var.test ? 1 : 0 + canary = 1 } } diff --git a/terraform/mediawiki.tf b/terraform/mediawiki.tf index 43c023d..36010f4 100644 --- a/terraform/mediawiki.tf +++ b/terraform/mediawiki.tf @@ -22,9 +22,6 @@ resource "nomad_job" "memcached_green" { hcl2 { allow_fs = true - vars = { - test = true - } } }