-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·74 lines (58 loc) · 2 KB
/
setup.sh
File metadata and controls
executable file
·74 lines (58 loc) · 2 KB
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
#!/bin/bash
# Script to verify TRH backend container setup
# Dependencies are now pre-installed in the Docker image.
# This script only verifies that the container is running and tools are available.
set -e
# Retry configuration
MAX_RETRIES=30
RETRY_DELAY=10
echo "🔍 Finding running trh-backend container..."
# Sleep for 10 seconds to ensure the container is running
sleep 10
# Function to find the running trh-backend container
find_container() {
docker compose --env-file config/.env.docker ps -q backend --status running
}
# Retry mechanism to find the container
CONTAINER_ID=""
for attempt in $(seq 1 $MAX_RETRIES); do
echo "Attempt $attempt/$MAX_RETRIES to find container..."
CONTAINER_ID=$(find_container)
if [ -n "$CONTAINER_ID" ]; then
echo "✅ Found container: $CONTAINER_ID"
break
fi
if [ $attempt -lt $MAX_RETRIES ]; then
echo "❌ No running trh-backend container found. Retrying in ${RETRY_DELAY} seconds..."
sleep $RETRY_DELAY
else
echo "❌ No running trh-backend container found after $MAX_RETRIES attempts!"
echo "Please make sure the container is running with:"
echo " docker compose up -d"
exit 1
fi
done
echo "🔍 Verifying pre-installed tools in container..."
# Verify tools are available in the container
docker exec -i "$CONTAINER_ID" bash -c "
echo '📦 Verifying installed tools...'
TOOLS_OK=true
for cmd in node npm npx pnpm forge cast anvil go; do
if command -v \$cmd &> /dev/null; then
echo \"✅ \$cmd is available\"
else
echo \"❌ \$cmd is NOT available\"
TOOLS_OK=false
fi
done
if [ \"\$TOOLS_OK\" = true ]; then
echo ''
echo '✅ All tools are pre-installed and available!'
else
echo ''
echo '⚠️ Some tools are missing. The Docker image may need to be rebuilt.'
echo ' Run: docker buildx build --platform linux/amd64,linux/arm64 -t tokamaknetwork/trh-backend:latest --push .'
exit 1
fi
"
echo "🎉 Container verification completed!"