V 2.0.3 - PUID/PGID Support, ZUGFeRD-Fix
- PUID/PGID Unterstützung für Unraid/Docker hinzugefügt - Entrypoint-Skript für Benutzer-Wechsel - ZUGFeRD-Dateien werden jetzt direkt in Zielordner verschoben (kein extra zugferd/ Unterordner) - Dokumentation aktualisiert Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
adbb1935ec
commit
b196bdc7fe
6 changed files with 54 additions and 8 deletions
|
|
@ -14,6 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
postgresql-client \
|
postgresql-client \
|
||||||
gzip \
|
gzip \
|
||||||
|
gosu \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Arbeitsverzeichnis
|
# Arbeitsverzeichnis
|
||||||
|
|
@ -28,8 +29,14 @@ COPY backend/ ./backend/
|
||||||
COPY frontend/ ./frontend/
|
COPY frontend/ ./frontend/
|
||||||
COPY regeln/ ./regeln/
|
COPY regeln/ ./regeln/
|
||||||
|
|
||||||
|
# Entrypoint für PUID/PGID
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
# Umgebungsvariablen
|
# Umgebungsvariablen
|
||||||
ENV PYTHONPATH=/app
|
ENV PYTHONPATH=/app
|
||||||
|
ENV PUID=1000
|
||||||
|
ENV PGID=1000
|
||||||
|
|
||||||
# Port
|
# Port
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
@ -38,5 +45,6 @@ EXPOSE 8000
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||||
CMD curl -f http://localhost:8000/health || exit 1
|
CMD curl -f http://localhost:8000/health || exit 1
|
||||||
|
|
||||||
# Start
|
# Entrypoint und Start
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Dateiverwaltung
|
# Dateiverwaltung v2.0.3
|
||||||
|
|
||||||
Dokumenten-Management-System für automatische Verarbeitung, Sortierung und Benennung von Dokumenten.
|
Dokumenten-Management-System für automatische Verarbeitung, Sortierung und Benennung von Dokumenten.
|
||||||
|
|
||||||
|
|
@ -47,6 +47,16 @@ Neuen Container erstellen mit folgenden Einstellungen:
|
||||||
|----------|--------------|----------|
|
|----------|--------------|----------|
|
||||||
| `DATABASE_URL` | Datenbank-Verbindung (MariaDB/MySQL) | `mysql+pymysql://user:pass@host/db` |
|
| `DATABASE_URL` | Datenbank-Verbindung (MariaDB/MySQL) | `mysql+pymysql://user:pass@host/db` |
|
||||||
| `TZ` | Zeitzone | `Europe/Berlin` |
|
| `TZ` | Zeitzone | `Europe/Berlin` |
|
||||||
|
| `PUID` | User-ID für Dateiberechtigungen | `1003` |
|
||||||
|
| `PGID` | Group-ID für Dateiberechtigungen | `100` |
|
||||||
|
|
||||||
|
**Wichtig für Unraid/NAS:** PUID und PGID sollten auf den Benutzer gesetzt werden, der Zugriff auf die gemounteten Ordner hat. So werden Dateien mit den richtigen Berechtigungen erstellt.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Benutzer-ID herausfinden:
|
||||||
|
id <benutzername>
|
||||||
|
# Beispiel: uid=1003(deep) gid=100(users)
|
||||||
|
```
|
||||||
|
|
||||||
**Beispiel DATABASE_URL Formate:**
|
**Beispiel DATABASE_URL Formate:**
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ async def lifespan(app: FastAPI):
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="Dateiverwaltung",
|
title="Dateiverwaltung",
|
||||||
description="Modulares Dokumenten-Management-System",
|
description="Modulares Dokumenten-Management-System",
|
||||||
version="1.0.0",
|
version="2.0.3",
|
||||||
lifespan=lifespan
|
lifespan=lifespan
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -611,13 +611,12 @@ def execute_grobsortierung(db, zeitplan: Zeitplan) -> Dict:
|
||||||
if not ist_zugferd:
|
if not ist_zugferd:
|
||||||
# Keine ZUGFeRD-PDF -> überspringen
|
# Keine ZUGFeRD-PDF -> überspringen
|
||||||
continue
|
continue
|
||||||
# ZUGFeRD-PDF in separaten Ordner verschieben
|
# ZUGFeRD-PDF direkt in Zielordner verschieben
|
||||||
zugferd_ziel = ziel_basis / "zugferd"
|
ziel_basis.mkdir(parents=True, exist_ok=True)
|
||||||
zugferd_ziel.mkdir(parents=True, exist_ok=True)
|
neuer_pfad = ziel_basis / datei.name
|
||||||
neuer_pfad = zugferd_ziel / datei.name
|
|
||||||
counter = 1
|
counter = 1
|
||||||
while neuer_pfad.exists():
|
while neuer_pfad.exists():
|
||||||
neuer_pfad = zugferd_ziel / f"{datei.stem}_{counter}{datei.suffix}"
|
neuer_pfad = ziel_basis / f"{datei.stem}_{counter}{datei.suffix}"
|
||||||
counter += 1
|
counter += 1
|
||||||
datei.rename(neuer_pfad)
|
datei.rename(neuer_pfad)
|
||||||
db.add(VerarbeiteteDatei(
|
db.add(VerarbeiteteDatei(
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
- TZ=Europe/Berlin
|
||||||
- DATABASE_URL=mysql+pymysql://data:8715@192.168.155.11/dateiverwaltung
|
- DATABASE_URL=mysql+pymysql://data:8715@192.168.155.11/dateiverwaltung
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
|
|
||||||
27
Source/entrypoint.sh
Executable file
27
Source/entrypoint.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# PUID/PGID Unterstützung für Unraid/Docker
|
||||||
|
PUID=${PUID:-1000}
|
||||||
|
PGID=${PGID:-1000}
|
||||||
|
|
||||||
|
echo "Starting with UID: $PUID, GID: $PGID"
|
||||||
|
|
||||||
|
# Gruppe erstellen/anpassen
|
||||||
|
if getent group appgroup > /dev/null 2>&1; then
|
||||||
|
groupmod -g "$PGID" appgroup 2>/dev/null || true
|
||||||
|
else
|
||||||
|
groupadd -g "$PGID" appgroup 2>/dev/null || groupadd appgroup
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Benutzer erstellen/anpassen
|
||||||
|
if id -u appuser > /dev/null 2>&1; then
|
||||||
|
usermod -u "$PUID" -g "$PGID" appuser 2>/dev/null || true
|
||||||
|
else
|
||||||
|
useradd -u "$PUID" -g "$PGID" -m -s /bin/bash appuser 2>/dev/null || useradd -g appgroup appuser
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rechte auf /app setzen
|
||||||
|
chown -R appuser:appgroup /app 2>/dev/null || true
|
||||||
|
|
||||||
|
# Als appuser starten
|
||||||
|
exec gosu appuser "$@"
|
||||||
Loading…
Reference in a new issue