-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
51 lines (45 loc) · 1.25 KB
/
entrypoint.sh
File metadata and controls
51 lines (45 loc) · 1.25 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
#!/usr/bin/env bash
set -euo pipefail
# Full provider/model string; default to OpenRouter free model
MODEL="${OPENCLAW_MODEL:-openrouter/arcee-ai/trinity-large-preview:free}"
GATEWAY_PORT="${OPENCLAW_GATEWAY_PORT:-18789}"
GATEWAY_TOKEN="${OPENCLAW_GATEWAY_TOKEN:?Set OPENCLAW_GATEWAY_TOKEN in .env or environment}"
# Generate OpenClaw config at runtime with the chosen model
cat > /root/.openclaw/openclaw.json <<EOF
{
"gateway": {
"mode": "local",
"auth": {
"mode": "token",
"token": "${GATEWAY_TOKEN}"
},
"http": {
"endpoints": {
"responses": {
"enabled": true
}
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "${MODEL}"
}
}
}
}
EOF
echo "OpenClaw configured with model: ${MODEL}"
# Start OpenClaw gateway in the background
openclaw gateway --port "${GATEWAY_PORT}" &
# Wait for the gateway to become healthy
echo "Waiting for OpenClaw gateway..."
if ! curl --retry 60 --retry-delay 1 --retry-connrefused -sf \
"http://127.0.0.1:${GATEWAY_PORT}/healthz" > /dev/null; then
echo "ERROR: OpenClaw gateway did not start within 60s."
exit 1
fi
echo "OpenClaw gateway is ready."
# Start the Python agent directly from the venv
exec /app/.venv/bin/agent