Skip to content

Commit 6123ed2

Browse files
committed
fix(setup): Fix setup script docker storage report and ensure we mine some blocks
1 parent 6ac450c commit 6123ed2

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

setup-test-network.sh

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@ set -e
1515
#
1616
# - The script checks for existing services and skips those already running
1717
# ==============================================================================
18-
18+
#
19+
# Save the starting disk usage
20+
START_SPACE=$(df -h --output=used /var/lib/docker | tail -1)
21+
START_IMAGES_SIZE=$(docker system df --format '{{.ImagesSize}}' 2>/dev/null || echo "N/A")
22+
START_CONTAINERS_SIZE=$(docker system df --format '{{.ContainersSize}}' 2>/dev/null || echo "N/A")
23+
START_VOLUMES_SIZE=$(docker system df --format '{{.VolumesSize}}' 2>/dev/null || echo "N/A")
24+
25+
echo "============ STARTING DISK USAGE ============"
26+
echo "Docker directory usage: $START_SPACE"
27+
echo "Images size: $START_IMAGES_SIZE"
28+
echo "Containers size: $START_CONTAINERS_SIZE"
29+
echo "Volumes size: $START_VOLUMES_SIZE"
30+
echo "=============================================="
31+
32+
# Your existing script starts here
1933
container_running() {
2034
docker ps --format '{{.Names}}' | grep -q "^$1$"
2135
return $?
@@ -60,12 +74,7 @@ docker compose up -d graph-contracts
6074
# Wait for contracts to be deployed
6175
timeout 300 bash -c 'until docker ps -a | grep graph-contracts | grep -q "Exited (0)"; do sleep 5; done'
6276

63-
# Verify the contracts have code, usually when starting from scratch
64-
# there could be timing issues between contract deployment
65-
# and when transaction gets approved and contract address gets available
66-
# in the network.
67-
# So bellow is a kind of double check
68-
# Extract a few key contract addresses from the contracts.json file
77+
# Verify the contracts have code
6978
graph_token_address=$(jq -r '."1337".GraphToken.address' contracts.json)
7079
controller_address=$(jq -r '."1337".Controller.address' contracts.json)
7180

@@ -169,12 +178,6 @@ rm docker-compose.override.yml
169178
timeout 30 bash -c 'until docker ps | grep indexer | grep -q healthy; do sleep 5; done'
170179
timeout 30 bash -c 'until docker ps | grep tap-agent | grep -q healthy; do sleep 5; done'
171180

172-
# GATEWAY DEPLOYMENT NOTE:
173-
# We're deploying gateway directly with "docker run" instead of docker-compose
174-
# because the local-network's compose file has a dependency on "indexer-service",
175-
# which would conflict with our custom indexer-service container.
176-
# This approach avoids container name conflicts while allowing full testing
177-
# of the RAV flow through the gateway.
178181
echo "Building gateway image..."
179182
docker build -t local-gateway:latest ./local-network/gateway
180183

@@ -191,9 +194,25 @@ docker run -d --name gateway \
191194
echo "Waiting for gateway to be healthy..."
192195
echo "Waiting for gateway to be available..."
193196

197+
# Mine some blocks
198+
# This is important for the gateway
199+
./local-network/scripts/mine-block.sh 100 2>/dev/null || true
200+
194201
# Ensure gateway is ready before testing
195-
# it might take a while to start(usually 5 minutes, why???)
196202
timeout 300 bash -c 'until curl -f http://localhost:7700/ > /dev/null 2>&1; do echo "Waiting for gateway service..."; sleep 5; done'
197203

204+
# After all services are running, measure the disk space used
205+
END_SPACE=$(df -h --output=used /var/lib/docker | tail -1)
206+
END_IMAGES_SIZE=$(docker system df --format '{{.ImagesSize}}' 2>/dev/null || echo "N/A")
207+
END_CONTAINERS_SIZE=$(docker system df --format '{{.ContainersSize}}' 2>/dev/null || echo "N/A")
208+
END_VOLUMES_SIZE=$(docker system df --format '{{.VolumesSize}}' 2>/dev/null || echo "N/A")
209+
198210
echo "All services are now running!"
199211
echo "You can enjoy your new local network setup for testing."
212+
213+
echo "============ FINAL DISK USAGE ============"
214+
echo "Docker directory usage: $END_SPACE"
215+
echo "Images size: $END_IMAGES_SIZE"
216+
echo "Containers size: $END_CONTAINERS_SIZE"
217+
echo "Volumes size: $END_VOLUMES_SIZE"
218+
echo "==========================================="

0 commit comments

Comments
 (0)