Compare commits

..

No commits in common. "48e049fb04e98716d3c1405f139779b8c9e4db2d" and "aaa02622e70be0a966c1d6bd355841db932274c3" have entirely different histories.

2 changed files with 9 additions and 6 deletions

View File

@ -21,18 +21,19 @@ async def lifespan(app: FastAPI):
# TEMPORARY: Clean up old deleted assets (remove this after first run)
from app.infra.database import AsyncSessionLocal
from sqlalchemy import text
import logging
logger = logging.getLogger(__name__)
async with AsyncSessionLocal() as session:
# Check how many deleted assets exist
result = await session.execute(text("SELECT COUNT(*) FROM assets WHERE status = 'deleted'"))
count_before = result.scalar()
print(f"[MIGRATION] Found {count_before} assets with status='deleted'")
logger.info(f"Found {count_before} assets with status='deleted'")
# Delete them
result = await session.execute(text("DELETE FROM assets WHERE status = 'deleted'"))
await session.commit()
print(f"[MIGRATION] Deleted {result.rowcount} assets with status='deleted'")
print("[MIGRATION] Migration complete - you can now remove this code from main.py")
logger.info(f"Deleted {result.rowcount} assets with status='deleted'")
# END TEMPORARY
yield

View File

@ -5,13 +5,13 @@ networks:
driver: bridge
internal: true # ВАЖНО: сеть без выхода "в интернет" (межконтейнерная)
itcloud-edge:
driver: bridge
driver: bridge # сеть для входящего трафика (только nginx)
services:
nginx:
image: nginx:alpine
ports:
- "${NGINX_PORT:-8095}:80"
- "${NGINX_PORT:-8095}:80" # единственный внешний порт
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
@ -39,7 +39,7 @@ services:
- REDIS_URL=redis://redis:6379/0
volumes:
- ./backend/src:/app/src
- ./backend-data:/app/data
- backend-data:/app/data
depends_on:
minio:
condition: service_healthy
@ -109,6 +109,7 @@ services:
redis:
image: redis:7-alpine
# ports: <-- УБРАЛИ! наружу не светим
expose:
- "6379"
volumes:
@ -122,4 +123,5 @@ services:
- itcloud-net
volumes:
backend-data:
redis-data: