-
Notifications
You must be signed in to change notification settings - Fork 10
/
build-dev.sh
executable file
·114 lines (89 loc) · 3.21 KB
/
build-dev.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# check if .env exists
if [ ! -f .env ]; then
echo ".env file not found, please create one!";
echo "creating .env file...";
cp env.example .env;
# ask user for SOURCE_RPC_URL and replace it in .env
if [ -z "$SOURCE_RPC_URL" ]; then
echo "Enter SOURCE_RPC_URL: ";
read SOURCE_RPC_URL;
sed -i'.backup' "s#<source-rpc-url>#$SOURCE_RPC_URL#" .env
fi
# ask user for SIGNER_ACCOUNT_ADDRESS and replace it in .env
if [ -z "$SIGNER_ACCOUNT_ADDRESS" ]; then
echo "Enter SIGNER_ACCOUNT_ADDRESS: ";
read SIGNER_ACCOUNT_ADDRESS;
sed -i'.backup' "s#<signer-account-address>#$SIGNER_ACCOUNT_ADDRESS#" .env
fi
# ask user for SIGNER_ACCOUNT_PRIVATE_KEY and replace it in .env
if [ -z "$SIGNER_ACCOUNT_PRIVATE_KEY" ]; then
echo "Enter SIGNER_ACCOUNT_PRIVATE_KEY: ";
read SIGNER_ACCOUNT_PRIVATE_KEY;
sed -i'.backup' "s#<signer-account-private-key>#$SIGNER_ACCOUNT_PRIVATE_KEY#" .env
fi
# ask user for SLOT_ID and replace it in .env
if [ -z "$SLOT_ID" ]; then
echo "Enter Your SLOT_ID (NFT_ID): ";
read SLOT_ID;
sed -i'.backup' "s#<slot-id>#$SLOT_ID#" .env
fi
fi
source .env
echo "testing before build...";
if [ -z "$SOURCE_RPC_URL" ]; then
echo "RPC URL not found, please set this in your .env!";
exit 1;
fi
if [ -z "$SIGNER_ACCOUNT_ADDRESS" ]; then
echo "SIGNER_ACCOUNT_ADDRESS not found, please set this in your .env!";
exit 1;
fi
if [ -z "$SIGNER_ACCOUNT_PRIVATE_KEY" ]; then
echo "SIGNER_ACCOUNT_ADDRESS not found, please set this in your .env!";
exit 1;
fi
echo "Found SOURCE RPC URL ${SOURCE_RPC_URL}";
echo "Found SIGNER ACCOUNT ADDRESS ${SIGNER_ACCOUNT_ADDRESS}";
if [ "$PROST_RPC_URL" ]; then
echo "Found PROST_RPC_URL ${PROST_RPC_URL}";
fi
if [ "$PROST_CHAIN_ID" ]; then
echo "Found PROST_CHAIN_ID ${PROST_CHAIN_ID}";
fi
if [ "$IPFS_URL" ]; then
echo "Found IPFS_URL ${IPFS_URL}";
fi
if [ "$PROTOCOL_STATE_CONTRACT" ]; then
echo "Found PROTOCOL_STATE_CONTRACT ${PROTOCOL_STATE_CONTRACT}";
fi
if [ "$RELAYER_HOST" ]; then
echo "Found RELAYER_HOST ${RELAYER_HOST}";
fi
if [ "$WEB3_STORAGE_TOKEN" ]; then
echo "Found WEB3_STORAGE_TOKEN ${WEB3_STORAGE_TOKEN}";
fi
if [ "$SLACK_REPORTING_URL" ]; then
echo "Found SLACK_REPORTING_URL ${SLACK_REPORTING_URL}";
fi
if [ "$POWERLOOM_REPORTING_URL" ]; then
echo "Found SLACK_REPORTING_URL ${POWERLOOM_REPORTING_URL}";
fi
# setting up git submodules
git submodule update --init --recursive
docker build -t powerloom-snapshotter-lite .
echo "building...";
if ! [ -x "$(command -v docker-compose)" ]; then
echo 'docker compose not found, trying to see if compose exists within docker';
if [ "$IPFS_URL" == "/dns/ipfs/tcp/5001" ]; then
docker compose -f docker-compose-dev.yaml --profile ipfs up -V --abort-on-container-exit
else
docker compose -f docker-compose-dev.yaml up --no-deps -V --abort-on-container-exit
fi
else
if [ "$IPFS_URL" == "/dns/ipfs/tcp/5001" ]; then
docker-compose -f docker-compose-dev.yaml --profile ipfs up -V --abort-on-container-exit
else
docker-compose -f docker-compose-dev.yaml up --no-deps -V --abort-on-container-exit
fi
fi