docs: normalisation titres H2 et mises à jour
This commit is contained in:
parent
9cbd862269
commit
fb1a2e17d0
28
docs/API.md
28
docs/API.md
@ -1,4 +1,4 @@
|
|||||||
# API Reference - sdk_relay
|
## API Reference - sdk_relay
|
||||||
|
|
||||||
## Vue d'Ensemble
|
## Vue d'Ensemble
|
||||||
|
|
||||||
@ -10,11 +10,11 @@
|
|||||||
## Base URLs
|
## Base URLs
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# WebSocket
|
## WebSocket
|
||||||
ws://localhost:8090
|
ws://localhost:8090
|
||||||
wss://localhost:8090 # Sécurisé
|
wss://localhost:8090 # Sécurisé
|
||||||
|
|
||||||
# HTTP REST
|
## HTTP REST
|
||||||
http://localhost:8091
|
http://localhost:8091
|
||||||
https://localhost:8091 # Sécurisé
|
https://localhost:8091 # Sécurisé
|
||||||
```
|
```
|
||||||
@ -1213,41 +1213,41 @@ if __name__ == "__main__":
|
|||||||
### Client cURL
|
### Client cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Vérifier la santé
|
## Vérifier la santé
|
||||||
curl -X GET http://localhost:8091/health
|
curl -X GET http://localhost:8091/health
|
||||||
|
|
||||||
# Obtenir les métriques
|
## Obtenir les métriques
|
||||||
curl -X GET http://localhost:8091/metrics
|
curl -X GET http://localhost:8091/metrics
|
||||||
|
|
||||||
# Obtenir la liste des relais
|
## Obtenir la liste des relais
|
||||||
curl -X GET http://localhost:8091/relays
|
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
|
curl -X GET http://localhost:8091/relays/relay-1
|
||||||
|
|
||||||
# Forcer une synchronisation
|
## Forcer une synchronisation
|
||||||
curl -X POST http://localhost:8091/sync/force \
|
curl -X POST http://localhost:8091/sync/force \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"sync_types": ["StateSync", "HealthSync"]}'
|
-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"
|
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"
|
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
|
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...
|
curl -X GET http://localhost:8091/bitcoin/blocks/abc123...
|
||||||
|
|
||||||
# Mettre à jour la configuration
|
## Mettre à jour la configuration
|
||||||
curl -X PUT http://localhost:8091/config \
|
curl -X PUT http://localhost:8091/config \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"sync": {"interval": 60}}'
|
-d '{"sync": {"interval": 60}}'
|
||||||
|
|
||||||
# Redémarrer le service
|
## Redémarrer le service
|
||||||
curl -X POST http://localhost:8091/restart
|
curl -X POST http://localhost:8091/restart
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Architecture - sdk_relay
|
## Architecture - sdk_relay
|
||||||
|
|
||||||
## Vue d'Ensemble
|
## Vue d'Ensemble
|
||||||
|
|
||||||
@ -148,23 +148,23 @@ pub struct CacheEntry {
|
|||||||
|
|
||||||
### Fichier de Configuration (`.conf`)
|
### Fichier de Configuration (`.conf`)
|
||||||
```toml
|
```toml
|
||||||
# Bitcoin Core
|
## Bitcoin Core
|
||||||
core_url=http://bitcoin:18443
|
core_url=http://bitcoin:18443
|
||||||
core_wallet=relay_wallet
|
core_wallet=relay_wallet
|
||||||
zmq_url=tcp://bitcoin:29000
|
zmq_url=tcp://bitcoin:29000
|
||||||
|
|
||||||
# WebSocket
|
## WebSocket
|
||||||
ws_url=0.0.0.0:8090
|
ws_url=0.0.0.0:8090
|
||||||
|
|
||||||
# Blindbit
|
## Blindbit
|
||||||
blindbit_url=http://blindbit:8000
|
blindbit_url=http://blindbit:8000
|
||||||
|
|
||||||
# Synchronisation
|
## Synchronisation
|
||||||
relay_id=relay-1
|
relay_id=relay-1
|
||||||
sync_interval=30
|
sync_interval=30
|
||||||
health_interval=60
|
health_interval=60
|
||||||
|
|
||||||
# Réseau
|
## Réseau
|
||||||
network=signet
|
network=signet
|
||||||
dev_mode=true
|
dev_mode=true
|
||||||
```
|
```
|
||||||
@ -317,13 +317,13 @@ services:
|
|||||||
|
|
||||||
### Logs Utiles
|
### Logs Utiles
|
||||||
```bash
|
```bash
|
||||||
# Logs de synchronisation
|
## Logs de synchronisation
|
||||||
RUST_LOG=debug,bitcoincore_rpc=trace
|
RUST_LOG=debug,bitcoincore_rpc=trace
|
||||||
|
|
||||||
# Logs WebSocket
|
## Logs WebSocket
|
||||||
RUST_LOG=debug,tokio_tungstenite=trace
|
RUST_LOG=debug,tokio_tungstenite=trace
|
||||||
|
|
||||||
# Logs HTTP
|
## Logs HTTP
|
||||||
RUST_LOG=debug,hyper=trace
|
RUST_LOG=debug,hyper=trace
|
||||||
```
|
```
|
||||||
|
|
||||||
|
9
docs/DEPLOYMENT.md
Normal file
9
docs/DEPLOYMENT.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
## DEPLOYMENT
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
### Intégration dans 4NK_node
|
||||||
|
|
||||||
|
### CI/CD appliquée
|
||||||
|
|
||||||
|
### Configuration
|
@ -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.
|
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é)
|
#### Avec Docker (Recommandé)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build de l'image
|
## Build de l'image
|
||||||
docker build -f Dockerfile -t sdk_relay .
|
docker build -f Dockerfile -t sdk_relay .
|
||||||
|
|
||||||
# Démarrage du service
|
## Démarrage du service
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name sdk_relay \
|
--name sdk_relay \
|
||||||
-p 8090:8090 \
|
-p 8090:8090 \
|
||||||
@ -21,40 +21,40 @@ docker run -d \
|
|||||||
-e RUST_LOG=info \
|
-e RUST_LOG=info \
|
||||||
sdk_relay
|
sdk_relay
|
||||||
|
|
||||||
# Vérifier le statut
|
## Vérifier le statut
|
||||||
docker ps | grep sdk_relay
|
docker ps | grep sdk_relay
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Avec Rust (Compilation native)
|
#### Avec Rust (Compilation native)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Compilation release
|
## Compilation release
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
# Démarrage du service
|
## Démarrage du service
|
||||||
cargo run --release -- --config .conf
|
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 &
|
nohup cargo run --release -- --config .conf > sdk_relay.log 2>&1 &
|
||||||
```
|
```
|
||||||
|
|
||||||
### Vérification du Démarrage
|
### Vérification du Démarrage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Test de santé HTTP
|
## Test de santé HTTP
|
||||||
curl http://localhost:8091/health
|
curl http://localhost:8091/health
|
||||||
|
|
||||||
# Réponse attendue
|
## Réponse attendue
|
||||||
{
|
{
|
||||||
"status": "healthy",
|
"status": "healthy",
|
||||||
"timestamp": "2024-01-01T12:00:00Z",
|
"timestamp": "2024-01-01T12:00:00Z",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test WebSocket
|
## Test WebSocket
|
||||||
wscat -c ws://localhost:8090
|
wscat -c ws://localhost:8090
|
||||||
|
|
||||||
# Test métriques
|
## Test métriques
|
||||||
curl http://localhost:8091/metrics
|
curl http://localhost:8091/metrics
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -377,10 +377,10 @@ curl -X DELETE http://localhost:8091/relays/relay_001
|
|||||||
#### Métriques Système
|
#### Métriques Système
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Métriques système
|
## Métriques système
|
||||||
curl http://localhost:8091/metrics/system
|
curl http://localhost:8091/metrics/system
|
||||||
|
|
||||||
# Réponse
|
## Réponse
|
||||||
{
|
{
|
||||||
"cpu_usage_percent": 12.5,
|
"cpu_usage_percent": 12.5,
|
||||||
"memory_usage_mb": 45.2,
|
"memory_usage_mb": 45.2,
|
||||||
@ -392,10 +392,10 @@ curl http://localhost:8091/metrics/system
|
|||||||
#### Métriques Métier
|
#### Métriques Métier
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Métriques métier
|
## Métriques métier
|
||||||
curl http://localhost:8091/metrics/business
|
curl http://localhost:8091/metrics/business
|
||||||
|
|
||||||
# Réponse
|
## Réponse
|
||||||
{
|
{
|
||||||
"payments_processed": 1250,
|
"payments_processed": 1250,
|
||||||
"payments_confirmed": 1200,
|
"payments_confirmed": 1200,
|
||||||
@ -500,20 +500,20 @@ curl http://localhost:8091/metrics/business
|
|||||||
#### Sauvegarde de Configuration
|
#### Sauvegarde de Configuration
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Sauvegarde de la configuration
|
## Sauvegarde de la configuration
|
||||||
cp .conf .conf.backup.$(date +%Y%m%d)
|
cp .conf .conf.backup.$(date +%Y%m%d)
|
||||||
|
|
||||||
# Sauvegarde des logs
|
## Sauvegarde des logs
|
||||||
tar -czf logs_$(date +%Y%m%d).tar.gz logs/
|
tar -czf logs_$(date +%Y%m%d).tar.gz logs/
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Sauvegarde des Données
|
#### Sauvegarde des Données
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Export des données
|
## Export des données
|
||||||
curl http://localhost:8091/export/data > data_export_$(date +%Y%m%d).json
|
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 \
|
curl -X POST http://localhost:8091/import/data \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d @data_export_20240101.json
|
-d @data_export_20240101.json
|
||||||
@ -524,13 +524,13 @@ curl -X POST http://localhost:8091/import/data \
|
|||||||
#### Mise à Jour du Service
|
#### Mise à Jour du Service
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Arrêt du service
|
## Arrêt du service
|
||||||
docker stop sdk_relay
|
docker stop sdk_relay
|
||||||
|
|
||||||
# Pull de la nouvelle image
|
## Pull de la nouvelle image
|
||||||
docker pull sdk_relay:latest
|
docker pull sdk_relay:latest
|
||||||
|
|
||||||
# Redémarrage
|
## Redémarrage
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name sdk_relay_new \
|
--name sdk_relay_new \
|
||||||
-p 8090:8090 \
|
-p 8090:8090 \
|
||||||
@ -538,17 +538,17 @@ docker run -d \
|
|||||||
-v $(pwd)/.conf:/app/.conf \
|
-v $(pwd)/.conf:/app/.conf \
|
||||||
sdk_relay:latest
|
sdk_relay:latest
|
||||||
|
|
||||||
# Vérification
|
## Vérification
|
||||||
curl http://localhost:8091/health
|
curl http://localhost:8091/health
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Migration des Données
|
#### Migration des Données
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Script de migration
|
## Script de migration
|
||||||
./scripts/migrate_data.sh
|
./scripts/migrate_data.sh
|
||||||
|
|
||||||
# Vérification post-migration
|
## Vérification post-migration
|
||||||
cargo test --test migration
|
cargo test --test migration
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ cargo test --test migration
|
|||||||
#### Authentification par Token
|
#### Authentification par Token
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Génération de token
|
## Génération de token
|
||||||
curl -X POST http://localhost:8091/auth/token \
|
curl -X POST http://localhost:8091/auth/token \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
@ -567,7 +567,7 @@ curl -X POST http://localhost:8091/auth/token \
|
|||||||
"password": "secure_password"
|
"password": "secure_password"
|
||||||
}'
|
}'
|
||||||
|
|
||||||
# Utilisation du token
|
## Utilisation du token
|
||||||
curl -H "Authorization: Bearer YOUR_TOKEN" \
|
curl -H "Authorization: Bearer YOUR_TOKEN" \
|
||||||
http://localhost:8091/admin/status
|
http://localhost:8091/admin/status
|
||||||
```
|
```
|
||||||
@ -575,7 +575,7 @@ curl -H "Authorization: Bearer YOUR_TOKEN" \
|
|||||||
#### Authentification par Certificat
|
#### Authentification par Certificat
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Connexion avec certificat client
|
## Connexion avec certificat client
|
||||||
curl --cert client.pem --key client.key \
|
curl --cert client.pem --key client.key \
|
||||||
https://localhost:8091/secure/endpoint
|
https://localhost:8091/secure/endpoint
|
||||||
```
|
```
|
||||||
@ -627,13 +627,13 @@ curl --cert client.pem --key client.key \
|
|||||||
#### Tests de Performance
|
#### Tests de Performance
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Test de charge
|
## Test de charge
|
||||||
ab -n 1000 -c 10 http://localhost:8091/health
|
ab -n 1000 -c 10 http://localhost:8091/health
|
||||||
|
|
||||||
# Test WebSocket
|
## Test WebSocket
|
||||||
./scripts/websocket_benchmark.sh
|
./scripts/websocket_benchmark.sh
|
||||||
|
|
||||||
# Test de synchronisation
|
## Test de synchronisation
|
||||||
cargo test --test performance
|
cargo test --test performance
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -644,39 +644,39 @@ cargo test --test performance
|
|||||||
#### Service ne démarre pas
|
#### Service ne démarre pas
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Vérifier les logs
|
## Vérifier les logs
|
||||||
docker logs sdk_relay
|
docker logs sdk_relay
|
||||||
|
|
||||||
# Vérifier la configuration
|
## Vérifier la configuration
|
||||||
cargo run -- --config .conf --check
|
cargo run -- --config .conf --check
|
||||||
|
|
||||||
# Vérifier les ports
|
## Vérifier les ports
|
||||||
netstat -tlnp | grep 809
|
netstat -tlnp | grep 809
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Connexions WebSocket échouent
|
#### Connexions WebSocket échouent
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Test de connectivité
|
## Test de connectivité
|
||||||
telnet localhost 8090
|
telnet localhost 8090
|
||||||
|
|
||||||
# Vérifier le firewall
|
## Vérifier le firewall
|
||||||
sudo ufw status
|
sudo ufw status
|
||||||
|
|
||||||
# Test avec wscat
|
## Test avec wscat
|
||||||
wscat -c ws://localhost:8090
|
wscat -c ws://localhost:8090
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Synchronisation lente
|
#### Synchronisation lente
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Vérifier les métriques
|
## Vérifier les métriques
|
||||||
curl http://localhost:8091/metrics
|
curl http://localhost:8091/metrics
|
||||||
|
|
||||||
# Vérifier les relais
|
## Vérifier les relais
|
||||||
curl http://localhost:8091/relays
|
curl http://localhost:8091/relays
|
||||||
|
|
||||||
# Forcer une synchronisation
|
## Forcer une synchronisation
|
||||||
curl -X POST http://localhost:8091/sync/force
|
curl -X POST http://localhost:8091/sync/force
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -685,23 +685,23 @@ curl -X POST http://localhost:8091/sync/force
|
|||||||
#### Niveaux de Log
|
#### Niveaux de Log
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Log détaillé
|
## Log détaillé
|
||||||
RUST_LOG=debug cargo run -- --config .conf
|
RUST_LOG=debug cargo run -- --config .conf
|
||||||
|
|
||||||
# Log spécifique
|
## Log spécifique
|
||||||
RUST_LOG=sdk_relay::websocket=debug cargo run -- --config .conf
|
RUST_LOG=sdk_relay::websocket=debug cargo run -- --config .conf
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Analyse des Logs
|
#### Analyse des Logs
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Logs en temps réel
|
## Logs en temps réel
|
||||||
tail -f logs/sdk_relay.log
|
tail -f logs/sdk_relay.log
|
||||||
|
|
||||||
# Recherche d'erreurs
|
## Recherche d'erreurs
|
||||||
grep ERROR logs/sdk_relay.log
|
grep ERROR logs/sdk_relay.log
|
||||||
|
|
||||||
# Statistiques des logs
|
## Statistiques des logs
|
||||||
awk '/ERROR/ {count++} END {print count}' logs/sdk_relay.log
|
awk '/ERROR/ {count++} END {print count}' logs/sdk_relay.log
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user