File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ sudo ./start-nomad.sh
21
21
Basically this command create a ` nomad_temp ` folder, run a server and a client, and mount ` nomad_temp/scratchdir ` as a ` local ` volume
22
22
, so all pipelines can/must use it as working dir
23
23
24
+ Use ` --secure ` argument if you want to create a secured cluster. The script will bootstrap an ACL and a NOMAD_TOKEN
25
+ will be generated (see the output of the script)
26
+
24
27
## Run pipelines examples
25
28
26
29
open another terminal and execute:
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- set -uex
2
+ set -ue
3
3
4
- export NOMAD_VERSION=" 1.8.1"
5
- export NOMAD_PLATFORM=" linux_amd64"
4
+ NOMAD_VERSION=" 1.8.1"
5
+ NOMAD_PLATFORM=" linux_amd64"
6
+
7
+ SECURE=0
8
+ [[ " $@ " =~ ' --secure' ]] && SECURE=1
6
9
7
10
if [ ! -f ./nomad ]; then
8
11
curl -O " https://releases.hashicorp.com/nomad/${NOMAD_VERSION} /nomad_${NOMAD_VERSION} _${NOMAD_PLATFORM} .zip"
@@ -23,6 +26,14 @@ cat >server-custom.conf <<EOL
23
26
data_dir = "${CURRENT_DIR} /server"
24
27
EOL
25
28
29
+ if [ " $SECURE " == 1 ]; then
30
+ cat >> server-custom.conf << EOL
31
+ acl {
32
+ enabled = true
33
+ }
34
+ EOL
35
+ fi
36
+
26
37
rm -f client-custom.conf
27
38
cat > client-custom.conf << EOL
28
39
data_dir = "${CURRENT_DIR} /client"
37
48
38
49
cp ../server.conf .
39
50
cp ../client.conf .
40
- ../nomad agent -config server.conf -config client.conf -config server-custom.conf -config client-custom.conf
51
+
52
+ if [ " $SECURE " == 0 ]; then
53
+ # basic nomad cluter
54
+ ../nomad agent -config server.conf -config client.conf -config server-custom.conf -config client-custom.conf
55
+ else
56
+ # secured nomad cluster
57
+ ../nomad agent -config server.conf -config client.conf -config server-custom.conf -config client-custom.conf &
58
+ cd ..
59
+ ./wait-nomad.sh
60
+ sleep 3
61
+ NOMAD_TOKEN=$( nomad acl bootstrap | awk ' /^Secret ID/ {print $4}' )
62
+ export NOMAD_TOKEN
63
+ echo New super token generated.
64
+ echo export NOMAD_TOKEN=$NOMAD_TOKEN
65
+ fi
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- until curl --output /dev/null --silent --head -- fail http://localhost:4646; do
3
+ until curl --output /dev/null --silent --fail http://localhost:4646/v1/status/leader ; do
4
4
printf ' .'
5
5
sleep 5
6
6
done
You can’t perform that action at this time.
0 commit comments