feat(gtm-architect): Finalize migration and implement web scraping
- Refactors the gtm-architect Dockerfile for a flat, more efficient build process. - Implements robust web scraping via BeautifulSoup in helpers.py for URL analysis in phase1. - Makes shared library imports (gspread, pandas, etc.) in helpers.py optional to prevent ModuleNotFoundErrors in microservices. - Implements the main execution logic in the orchestrator to handle command-line arguments. - Updates documentation to reflect the new architecture, scraping feature, and dependency handling.
This commit is contained in:
@@ -42,14 +42,29 @@ Wenn die App unter einem Unterverzeichnis (z.B. `/gtm/`) läuft, findet sie ihre
|
||||
});
|
||||
```
|
||||
|
||||
### 1.4 Python Dependencies (OpenAI Version)
|
||||
Das Projekt nutzt ein geteiltes `helpers.py`, das auf der alten OpenAI Python Library (v0.28.1) basiert.
|
||||
* **Fehler:** `ModuleNotFoundError: No module named 'openai.error'`
|
||||
* **Ursache:** `pip install openai` installiert standardmäßig v1.x, was inkompatibel ist.
|
||||
* **Fix:** In `requirements.txt` zwingend die Version pinnen:
|
||||
### 1.4 Python Dependencies & Shared Libraries (Critical Pitfall)
|
||||
Das Projekt nutzt ein zentrales `helpers.py`, das von mehreren Services geteilt wird. Dies führt oft zu `ModuleNotFoundError`, da eine kleine App (wie `gtm-architect`) nicht alle Bibliotheken benötigt, die in `helpers.py` importiert werden (z.B. `gspread`, `pandas`).
|
||||
|
||||
* **Fehler:** `ModuleNotFoundError: No module named 'gspread'`
|
||||
* **Ursache:** Die `gtm-architect/requirements.txt` enthält `gspread` nicht, aber `helpers.py` versucht es zu importieren.
|
||||
* **Fix (in `helpers.py`):** Machen Sie "exotische" Importe optional. Dies ist die robusteste Methode, um die Kompatibilität zu wahren, ohne die `requirements.txt` kleiner Apps aufzublähen.
|
||||
|
||||
```python
|
||||
# Beispiel in helpers.py
|
||||
try:
|
||||
import gspread
|
||||
GSPREAD_AVAILABLE = True
|
||||
except ImportError:
|
||||
GSPREAD_AVAILABLE = False
|
||||
gspread = None # Wichtig, damit Referenzen nicht fehlschlagen
|
||||
```
|
||||
* **Fix (in `requirements.txt`):** Stellen Sie sicher, dass die für die App **unmittelbar** benötigten Bibliotheken vorhanden sind. Für `gtm-architect` sind das:
|
||||
```text
|
||||
openai==0.28.1
|
||||
# weitere deps...
|
||||
google-generativeai
|
||||
requests
|
||||
beautifulsoup4
|
||||
```
|
||||
|
||||
### 1.5 Python Syntax & F-Strings
|
||||
Multi-Line Prompts können in Docker-Umgebungen zu **sehr hartnäckigen Syntaxfehlern** führen, selbst wenn sie lokal korrekt aussehen.
|
||||
|
||||
@@ -149,10 +164,14 @@ RUN npm run build
|
||||
FROM python:3.11-slim
|
||||
WORKDIR /app
|
||||
|
||||
# Node.js installieren (für Server Bridge)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends nodejs npm && rm -rf /var/lib/apt/lists/*
|
||||
# Node.js installieren (für Server Bridge, optimierte Methode)
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl ca-certificates && \
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
||||
apt-get install -y --no-install-recommends nodejs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Python Deps
|
||||
# Python Deps (aus der app-spezifischen requirements.txt)
|
||||
COPY mein-app-ordner/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
@@ -228,7 +247,7 @@ Achtung beim Routing. Wenn die App unter `/app/` laufen soll, muss der Trailing
|
||||
|
||||
- [ ] `express` in `package.json`?
|
||||
- [ ] `vite.config.ts` hat `base: './'`?
|
||||
- [ ] `requirements.txt` hat `openai==0.28.1`?
|
||||
- [ ] `requirements.txt` enthält die korrekten (minimalen) Dependencies?
|
||||
- [ ] `server.cjs` hat Timeouts (>600s)?
|
||||
- [ ] `docker-compose.yml` mountet auch `helpers.py` und `config.py`?
|
||||
- [ ] Leere `.db` Datei auf dem Host erstellt?
|
||||
|
||||
Reference in New Issue
Block a user