Etappe 1: Container-Infrastruktur + udev-Erkennung
- Docker Compose mit 5 Containern (api, worker, ui, postgres, redis) - Basis-Dockerfiles für FastAPI, Celery, React/Vite, PostgreSQL, Redis - udev-Regel + Python-Daemon für Disc-Einwurf-Erkennung - Device-Resolver (UUID/Serial → /dev/disc/<uuid>) - Celery-Worker mit Dummy-Job-Task (Disc-Erkennung) - .env.example mit Umgebungsvariablen - .gitignore für Docker, .env, node_modules - README, SAVEPOINT, ROADMAP aktualisiert
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pip install --no-cache-dir \
|
||||
celery==5.4.0 \
|
||||
redis==5.0.7 \
|
||||
psycopg2-binary==2.9.9 \
|
||||
python-dotenv==1.0.1
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["celery", "-A", "celery_app", "worker", "--loglevel=info", "--pool=solo"]
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from celery import Celery
|
||||
import os
|
||||
|
||||
REDIS_URL = os.getenv("REDIS_URL", "redis://localhost:6379/0")
|
||||
|
||||
celery_app = Celery(
|
||||
"rippy_worker",
|
||||
broker=REDIS_URL,
|
||||
backend=REDIS_URL,
|
||||
include=["tasks"]
|
||||
)
|
||||
|
||||
celery_app.conf.update(
|
||||
task_serializer="json",
|
||||
accept_content=["json"],
|
||||
result_serializer="json",
|
||||
timezone="UTC",
|
||||
enable_utc=True,
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
celery==5.4.0
|
||||
redis==5.0.7
|
||||
psycopg2-binary==2.9.9
|
||||
python-dotenv==1.0.1
|
||||
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
from celery_app import celery_app
|
||||
|
||||
|
||||
@celery_app.task(bind=True, name="worker.tasks.detect_disc")
|
||||
def detect_disc(self, device_path: str, disc_type: str):
|
||||
"""Dummy-Disk-Erkennungstask."""
|
||||
print(f"Disc erkannt: {disc_type}, Device: {device_path}")
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"message": f"Disc erkannt: {disc_type}",
|
||||
"device_path": device_path,
|
||||
"disc_type": disc_type
|
||||
}
|
||||
Reference in New Issue
Block a user