swicthed back to network mod and added helatcheck for diagnostic to restart
This commit is contained in:
@@ -556,6 +556,8 @@ class ARIABridge:
|
|||||||
async def connect_to_core(self) -> None:
|
async def connect_to_core(self) -> None:
|
||||||
"""Persistente WebSocket-Verbindung zu aria-core (OpenClaw Gateway)."""
|
"""Persistente WebSocket-Verbindung zu aria-core (OpenClaw Gateway)."""
|
||||||
retry_delay = 2
|
retry_delay = 2
|
||||||
|
max_conn_failures = 6
|
||||||
|
conn_fail_count = 0
|
||||||
|
|
||||||
while self.running:
|
while self.running:
|
||||||
try:
|
try:
|
||||||
@@ -570,6 +572,7 @@ class ARIABridge:
|
|||||||
|
|
||||||
self.ws_core = ws
|
self.ws_core = ws
|
||||||
retry_delay = 2
|
retry_delay = 2
|
||||||
|
conn_fail_count = 0
|
||||||
logger.info("[core] Verbunden und authentifiziert")
|
logger.info("[core] Verbunden und authentifiziert")
|
||||||
|
|
||||||
async for message in ws:
|
async for message in ws:
|
||||||
@@ -577,13 +580,25 @@ class ARIABridge:
|
|||||||
|
|
||||||
except websockets.ConnectionClosed:
|
except websockets.ConnectionClosed:
|
||||||
logger.warning("[core] Verbindung verloren")
|
logger.warning("[core] Verbindung verloren")
|
||||||
|
conn_fail_count += 1
|
||||||
except ConnectionRefusedError:
|
except ConnectionRefusedError:
|
||||||
logger.warning("[core] Nicht erreichbar (%s)", self.ws_url)
|
logger.warning("[core] Nicht erreichbar (%s)", self.ws_url)
|
||||||
|
conn_fail_count += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("[core] WebSocket-Fehler")
|
logger.exception("[core] WebSocket-Fehler")
|
||||||
|
conn_fail_count += 1
|
||||||
finally:
|
finally:
|
||||||
self.ws_core = None
|
self.ws_core = None
|
||||||
|
|
||||||
|
# Nach N aufeinanderfolgenden Fehlern: Exit damit Docker neustartet
|
||||||
|
# (bekommt neuen Network-Namespace wenn aria-core restarted wurde)
|
||||||
|
if conn_fail_count >= max_conn_failures:
|
||||||
|
logger.error(
|
||||||
|
"[core] %dx nicht erreichbar — Exit fuer Docker-Restart",
|
||||||
|
conn_fail_count,
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if self.running:
|
if self.running:
|
||||||
logger.info("[core] Reconnect in %ds...", retry_delay)
|
logger.info("[core] Reconnect in %ds...", retry_delay)
|
||||||
await asyncio.sleep(retry_delay)
|
await asyncio.sleep(retry_delay)
|
||||||
|
|||||||
@@ -82,6 +82,27 @@ function pipelineEnd(ok, detail) {
|
|||||||
pipelineActive = false;
|
pipelineActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Auto-Restart bei Netzwerk-Namespace-Verlust ──────
|
||||||
|
// Bei network_mode: "service:aria" verliert dieser Container
|
||||||
|
// den Netzwerkzugriff wenn aria-core neustartet.
|
||||||
|
// Nach MAX_GATEWAY_FAILURES aufeinanderfolgenden Fehlern → process.exit
|
||||||
|
// Docker restart: unless-stopped startet uns mit neuem Namespace neu.
|
||||||
|
const MAX_GATEWAY_FAILURES = 6; // 6 × 5s = 30s
|
||||||
|
let gatewayFailCount = 0;
|
||||||
|
|
||||||
|
function checkGatewayHealth() {
|
||||||
|
if (state.gateway.status === "connected") {
|
||||||
|
gatewayFailCount = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gatewayFailCount++;
|
||||||
|
if (gatewayFailCount >= MAX_GATEWAY_FAILURES) {
|
||||||
|
log("error", "server", `Gateway ${MAX_GATEWAY_FAILURES}x nicht erreichbar — Neustart (Netzwerk-Namespace veraltet?)`);
|
||||||
|
// Kurze Verzoegerung damit die Log-Nachricht noch gesendet wird
|
||||||
|
setTimeout(() => process.exit(1), 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function nextReqId() {
|
function nextReqId() {
|
||||||
return `diag-${++reqIdCounter}`;
|
return `diag-${++reqIdCounter}`;
|
||||||
}
|
}
|
||||||
@@ -191,6 +212,7 @@ async function connectGateway() {
|
|||||||
state.gateway.status = "connected";
|
state.gateway.status = "connected";
|
||||||
state.gateway.handshakeOk = true;
|
state.gateway.handshakeOk = true;
|
||||||
state.gateway.lastError = null;
|
state.gateway.lastError = null;
|
||||||
|
gatewayFailCount = 0;
|
||||||
} else {
|
} else {
|
||||||
const error = typeof response.error === "string"
|
const error = typeof response.error === "string"
|
||||||
? response.error
|
? response.error
|
||||||
@@ -219,6 +241,7 @@ async function connectGateway() {
|
|||||||
state.gateway.handshakeOk = false;
|
state.gateway.handshakeOk = false;
|
||||||
gatewayWs = null;
|
gatewayWs = null;
|
||||||
broadcastState();
|
broadcastState();
|
||||||
|
checkGatewayHealth();
|
||||||
// Auto-Reconnect nach 5s
|
// Auto-Reconnect nach 5s
|
||||||
setTimeout(connectGateway, 5000);
|
setTimeout(connectGateway, 5000);
|
||||||
});
|
});
|
||||||
@@ -236,6 +259,7 @@ async function connectGateway() {
|
|||||||
state.gateway.handshakeOk = false;
|
state.gateway.handshakeOk = false;
|
||||||
gatewayWs = null;
|
gatewayWs = null;
|
||||||
broadcastState();
|
broadcastState();
|
||||||
|
checkGatewayHealth();
|
||||||
// Retry nach 5s
|
// Retry nach 5s
|
||||||
setTimeout(connectGateway, 5000);
|
setTimeout(connectGateway, 5000);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-9
@@ -25,10 +25,11 @@ services:
|
|||||||
privileged: true # ARIAs Wohnung — sie hat die Schlüssel
|
privileged: true # ARIAs Wohnung — sie hat die Schlüssel
|
||||||
depends_on:
|
depends_on:
|
||||||
- proxy
|
- proxy
|
||||||
|
ports:
|
||||||
|
- "3001:3001" # Diagnostic Web-UI (laeuft im shared network)
|
||||||
environment:
|
environment:
|
||||||
- CANVAS_HOST=127.0.0.1
|
- CANVAS_HOST=127.0.0.1
|
||||||
- OPENCLAW_GATEWAY_TOKEN=${ARIA_AUTH_TOKEN}
|
- OPENCLAW_GATEWAY_TOKEN=${ARIA_AUTH_TOKEN}
|
||||||
- OPENCLAW_GATEWAY_BIND=0.0.0.0
|
|
||||||
- DEFAULT_MODEL=proxy/claude-sonnet-4
|
- DEFAULT_MODEL=proxy/claude-sonnet-4
|
||||||
- RATE_LIMIT_PER_USER=30
|
- RATE_LIMIT_PER_USER=30
|
||||||
- DISPLAY=:0
|
- DISPLAY=:0
|
||||||
@@ -51,6 +52,7 @@ services:
|
|||||||
container_name: aria-bridge
|
container_name: aria-bridge
|
||||||
depends_on:
|
depends_on:
|
||||||
- aria
|
- aria
|
||||||
|
network_mode: "service:aria" # Teilt Netzwerk mit aria-core → localhost:18789
|
||||||
volumes:
|
volumes:
|
||||||
- ./aria-data/voices:/voices:ro # TTS Stimmen
|
- ./aria-data/voices:/voices:ro # TTS Stimmen
|
||||||
- ./aria-data/config/aria.env:/config/aria.env
|
- ./aria-data/config/aria.env:/config/aria.env
|
||||||
@@ -61,7 +63,6 @@ services:
|
|||||||
- /dev/snd
|
- /dev/snd
|
||||||
environment:
|
environment:
|
||||||
- PULSE_SERVER=unix:/run/user/1000/pulse/native
|
- PULSE_SERVER=unix:/run/user/1000/pulse/native
|
||||||
- ARIA_CORE_WS=ws://aria:18789 # Gateway über aria-net (nicht localhost)
|
|
||||||
- ARIA_AUTH_TOKEN=${ARIA_AUTH_TOKEN:-}
|
- ARIA_AUTH_TOKEN=${ARIA_AUTH_TOKEN:-}
|
||||||
- RVS_HOST=${RVS_HOST:-}
|
- RVS_HOST=${RVS_HOST:-}
|
||||||
- RVS_PORT=${RVS_PORT:-443}
|
- RVS_PORT=${RVS_PORT:-443}
|
||||||
@@ -69,8 +70,6 @@ services:
|
|||||||
- RVS_TLS_FALLBACK=${RVS_TLS_FALLBACK:-true}
|
- RVS_TLS_FALLBACK=${RVS_TLS_FALLBACK:-true}
|
||||||
- RVS_TOKEN=${RVS_TOKEN:-}
|
- RVS_TOKEN=${RVS_TOKEN:-}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
|
||||||
- aria-net
|
|
||||||
|
|
||||||
# ─── Diagnostic (Selbstcheck-UI) ──────────────────────
|
# ─── Diagnostic (Selbstcheck-UI) ──────────────────────
|
||||||
diagnostic:
|
diagnostic:
|
||||||
@@ -78,12 +77,10 @@ services:
|
|||||||
container_name: aria-diagnostic
|
container_name: aria-diagnostic
|
||||||
depends_on:
|
depends_on:
|
||||||
- aria
|
- aria
|
||||||
ports:
|
network_mode: "service:aria" # Teilt Netzwerk mit aria-core → localhost:18789
|
||||||
- "3001:3001" # Diagnostic Web-UI
|
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
environment:
|
environment:
|
||||||
- ARIA_CORE_WS=ws://aria:18789 # Gateway über aria-net (nicht localhost)
|
|
||||||
- ARIA_AUTH_TOKEN=${ARIA_AUTH_TOKEN:-}
|
- ARIA_AUTH_TOKEN=${ARIA_AUTH_TOKEN:-}
|
||||||
- PROXY_URL=http://proxy:3456
|
- PROXY_URL=http://proxy:3456
|
||||||
- RVS_HOST=${RVS_HOST:-}
|
- RVS_HOST=${RVS_HOST:-}
|
||||||
@@ -92,8 +89,6 @@ services:
|
|||||||
- RVS_TLS_FALLBACK=${RVS_TLS_FALLBACK:-true}
|
- RVS_TLS_FALLBACK=${RVS_TLS_FALLBACK:-true}
|
||||||
- RVS_TOKEN=${RVS_TOKEN:-}
|
- RVS_TOKEN=${RVS_TOKEN:-}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
|
||||||
- aria-net
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
openclaw-config: # Persistiert ~/.openclaw (Model, Auth, Sessions)
|
openclaw-config: # Persistiert ~/.openclaw (Model, Auth, Sessions)
|
||||||
|
|||||||
Reference in New Issue
Block a user