From f0b1dd07f6abc0d4f64e0e2e8404930aa9f7f4ad Mon Sep 17 00:00:00 2001 From: nicoboy Date: Tue, 24 Feb 2026 14:21:03 +0100 Subject: [PATCH] avec nginx --- docker-compose.yml | 26 +++++++++++++++++++------- nginx/default.conf | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 nginx/default.conf diff --git a/docker-compose.yml b/docker-compose.yml index cc21a6f..f4255b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,23 @@ version: '3.8' services: - # --- L'INTERFACE (La Glue) --- + # --- LE PORTIER (Point d'entrée pour tes 20 étudiants) --- + gateway: + image: nginx:latest + ports: + - "80:80" + volumes: + - ./nginx/default.conf:/etc/nginx/conf.d/default.conf + networks: + - studio-net + depends_on: + - open-webui + + # --- L'INTERFACE (Open WebUI) --- open-webui: image: ghcr.io/open-webui/open-webui:main container_name: open-webui - ports: - - "3000:8080" + # On ne publie plus le port 3000 vers l'extérieur, Nginx s'en charge en interne environment: - OLLAMA_BASE_URL=http://ollama:11434 - WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY:-supersecretkey} @@ -16,7 +27,7 @@ services: - studio-net restart: always - # --- LE CERVEAU (LLM) --- + # --- LE CERVEAU (Ollama) --- ollama: image: ollama/ollama:latest container_name: ollama @@ -32,17 +43,18 @@ services: networks: - studio-net - # --- LE PREMIER SERVICE AUDIO (Exemple) --- + # --- LE SERVICE AUDIO (Ton API) --- audio-api: build: - context: ./services/audio-api # On créera ce dossier juste après + context: ./services/audio-api container_name: audio-api + # On laisse le port 7860 ouvert au cas où tu voudrais tester en direct ports: - "7860:7860" deploy: resources: limits: - memroy: 16G # On empêche un service de manger toute la RAM système + memory: 32G # 64 Go de VRAM permet d'être large sur la RAM système aussi reservations: devices: - driver: nvidia diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..cf0acc1 --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,20 @@ +server { + listen 80; + + # Accès à l'interface principale (Open WebUI) + location / { + proxy_pass http://open-webui:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + # Accès direct aux APIs (Optionnel, pour les étudiants avancés) + location /audio/ { + proxy_pass http://audio-api:7860/; + proxy_buffering off; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } +} \ No newline at end of file