design final

This commit is contained in:
Aron Petau 2025-10-02 12:20:11 +02:00
parent da5e765d49
commit a0d2188f6f
1400 changed files with 1748 additions and 207 deletions

BIN
.DS_Store vendored

Binary file not shown.

6
.gitignore vendored
View file

@ -1,2 +1,8 @@
.env
__pycache__
.continue
.venv
matrix/data
ollama
open-webui

1
.venv
View file

@ -1 +0,0 @@
124-webapp-sckb

View file

@ -1,33 +1,37 @@
# --- Base image ---
FROM python:3.12-slim
# Set environment variables
# --- Environment variables ---
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set working directory
# --- Set working directory ---
WORKDIR /cost-assistant
# Copy requirements first (for caching)
COPY requirements.txt .
# Install system dependencies: OpenCV, Poppler, and minimal utils
RUN apt-get update && apt-get install -y \
# --- Install system dependencies (minimal for OpenCV, Poppler, PDF/image handling) ---
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# --- Copy requirements and install Python dependencies ---
COPY requirements.txt .
RUN python -m pip install --no-cache-dir -r requirements.txt
# Copy the project files
# --- Copy project files ---
COPY . .
# Create upload folder
RUN mkdir -p data/uploads
# --- Create upload folder and set permissions ---
RUN mkdir -p data/uploads \
&& groupadd -r appuser && useradd -r -g appuser appuser \
&& chown -R appuser:appuser data/uploads
# Expose port
# --- Switch to non-root user for security ---
USER appuser
# --- Expose internal port (optional, handled via Docker Compose) ---
EXPOSE 8000
# Run FastAPI with Uvicorn (reload for dev)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
# --- Run Gunicorn with Uvicorn worker for production ---
CMD ["gunicorn", "main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--workers", "4", "--timeout", "120"]

View file

