Skip to content

Commit b42d37d

Browse files
committed
chore: create custom private network
1 parent 97a422d commit b42d37d

File tree

4 files changed

+36
-96
lines changed

4 files changed

+36
-96
lines changed

.docker/algod_config.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

.docker/algod_network_template.json

Lines changed: 0 additions & 52 deletions
This file was deleted.

.docker/start_all.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ if [ "$ALGORAND_DATA" != "/algod/data" ]; then
1010
echo "Do not override 'ALGORAND_DATA' environment variable."
1111
exit 1
1212
fi
13-
# To allow mounting the data directory we need to change permissions
14-
# to our algorand user. The script is initially run as the root user
15-
# in order to change permissions, afterwards the script is re-launched
16-
# as the algorand user.
17-
if [ "$(id -u)" = '0' ]; then
18-
chown -R algorand:algorand $ALGORAND_DATA
19-
exec su -p -c "$(readlink -f $0) $@" algorand
20-
fi
2113

2214
/node/run/start_empty.sh &
2315
/node/run/start_fast_catchup.sh &

.docker/start_dev.sh

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,47 @@
33
set -e
44

55
if [ "$DEBUG" = "1" ]; then
6-
set -x
6+
set -x
77
fi
88

99
if [ "$ALGORAND_DATA" != "/algod/data" ]; then
10-
echo "Do not override 'ALGORAND_DATA' environment variable."
11-
exit 1
10+
echo "Do not override 'ALGORAND_DATA' environment variable."
11+
exit 1
1212
fi
1313

14-
# To allow mounting the data directory we need to change permissions
15-
# to our algorand user. The script is initially run as the root user
16-
# in order to change permissions, afterwards the script is re-launched
17-
# as the algorand user.
18-
if [ "$(id -u)" = '0' ]; then
19-
chown -R algorand:algorand "$ALGORAND_DATA"
20-
exec su -p -c "$(readlink -f $0) $@" algorand
21-
fi
22-
23-
2414
# Configure the participation node
2515
if [ -d "$ALGORAND_DATA" ]; then
26-
if [ "$TOKEN" != "" ]; then
27-
echo "$TOKEN" > "$ALGORAND_DATA/algod.token"
28-
fi
29-
if [ "$ADMIN_TOKEN" != "" ]; then
30-
echo "$ADMIN_TOKEN" > "$ALGORAND_DATA/algod.admin.token"
31-
fi
32-
cd "$ALGORAND_DATA"
33-
cp "/node/run/genesis/testnet/genesis.json" genesis.json
34-
algocfg profile set --yes -d "$ALGORAND_DATA" "participation"
35-
algod -o -d $ALGORAND_DATA -l "0.0.0.0:8080"
16+
if [ -f "$ALGORAND_DATA/genesis.json" ]; then
17+
if [ "$TOKEN" != "" ]; then
18+
echo "$TOKEN" >"$EMPTY_DATA/algod.token"
19+
fi
20+
if [ "$ADMIN_TOKEN" != "" ]; then
21+
echo "$ADMIN_TOKEN" >"$EMPTY_DATA/algod.admin.token"
22+
fi
23+
algod -o -d "$ALGORAND_DATA" -l "0.0.0.0:8080"
24+
else
25+
sed -i "s/NUM_ROUNDS/${NUM_ROUNDS:-30000}/" "/node/run/template.json"
26+
sed -i "s/\"NetworkName\": \"\"/\"NetworkName\": \"hack-tui\"/" "/node/run/template.json"
27+
goal network create --noclean -n tuinet -r "${ALGORAND_DATA}/.." -t "/node/run/template.json"
28+
29+
# Cycle Network
30+
goal network start -r "${ALGORAND_DATA}/.."
31+
goal node stop
32+
33+
# Update Tokens
34+
if [ "$TOKEN" != "" ]; then
35+
echo "$TOKEN" >"$ALGORAND_DATA/algod.token"
36+
fi
37+
if [ "$ADMIN_TOKEN" != "" ]; then
38+
echo "$ADMIN_TOKEN" >"$ALGORAND_DATA/algod.admin.token"
39+
fi
40+
# Import wallet
41+
goal account import -m "artefact exist coil life turtle edge edge inside punch glance recycle teach melody diet method pause slam dumb race interest amused side learn able heavy"
42+
43+
algod -o -d "$ALGORAND_DATA" -l "0.0.0.0:8080"
44+
fi
45+
3646
else
37-
echo "$ALGORAND_DATA" does not exist
38-
exit 1
39-
fi
47+
echo "$ALGORAND_DATA" does not exist
48+
exit 1
49+
fi

0 commit comments

Comments
 (0)