|
43 | 43 |
|
44 | 44 | - Python **3.10+** |
45 | 45 | - MariaDB or MySQL (local or Docker) |
46 | | -- Optional: `POKE_WALLET_API_KEY`, `GROQ_API_KEY`, Chrome for real Vinted runs |
| 46 | +- Optional: `POKE_WALLET_API_KEY`, `GROQ_API_KEY`, **Chromium** for Vinted (voir ci-dessous) |
| 47 | + |
| 48 | +### Vinted (Chromium) et Xvfb |
| 49 | + |
| 50 | +La publication Vinted lance **Chromium** via **nodriver**. Sur une machine **sans écran** (VPS, conteneur, CI), `VINTED_BROWSER_HEADLESS=false` exige un **DISPLAY** : le dépôt prévoit **Xvfb** pour ne rien configurer à la main. |
| 51 | + |
| 52 | +| Environnement | Comportement | |
| 53 | +|----------------|---------------| |
| 54 | +| **Docker Compose** (`api/`) | L’image installe **chromium**, **xvfb**, **xauth** ; la commande de service enveloppe **uvicorn** avec **`xvfb-run`**. Aucune étape manuelle. | |
| 55 | +| **Déploiement GitHub → VPS** (`.github/workflows/deploy-api.yml`) | `apt install` inclut **xvfb** et **xauth** ; l’unité **systemd** lance Uvicorn sous **`xvfb-run`**. | |
| 56 | +| **Linux sans Docker** (venv + systemd maison) | Installez `xvfb` et `xauth` (`apt install xvfb xauth`), puis lancez l’API avec : `xvfb-run -a --server-args="-screen 0 1920x1080x24" uvicorn …` si `VINTED_BROWSER_HEADLESS=false`. | |
| 57 | +| **Windows (dev)** | Pas besoin d’Xvfb ; utilisez `VINTED_BROWSER_HEADLESS=false` avec un bureau local, ou `run_dev.py` si vous utilisez `--reload` avec Vinted. | |
| 58 | + |
| 59 | +**GitHub Actions (secret optionnel)** : `VINTED_BROWSER_HEADLESS` — si absent ou vide, la valeur générée sur le VPS reste **`true`** (comportement historique). Mettez **`false`** pour un Chromium fenêtré sur Xvfb (souvent moins refusé par Vinted que le headless intégré). **Cloudflare / IP hébergeur** peuvent quand même bloquer des requêtes : un `curl` en **403** depuis le VPS alors qu’un navigateur répond **200** est possible. |
| 60 | + |
| 61 | +Variables utiles dans `.env` / `.env.example` : `VINTED_BROWSER_HEADLESS`, `VINTED_CHROME_EXECUTABLE` (souvent `/usr/bin/chromium` sous Linux). |
47 | 62 |
|
48 | 63 | ## Install |
49 | 64 |
|
@@ -142,12 +157,17 @@ From `api/`: |
142 | 157 | docker compose up --build |
143 | 158 | ``` |
144 | 159 |
|
145 | | -- API: port **8000** (migrations run on startup) |
| 160 | +- API: port **8000** (migrations + seed conditionnel au démarrage, puis **uvicorn** sous **`xvfb-run`** pour Vinted) |
146 | 161 | - MariaDB: **3306** |
147 | 162 | - phpMyAdmin: **8080** |
| 163 | +- L’image inclut **Chromium**, **Xvfb** et **xauth** ; les variables `VINTED_*` et **Supabase** peuvent être définies dans un fichier **`.env`** à côté de `docker-compose.yml` (substitution `${…}` — voir [Compose env files](https://docs.docker.com/compose/environment-variables/set-environment-variables/)). |
148 | 164 |
|
149 | 165 | Create a user after startup: `docker compose exec api python seeders/user_seeder.py` (with env vars set), or use `POST /users` and `POST /auth/login`. |
150 | 166 |
|
| 167 | +### Déploiement API (GitHub → VPS) |
| 168 | + |
| 169 | +Le workflow **Deploy API** installe **xvfb** et **xauth**, écrit l’unité **systemd** avec **`ExecStart=/usr/bin/xvfb-run … uvicorn`**, et peut fixer **`VINTED_BROWSER_HEADLESS`** via le secret du même nom (défaut **`true`** si le secret est absent). Aucune installation manuelle de Xvfb sur le VPS n’est nécessaire après un déploiement via cette CI. |
| 170 | + |
151 | 171 | ## Limitations |
152 | 172 |
|
153 | 173 | - Vinted UI and anti-bot policies may break automation; local runs that trigger publication need valid Vinted credentials. |
|
0 commit comments