diff --git a/CHANGELOG.md b/CHANGELOG.md index bc51eb8..08100d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ Toutes les modifications notables de ce projet seront documentées dans ce fichi Le format est basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/), et ce projet adhère au [Versioning Sémantique](https://semver.org/lang/fr/). +## [1.2.1] - 2025-01-10 + +### Corrigé +- **Configuration MinIO** : Correction de l'endpoint MinIO dans docker-compose.yml (suppression du protocole http://) +- **Fichier d'environnement** : Création automatique du fichier .env avec les bonnes configurations +- **Documentation** : Mise à jour des guides d'installation avec les corrections apportées + +### Ajouté +- **Script de démarrage** : Nouveau script `start-stack.sh` pour faciliter le déploiement +- **Section de dépannage** : Ajout d'une section de dépannage dans la documentation +- **Commandes de diagnostic** : Ajout de commandes utiles pour le diagnostic des problèmes + +### Supprimé +- **docker-compose.simple.yml** : Suppression du fichier docker-compose simplifié (remplacé par le script de démarrage) + ## [1.2.0] - 2025-01-09 ### Ajouté diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ebe31b7..9c2c895 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Merci de votre intérêt pour contribuer au Pipeline Notarial ! Ce document expl ### Signaler un bug -1. Vérifiez que le bug n'a pas déjà été signalé dans les [issues](https://github.com/4nkweb/notariat-pipeline/issues) +1. Vérifiez que le bug n'a pas déjà été signalé dans les [issues](https://git.4nkweb.com/notariat-pipeline/issues) 2. Créez une nouvelle issue avec le label "bug" 3. Incluez : - Description détaillée du problème diff --git a/README.md b/README.md index c11c428..f4c2af5 100644 --- a/README.md +++ b/README.md @@ -66,25 +66,33 @@ chmod +x ops/bootstrap.sh # Ou installation manuelle cd infra -cp .env.example .env -# Éditer .env avec vos paramètres -docker-compose up -d +# Le fichier .env est créé automatiquement avec les valeurs par défaut +docker compose up -d ``` -### Installation +### Démarrage Rapide ```bash # 1. Cloner le projet -git clone -cd 4NK_IA +git clone https://git.4nkweb.com/4nk/4NK_IA_back.git +cd 4NK_IA_back -# 2. Démarrage automatique -./start_notary_system.sh +# 2. Démarrage automatique (recommandé) +./start-stack.sh + +# Ou démarrage manuel +cd infra +docker compose up -d + +# 3. Vérification +curl http://localhost:8000/api/health ``` -### Accès -- **Interface Web** : http://localhost:8080 -- **API Documentation** : http://localhost:8000/docs +### Accès aux Services +- **API Notariale** : http://localhost:8000 +- **Documentation API** : http://localhost:8000/docs - **MinIO Console** : http://localhost:9001 +- **PostgreSQL** : localhost:5432 +- **Redis** : localhost:6379 ## 📋 Types de Documents Supportés @@ -260,7 +268,7 @@ pip install -r docker/host-api/requirements.txt ### Ressources - **Documentation** : `docs/` directory - **Tests** : `tests/` directory -- **Issues** : GitHub Issues +- **Issues** : git.4nkweb.com Issues ### Contact - **Email** : support@4nkweb.com diff --git a/docs/API-NOTARIALE.md b/docs/API-NOTARIALE.md index b735fed..b37d26b 100644 --- a/docs/API-NOTARIALE.md +++ b/docs/API-NOTARIALE.md @@ -434,7 +434,7 @@ export OLLAMA_DEFAULT_MODEL=llama3:70b ### Documentation - **API Docs** : http://localhost:8000/docs - **Code Source** : Repository Git -- **Issues** : GitHub Issues +- **Issues** : git.4nkweb.com Issues ### Contact - **Email** : support@4nkweb.com diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index d861016..09c39b8 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -407,7 +407,7 @@ CACHE_TTL = { ### **Pipeline de Déploiement** ```yaml -# .github/workflows/deploy.yml +# .gitea/workflows/deploy.yml name: Deploy on: push: diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index ad11e33..ed067cf 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -35,6 +35,10 @@ Le script bootstrap configure automatiquement : - 🗄️ MinIO Console : http://localhost:9001 - 🦙 Ollama : http://localhost:11434 +## ⚠️ Configuration MinIO + +**Important** : Le fichier `.env` est créé automatiquement avec les bonnes configurations. Si vous rencontrez des erreurs MinIO, vérifiez que `MINIO_ENDPOINT` ne contient pas de protocole (ex: `minio:9000` et non `http://minio:9000`). + ## 📋 Prérequis ### **Système d'Exploitation** @@ -653,6 +657,54 @@ docker run --rm -v 4nk_ia_pgdata:/data -v $(pwd):/backup alpine tar czf /backup/ - [ ] **Accès** restreint - [ ] **Sauvegardes** configurées +## 🔧 Dépannage + +### **Problèmes Courants** + +#### Erreur MinIO "path in endpoint is not allowed" +```bash +# Symptôme : L'API redémarre constamment avec cette erreur +# Solution : Vérifier la configuration MINIO_ENDPOINT +grep MINIO_ENDPOINT infra/.env +# Doit afficher : MINIO_ENDPOINT=minio:9000 (sans http://) +``` + +#### Services non accessibles +```bash +# Vérifier le statut des conteneurs +docker compose ps + +# Vérifier les logs +docker compose logs host-api + +# Redémarrer un service +docker compose restart host-api +``` + +#### Ports déjà utilisés +```bash +# Vérifier les ports utilisés +netstat -tulpn | grep :8000 + +# Changer les ports dans docker-compose.yml si nécessaire +``` + +### **Commandes de Diagnostic** +```bash +# Test de l'API +curl http://localhost:8000/api/health + +# Test de MinIO +curl http://localhost:9001 + +# Vérification des volumes +docker volume ls | grep infra + +# Nettoyage complet +docker compose down -v +docker system prune -f +``` + ## 🆘 Support ### **Documentation** @@ -662,7 +714,7 @@ docker run --rm -v 4nk_ia_pgdata:/data -v $(pwd):/backup alpine tar czf /backup/ - **NETWORK.md** : Architecture réseau ### **Communauté** -- **Issues GitHub** : Signalement de bugs +- **Issues git.4nkweb.com** : Signalement de bugs - **Discussions** : Questions et suggestions - **Wiki** : Documentation communautaire diff --git a/docs/installation-setup.md b/docs/installation-setup.md index f51f3fe..776ab81 100644 --- a/docs/installation-setup.md +++ b/docs/installation-setup.md @@ -8,17 +8,16 @@ - **Utilisateur** : `ncantu` - **Email** : `ncantu@4nkweb.com` - **Branche par défaut** : `main` -- **Configuration SSH automatique** pour `git.4nkweb.com` et `github.com` +- **Configuration SSH automatique** pour `git.4nkweb.com` #### Clé SSH générée - **Type** : ED25519 (recommandé pour la sécurité) - **Emplacement** : `~/.ssh/id_ed25519` -- **Clé publique** : `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAK/Zjov/RCp1n3rV2rZQsJ5jKqfpF1OAlA6CoKRNbbT ncantu@4nkweb.com` +- **Clé publique** : `` #### Configuration SSH Fichier `~/.ssh/config` configuré pour : - `git.4nkweb.com` (serveur Gitea 4NK) -- `github.com` (GitHub) ### 🔄 Installation des prérequis en cours @@ -83,15 +82,12 @@ cat ~/.ssh/id_ed25519.pub Ajoutez cette clé dans : - **git.4nkweb.com** : Paramètres SSH de votre compte -- **GitHub** : Settings > SSH and GPG keys #### 2. Tester la connexion SSH ```bash # Tester git.4nkweb.com ssh -T git@git.4nkweb.com -# Tester GitHub -ssh -T git@github.com ``` #### 3. Installation des dépendances Python diff --git a/infra/docker-compose.simple.yml b/infra/docker-compose.simple.yml deleted file mode 100644 index b27bf35..0000000 --- a/infra/docker-compose.simple.yml +++ /dev/null @@ -1,83 +0,0 @@ -x-env: &default-env - TZ: ${TZ} - PUID: "1000" - PGID: "1000" - -services: - postgres: - image: postgres:16 - environment: - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DB: ${POSTGRES_DB} - volumes: - - pgdata:/var/lib/postgresql/data - ports: - - "15432:5432" - restart: unless-stopped - - redis: - image: redis:7 - command: ["redis-server", "--appendonly", "yes"] - volumes: - - redis:/data - ports: - - "16379:6379" - restart: unless-stopped - - minio: - image: minio/minio:latest - command: server /data --console-address ":9001" - environment: - MINIO_ROOT_USER: ${MINIO_ROOT_USER} - MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} - volumes: - - minio:/data - ports: - - "19000:9000" - - "19001:9001" - restart: unless-stopped - - host-api: - image: notariat-api-simple - env_file: ./.env - environment: - <<: *default-env - DATABASE_URL: postgresql+psycopg://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB - REDIS_URL: redis://redis:6379/0 - MINIO_ENDPOINT: http://minio:9000 - MINIO_BUCKET: ${MINIO_BUCKET} - volumes: - - ../services/host_api:/app - - ../ops/seed:/seed:ro - - ../ops/seed/schemas:/schemas:ro - ports: - - "18000:8000" - depends_on: - - postgres - - redis - - minio - restart: unless-stopped - -# Worker désactivé pour la version simplifiée - # worker: - # build: - # context: ../docker/worker - # env_file: ./.env - # environment: - # <<: *default-env - # DATABASE_URL: postgresql+psycopg://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB - # REDIS_URL: redis://redis:6379/0 - # MINIO_ENDPOINT: http://minio:9000 - # MINIO_BUCKET: ${MINIO_BUCKET} - # volumes: - # - ../services/worker:/app - # - ../ops/seed:/seed:ro - # depends_on: - # - host-api - # restart: unless-stopped - -volumes: - pgdata: - redis: - minio: diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml index 5a8cfd9..a45a861 100644 --- a/infra/docker-compose.yml +++ b/infra/docker-compose.yml @@ -90,7 +90,7 @@ services: <<: *default-env DATABASE_URL: postgresql+psycopg://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB REDIS_URL: redis://redis:6379/0 - MINIO_ENDPOINT: http://minio:9000 + MINIO_ENDPOINT: minio:9000 MINIO_BUCKET: ${MINIO_BUCKET} ANYLLM_BASE_URL: ${ANYLLM_BASE_URL} ANYLLM_API_KEY: ${ANYLLM_API_KEY} @@ -120,7 +120,7 @@ services: <<: *default-env DATABASE_URL: postgresql+psycopg://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB REDIS_URL: redis://redis:6379/0 - MINIO_ENDPOINT: http://minio:9000 + MINIO_ENDPOINT: minio:9000 MINIO_BUCKET: ${MINIO_BUCKET} ANYLLM_BASE_URL: ${ANYLLM_BASE_URL} ANYLLM_API_KEY: ${ANYLLM_API_KEY} diff --git a/services/host_api/app.py b/services/host_api/app.py index f24eba9..03fa449 100644 --- a/services/host_api/app.py +++ b/services/host_api/app.py @@ -22,7 +22,7 @@ logger = logging.getLogger(__name__) app = FastAPI( title="Notariat Pipeline API", description="API d'ingestion et d'orchestration pour le traitement de documents notariaux", - version="1.2.0" + version="1.2.1" ) # Configuration CORS diff --git a/start-stack.sh b/start-stack.sh new file mode 100644 index 0000000..4b8cbea --- /dev/null +++ b/start-stack.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +# Script de démarrage de la stack 4NK_IA_back +# Usage: ./start-stack.sh + +set -euo pipefail + +echo "🚀 Démarrage de la stack 4NK_IA_back..." + +# Vérifier que nous sommes dans le bon répertoire +if [ ! -f "requirements-test.txt" ]; then + echo "❌ Erreur: Ce script doit être exécuté depuis le répertoire racine du projet 4NK_IA_back" + exit 1 +fi + +# Vérifier Docker +if ! command -v docker >/dev/null 2>&1; then + echo "❌ Docker n'est pas installé" + exit 1 +fi + +if ! docker ps >/dev/null 2>&1; then + echo "❌ Docker n'est pas démarré" + exit 1 +fi + +# Aller dans le répertoire infra +cd infra + +# Créer le fichier .env s'il n'existe pas +if [ ! -f .env ]; then + echo "📝 Création du fichier .env..." + cat > .env << 'EOF' +# Configuration de l'environnement 4NK_IA_back +# Fichier généré automatiquement pour le démarrage de la stack + +# Configuration générale +TZ=Europe/Paris +PUID=1000 +PGID=1000 + +# Configuration PostgreSQL +POSTGRES_USER=notariat +POSTGRES_PASSWORD=notariat_pwd +POSTGRES_DB=notariat + +# Configuration MinIO +MINIO_ROOT_USER=minio +MINIO_ROOT_PASSWORD=minio_pwd +MINIO_BUCKET=ingest +MINIO_ENDPOINT=minio:9000 + +# Configuration Neo4j +NEO4J_AUTH=neo4j/neo4j_pwd + +# Configuration OpenSearch +OPENSEARCH_PASSWORD=opensearch_pwd + +# Configuration AnythingLLM +ANYLLM_BASE_URL=http://anythingsqlite:3001 +ANYLLM_API_KEY=notariat_api_key_2025 +ANYLLM_WORKSPACE_NORMES=workspace_normes +ANYLLM_WORKSPACE_TRAMES=workspace_trames +ANYLLM_WORKSPACE_ACTES=workspace_actes + +# Configuration Ollama +OLLAMA_BASE_URL=http://ollama:11434 + +# Configuration des URLs externes (pour les tests) +EXTERNAL_ANYLLM_BASE_URL=http://localhost:3001 +EXTERNAL_OLLAMA_BASE_URL=http://localhost:11434 +EOF + echo "✅ Fichier .env créé" +else + echo "✅ Fichier .env existe déjà" +fi + +# Démarrer les services +echo "🐳 Démarrage des services Docker..." +docker compose up -d + +# Attendre que les services soient prêts +echo "⏳ Attente du démarrage des services..." +sleep 15 + +# Vérifier l'API +echo "🔍 Vérification de l'API..." +if curl -s http://localhost:8000/api/health > /dev/null; then + echo "✅ API accessible sur http://localhost:8000" +else + echo "⚠️ API non accessible, vérifiez les logs avec: docker compose logs host-api" +fi + +# Afficher le statut +echo "📊 Statut des services:" +docker compose ps + +echo "" +echo "🎉 Stack 4NK_IA_back démarrée !" +echo "" +echo "📋 Services disponibles:" +echo " • API Notariale: http://localhost:8000" +echo " • Documentation API: http://localhost:8000/docs" +echo " • MinIO Console: http://localhost:9001" +echo " • PostgreSQL: localhost:5432" +echo " • Redis: localhost:6379" +echo "" +echo "🔧 Commandes utiles:" +echo " • Voir les logs: docker compose logs -f" +echo " • Arrêter: docker compose down" +echo " • Redémarrer: docker compose restart"