Updated docker-compose.yml to clarify port mapping, modified Dockerfile.worker to enable access logging, and added logging functionality in main.py for request tracking.
This commit is contained in:
1 parent
3542e4564b
commit
46b59d2c5c
3 files changed
+11
-2
No files matched your search
+2
-1
@@ -24,4 +24,5 @@ WORKDIR /app/src
|
||||
EXPOSE 8000
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
# Access-Log explizit an, damit jeder Request im Docker-Log erscheint
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--access-log"]
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
# CIA Scout-Modul: FastAPI-Service auf Port 8000
|
||||
# CIA Scout-Modul: FastAPI-Service
|
||||
# Host-Port 8010 → Container 8000. Requests: http://localhost:8010/discover
|
||||
services:
|
||||
scout:
|
||||
build:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Scout-Modul CIA: FastAPI-Service zum Erkennen von Publikations-/Insights-URLs pro Domain.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
@@ -12,6 +13,10 @@ from scout_logic import get_publication_url
|
||||
# Umgebungsvariablen aus .env laden (OPENROUTER_API_KEY)
|
||||
load_dotenv()
|
||||
|
||||
# Logging: Requests im Docker-Log sichtbar (stdout)
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
app = FastAPI(
|
||||
title="CIA Scout",
|
||||
description="Erkennt Publikations-/Insights-Seiten von Beratungsdomains.",
|
||||
@@ -44,6 +49,7 @@ async def discover(body: DiscoverRequest) -> DiscoverResponse:
|
||||
Domain übergeben; Service scannt die Startseite mit Playwright,
|
||||
extrahiert Links und lässt OpenRouter die beste Publikations-URL wählen.
|
||||
"""
|
||||
logger.info("POST /discover request: domain=%s", body.domain)
|
||||
if not os.getenv("OPENROUTER_API_KEY"):
|
||||
raise HTTPException(
|
||||
status_code=503,
|
||||
@@ -51,6 +57,7 @@ async def discover(body: DiscoverRequest) -> DiscoverResponse:
|
||||
)
|
||||
|
||||
result = await get_publication_url(body.domain)
|
||||
logger.info("POST /discover done: domain=%s url=%s error=%s", body.domain, result.get("url"), result.get("error"))
|
||||
return DiscoverResponse(url=result["url"], error=result.get("error"))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user