@@ -32,6 +32,10 @@ cleanup(){
32
32
fi
33
33
)|| true
34
34
done
35
+ if [[ -d " ${ZITI_CONSOLE_LOCATION} " ]]
36
+ then
37
+ sudo rm -rf " ${ZITI_CONSOLE_LOCATION} "
38
+ fi
35
39
echo " DEBUG: cleanup complete"
36
40
}
37
41
@@ -58,7 +62,7 @@ BASEDIR="$(cd "$(dirname "${0}")" && pwd)"
58
62
REPOROOT=" $( cd " ${BASEDIR} /../../.." && pwd) "
59
63
cd " ${REPOROOT} "
60
64
61
- declare -a BINS=(grep go nc nfpm)
65
+ declare -a BINS=(grep go nc nfpm curl unzip )
62
66
for BIN in " ${BINS[@]} " ; do
63
67
checkCommand " $BIN "
64
68
done
73
77
: " ${ZITI_ROUTER_NAME:= " linux-router1" } "
74
78
: " ${ZITI_ROUTER_ADVERTISED_ADDRESS:= " ${ZITI_ROUTER_NAME} .127.0.0.1.sslip.io" } "
75
79
: " ${ZITI_ENROLL_TOKEN:= " ${TMPDIR} /${ZITI_ROUTER_NAME} .jwt" } "
80
+ : " ${ZITI_CONSOLE_LOCATION:= " /opt/openziti/share/consoletest" } "
76
81
77
82
export \
78
83
ZITI_GO_VERSION \
@@ -115,6 +120,7 @@ ZITI_ENROLL_TOKEN=/tmp/${ZITI_ROUTER_NAME}.jwt \
115
120
sudo /opt/openziti/etc/controller/bootstrap.bash << CTRL
116
121
ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_CTRL_ADVERTISED_ADDRESS} "
117
122
ZITI_CTRL_ADVERTISED_PORT="${ZITI_CTRL_ADVERTISED_PORT} "
123
+ ZITI_CONSOLE_LOCATION="${ZITI_CONSOLE_LOCATION} "
118
124
ZITI_USER="admin"
119
125
ZITI_PWD="${ZITI_PWD} "
120
126
CTRL
141
147
done
142
148
ziti edge create edge-router " ${ZITI_ROUTER_NAME} " -to " ${ZITI_ENROLL_TOKEN} "
143
149
150
+ # fetch and install ziti console
151
+ sudo mkdir -p " ${ZITI_CONSOLE_LOCATION} "
152
+ sudo tee " ${ZITI_CONSOLE_LOCATION} /index.html" <<< " I am ZAC"
153
+ sudo chmod -R +rX " ${ZITI_CONSOLE_LOCATION} "
154
+
144
155
sudo /opt/openziti/etc/router/bootstrap.bash << ROUTER
145
156
ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_CTRL_ADVERTISED_ADDRESS} "
146
157
ZITI_CTRL_ADVERTISED_PORT="${ZITI_CTRL_ADVERTISED_PORT} "
@@ -175,4 +186,17 @@ ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
175
186
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
176
187
go test -v -count=1 -tags=" quickstart manual" ./ziti/cmd/edge/...
177
188
189
+ ATTEMPTS=5
190
+ DELAY=3
191
+
192
+ # verify console is available
193
+ curl_cmd=" curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null \" https://${ZITI_CTRL_ADVERTISED_ADDRESS} :${ZITI_CTRL_ADVERTISED_PORT} /zac/\" "
194
+ until ! (( ATTEMPTS)) || eval " ${curl_cmd} " & > /dev/null
195
+ do
196
+ (( ATTEMPTS-- ))
197
+ echo " Waiting for zac"
198
+ sleep ${DELAY}
199
+ done
200
+ eval " ${curl_cmd} "
201
+
178
202
cleanup
0 commit comments