2020-01-10 19:25:57 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2020-02-03 16:50:43 +00:00
|
|
|
mkdir -p /tmp/nomad-dev-cluster/server{1,2,3} /tmp/nomad-dev-cluster/client{1,2}
|
|
|
|
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
2020-01-10 19:25:57 +00:00
|
|
|
|
|
|
|
# launch server
|
2020-02-03 16:50:43 +00:00
|
|
|
( nomad agent -config=${DIR}/server1.hcl 2>&1 | tee "/tmp/nomad-dev-cluster/server1/log" ; echo "Exit code: $?" >> "/tmp/nomad-dev-cluster/server1/log" ) &
|
2019-05-03 22:07:27 +00:00
|
|
|
|
2020-02-03 16:50:43 +00:00
|
|
|
( nomad agent -config=${DIR}/server2.hcl 2>&1 | tee "/tmp/nomad-dev-cluster/server2/log" ; echo "Exit code: $?" >> "/tmp/nomad-dev-cluster/server2/log" ) &
|
2019-05-03 22:07:27 +00:00
|
|
|
|
2020-02-03 16:50:43 +00:00
|
|
|
( nomad agent -config=${DIR}/server3.hcl 2>&1 | tee "/tmp/nomad-dev-cluster/server3/log" ; echo "Exit code: $?" >> "/tmp/nomad-dev-cluster/server3/log" ) &
|
2019-05-03 22:07:27 +00:00
|
|
|
|
|
|
|
# launch client 1
|
2020-02-03 16:50:43 +00:00
|
|
|
( nomad agent -config=${DIR}/client1.hcl 2>&1 | tee "/tmp/nomad-dev-cluster/client1/log" ; echo "Exit code: $?" >> "/tmp/nomad-dev-cluster/client1/log" ) &
|
2019-05-03 22:07:27 +00:00
|
|
|
|
|
|
|
# launch client 2
|
2020-02-03 16:50:43 +00:00
|
|
|
( nomad agent -config=${DIR}/client2.hcl 2>&1 | tee "/tmp/nomad-dev-cluster/client2/log" ; echo "Exit code: $?" >> "/tmp/nomad-dev-cluster/client2/log" ) &
|
|
|
|
|
|
|
|
|
|
|
|
trap 'kill -SIGTERM $(jobs -pr)' SIGINT SIGTERM
|
|
|
|
|
|
|
|
wait
|
|
|
|
|
|
|
|
# wait again to ensure process die
|
|
|
|
wait
|