avec nginx

This commit is contained in:
2026-02-24 14:21:03 +01:00
parent c8ca363996
commit f0b1dd07f6
2 changed files with 39 additions and 7 deletions

View File

@ -1,12 +1,23 @@
version: '3.8' version: '3.8'
services: 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: open-webui:
image: ghcr.io/open-webui/open-webui:main image: ghcr.io/open-webui/open-webui:main
container_name: open-webui container_name: open-webui
ports: # On ne publie plus le port 3000 vers l'extérieur, Nginx s'en charge en interne
- "3000:8080"
environment: environment:
- OLLAMA_BASE_URL=http://ollama:11434 - OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY:-supersecretkey} - WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY:-supersecretkey}
@ -16,7 +27,7 @@ services:
- studio-net - studio-net
restart: always restart: always
# --- LE CERVEAU (LLM) --- # --- LE CERVEAU (Ollama) ---
ollama: ollama:
image: ollama/ollama:latest image: ollama/ollama:latest
container_name: ollama container_name: ollama
@ -32,17 +43,18 @@ services:
networks: networks:
- studio-net - studio-net
# --- LE PREMIER SERVICE AUDIO (Exemple) --- # --- LE SERVICE AUDIO (Ton API) ---
audio-api: audio-api:
build: build:
context: ./services/audio-api # On créera ce dossier juste après context: ./services/audio-api
container_name: audio-api container_name: audio-api
# On laisse le port 7860 ouvert au cas où tu voudrais tester en direct
ports: ports:
- "7860:7860" - "7860:7860"
deploy: deploy:
resources: resources:
limits: 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: reservations:
devices: devices:
- driver: nvidia - driver: nvidia

20
nginx/default.conf Normal file
View File

@ -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";
}
}