-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetupTest.sh
executable file
·44 lines (33 loc) · 3.79 KB
/
setupTest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
docker kill zestNoArb
docker kill arbiter
docker kill zest
ZEST_IMAGE_VERSION="databoxsystems/zestdb-amd64:latest"
ARBITER_IMAGE_VERSION="jptmoore/arbiter:v0.0.4"
#
#start a store which is not paired for resting the zest.js
#
echo "start the store with the default key"
docker run -p 3333:5555 -p 3334:5556 -d --name zestNoArb --rm ${ZEST_IMAGE_VERSION} /app/zest/server.exe --secret-key-file example-server-key --identity '127.0.0.1' --enable-logging
#
# start an arbiter and pair it with the store to test the client
#
echo "start the arbiter"
docker run -p 4444:4444 -p 4445:4445 -d --name arbiter --rm ${ARBITER_IMAGE_VERSION} /app/zest/server.exe --request-endpoint tcp://0.0.0.0:4444 --secret-key-file example-server-key --token-key-file example-token-key --enable-logging
echo "register a store"
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --request-endpoint tcp://0.0.0.0:4444 --path '/cm/upsert-container-info' --mode post --payload "{\"name\": \"127.0.0.1\", \"type\": \"store\", \"key\": \"storeSecret\"}" --token secret
echo "Get the store token"
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --request-endpoint tcp://0.0.0.0:4444 --path '/store/secret' --mode get --identity '127.0.0.1' --token storeSecret > /tmp/storekeyextra.txt
# strip
tr -d '\r\n' < /tmp/storekeyextra.txt > /tmp/storekey.txt
echo "store token is "
cat /tmp/storekey.txt
echo "start the store with the key from above"
docker run -p 5555:5555 -p 5556:5556 -d --name zest -v /tmp/storekey.txt:/storekey.txt --rm ${ZEST_IMAGE_VERSION} /app/zest/server.exe --secret-key-file example-server-key --token-key-file /storekey.txt --identity '127.0.0.1' --enable-logging
HOST_NAME=$(hostname)
echo "registering app called " $HOST_NAME
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --request-endpoint tcp://0.0.0.0:4444 --path '/cm/upsert-container-info' --mode post --payload "{\"name\": \"${HOST_NAME}\", \"type\": \"app\", \"key\": \"secret\"}" --token secret
echo "Granting permissions for app called " $HOST_NAME
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --path '/cm/grant-container-permissions' --mode post --payload "{\"name\": \"${HOST_NAME}\", \"caveats\": [{\"destination\":\"https://export.amar.io/\"}], \"route\": {\"method\": \"POST\", \"path\": \"/export/lp\", \"target\": \"127.0.0.1\"}}" --token secret --request-endpoint 'tcp://127.0.0.1:4444' --token secret
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --path '/cm/grant-container-permissions' --mode post --payload "{\"name\": \"${HOST_NAME}\", \"caveats\": [], \"route\": {\"method\": \"POST\", \"path\": \"/*\", \"target\": \"127.0.0.1\"}}" --token secret --request-endpoint 'tcp://127.0.0.1:4444' --token secret
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --path '/cm/grant-container-permissions' --mode post --payload "{\"name\": \"${HOST_NAME}\", \"caveats\": [], \"route\": {\"method\": \"GET\", \"path\": \"/*\", \"target\": \"127.0.0.1\"}}" --token secret --request-endpoint 'tcp://127.0.0.1:4444' --token secret
docker run --network host -it ${ZEST_IMAGE_VERSION} /app/zest/client.exe --server-key 'vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<' --path '/cm/grant-container-permissions' --mode post --payload "{\"name\": \"${HOST_NAME}\", \"caveats\": [], \"route\": {\"method\": \"DELETE\", \"path\": \"/*\", \"target\": \"127.0.0.1\"}}" --token secret --request-endpoint 'tcp://127.0.0.1:4444' --token secret