diff --git a/jobs/fastcgi.nomad b/jobs/fastcgi.nomad index 8145aa3..474cb92 100644 --- a/jobs/fastcgi.nomad +++ b/jobs/fastcgi.nomad @@ -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", ] } } @@ -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", ] } }