-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart-node-ci
More file actions
executable file
·67 lines (54 loc) · 1.94 KB
/
start-node-ci
File metadata and controls
executable file
·67 lines (54 loc) · 1.94 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
#!/usr/bin/env bash
set -e
source .env
# Optional second arg selects the gatekeeper implementation. Accepts the same
# values as ARCHON_GATEKEEPER_FLAVOR (ts | rust). If unset, falls back to the
# value already in the environment (e.g. from .env) or "ts".
case "${2:-${ARCHON_GATEKEEPER_FLAVOR:-ts}}" in
rust) export ARCHON_GATEKEEPER_FLAVOR="rust" ;;
ts|typescript) export ARCHON_GATEKEEPER_FLAVOR="ts" ;;
*)
echo "Unknown gatekeeper flavor: ${2:-$ARCHON_GATEKEEPER_FLAVOR} (expected: ts | rust)"
exit 1
;;
esac
# Optional third arg selects the keymaster implementation. Accepts the same
# values as ARCHON_KEYMASTER_FLAVOR (ts | py). If unset, falls back to the
# value already in the environment (e.g. from .env) or "ts".
case "${3:-${ARCHON_KEYMASTER_FLAVOR:-ts}}" in
py|python) export ARCHON_KEYMASTER_FLAVOR="py" ;;
ts|typescript) export ARCHON_KEYMASTER_FLAVOR="ts" ;;
*)
echo "Unknown keymaster flavor: ${3:-$ARCHON_KEYMASTER_FLAVOR} (expected: ts | py)"
exit 1
;;
esac
echo "Using gatekeeper flavor: $ARCHON_GATEKEEPER_FLAVOR"
echo "Using keymaster flavor: $ARCHON_KEYMASTER_FLAVOR"
export GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
echo $ARCHON_GATEKEEPER_URL
docker compose down
docker compose build cli gatekeeper keymaster ipfs redis mongodb
docker compose up -d cli
echo "Waiting for all services to be 'Up'..."
MAX_RETRIES=30
RETRY_INTERVAL=5
RETRY_COUNT=0
while true; do
# Count total services defined
TOTAL_SERVICES="6"
# Count lines with 'Up' in status
UP_COUNT=$(docker compose ps | grep 'Up' | wc -l)
if [[ "$UP_COUNT" -eq "$TOTAL_SERVICES" ]]; then
echo "✅ All containers are 'Up'"
break
fi
if [[ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]]; then
echo "❌ Timed out waiting for containers to be 'Up'"
docker compose ps
exit 1
fi
echo "⏳ Waiting... ($RETRY_COUNT/$MAX_RETRIES)"
sleep "$RETRY_INTERVAL"
((RETRY_COUNT++))
done