Skip to content

Commit

Permalink
Request consul in prestart hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Oct 4, 2024
1 parent 866604a commit 2c84874
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions jobs/fastcgi.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ job "fastcgi" {

driver = "exec"
config {
command = "sh"
image = "busybox:1.28"
command = "sh"
network_mode = "host"
args = [
"-c",
format(
"while ! ncat --send-only %s %s < /dev/null; do sleep 1; done",
local.main ? "127.0.0.1" : NOMAD_UPSTREAM_IP_mysql,
local.main ? "3306" : NOMAD_UPSTREAM_PORT_mysql
),
local.main ? "while ! ncat --send-only 127.0.0.1 3306 < /dev/null; do sleep 1; done"
: true ? "echo -n 'Waiting for service'; until ncat --send-only ${main_nomad_addr} 3306 < /dev/null; do echo '.'; sleep 2; done"
: "echo -n 'Waiting for service'; until nslookup mysql.service.consul 127.0.0.1:8600 2>&1 >/dev/null; do echo '.'; sleep 2; done",
]
}
}
Expand All @@ -50,15 +50,17 @@ job "fastcgi" {
sidecar = false
}

driver = "exec"
driver = "docker"
config {
command = "sh"
image = "busybox:1.28"
command = "sh"
network_mode = "host"
args = [
"-c",
format("while ! ncat --send-only %s %s < /dev/null; do sleep 1; done",
local.main ? "127.0.0.1" : NOMAD_UPSTREAM_IP_memcached,
local.main ? "11211" : NOMAD_UPSTREAM_PORT_memcached
),
local.main ? format("while ! ncat --send-only %s %s < /dev/null; do sleep 1; done",
"127.0.0.1",
"11211"
) : "echo -n 'Waiting for service'; until nslookup memcached.service.consul 127.0.0.1:8600 2>&1 >/dev/null; do echo '.'; sleep 2; done",
]
}
}
Expand Down

0 comments on commit 2c84874

Please sign in to comment.