From 23f8a3d2ae852e7859e9bcc2e0e3c7f25a376e49 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 5 Dec 2025 14:42:18 +0100 Subject: [PATCH] Fix watchfiles spam and port conflicts - Disabled auto-reload by default (ENABLE_RELOAD=false) - Changed default ports: PostgreSQL 5433, API 8001 - Updated psycopg2-binary to 2.9.10 (Python 3.13 compat) - Updated Pydantic to 2.10.3 (Python 3.13 compat) - Added reload_excludes to prevent .git watching - Updated .env.example with new defaults --- .env.example | 6 +++--- Dockerfile | 2 ++ docker-compose.yml | 6 +++--- main.py | 1 + requirements.txt | 14 +++++++------- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index efc1246..bc83e8d 100644 --- a/.env.example +++ b/.env.example @@ -7,14 +7,14 @@ DATABASE_URL=postgresql://bmc_hub:bmc_hub@postgres:5432/bmc_hub POSTGRES_USER=bmc_hub POSTGRES_PASSWORD=bmc_hub POSTGRES_DB=bmc_hub -POSTGRES_PORT=5432 +POSTGRES_PORT=5433 # Changed from 5432 to avoid conflicts with other services # ===================================================== # API CONFIGURATION # ===================================================== API_HOST=0.0.0.0 -API_PORT=8000 -API_RELOAD=true +API_PORT=8001 # Changed from 8000 to avoid conflicts with other services +ENABLE_RELOAD=false # Set to true for live code reload (causes log spam in Docker) # ===================================================== # SECURITY diff --git a/Dockerfile b/Dockerfile index b8067fc..c505fdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ WORKDIR /app RUN apt-get update && apt-get install -y \ curl \ git \ + libpq-dev \ + gcc \ && rm -rf /var/lib/apt/lists/* # Build arguments for GitHub release deployment diff --git a/docker-compose.yml b/docker-compose.yml index 5326f0e..b7a1b4e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - postgres_data:/var/lib/postgresql/data - ./migrations/init.sql:/docker-entrypoint-initdb.d/init.sql:ro ports: - - "${POSTGRES_PORT:-5432}:5432" + - "${POSTGRES_PORT:-5433}:5432" restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-bmc_hub}"] @@ -33,7 +33,7 @@ services: postgres: condition: service_healthy ports: - - "${API_PORT:-8000}:8000" + - "${API_PORT:-8001}:8000" volumes: - ./logs:/app/logs - ./uploads:/app/uploads @@ -47,7 +47,7 @@ services: environment: # Override database URL to point to postgres service - DATABASE_URL=postgresql://${POSTGRES_USER:-bmc_hub}:${POSTGRES_PASSWORD:-bmc_hub}@postgres:5432/${POSTGRES_DB:-bmc_hub} - - ENABLE_RELOAD=true + - ENABLE_RELOAD=false restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] diff --git a/main.py b/main.py index bc97ca8..ac6e776 100644 --- a/main.py +++ b/main.py @@ -111,6 +111,7 @@ if __name__ == "__main__": reload=True, reload_includes=["*.py"], reload_dirs=["app"], + reload_excludes=[".git/*", "*.pyc", "__pycache__/*", "logs/*", "uploads/*", "data/*"], log_level="info" ) else: diff --git a/requirements.txt b/requirements.txt index abfd76e..1113e62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -fastapi==0.109.0 -uvicorn[standard]==0.27.0 -psycopg2-binary==2.9.9 -pydantic==2.5.3 -pydantic-settings==2.1.0 -python-dotenv==1.0.0 -python-multipart==0.0.6 +fastapi==0.115.0 +uvicorn[standard]==0.32.1 +psycopg2-binary==2.9.10 +pydantic==2.10.3 +pydantic-settings==2.6.1 +python-dotenv==1.0.1 +python-multipart==0.0.17