From fb1a2e17d06bbbe645b2b2d78329bb573e9c7ab9 Mon Sep 17 00:00:00 2001 From: Debian Date: Wed, 3 Sep 2025 08:16:03 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20normalisation=20titres=20H2=20et=20mise?= =?UTF-8?q?s=20=C3=A0=20jour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/API.md | 28 +++++++------- docs/ARCHITECTURE.md | 18 ++++----- docs/DEPLOYMENT.md | 9 +++++ docs/USAGE.md | 90 ++++++++++++++++++++++---------------------- 4 files changed, 77 insertions(+), 68 deletions(-) create mode 100644 docs/DEPLOYMENT.md diff --git a/docs/API.md b/docs/API.md index 3d06d85..fb94fe7 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,4 +1,4 @@ -# API Reference - sdk_relay +## API Reference - sdk_relay ## Vue d'Ensemble @@ -10,11 +10,11 @@ ## Base URLs ```bash -# WebSocket +## WebSocket ws://localhost:8090 wss://localhost:8090 # Sécurisé -# HTTP REST +## HTTP REST http://localhost:8091 https://localhost:8091 # Sécurisé ``` @@ -1213,41 +1213,41 @@ if __name__ == "__main__": ### Client cURL ```bash -# Vérifier la santé +## Vérifier la santé curl -X GET http://localhost:8091/health -# Obtenir les métriques +## Obtenir les métriques curl -X GET http://localhost:8091/metrics -# Obtenir la liste des relais +## Obtenir la liste des relais curl -X GET http://localhost:8091/relays -# Obtenir les détails d'un relais +## Obtenir les détails d'un relais curl -X GET http://localhost:8091/relays/relay-1 -# Forcer une synchronisation +## Forcer une synchronisation curl -X POST http://localhost:8091/sync/force \ -H "Content-Type: application/json" \ -d '{"sync_types": ["StateSync", "HealthSync"]}' -# Obtenir l'historique des synchronisations +## Obtenir l'historique des synchronisations curl -X GET "http://localhost:8091/sync/history?limit=10" -# Obtenir les logs +## Obtenir les logs curl -X GET "http://localhost:8091/logs?level=info&limit=50" -# Obtenir les informations Bitcoin +## Obtenir les informations Bitcoin curl -X GET http://localhost:8091/bitcoin/info -# Obtenir un bloc spécifique +## Obtenir un bloc spécifique curl -X GET http://localhost:8091/bitcoin/blocks/abc123... -# Mettre à jour la configuration +## Mettre à jour la configuration curl -X PUT http://localhost:8091/config \ -H "Content-Type: application/json" \ -d '{"sync": {"interval": 60}}' -# Redémarrer le service +## Redémarrer le service curl -X POST http://localhost:8091/restart ``` diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index bfd38d9..7c91638 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -1,4 +1,4 @@ -# Architecture - sdk_relay +## Architecture - sdk_relay ## Vue d'Ensemble @@ -148,23 +148,23 @@ pub struct CacheEntry { ### Fichier de Configuration (`.conf`) ```toml -# Bitcoin Core +## Bitcoin Core core_url=http://bitcoin:18443 core_wallet=relay_wallet zmq_url=tcp://bitcoin:29000 -# WebSocket +## WebSocket ws_url=0.0.0.0:8090 -# Blindbit +## Blindbit blindbit_url=http://blindbit:8000 -# Synchronisation +## Synchronisation relay_id=relay-1 sync_interval=30 health_interval=60 -# Réseau +## Réseau network=signet dev_mode=true ``` @@ -317,13 +317,13 @@ services: ### Logs Utiles ```bash -# Logs de synchronisation +## Logs de synchronisation RUST_LOG=debug,bitcoincore_rpc=trace -# Logs WebSocket +## Logs WebSocket RUST_LOG=debug,tokio_tungstenite=trace -# Logs HTTP +## Logs HTTP RUST_LOG=debug,hyper=trace ``` diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md new file mode 100644 index 0000000..6f48af9 --- /dev/null +++ b/docs/DEPLOYMENT.md @@ -0,0 +1,9 @@ +## DEPLOYMENT + +### Docker + +### Intégration dans 4NK_node + +### CI/CD appliquée + +### Configuration diff --git a/docs/USAGE.md b/docs/USAGE.md index c95931f..acbcae6 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -1,4 +1,4 @@ -# 📖 Guide d'Utilisation - sdk_relay +## 📖 Guide d'Utilisation - sdk_relay Guide complet pour utiliser le service de relais sdk_relay au quotidien. @@ -9,10 +9,10 @@ Guide complet pour utiliser le service de relais sdk_relay au quotidien. #### Avec Docker (Recommandé) ```bash -# Build de l'image +## Build de l'image docker build -f Dockerfile -t sdk_relay . -# Démarrage du service +## Démarrage du service docker run -d \ --name sdk_relay \ -p 8090:8090 \ @@ -21,40 +21,40 @@ docker run -d \ -e RUST_LOG=info \ sdk_relay -# Vérifier le statut +## Vérifier le statut docker ps | grep sdk_relay ``` #### Avec Rust (Compilation native) ```bash -# Compilation release +## Compilation release cargo build --release -# Démarrage du service +## Démarrage du service cargo run --release -- --config .conf -# Ou en arrière-plan +## Ou en arrière-plan nohup cargo run --release -- --config .conf > sdk_relay.log 2>&1 & ``` ### Vérification du Démarrage ```bash -# Test de santé HTTP +## Test de santé HTTP curl http://localhost:8091/health -# Réponse attendue +## Réponse attendue { "status": "healthy", "timestamp": "2024-01-01T12:00:00Z", "version": "1.0.0" } -# Test WebSocket +## Test WebSocket wscat -c ws://localhost:8090 -# Test métriques +## Test métriques curl http://localhost:8091/metrics ``` @@ -377,10 +377,10 @@ curl -X DELETE http://localhost:8091/relays/relay_001 #### Métriques Système ```bash -# Métriques système +## Métriques système curl http://localhost:8091/metrics/system -# Réponse +## Réponse { "cpu_usage_percent": 12.5, "memory_usage_mb": 45.2, @@ -392,10 +392,10 @@ curl http://localhost:8091/metrics/system #### Métriques Métier ```bash -# Métriques métier +## Métriques métier curl http://localhost:8091/metrics/business -# Réponse +## Réponse { "payments_processed": 1250, "payments_confirmed": 1200, @@ -500,20 +500,20 @@ curl http://localhost:8091/metrics/business #### Sauvegarde de Configuration ```bash -# Sauvegarde de la configuration +## Sauvegarde de la configuration cp .conf .conf.backup.$(date +%Y%m%d) -# Sauvegarde des logs +## Sauvegarde des logs tar -czf logs_$(date +%Y%m%d).tar.gz logs/ ``` #### Sauvegarde des Données ```bash -# Export des données +## Export des données curl http://localhost:8091/export/data > data_export_$(date +%Y%m%d).json -# Import des données +## Import des données curl -X POST http://localhost:8091/import/data \ -H "Content-Type: application/json" \ -d @data_export_20240101.json @@ -524,13 +524,13 @@ curl -X POST http://localhost:8091/import/data \ #### Mise à Jour du Service ```bash -# Arrêt du service +## Arrêt du service docker stop sdk_relay -# Pull de la nouvelle image +## Pull de la nouvelle image docker pull sdk_relay:latest -# Redémarrage +## Redémarrage docker run -d \ --name sdk_relay_new \ -p 8090:8090 \ @@ -538,17 +538,17 @@ docker run -d \ -v $(pwd)/.conf:/app/.conf \ sdk_relay:latest -# Vérification +## Vérification curl http://localhost:8091/health ``` #### Migration des Données ```bash -# Script de migration +## Script de migration ./scripts/migrate_data.sh -# Vérification post-migration +## Vérification post-migration cargo test --test migration ``` @@ -559,7 +559,7 @@ cargo test --test migration #### Authentification par Token ```bash -# Génération de token +## Génération de token curl -X POST http://localhost:8091/auth/token \ -H "Content-Type: application/json" \ -d '{ @@ -567,7 +567,7 @@ curl -X POST http://localhost:8091/auth/token \ "password": "secure_password" }' -# Utilisation du token +## Utilisation du token curl -H "Authorization: Bearer YOUR_TOKEN" \ http://localhost:8091/admin/status ``` @@ -575,7 +575,7 @@ curl -H "Authorization: Bearer YOUR_TOKEN" \ #### Authentification par Certificat ```bash -# Connexion avec certificat client +## Connexion avec certificat client curl --cert client.pem --key client.key \ https://localhost:8091/secure/endpoint ``` @@ -627,13 +627,13 @@ curl --cert client.pem --key client.key \ #### Tests de Performance ```bash -# Test de charge +## Test de charge ab -n 1000 -c 10 http://localhost:8091/health -# Test WebSocket +## Test WebSocket ./scripts/websocket_benchmark.sh -# Test de synchronisation +## Test de synchronisation cargo test --test performance ``` @@ -644,39 +644,39 @@ cargo test --test performance #### Service ne démarre pas ```bash -# Vérifier les logs +## Vérifier les logs docker logs sdk_relay -# Vérifier la configuration +## Vérifier la configuration cargo run -- --config .conf --check -# Vérifier les ports +## Vérifier les ports netstat -tlnp | grep 809 ``` #### Connexions WebSocket échouent ```bash -# Test de connectivité +## Test de connectivité telnet localhost 8090 -# Vérifier le firewall +## Vérifier le firewall sudo ufw status -# Test avec wscat +## Test avec wscat wscat -c ws://localhost:8090 ``` #### Synchronisation lente ```bash -# Vérifier les métriques +## Vérifier les métriques curl http://localhost:8091/metrics -# Vérifier les relais +## Vérifier les relais curl http://localhost:8091/relays -# Forcer une synchronisation +## Forcer une synchronisation curl -X POST http://localhost:8091/sync/force ``` @@ -685,23 +685,23 @@ curl -X POST http://localhost:8091/sync/force #### Niveaux de Log ```bash -# Log détaillé +## Log détaillé RUST_LOG=debug cargo run -- --config .conf -# Log spécifique +## Log spécifique RUST_LOG=sdk_relay::websocket=debug cargo run -- --config .conf ``` #### Analyse des Logs ```bash -# Logs en temps réel +## Logs en temps réel tail -f logs/sdk_relay.log -# Recherche d'erreurs +## Recherche d'erreurs grep ERROR logs/sdk_relay.log -# Statistiques des logs +## Statistiques des logs awk '/ERROR/ {count++} END {print count}' logs/sdk_relay.log ```