From 94a39cf3b4901ad9a440d9c6f71b421429bac2e4 Mon Sep 17 00:00:00 2001 From: "IETM_FIXE\\ietm6" Date: Sun, 26 Apr 2026 10:46:46 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20en=20place=20de=20la=20pipeline=20pour?= =?UTF-8?q?=20github=20plutot=20que=20gitea=20;=20mise=20en=20place=20des?= =?UTF-8?q?=20images=20docker=20sur=20GHCR=20plut=C3=B4t=20que=20gitea=20P?= =?UTF-8?q?assage=20version=20v0.6.13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yml | 34 ++++++++++++++++++---- brain/app/infrastructure/ollama_adapter.py | 26 +++++++++++++++-- core/pom.xml | 2 +- docker-compose.yml | 15 ++++++---- installers/README.md | 2 +- installers/install.ps1 | 9 +++--- installers/install.sh | 7 +++-- installers/secure-host-ollama.ps1 | 2 +- web/package-lock.json | 4 +-- web/package.json | 2 +- 10 files changed, 77 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index bae8ebb..b0e207d 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -6,8 +6,10 @@ on: - 'v*' env: - REGISTRY: git.igmlcreation.fr - REGISTRY_USER: ietm64 + GITEA_REGISTRY: git.igmlcreation.fr + GITEA_REGISTRY_USER: ietm64 + GHCR_REGISTRY: ghcr.io + GHCR_NAMESPACE: igmlcreation jobs: build: @@ -26,19 +28,39 @@ jobs: - name: Login to Gitea Registry uses: docker/login-action@v3 with: - registry: ${{ env.REGISTRY }} - username: ${{ env.REGISTRY_USER }} + registry: ${{ env.GITEA_REGISTRY }} + username: ${{ env.GITEA_REGISTRY_USER }} password: ${{ secrets.DOCKER_PAT }} + # Login to GHCR (GitHub Container Registry) pour distribuer les images + # publiquement aux utilisateurs finaux. Reputation domaine plus elevee + # que git.igmlcreation.fr (mieux pour les antivirus / SmartScreen). + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.GHCR_REGISTRY }} + username: ${{ env.GHCR_NAMESPACE }} + password: ${{ secrets.GHCR_TOKEN }} + - name: Extract version id: meta run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + # Push vers les deux registries en un seul build (build-push-action + # accepte une liste de tags ; aucun build supplementaire necessaire). + # Naming : + # - Gitea : conserve l'ancien pattern ietm64/ pour ne pas + # casser les installs existantes qui ont REGISTRY=git.igmlcreation.fr + # dans leur .env. + # - GHCR : nouveau pattern igmlcreation/loremind- qui evite + # la collision avec d'autres projets de l'org. - name: Build & push ${{ matrix.component }} uses: docker/build-push-action@v5 with: context: ./${{ matrix.component }} push: true tags: | - ${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/${{ matrix.component }}:latest - ${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/${{ matrix.component }}:${{ steps.meta.outputs.version }} + ${{ env.GITEA_REGISTRY }}/${{ env.GITEA_REGISTRY_USER }}/${{ matrix.component }}:latest + ${{ env.GITEA_REGISTRY }}/${{ env.GITEA_REGISTRY_USER }}/${{ matrix.component }}:${{ steps.meta.outputs.version }} + ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_NAMESPACE }}/loremind-${{ matrix.component }}:latest + ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_NAMESPACE }}/loremind-${{ matrix.component }}:${{ steps.meta.outputs.version }} diff --git a/brain/app/infrastructure/ollama_adapter.py b/brain/app/infrastructure/ollama_adapter.py index 560d2b7..59cf547 100644 --- a/brain/app/infrastructure/ollama_adapter.py +++ b/brain/app/infrastructure/ollama_adapter.py @@ -61,7 +61,16 @@ class OllamaLLMProvider: async with httpx.AsyncClient(timeout=self._timeout) as client: try: response = await client.post(url, json=payload) - response.raise_for_status() + if response.status_code >= 400: + body = response.text + try: + err_obj = json.loads(body) + err_msg = err_obj.get("error") or body + except json.JSONDecodeError: + err_msg = body + raise LLMProviderError( + f"Ollama HTTP {response.status_code} : {err_msg.strip()[:500]}" + ) except httpx.HTTPError as exc: raise LLMProviderError( f"Erreur lors de l'appel à Ollama : {exc}" @@ -105,7 +114,20 @@ class OllamaLLMProvider: async with httpx.AsyncClient(timeout=self._timeout) as client: try: async with client.stream("POST", url, json=payload) as response: - response.raise_for_status() + if response.status_code >= 400: + # On lit le body d'erreur pour le remonter a l'utilisateur, + # sinon on ne voit que "500 Internal Server Error" sans + # savoir POURQUOI Ollama refuse (modele introuvable, OOM, + # num_ctx trop grand pour la VRAM, etc.). + body = (await response.aread()).decode("utf-8", errors="replace") + try: + err_obj = json.loads(body) + err_msg = err_obj.get("error") or body + except json.JSONDecodeError: + err_msg = body + raise LLMProviderError( + f"Ollama HTTP {response.status_code} : {err_msg.strip()[:500]}" + ) async for line in response.aiter_lines(): if not line.strip(): continue diff --git a/core/pom.xml b/core/pom.xml index dbcc5b6..d05fea6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -14,7 +14,7 @@ com.loremind loremind-core - 0.6.12 + 0.6.13 LoreMind Core Backend Core - Architecture Hexagonale diff --git a/docker-compose.yml b/docker-compose.yml index ea42b6d..e0e8ac6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -60,7 +60,12 @@ services: " core: - image: ${REGISTRY:-git.igmlcreation.fr}/ietm64/core:${TAG:-latest} + # Defaut : GHCR (registry public, reputation domaine elevee). + # Pour les anciennes installs qui pointaient sur Gitea, REGISTRY et + # IMAGE_NAMESPACE peuvent etre overrides dans .env : + # REGISTRY=git.igmlcreation.fr + # IMAGE_NAMESPACE=ietm64/ (le slash final est important : voir image: ci-dessous) + image: ${REGISTRY:-ghcr.io}/${IMAGE_NAMESPACE:-igmlcreation/loremind-}core:${TAG:-latest} container_name: loremind-core labels: - "com.centurylinklabs.watchtower.enable=true" @@ -84,8 +89,8 @@ services: # Detection des mises a jour : interroge le registry et delegue le pull/restart # a Watchtower. Si WATCHTOWER_TOKEN est vide, la feature est desactivee # (l'UI masque le badge et le bouton). - UPDATE_CHECK_REGISTRY: ${REGISTRY:-git.igmlcreation.fr} - UPDATE_CHECK_IMAGES: ietm64/core,ietm64/brain,ietm64/web + UPDATE_CHECK_REGISTRY: ${REGISTRY:-ghcr.io} + UPDATE_CHECK_IMAGES: ${IMAGE_NAMESPACE:-igmlcreation/loremind-}core,${IMAGE_NAMESPACE:-igmlcreation/loremind-}brain,${IMAGE_NAMESPACE:-igmlcreation/loremind-}web UPDATE_CHECK_TAG: ${TAG:-latest} WATCHTOWER_URL: http://watchtower:8080 WATCHTOWER_TOKEN: ${WATCHTOWER_TOKEN:-} @@ -115,7 +120,7 @@ services: restart: unless-stopped brain: - image: ${REGISTRY:-git.igmlcreation.fr}/ietm64/brain:${TAG:-latest} + image: ${REGISTRY:-ghcr.io}/${IMAGE_NAMESPACE:-igmlcreation/loremind-}brain:${TAG:-latest} container_name: loremind-brain labels: - "com.centurylinklabs.watchtower.enable=true" @@ -138,7 +143,7 @@ services: restart: unless-stopped web: - image: ${REGISTRY:-git.igmlcreation.fr}/ietm64/web:${TAG:-latest} + image: ${REGISTRY:-ghcr.io}/${IMAGE_NAMESPACE:-igmlcreation/loremind-}web:${TAG:-latest} container_name: loremind-web labels: - "com.centurylinklabs.watchtower.enable=true" diff --git a/installers/README.md b/installers/README.md index 3e88e8d..687a22b 100644 --- a/installers/README.md +++ b/installers/README.md @@ -29,7 +29,7 @@ déclaratif et auditable en quelques lignes. ## Linux (Debian / Ubuntu / Fedora / Arch) ```bash -curl -fsSL https://git.igmlcreation.fr/ietm64/loremind/raw/branch/main/installers/install.sh | bash +curl -fsSL https://raw.githubusercontent.com/IGMLcreation/LoreMind/main/installers/install.sh | bash ``` Le script : diff --git a/installers/install.ps1 b/installers/install.ps1 index dd19366..e24d4f2 100644 --- a/installers/install.ps1 +++ b/installers/install.ps1 @@ -40,16 +40,16 @@ Auteur : ietm64 Licence : AGPL-3.0 Projet : LoreMindMJ - assistant pour Maitres de Jeu de JDR - Version : 0.6.12 + Version : 0.6.13 .LINK - https://git.igmlcreation.fr/ietm64/loremind + https://github.com/IGMLcreation/LoreMind #> [CmdletBinding()] param( [string]$InstallDir = "$env:LOCALAPPDATA\LoreMind", - [string]$ComposeUrl = "https://git.igmlcreation.fr/ietm64/loremind/raw/branch/main/docker-compose.yml", + [string]$ComposeUrl = "https://raw.githubusercontent.com/IGMLcreation/LoreMind/main/docker-compose.yml", [int]$WebPort = 8081, [switch]$NonInteractive ) @@ -316,7 +316,8 @@ $composeProfiles = $profilesList -join ',' $envContent = @" # Genere par install.ps1 le $(Get-Date -Format 'yyyy-MM-dd HH:mm') -REGISTRY=git.igmlcreation.fr +REGISTRY=ghcr.io +IMAGE_NAMESPACE=igmlcreation/loremind- TAG=latest WEB_PORT=$WebPort diff --git a/installers/install.sh b/installers/install.sh index 2b84702..4540d74 100644 --- a/installers/install.sh +++ b/installers/install.sh @@ -2,12 +2,12 @@ # ========================================================================== # Installeur LoreMindMJ pour Linux (Debian/Ubuntu/Fedora/Arch) # Usage : -# curl -fsSL https://git.igmlcreation.fr/ietm64/loremind/raw/branch/main/installers/install.sh | bash +# curl -fsSL https://raw.githubusercontent.com/IGMLcreation/LoreMind/main/installers/install.sh | bash # ========================================================================== set -euo pipefail INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/share/loremind}" -COMPOSE_URL="${COMPOSE_URL:-https://git.igmlcreation.fr/ietm64/loremind/raw/branch/main/docker-compose.yml}" +COMPOSE_URL="${COMPOSE_URL:-https://raw.githubusercontent.com/IGMLcreation/LoreMind/main/docker-compose.yml}" WEB_PORT="${WEB_PORT:-8081}" NON_INTERACTIVE="${NON_INTERACTIVE:-0}" @@ -190,7 +190,8 @@ COMPOSE_PROFILES="$(IFS=,; echo "${PROFILES_ARR[*]}")" cat > .env < [CmdletBinding()] diff --git a/web/package-lock.json b/web/package-lock.json index cb6e246..cc9a823 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,12 +1,12 @@ { "name": "loremind-web", - "version": "0.6.12", + "version": "0.6.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "loremind-web", - "version": "0.6.12", + "version": "0.6.13", "dependencies": { "@angular/animations": "^17.0.0", "@angular/common": "^17.0.0", diff --git a/web/package.json b/web/package.json index 79d0687..2dd1a42 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "loremind-web", - "version": "0.6.12", + "version": "0.6.13", "description": "LoreMind Frontend - Angular", "scripts": { "ng": "ng",