diff --git a/.env.template b/.env.template index cd85ba0..8f19327 100644 --- a/.env.template +++ b/.env.template @@ -2,3 +2,10 @@ MILVUS_HOST= MILVUS_PORT= BACKEND_URL= FLOWISE_PORT= +ETCD_AUTO_COMPACTION_MODE= +ETCD_AUTO_COMPACTION_RETENTION= +ETCD_QUOTA_BACKEND_BYTES= +ETCD_SNAPSHOT_COUNT= +MINIO_ROOT_USER= +MINIO_ROOT_PASSWORD= +ATTU_HOST_URL= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5566902..70f4142 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,4 @@ cython_debug/ #.idea/ /.idea/ +/volumes/ diff --git a/backend/Dockerfile b/backend/Dockerfile index 5487e76..af3e32d 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -5,7 +5,7 @@ FROM python:3.13-slim WORKDIR /app # Expose the port the app will run on -EXPOSE 5000 +EXPOSE 8080 # Copy the current directory contents into the container COPY . . @@ -14,4 +14,4 @@ COPY . . RUN pip install --no-cache-dir -r requirements.txt # Command to run the app using Uvicorn -CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"] +CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "8080"] diff --git a/backend/__init__.py b/backend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/app/__init__.py b/backend/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/models.py b/backend/app/models.py similarity index 62% rename from backend/models.py rename to backend/app/models.py index c6ebddf..9b640b9 100644 --- a/backend/models.py +++ b/backend/app/models.py @@ -3,11 +3,11 @@ from typing import Dict from pydantic import BaseModel -class AnalysisRequest: +class AnalysisRequest(BaseModel): analysis_type: str filters: Dict -class AnalysisResponse: +class AnalysisResponse(BaseModel): result: str @@ -21,28 +21,28 @@ class ConversionResponse(BaseModel): status: str -class ExportRequest: +class ExportRequest(BaseModel): filters: Dict format: str -class ExportResponse: +class ExportResponse(BaseModel): export_url: str status: str -class GenerateRequest: +class GenerateRequest(BaseModel): prompt: str -class GenerateResponse: +class GenerateResponse(BaseModel): content_url: str status: str -class ImportRequest: +class ImportRequest(BaseModel): data: str -class ImportResponse: +class ImportResponse(BaseModel): status: str diff --git a/backend/app/routers/__init__.py b/backend/app/routers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/routers/analysis_router.py b/backend/app/routers/analysis_router.py similarity index 86% rename from backend/routers/analysis_router.py rename to backend/app/routers/analysis_router.py index 425a3c8..a2b9656 100644 --- a/backend/routers/analysis_router.py +++ b/backend/app/routers/analysis_router.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from backend.models import AnalysisResponse, AnalysisRequest +from app.models import AnalysisResponse, AnalysisRequest analysis_router = APIRouter(prefix="/analysis", tags=["Analysis"]) diff --git a/backend/routers/convert_router.py b/backend/app/routers/convert_router.py similarity index 88% rename from backend/routers/convert_router.py rename to backend/app/routers/convert_router.py index 39a4e54..39a6e85 100644 --- a/backend/routers/convert_router.py +++ b/backend/app/routers/convert_router.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from backend.models import ConversionResponse, ConversionRequest +from app.models import ConversionResponse, ConversionRequest convert_router = APIRouter(prefix="/convert", tags=["Convert"]) diff --git a/backend/routers/export_router.py b/backend/app/routers/export_router.py similarity index 85% rename from backend/routers/export_router.py rename to backend/app/routers/export_router.py index eadacad..a7018c9 100644 --- a/backend/routers/export_router.py +++ b/backend/app/routers/export_router.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from backend.models import ExportRequest, ExportResponse +from app.models import ExportRequest, ExportResponse export_router = APIRouter(prefix="/export", tags=["Export"]) diff --git a/backend/routers/generate_router.py b/backend/app/routers/generate_router.py similarity index 86% rename from backend/routers/generate_router.py rename to backend/app/routers/generate_router.py index 8f60886..c5b60bd 100644 --- a/backend/routers/generate_router.py +++ b/backend/app/routers/generate_router.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from backend.models import GenerateResponse, GenerateRequest +from app.models import GenerateResponse, GenerateRequest generate_router = APIRouter(prefix="/generate", tags=["Generate"]) diff --git a/backend/routers/import_router.py b/backend/app/routers/import_router.py similarity index 84% rename from backend/routers/import_router.py rename to backend/app/routers/import_router.py index 9c4a15e..a1fe6f6 100644 --- a/backend/routers/import_router.py +++ b/backend/app/routers/import_router.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from backend.models import ImportRequest, ImportResponse +from app.models import ImportRequest, ImportResponse import_router = APIRouter(prefix="/import", tags=["Import"]) diff --git a/backend/main.py b/backend/main.py index 4e7dd56..7f98564 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,9 +1,9 @@ from fastapi import FastAPI -from routers.convert_router import convert_router -from routers.import_router import import_router -from routers.analysis_router import analysis_router -from routers.export_router import export_router -from routers.generate_router import generate_router +from app.routers.convert_router import convert_router +from app.routers.import_router import import_router +from app.routers.analysis_router import analysis_router +from app.routers.export_router import export_router +from app.routers.generate_router import generate_router app = FastAPI(title="Retro API", description="Retro content management system") diff --git a/docker-compose.yml b/docker-compose.yml index ce48176..1674aa2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,15 @@ -version: '3.8' - services: backend: build: context: ./backend dockerfile: Dockerfile ports: - - "5000:5000" + - "8080:8080" environment: - MILVUS_HOST=${MILVUS_HOST} - MILVUS_PORT=${MILVUS_PORT} depends_on: - - milvus - + - "milvus" frontend: build: context: ./frontend @@ -22,15 +19,74 @@ services: environment: - BACKEND_URL=${BACKEND_URL} depends_on: - - backend - + - "backend" + etcd: + container_name: milvus-etcd + image: quay.io/coreos/etcd:v3.5.21 + environment: + - ETCD_AUTO_COMPACTION_MODE=${ETCD_AUTO_COMPACTION_MODE} + - ETCD_AUTO_COMPACTION_RETENTION=${ETCD_AUTO_COMPACTION_RETENTION} + - ETCD_QUOTA_BACKEND_BYTES=${ETCD_QUOTA_BACKEND_BYTES} + - ETCD_SNAPSHOT_COUNT=${ETCD_SNAPSHOT_COUNT} + volumes: + - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd + command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd + healthcheck: + test: ["CMD", "etcdctl", "endpoint", "health"] + interval: 30s + timeout: 20s + retries: 3 + minio: + container_name: milvus-minio + image: minio/minio:RELEASE.2025-04-22T22-12-26Z + environment: + - MINIO_ROOT_USER=${MINIO_ROOT_USER} + - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} + ports: + - "9001:9001" + - "9000:9000" + volumes: + - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data + command: minio server /minio_data --console-address ":9001" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 milvus: - image: milvusdb/milvus:latest + container_name: milvus-standalone + image: milvusdb/milvus:v2.5.11 + command: ["milvus", "run", "standalone"] + security_opt: + - seccomp:unconfined + environment: + ETCD_ENDPOINTS: etcd:2379 + MINIO_ADDRESS: minio:9000 + volumes: + - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"] + interval: 30s + start_period: 90s + timeout: 20s + retries: 3 ports: - "19530:19530" - volumes: - - milvus_data:/var/lib/milvus - + - "9091:9091" + depends_on: + - "etcd" + - "minio" + attu: + image: zilliz/attu:v2.5.6 + ports: + - "3001:3001" + environment: + - HOST_URL=${ATTU_HOST_URL} + - SERVER_PORT=3001 + - MILVUS_URL=milvus:19530 + - ATTU_LOG_LEVEL=debug + depends_on: + - "milvus" flowise: image: flowiseai/flowise:latest ports: @@ -38,7 +94,4 @@ services: environment: - PORT=3000 depends_on: - - backend - -volumes: - milvus_data: + - "milvus"