Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
5db4585
1
Parent(s): 54e4ffb
Claude Code: Fix A2A port routing - expose a2a-proxy on external port 7860
Browse files- Move a2a-proxy from internal 7861 to external 7860 (Docker exposed)
- Move uvicorn to internal 7862 (only accessed by proxy)
- Fixes external A2A health checks failing due to unreachable proxy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- entrypoint.sh +14 -14
entrypoint.sh
CHANGED
|
@@ -139,11 +139,11 @@ echo "=========================================="
|
|
| 139 |
echo "Starting A2A proxy..."
|
| 140 |
echo "=========================================="
|
| 141 |
|
| 142 |
-
# Start a2a-proxy on port
|
| 143 |
-
# Routes A2A traffic to FastAPI backend
|
| 144 |
if [ -f "/app/scripts/a2a-proxy.cjs" ]; then
|
| 145 |
-
echo "✓ Starting a2a-proxy.cjs on port
|
| 146 |
-
node /app/scripts/a2a-proxy.cjs > /app/logs/a2a-proxy.log 2>&1 &
|
| 147 |
A2A_PID=$!
|
| 148 |
echo " A2A proxy PID: $A2A_PID"
|
| 149 |
# Record PID for cleanup on shutdown
|
|
@@ -157,9 +157,9 @@ echo "=========================================="
|
|
| 157 |
echo "Starting uvicorn..."
|
| 158 |
echo "=========================================="
|
| 159 |
|
| 160 |
-
# Start uvicorn
|
| 161 |
-
echo "✓ Starting uvicorn on port
|
| 162 |
-
uvicorn app:app --host 0.0.0.0 --port
|
| 163 |
UVICORN_PID=$!
|
| 164 |
echo " Uvicorn PID: $UVICORN_PID"
|
| 165 |
echo $UVICORN_PID > /tmp/uvicorn.pid
|
|
@@ -174,12 +174,12 @@ sleep 3
|
|
| 174 |
# Check if processes exist
|
| 175 |
ps aux | grep -E "(uvicorn|node.*a2a-proxy)" | grep -v grep || echo " WARNING: Some processes may not have started"
|
| 176 |
|
| 177 |
-
# CRITICAL: Verify uvicorn is actually accepting connections on port
|
| 178 |
echo ""
|
| 179 |
-
echo "Verifying uvicorn is accepting connections..."
|
| 180 |
for i in {1..10}; do
|
| 181 |
-
if curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:
|
| 182 |
-
echo " ✓ Uvicorn is accepting connections on port
|
| 183 |
break
|
| 184 |
else
|
| 185 |
if [ $i -eq 10 ]; then
|
|
@@ -197,8 +197,8 @@ echo ""
|
|
| 197 |
echo "=========================================="
|
| 198 |
echo "Cain is running!"
|
| 199 |
echo "=========================================="
|
| 200 |
-
echo "
|
| 201 |
-
echo "
|
| 202 |
echo "Worker: Integrated (FastAPI background thread)"
|
| 203 |
echo ""
|
| 204 |
echo "PIDs:"
|
|
@@ -212,7 +212,7 @@ while true; do
|
|
| 212 |
# Check if uvicorn is still running
|
| 213 |
if ! kill -0 $UVICORN_PID 2>/dev/null; then
|
| 214 |
echo "WARNING: Uvicorn died (PID $UVICORN_PID), restarting..."
|
| 215 |
-
uvicorn app:app --host 0.0.0.0 --port
|
| 216 |
UVICORN_PID=$!
|
| 217 |
echo " Uvicorn restarted with PID: $UVICORN_PID"
|
| 218 |
echo $UVICORN_PID > /tmp/uvicorn.pid
|
|
|
|
| 139 |
echo "Starting A2A proxy..."
|
| 140 |
echo "=========================================="
|
| 141 |
|
| 142 |
+
# Start a2a-proxy on port 7860 in background (EXTERNAL port)
|
| 143 |
+
# Routes A2A traffic to FastAPI backend on internal port
|
| 144 |
if [ -f "/app/scripts/a2a-proxy.cjs" ]; then
|
| 145 |
+
echo "✓ Starting a2a-proxy.cjs on port 7860 (external)..."
|
| 146 |
+
OPENCLAW_PORT=7862 LISTEN_PORT=7860 node /app/scripts/a2a-proxy.cjs > /app/logs/a2a-proxy.log 2>&1 &
|
| 147 |
A2A_PID=$!
|
| 148 |
echo " A2A proxy PID: $A2A_PID"
|
| 149 |
# Record PID for cleanup on shutdown
|
|
|
|
| 157 |
echo "Starting uvicorn..."
|
| 158 |
echo "=========================================="
|
| 159 |
|
| 160 |
+
# Start uvicorn on INTERNAL port 7862 (a2a-proxy faces external on 7860)
|
| 161 |
+
echo "✓ Starting uvicorn on internal port 7862..."
|
| 162 |
+
uvicorn app:app --host 0.0.0.0 --port 7862 > /app/logs/uvicorn.log 2>&1 &
|
| 163 |
UVICORN_PID=$!
|
| 164 |
echo " Uvicorn PID: $UVICORN_PID"
|
| 165 |
echo $UVICORN_PID > /tmp/uvicorn.pid
|
|
|
|
| 174 |
# Check if processes exist
|
| 175 |
ps aux | grep -E "(uvicorn|node.*a2a-proxy)" | grep -v grep || echo " WARNING: Some processes may not have started"
|
| 176 |
|
| 177 |
+
# CRITICAL: Verify uvicorn is actually accepting connections on internal port 7862
|
| 178 |
echo ""
|
| 179 |
+
echo "Verifying uvicorn is accepting connections on internal port 7862..."
|
| 180 |
for i in {1..10}; do
|
| 181 |
+
if curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:7862/health | grep -q "200\|401"; then
|
| 182 |
+
echo " ✓ Uvicorn is accepting connections on port 7862"
|
| 183 |
break
|
| 184 |
else
|
| 185 |
if [ $i -eq 10 ]; then
|
|
|
|
| 197 |
echo "=========================================="
|
| 198 |
echo "Cain is running!"
|
| 199 |
echo "=========================================="
|
| 200 |
+
echo "A2A Proxy (external): http://0.0.0.0:7860"
|
| 201 |
+
echo "FastAPI (internal): http://0.0.0.0:7862"
|
| 202 |
echo "Worker: Integrated (FastAPI background thread)"
|
| 203 |
echo ""
|
| 204 |
echo "PIDs:"
|
|
|
|
| 212 |
# Check if uvicorn is still running
|
| 213 |
if ! kill -0 $UVICORN_PID 2>/dev/null; then
|
| 214 |
echo "WARNING: Uvicorn died (PID $UVICORN_PID), restarting..."
|
| 215 |
+
uvicorn app:app --host 0.0.0.0 --port 7862 > /app/logs/uvicorn.log 2>&1 &
|
| 216 |
UVICORN_PID=$!
|
| 217 |
echo " Uvicorn restarted with PID: $UVICORN_PID"
|
| 218 |
echo $UVICORN_PID > /tmp/uvicorn.pid
|