🌟 Initial project setup with backend (FastAPI), frontend (Streamlit), Milvus, and Flowise in Docker 🧱📦
* Added backend infrastructure (FastAPI, Dockerfile, requirements) * Set up frontend (Streamlit, Dockerfile, requirements) * Configured docker-compose with Milvus and Flowise services * Created project structure with .env.template and .dockerignore * Added initial gitignore and project metadata
This commit is contained in:
parent
bf9d953912
commit
0fffbcfba4
14 changed files with 217 additions and 1 deletions
4
.env.template
Normal file
4
.env.template
Normal file
|
@ -0,0 +1,4 @@
|
|||
MILVUS_HOST=
|
||||
MILVUS_PORT=
|
||||
BACKEND_URL=
|
||||
FLOWISE_PORT=
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -162,3 +162,4 @@ cython_debug/
|
|||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
/.idea/
|
||||
|
|
16
000-create-directories.sh
Normal file
16
000-create-directories.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create core directories
|
||||
mkdir -p backend frontend
|
||||
|
||||
# Create Dockerfiles for each service
|
||||
touch backend/Dockerfile frontend/Dockerfile
|
||||
|
||||
# Create placeholder for environment files
|
||||
touch .env
|
||||
|
||||
# Create directory for Milvus data persistence
|
||||
mkdir -p ./volumes/milvus
|
||||
|
||||
# Create directory for Flowise data persistence
|
||||
mkdir -p ./volumes/flowise
|
13
README.md
13
README.md
|
@ -1,3 +1,14 @@
|
|||
# systeme-retro-contenu
|
||||
|
||||
Système de création de contenu rétrospectif
|
||||
Système de création de contenu rétrospectif
|
||||
|
||||
## Frontend
|
||||
|
||||
## Backend
|
||||
|
||||
| Route | Method | Description |
|
||||
|--------------------|--------|----------------------|
|
||||
| /import/data | POST | Import raw data |
|
||||
| /analyse/{data_id} | GET | Analyse stored data |
|
||||
| /export/{data_id} | GET | Export analysed data |
|
||||
| /generate/content | POST | Generate new content |
|
12
backend/.dockerignore
Normal file
12
backend/.dockerignore
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Python build and runtime artifacts
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
venv/
|
||||
requirements/
|
||||
|
||||
# Version control
|
||||
.git
|
||||
|
||||
# OS-specific files
|
||||
.DS_Store
|
17
backend/Dockerfile
Normal file
17
backend/Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Use the official Python 3.13 image as the base
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Expose the port the app will run on
|
||||
EXPOSE 5000
|
||||
|
||||
# Copy the current directory contents into the container
|
||||
COPY . .
|
||||
|
||||
# Install dependencies (ensure you have a requirements.txt file)
|
||||
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"]
|
67
backend/main.py
Normal file
67
backend/main.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
from fastapi import FastAPI, APIRouter, HTTPException
|
||||
import uuid
|
||||
|
||||
app = FastAPI(title="Retro API", description="Retro content management system")
|
||||
|
||||
# Routers
|
||||
import_router = APIRouter(prefix="/import", tags=["Import"])
|
||||
analyse_router = APIRouter(prefix="/analyse", tags=["Analyse"])
|
||||
export_router = APIRouter(prefix="/export", tags=["Export"])
|
||||
generate_router = APIRouter(prefix="/generate", tags=["Generate"])
|
||||
|
||||
# Sample data storage (replace with Milvus/DB integration)
|
||||
data_store = {}
|
||||
|
||||
# Import Router
|
||||
@import_router.post("/data")
|
||||
def import_data(data: dict):
|
||||
"""
|
||||
Import data (e.g., text, files, or structured data).
|
||||
"""
|
||||
data_id = str(uuid.uuid4())
|
||||
data_store[data_id] = data
|
||||
return {"message": "Data imported successfully", "data_id": data_id}
|
||||
|
||||
# Analyse Router
|
||||
@analyse_router.get("/{data_id}")
|
||||
def analyse_data(data_id: str):
|
||||
"""
|
||||
Analyse imported data (e.g., sentiment, keywords, or patterns).
|
||||
"""
|
||||
if data_id not in data_store:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
# Placeholder for analysis logic
|
||||
return {
|
||||
"data_id": data_id,
|
||||
"analysis": {"word_count": len(data_store[data_id].get("text", ""))},
|
||||
}
|
||||
|
||||
# Export Router
|
||||
@export_router.get("/{data_id}")
|
||||
def export_data(data_id: str):
|
||||
"""
|
||||
Export analysed data (e.g., as JSON, CSV, or PDF).
|
||||
"""
|
||||
if data_id not in data_store:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return {
|
||||
"data_id": data_id,
|
||||
"content": data_store[data_id],
|
||||
"status": "exported",
|
||||
}
|
||||
|
||||
# Generate Router
|
||||
@generate_router.post("/content")
|
||||
def generate_content(prompt: str):
|
||||
"""
|
||||
Generate new content (e.g., text, images, or summaries).
|
||||
"""
|
||||
# Placeholder for generation logic (e.g., LLM, AI model)
|
||||
generated = {"response": f"Generated content based on: {prompt}"}
|
||||
return {"message": "Content generated", "data": generated}
|
||||
|
||||
# Include routers in the main app
|
||||
app.include_router(import_router)
|
||||
app.include_router(analyse_router)
|
||||
app.include_router(export_router)
|
||||
app.include_router(generate_router)
|
3
backend/requirements.txt
Normal file
3
backend/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
fastapi
|
||||
uvicorn
|
||||
pydantic
|
1
backend/run.sh
Normal file
1
backend/run.sh
Normal file
|
@ -0,0 +1 @@
|
|||
uvicorn main:app --reload --host 0.0.0.0 --port 8000
|
44
docker-compose.yml
Normal file
44
docker-compose.yml
Normal file
|
@ -0,0 +1,44 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- MILVUS_HOST=${MILVUS_HOST}
|
||||
- MILVUS_PORT=${MILVUS_PORT}
|
||||
depends_on:
|
||||
- milvus
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8501:8501"
|
||||
environment:
|
||||
- BACKEND_URL=${BACKEND_URL}
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
milvus:
|
||||
image: milvusdb/milvus:latest
|
||||
ports:
|
||||
- "19530:19530"
|
||||
volumes:
|
||||
- milvus_data:/var/lib/milvus
|
||||
|
||||
flowise:
|
||||
image: flowiseai/flowise:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- PORT=3000
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
milvus_data:
|
12
frontend/.dockerignore
Normal file
12
frontend/.dockerignore
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Python build and runtime artifacts
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
venv/
|
||||
requirements/
|
||||
|
||||
# Version control
|
||||
.git
|
||||
|
||||
# OS-specific files
|
||||
.DS_Store
|
20
frontend/Dockerfile
Normal file
20
frontend/Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Use an official Python runtime as a parent image
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements file first to leverage Docker layer caching
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install any needed packages (e.g., streamlit and dependencies)
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY . .
|
||||
|
||||
# Make port 8501 available (Streamlit default port)
|
||||
EXPOSE 8501
|
||||
|
||||
# Run the Streamlit app
|
||||
CMD ["streamlit", "run", "app.py"]
|
2
frontend/requirements.txt
Normal file
2
frontend/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
streamlit
|
||||
|
6
pyproject.toml
Normal file
6
pyproject.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[project]
|
||||
name = "systeme-retro-contenu"
|
||||
version = "0.1.0"
|
||||
description = "Système de création de contenu rétrospectif - Backend"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = []
|
Loading…
Add table
Add a link
Reference in a new issue