Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

Open WebUI

De Le Wiki de Lug

Prérequis

Pour une utilisation de base :

  • si Alpine LXC : avec Nesting et keyctl activé (Docker).
  • RAM :
    • 2 Go → minimum
    • 4 Go → recommandé
    • 8 Go → confortable
  • CPU / vCPU :
    • 1 vCPU → suffisant
    • 2 vCPU → recommandé
  • Espace disque :
    • 5 Go → minimum (test uniquement)
    • 10 Go → utilisable
    • 20 Go → confortable

Installation

  • On installe docker (Alpine) :
# apk update && apk upgrade
# apk add docker docker-cli-compose curl
# rc-update add docker default
# rc-service docker start
  • On installe le service :
# mkdir -p /opt/openwebui

Le fichier docker-compose :

# vi /opt/openwebui/docker-compose.yml
services:
  openwebui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: openwebui
    restart: unless-stopped

    ports:
      - "3000:8080"
      # Pour verrouiller l'écoute sur une seule interface :
      # - "IP_SERVEUR:3000:8080"

    environment:
      - OPENAI_API_BASE_URL=${OPENAI_API_BASE_URL}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST=30

    volumes:
      - openwebui_data:/app/backend/data

volumes:
  openwebui_data:

(Optionnel) Pour connecter automatiquement Hermes :

# vi /opt/openwebui/.env
OPENAI_API_BASE_URL=http://IP_HERMES:8642/v1
OPENAI_API_KEY=maclefsecrete

On crée le conteneur :

# docker compose -f /opt/openwebui/docker-compose.yml --project-directory /opt/openwebui up -d
  • Accéder à l'interface :
http://IP_LXC:3000

vhost

server {
    listen 80;
    listen [::]:80;
    server_name     openwebui.exemple.net;
    return 301 https://$host$request_uri;
}

server {
    server_name     openwebui.exemple.net;

    # protection
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy "geolocation=(self), microphone=(self), camera=(self)" always;
    add_header Strict-Transport-Security "max-age=31536000" always;

    location / {
            proxy_http_version 1.1;

            proxy_set_header Upgrade           $http_upgrade;
            proxy_set_header Connection        "upgrade";
            proxy_set_header Host              $host;
            proxy_set_header X-Real-IP         $remote_addr;
            proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Host  $host;
            proxy_set_header X-Forwarded-Port  $server_port;

            proxy_read_timeout 3600;
            proxy_send_timeout 3600;
            proxy_connect_timeout 60;

            client_max_body_size 100M;

            proxy_pass http://IP_SERVEUR_WEB:3000;
            # proxy_pass https://IP_SERVEUR_WEB:PORT; #Alternatif pour redirection sur https
            proxy_buffering off; #activer pour désactiver le "buffering"
    }

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/openwebui.exemple.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/openwebui.exemple.net/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;

}

Mise à jour du conteneur

# docker compose -f /opt/openwebui/docker-compose.yml pull
# docker compose -f /opt/openwebui/docker-compose.yml up -d --remove-orphans

Plugins

Si nécessaire installer les dépendances :

# apt update && apt upgrade
# apt install python3-venv
# python3 -m venv venv --upgrade-deps

Installation du plugin :

# git clone https://github.com/robbyczgw-cla/hermes-web-search-plus.git ~/.hermes/plugins/web-search-plus
# cd ~/.hermes/hermes-agent
# source venv/bin/activate
# python -m ensurepip --upgrade
# pip3 install --upgrade pip
# python -m pip install requests
# cd ~/.hermes/plugins/web-search-plus
# cp .env.template .env

On configure searxng :

# vi /root/.hermes/plugins/web-search-plus/.env

Et on ajoute à la fin :

...
SEARXNG_INSTANCE_URL=<nowiki>http://<nowiki>IP_SEARXNG:8080

On active le plugin :

# vi ~/.hermes/config.yaml
plugins:
  enabled:
    - web-search-plus
tools:
  enabled:
    - web
    - web-search-plus

On redémarre le service :

# systemctl restart hermes-gateway.service