From 45417068aed11636789379c75ac862937268c3d7 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Jun 2026 13:16:47 +0000 Subject: [PATCH] fix: change sidecar port from 8081 to 8080 The sidecar is deployed on port 8080 instead of 8081. Update all: - Default SIDECAR_PORT in sidecar/app.py - Default SIDECAR_URL in main.py (router) - deploy/llm-sidecar.service Environment - deploy/README.md (.env example + config table) - All 7 test files (conftest, circuit-breaker, fallback, queue, model-detection, sse-progress, v1-models) --- deploy/README.md | 4 ++-- deploy/llm-sidecar.service | 2 +- main.py | 2 +- sidecar/app.py | 2 +- tests/conftest.py | 2 +- tests/test_router_circuit_breaker.py | 4 ++-- tests/test_router_fallback_lxc.py | 6 +++--- tests/test_router_model_detection.py | 2 +- tests/test_router_queue.py | 2 +- tests/test_router_sse_progress.py | 2 +- tests/test_router_v1_models.py | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/deploy/README.md b/deploy/README.md index 83cea2a..5c267b2 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -26,7 +26,7 @@ python3 -m venv /home/bigt/AI/llm/venv cat > /home/bigt/AI/llm/.env << 'EOF' # Sidecar configuration MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml -SIDECAR_PORT=8081 +SIDECAR_PORT=8080 EOF # 5. Enable and start the service @@ -57,7 +57,7 @@ curl http://10.0.4.100:9001/v1/models | Variable | Default | Description | |----------|---------|-------------| | `MANIFEST_PATH` | `/home/bigt/AI/llm/manifest.yaml` | Path to the YAML manifest file | -| `SIDECAR_PORT` | `8081` | Port the sidecar listens on | +| `SIDECAR_PORT` | `8080` | Port the sidecar listens on | ### Manifest Format diff --git a/deploy/llm-sidecar.service b/deploy/llm-sidecar.service index 4536042..43c56b9 100644 --- a/deploy/llm-sidecar.service +++ b/deploy/llm-sidecar.service @@ -10,7 +10,7 @@ WorkingDirectory=/home/bigt/AI/llm # Environment EnvironmentFile=-/home/bigt/AI/llm/.env Environment=MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml -Environment=SIDECAR_PORT=8081 +Environment=SIDECAR_PORT=8080 Environment=PATH=/home/bigt/AI/llm/venv/bin:/usr/local/bin:/usr/bin:/bin # Use the sidecar's venv — install deps via deploy/README.md diff --git a/main.py b/main.py index f142d89..705f128 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ from dotenv import load_dotenv load_dotenv() # ─── Configuration ─────────────────────────────────────────────────────────── -SIDECAR_URL = os.getenv("SIDECAR_URL", "http://10.0.4.11:8081") +SIDECAR_URL = os.getenv("SIDECAR_URL", "http://10.0.4.11:8080") MAIN_PC_BASE = os.getenv("MAIN_PC_URL", "http://10.0.4.11:8080/v1").removesuffix("/v1") FALLBACK_SLM_URL = os.getenv("FALLBACK_SLM_URL", "http://10.0.4.200:8080/v1").removesuffix("/v1") OPENROUTER_API_KEY=os.getenv("OPENROUTER_API_KEY", "") diff --git a/sidecar/app.py b/sidecar/app.py index c776f44..2af0a89 100644 --- a/sidecar/app.py +++ b/sidecar/app.py @@ -17,7 +17,7 @@ from sidecar.manifest import load_manifest # Configuration from environment MANIFEST_PATH = os.getenv("MANIFEST_PATH", "/home/bigt/AI/llm/manifest.yaml") -SIDECAR_PORT = int(os.getenv("SIDECAR_PORT", "8081")) +SIDECAR_PORT = int(os.getenv("SIDECAR_PORT", "8080")) LLAMA_SERVER_PORT = 8080 # Global state diff --git a/tests/conftest.py b/tests/conftest.py index 1fd6036..c5a5071 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,7 @@ from unittest.mock import patch @pytest.fixture(autouse=True) def patch_router_urls(): """Patch router URLs for all tests in this package.""" - with patch("main.SIDECAR_URL", "http://localhost:8081"), \ + with patch("main.SIDECAR_URL", "http://localhost:8080"), \ patch("main.MAIN_PC_BASE", "http://localhost:8080"), \ patch("main.FALLBACK_SLM_URL", "http://localhost:9999"), \ patch("main.OPENROUTER_API_KEY", "test-key"), \ diff --git a/tests/test_router_circuit_breaker.py b/tests/test_router_circuit_breaker.py index cc09986..d312daa 100644 --- a/tests/test_router_circuit_breaker.py +++ b/tests/test_router_circuit_breaker.py @@ -58,7 +58,7 @@ class TestOpenRouterFallback: async def run_test(): with respx.mock: # Sidecar is down - respx.get("http://localhost:8081/models/status").mock( + respx.get("http://localhost:8080/models/status").mock( side_effect=Exception("connection refused") ) # OpenRouter works @@ -84,7 +84,7 @@ class TestDeprecatedHeaderRemoved: """Router does not route based on x-intelligence-level: High.""" async def run_test(): with respx.mock: - respx.get("http://localhost:8081/models/status").mock( + respx.get("http://localhost:8080/models/status").mock( return_value=Response(200, json={"active_profile": "qwen-3-8b", "llama_server_running": True}) ) # Should route to Main PC regardless of header diff --git a/tests/test_router_fallback_lxc.py b/tests/test_router_fallback_lxc.py index ca2bd47..84302df 100644 --- a/tests/test_router_fallback_lxc.py +++ b/tests/test_router_fallback_lxc.py @@ -19,7 +19,7 @@ class TestFallbackChain: async def run_test(): with respx.mock: # Sidecar is down — triggers fallback chain - respx.get("http://localhost:8081/models/status").mock( + respx.get("http://localhost:8080/models/status").mock( return_value=Response(503, json={"status": "error", "message": "not ready"}) ) # OpenRouter fails with network error @@ -50,7 +50,7 @@ class TestFallbackChain: async def run_test(): with respx.mock: # Sidecar down - respx.get("http://localhost:8081/models/status").mock( + respx.get("http://localhost:8080/models/status").mock( side_effect=Exception("connection refused") ) # OpenRouter down @@ -76,7 +76,7 @@ class TestFallbackChain: async def run_test(): with respx.mock: # Sidecar down, OpenRouter down - respx.get("http://localhost:8081/models/status").mock( + respx.get("http://localhost:8080/models/status").mock( side_effect=Exception("connection refused") ) respx.post("https://openrouter.ai/v1/chat/completions").mock( diff --git a/tests/test_router_model_detection.py b/tests/test_router_model_detection.py index b739e74..57b3542 100644 --- a/tests/test_router_model_detection.py +++ b/tests/test_router_model_detection.py @@ -9,7 +9,7 @@ from httpx import Response, ASGITransport, AsyncClient from main import app as router_app -SIDECAR_URL = "http://localhost:8081" +SIDECAR_URL = "http://localhost:8080" MAIN_PC_URL = "http://localhost:8080" diff --git a/tests/test_router_queue.py b/tests/test_router_queue.py index b9b1c63..69b6965 100644 --- a/tests/test_router_queue.py +++ b/tests/test_router_queue.py @@ -6,7 +6,7 @@ from httpx import Response, ASGITransport, AsyncClient from main import app as router_app -SIDECAR_URL = "http://localhost:8081" +SIDECAR_URL = "http://localhost:8080" MAIN_PC_URL = "http://localhost:8080" FALLBACK_URL = "http://localhost:9999" diff --git a/tests/test_router_sse_progress.py b/tests/test_router_sse_progress.py index 6e9d616..af63b8b 100644 --- a/tests/test_router_sse_progress.py +++ b/tests/test_router_sse_progress.py @@ -10,7 +10,7 @@ from httpx import Response, ASGITransport, AsyncClient from main import app as router_app -SIDECAR_URL = "http://localhost:8081" +SIDECAR_URL = "http://localhost:8080" MAIN_PC_URL = "http://localhost:8080" FALLBACK_URL = "http://localhost:9999" diff --git a/tests/test_router_v1_models.py b/tests/test_router_v1_models.py index 803be23..1bf0416 100644 --- a/tests/test_router_v1_models.py +++ b/tests/test_router_v1_models.py @@ -7,7 +7,7 @@ from httpx import Response, ASGITransport, AsyncClient from main import app as router_app -SIDECAR_URL = "http://localhost:8081" +SIDECAR_URL = "http://localhost:8080" def test_v1_models_returns_profiles_from_sidecar():