Skip to content

Commit

Permalink
memcached: Restore health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Oct 8, 2024
1 parent 37483e1 commit 8f7905b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 53 deletions.
67 changes: 17 additions & 50 deletions jobs/memcached.nomad
Original file line number Diff line number Diff line change
@@ -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"]

Expand All @@ -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
}
}
}
Expand All @@ -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
}
}
3 changes: 0 additions & 3 deletions terraform/mediawiki.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ resource "nomad_job" "memcached_green" {

hcl2 {
allow_fs = true
vars = {
test = true
}
}
}

Expand Down

0 comments on commit 8f7905b

Please sign in to comment.