:fix: Correction du l'expose du web app

This commit is contained in:
Orionis committed 2026-10-29 00:08:18 +01:00
1 parent c6a3376317
commit 9961a46014
7 files changed
+218 -45

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
node_modules
dist
dist-ssr
.env
.env.*
*.log
.git
.gitignore
.vscode
.idea
README.md
scripts
docker-compose.yml
.gitlab-ci.yml
+12 -5
View File
@@ -1,20 +1,27 @@
# Étape 1 : Build (On passe de 18 à 22)
# Étape 1 : Build
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
# On installe les dépendances
RUN npm install
# On installe les dépendances (reproductible via le lock file)
RUN npm ci
COPY . .
# On récupère la variable VITE_API_URL injectée par Coolify pendant le build
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
# On lance le build (en ignorant les erreurs TypeScript si tu as modifié le package.json comme convenu)
# On lance le build
RUN npm run build
# Étape 2 : Serveur léger
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
# Vérifie que nginx répond bien sur le port 80
# (127.0.0.1 et pas localhost : busybox wget résoudrait localhost en IPv6)
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget -q --spider http://127.0.0.1 || exit 1
CMD ["nginx", "-g", "daemon off;"]
+16
View File
@@ -0,0 +1,16 @@
services:
frontend:
build:
context: .
dockerfile: Dockerfile
args:
# URL publique de l'API, définie dans les variables d'environnement Coolify
- VITE_API_URL=${VITE_API_URL:-http://localhost:3001}
container_name: logai-frontend
restart: unless-stopped
ports:
# Port du conteneur UNIQUEMENT : Coolify lui attribue automatiquement
# un port hôte et route le domaine configuré dessus.
# Ne PAS écrire "80:80" : le port 80 de l'hôte est déjà pris
# par le reverse proxy Coolify, ce qui empêcherait le conteneur de démarrer.
- "80"
+22
View File
@@ -0,0 +1,22 @@
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# SPA (react-router BrowserRouter) : toute route inconnue renvoie index.html
# Sans ça, un rafraîchissement ou un lien direct vers /login, /logs, etc. renvoie 404.
location / {
try_files $uri $uri/ /index.html;
}
# Assets hashés par Vite : cache immuable d'un an
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
gzip_min_length 1024;
}
+35 -17
View File
@@ -78,7 +78,6 @@
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.0",
"@babel/generator": "^7.29.0",
@@ -288,6 +287,40 @@
"node": ">=6.9.0"
}
},
"node_modules/@emnapi/core": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz",
"integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.3",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
"integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
"integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
@@ -2053,7 +2086,6 @@
"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -2063,7 +2095,6 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
@@ -2074,7 +2105,6 @@
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
"devOptional": true,
"license": "MIT",
"peer": true,
"peerDependencies": {
"@types/react": "^19.2.0"
}
@@ -2130,7 +2160,6 @@
"integrity": "sha512-gGkiNMPqerb2cJSVcruigx9eHBlLG14fSdPdqMoOcBfh+vvn4iCq2C8MzUB89PrxOXk0y3GZ1yIWb9aOzL93bw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.58.1",
"@typescript-eslint/types": "8.58.1",
@@ -2419,7 +2448,6 @@
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2587,7 +2615,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.10.12",
"caniuse-lite": "^1.0.30001782",
@@ -2958,7 +2985,6 @@
"integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -5097,7 +5123,6 @@
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -5125,7 +5150,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -5177,7 +5201,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.2.5.tgz",
"integrity": "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -5187,7 +5210,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.5.tgz",
"integrity": "sha512-J5bAZz+DXMMwW/wV3xzKke59Af6CHY7G4uYLN1OvBcKEsWOs4pQExj86BBKamxl/Ik5bx9whOrvBlSDfWzgSag==",
"license": "MIT",
"peer": true,
"dependencies": {
"scheduler": "^0.27.0"
},
@@ -5626,8 +5648,7 @@
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.2.2.tgz",
"integrity": "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/tailwindcss-animate": {
"version": "1.0.7",
@@ -5727,7 +5748,6 @@
"integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -5986,7 +6006,6 @@
"integrity": "sha512-dbU7/iLVa8KZALJyLOBOQ88nOXtNG8vxKuOT4I2mD+Ya70KPceF4IAmDsmU0h1Qsn5bPrvsY9HJstCRh3hG6Uw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"lightningcss": "^1.32.0",
"picomatch": "^4.0.4",
@@ -6150,7 +6169,6 @@
"integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
+114 -23
View File
@@ -17,15 +17,27 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
import { CheckCircle2, Cpu, Globe, Link as LinkIcon } from 'lucide-react';
import { CheckCircle2, Cloud, Cpu, Globe, Link as LinkIcon } from 'lucide-react';
const REMOTE_MODEL_PLACEHOLDERS: Record<string, string> = {
mistral: 'ex: mistral-large-latest, mistral-small-latest',
openai: 'ex: gpt-4o, gpt-4o-mini',
claude: 'ex: claude-sonnet-4-5, claude-opus-4-1',
gemini: 'ex: gemini-2.0-flash, gemini-2.5-pro'
};
export default function SettingsModal({ onClose }: { onClose: () => void }) {
const [formData, setFormData] = useState({
notionToken: '',
notionDbId: '',
aiMode: 'local' as 'local' | 'remote',
ollamaUrl: '',
ollamaModel: '',
searxngUrl: '',
remoteProvider: 'mistral',
remoteApiKey: '',
remoteModel: '',
remoteApiUrl: '',
aiLanguage: 'Français'
});
const [saved, setSaved] = useState(false);
@@ -40,9 +52,14 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
setFormData({
notionToken: data.notionToken || '',
notionDbId: data.notionDbId || '',
aiMode: data.aiMode || 'local',
ollamaUrl: data.ollamaUrl || '',
ollamaModel: data.ollamaModel || '',
searxngUrl: data.searxngUrl || '',
remoteProvider: data.remoteProvider || 'mistral',
remoteApiKey: data.remoteApiKey || '',
remoteModel: data.remoteModel || '',
remoteApiUrl: data.remoteApiUrl || '',
aiLanguage: data.aiLanguage || 'Français'
});
}
@@ -74,7 +91,7 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
<DialogHeader className="p-6 pb-2 border-b">
<DialogTitle className="text-2xl font-bold tracking-tight">Paramètres Globaux</DialogTitle>
<DialogDescription>
Configurez vos intégrations Notion, Ollama et SearXNG pour personnaliser votre expérience LogAI.
Configurez vos intégrations Notion, votre IA (locale ou distante) et SearXNG pour personnaliser votre expérience LogAI.
</DialogDescription>
</DialogHeader>
@@ -112,30 +129,102 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
{/* AI Integration */}
<section className="space-y-4">
<div className="flex items-center gap-2 text-secondary font-semibold">
<Cpu size={18} />
<h4>Intégration IA (Ollama Local)</h4>
{formData.aiMode === 'remote' ? <Cloud size={18} /> : <Cpu size={18} />}
<h4>Intégration IA</h4>
</div>
<div className="grid gap-4 bg-secondary/5 p-4 rounded-xl border border-secondary/20">
{/* Choix du mode : local (Ollama + SearXNG) ou distant (clé API) */}
<div className="grid gap-2">
<Label htmlFor="ollamaUrl">URL de l'API Ollama</Label>
<Input
id="ollamaUrl"
type="text"
value={formData.ollamaUrl}
onChange={e => setFormData({...formData, ollamaUrl: e.target.value})}
placeholder="ex: http://localhost:11434"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="ollamaModel">Nom du modèle</Label>
<Input
id="ollamaModel"
type="text"
value={formData.ollamaModel}
onChange={e => setFormData({...formData, ollamaModel: e.target.value})}
placeholder="ex: qwen:7b, llama3"
/>
<Label htmlFor="aiMode">Mode d'exécution</Label>
<Select
value={formData.aiMode}
onValueChange={(val) => setFormData({...formData, aiMode: val as 'local' | 'remote'})}
>
<SelectTrigger id="aiMode">
<SelectValue placeholder="Choisir un mode" />
</SelectTrigger>
<SelectContent>
<SelectItem value="local">Local (Ollama + SearXNG)</SelectItem>
<SelectItem value="remote">Distant (API Mistral, Claude, ChatGPT, Gemini)</SelectItem>
</SelectContent>
</Select>
</div>
{formData.aiMode === 'local' ? (
<>
<div className="grid gap-2">
<Label htmlFor="ollamaUrl">URL de l'API Ollama</Label>
<Input
id="ollamaUrl"
type="text"
value={formData.ollamaUrl}
onChange={e => setFormData({...formData, ollamaUrl: e.target.value})}
placeholder="ex: http://localhost:11434"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="ollamaModel">Nom du modèle</Label>
<Input
id="ollamaModel"
type="text"
value={formData.ollamaModel}
onChange={e => setFormData({...formData, ollamaModel: e.target.value})}
placeholder="ex: qwen:7b, llama3"
/>
</div>
</>
) : (
<>
<div className="grid gap-2">
<Label htmlFor="remoteProvider">Fournisseur</Label>
<Select
value={formData.remoteProvider}
onValueChange={(val) => setFormData({...formData, remoteProvider: val})}
>
<SelectTrigger id="remoteProvider">
<SelectValue placeholder="Choisir un fournisseur" />
</SelectTrigger>
<SelectContent>
<SelectItem value="mistral">Mistral AI</SelectItem>
<SelectItem value="openai">OpenAI (ChatGPT)</SelectItem>
<SelectItem value="claude">Anthropic (Claude)</SelectItem>
<SelectItem value="gemini">Google (Gemini)</SelectItem>
</SelectContent>
</Select>
</div>
<div className="grid gap-2">
<Label htmlFor="remoteApiKey">Clé API</Label>
<Input
id="remoteApiKey"
type="password"
value={formData.remoteApiKey}
onChange={e => setFormData({...formData, remoteApiKey: e.target.value})}
placeholder="ex: sk-..., ou clé fournie par le fournisseur"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="remoteModel">Modèle</Label>
<Input
id="remoteModel"
type="text"
value={formData.remoteModel}
onChange={e => setFormData({...formData, remoteModel: e.target.value})}
placeholder={REMOTE_MODEL_PLACEHOLDERS[formData.remoteProvider] || ''}
/>
</div>
<div className="grid gap-2">
<Label htmlFor="remoteApiUrl">URL de base personnalisée (optionnel)</Label>
<Input
id="remoteApiUrl"
type="text"
value={formData.remoteApiUrl}
onChange={e => setFormData({...formData, remoteApiUrl: e.target.value})}
placeholder="Laisser vide pour l'API officielle du fournisseur"
/>
</div>
</>
)}
<div className="grid gap-2">
<Label htmlFor="language">Langue de sortie</Label>
<Select
@@ -157,7 +246,8 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
</div>
</section>
{/* Search Integration */}
{/* Search Integration : uniquement utile en mode local (enrichissement de l'IA locale) */}
{formData.aiMode === 'local' && (
<section className="space-y-4">
<div className="flex items-center gap-2 text-amber-500 font-semibold">
<Globe size={18} />
@@ -176,6 +266,7 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
</div>
</div>
</section>
)}
</div>
<DialogFooter className="p-6 border-t bg-muted/10">
+5
View File
@@ -10,9 +10,14 @@ export interface LogService {
export interface GlobalSettings {
notionToken: string;
notionDbId: string;
aiMode?: 'local' | 'remote';
ollamaUrl: string;
ollamaModel: string;
searxngUrl: string;
remoteProvider?: string;
remoteApiKey?: string;
remoteModel?: string;
remoteApiUrl?: string;
aiLanguage?: string;
}