@ -1,47 +1,86 @@
# papercut-lite-printshop
# webapp_124
Minimal Flask-based PDF print-cost calculator with optional ink-coverage adjustment.
Minimal **FastAPI**-based PDF print-cost calculator with optional ink-coverage adjustment.
Run:
This project is part of **Studio EinsZwoVier**, a collaborative environment.
Everyone is invited to contribute improvements. See the [source code](https://forgejo.petau.net/aron/124-webapp).
---
## Features
- **Landing Page**: Overview of all available tools and links.
- **Cost Calculator**: Calculate print and material costs for posters and large-format prints.
- **Docmost / Wissenssammlung**: Shared knowledge library for manuals and documentation.
- **Local Chatbot**: Access your own Large Language Models via Open WebUI and Ollama.
- **Matrix Server**: Collects print jobs and payments.
- **Administration**: Manage the Docker stack via Portainer.
- **Automatic Updates**: Watchtower updates all containers every 24 hours and cleans up old images.
---
## Getting Started
### Prerequisites
- Docker & Docker Compose installed
- Optional: local network access to `einszwovier.local` for local services
if the server is moved, replace with new host
---
### Run the Stack
```bash
docker-compose up --build
```
Then open http://localhost:8000 and upload PDFs. Configure rate via env var RATE_PER_M2 (default 4.0).
docker-compose up --build -d
```mermaid
graph TD
subgraph WebApp ["Studio Einszwovier Internal Pages"]
%% --- Subgraphs for clarity ---
subgraph WebApp ["Studio EinsZwoVier - Internal Web Pages"]
LP[Landing Page<br>studio-einszwovier.local]
About[About Page]
CostCalc[Cost Calculator]
Mailto[Mailto Contact]
OutlinePage[Outline Page<br>Knowledge Library<br>via IServ SSO]
About[About Page<br>/about]
CostCalc[Cost Calculator<br>/cost]
Mailto[Contact Email<br>mailto:einszwovier@gvb-gymnasium.de]
DocmostPage[Wissenssammlung<br>Docmost @ :3000]
ChatbotPage[Lokaler Chatbot<br>:8080]
end
subgraph Matrix ["Matrix Server"]
MatrixServer[Matrix Server<br>Collect print jobs & payments]
subgraph MatrixServer ["Matrix Server"]
MatrixSrv[Matrix Server<br>Collects print jobs & payments]
end
subgraph OutlineServer ["Outline Server"]
OutlineSrv[Outline Server<br>Manages manuals & docs]
subgraph DocmostServer ["Docmost Server"]
DocmostSrv[Docmost Server<br>Manages manuals & docs]
end
%% Landing page links
subgraph AdminPanel ["Administration"]
Portainer[Portainer Admin Panel<br>:9000]
end
%% --- Landing page links ---
LP --> About
LP --> CostCalc
LP --> Mailto
LP --> MatrixServer
LP --> OutlinePage
LP --> DocmostPage
LP --> ChatbotPage
LP --> Portainer
%% Cost calculator workflow
CostCalc --> PDF[PDF upload]
%% --- Cost Calculator workflow ---
CostCalc --> PDF[PDF Upload]
PDF --> Quote[Generate Quote]
Quote --> MatrixServer
Quote --> MatrixSrv
%% Outline workflow
OutlinePage --> OutlineSrv
%% --- Docmost workflow ---
DocmostPage --> DocmostSrv
```
%% --- Chatbot workflow ---
ChatbotPage --> Ollama[Ollama AI Server<br>:11434]
ChatbotPage --> OpenWebUI[Open WebUI<br>:8080]
%% --- Optional styling for clarity ---
classDef internal fill:#e3f2fd,stroke:#90caf9,stroke-width:1px;
classDef external fill:#fff3e0,stroke:#ffb74d,stroke-width:1px;
class LP,About,CostCalc,Mailto,DocmostPage,ChatbotPage internal;
class MatrixSrv,DocmostSrv,Ollama,OpenWebUI,Portainer external;

Binary file not shown.

Binary file not shown.

BIN
data/.DS_Store vendored

Binary file not shown.

BIN
data/uploads/flyer umzu.pdf Normal file

Binary file not shown.

View file

@ -1,14 +1,119 @@
services:
web:
build: .
container_name: cost-dashboard
container_name: 124_webapp
ports:
- "8000:8000"
- "80:8000"
working_dir: /cost-assistant
volumes:
- .:/cost-assistant # live reload for code/templates/static
- ./data/uploads:/cost-assistant/data/uploads # persistent uploads
- .:/cost-assistant
- ./data/uploads:/cost-assistant/data/uploads
env_file:
- .env # RATE_PER_M2_BLACK and RATE_PER_M2_COLOR
- .env
command: python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
docmost:
image: docmost/docmost:latest
container_name: docmost
depends_on:
- db
- redis
environment:
APP_URL: "http://einszwovier.local:3000"
APP_SECRET: "Ltr/i5KY8S8xQQZbaRHVS07gaAqwxPfrMxW6ZetNRqk="
DATABASE_URL: "postgresql://docmost:einszwo4@db:5432/docmost?schema=public"
REDIS_URL: "redis://redis:6379"
MAIL_DRIVER: "smtp"
SMTP_HOST: "smtp.migadu.com"
SMTP_PORT: 465
SMTP_SECURE: "true"
SMTP_USERNAME: "aron@petau.net"
SMTP_PASSWORD: "Reprintedservices2766"
MAIL_FROM_ADDRESS: "aron@petau.net"
MAIL_FROM_NAME: "einszwovier - docs"
ports:
- "3000:3000"
restart: unless-stopped
volumes:
- ./docmost/storage:/app/data/storage
db:
image: postgres:16-alpine
container_name: docmost_postgres
environment:
POSTGRES_DB: docmost
POSTGRES_USER: docmost
POSTGRES_PASSWORD: einszwo4
restart: unless-stopped
volumes:
- ./docmost/db:/var/lib/postgresql/data
redis:
image: redis:7.2-alpine
container_name: docmost_redis
restart: unless-stopped
volumes:
- ./docmost/redis:/data
synapse:
image: matrixdotorg/synapse:latest
container_name: matrix_server
restart: always
ports:
- "8008:8008"
volumes:
- ./matrix/data:/data
environment:
- SYNAPSE_SERVER_NAME=einszwovier.local
- SYNAPSE_REPORT_STATS=no
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- 11434:11434
volumes:
- ./ollama:/root/.ollama
tty: true
restart: unless-stopped
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
depends_on:
- ollama
ports:
- 8080:8080
volumes:
- ./open-webui:/app/backend/data
environment:
- 'OLLAMA_BASE_URL=http://ollama:11434'
- 'WEBUI_SECRET_KEY=a8cbc11647c471e5a30d9b182a7147a0777e41a6b0cb036fd6a8d967585502c7'
- 'ENABLE_API=true'
- 'WEBUI_API_KEY=a8cbc11647c471e5a30d9b182a7147a0777e41a6b0cb036fd6a8d967585502c7'
extra_hosts:
- host.docker.internal:host-gateway
restart: unless-stopped
watchtower:
image: containrrr/watchtower:latest
container_name: watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: >
--cleanup
--interval 86400
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
restart: unless-stopped
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
volumes:
portainer_data:

BIN
docmost/.DS_Store vendored Normal file

Binary file not shown.

1
docmost/db/PG_VERSION Normal file
View file

@ -0,0 +1 @@
16

BIN
docmost/db/base/1/112 Normal file

Binary file not shown.

BIN
docmost/db/base/1/113 Normal file

Binary file not shown.

BIN
docmost/db/base/1/1247 Normal file

Binary file not shown.

BIN
docmost/db/base/1/1247_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1247_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1249 Normal file

Binary file not shown.

BIN
docmost/db/base/1/1249_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1249_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1255 Normal file

Binary file not shown.

BIN
docmost/db/base/1/1255_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1255_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1259 Normal file

Binary file not shown.

BIN
docmost/db/base/1/1259_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/1259_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/13457 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13457_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/13457_vm Normal file

Binary file not shown.

0
docmost/db/base/1/13460 Normal file
View file

BIN
docmost/db/base/1/13461 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13462 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13462_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/13462_vm Normal file

Binary file not shown.

0
docmost/db/base/1/13465 Normal file
View file

BIN
docmost/db/base/1/13466 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13467 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13467_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/13467_vm Normal file

Binary file not shown.

0
docmost/db/base/1/13470 Normal file
View file

BIN
docmost/db/base/1/13471 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13472 Normal file

Binary file not shown.

BIN
docmost/db/base/1/13472_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/13472_vm Normal file

Binary file not shown.

0
docmost/db/base/1/13475 Normal file
View file

BIN
docmost/db/base/1/13476 Normal file

Binary file not shown.

0
docmost/db/base/1/1417 Normal file
View file

0
docmost/db/base/1/1418 Normal file
View file

BIN
docmost/db/base/1/174 Normal file

Binary file not shown.

BIN
docmost/db/base/1/175 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2187 Normal file

Binary file not shown.

0
docmost/db/base/1/2224 Normal file
View file

BIN
docmost/db/base/1/2228 Normal file

Binary file not shown.

0
docmost/db/base/1/2328 Normal file
View file

0
docmost/db/base/1/2336 Normal file
View file

BIN
docmost/db/base/1/2337 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2579 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2600 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2600_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2600_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2601 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2601_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2601_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2602 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2602_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2602_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2603 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2603_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2603_vm Normal file

Binary file not shown.

0
docmost/db/base/1/2604 Normal file
View file

BIN
docmost/db/base/1/2605 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2605_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2605_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2606 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2606_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2606_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2607 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2607_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2607_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2608 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2608_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2608_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2609 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2609_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2609_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2610 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2610_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2610_vm Normal file

Binary file not shown.

0
docmost/db/base/1/2611 Normal file
View file

BIN
docmost/db/base/1/2612 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2612_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2612_vm Normal file

Binary file not shown.

0
docmost/db/base/1/2613 Normal file
View file

BIN
docmost/db/base/1/2615 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2615_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2615_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2616 Normal file

Binary file not shown.

BIN
docmost/db/base/1/2616_fsm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2616_vm Normal file

Binary file not shown.

BIN
docmost/db/base/1/2617 Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more