-
Notifications
You must be signed in to change notification settings - Fork 38
/
container_run.sh
executable file
·69 lines (61 loc) · 1.99 KB
/
container_run.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
#
# This script starts up the faucet server to connect to a local testnet
#
help_and_exit() {
echo ""
echo "Usage: $(basename "${0}")"
echo ""
echo " nodeHost *Optional* Set the l2 host address"
echo ""
echo " nodePort *Optional* Set the l2 host port"
echo ""
echo " port *Optional* Set the faucet server port"
echo ""
echo " pk *Optional* Set the pre-funded private key"
echo ""
echo " jwtSecret *Optional* Set the jwt secret"
echo ""
echo " image *Optional* Set image to use, defaults to testnetobscuronet.azurecr.io/obscuronet/faucet_sepolia_testnet:latest"
echo ""
echo ""
echo ""
exit 1 # Exit with error explicitly
}
# Ensure any fail is loud and explicit
set -euo pipefail
# Define defaults
nodeHost="validator-host"
nodePort=13010
port=80
pk="0x8dfb8083da6275ae3e4f41e3e8a8c19d028d32c9247e24530933782f2a05035b"
jwtSecret="This_is_the_secret"
image="testnetobscuronet.azurecr.io/obscuronet/faucet_sepolia_testnet:latest"
# Parse the options
for argument in "$@"
do
key=$(echo $argument | cut -f1 -d=)
value=$(echo $argument | cut -f2 -d=)
case "$key" in
--nodeHost) nodeHost=${value} ;;
--nodePort) nodePort=${value} ;;
--port) port=${value} ;;
--pk) pk=${value} ;;
--jwtSecret) jwtSecret=${value} ;;
--image) image=${value} ;;
*)
esac
done
# Stop and remove any running container, and then star
echo "Force stopping any existing container ... "
docker rm -f local-testnet-faucet 2>/dev/null
echo "Starting the faucet server..."
docker run --env PORT=${port} -p 8080:${port} --name=local-testnet-faucet \
--detach \
--network=node_network \
--entrypoint ./faucet \
${image} \
--nodeHost=${nodeHost} \
--nodePort=${nodePort} \
--pk=${pk}\
--jwtSecret=${jwtSecret}\