ci: docker_tag=ext - Update configurations and monitoring scripts for deployment

This commit is contained in:
Nicolas Cantu 2025-09-21 22:13:01 +00:00
parent 282cdae489
commit 2af9890b07
33 changed files with 1011 additions and 1121 deletions

View File

@ -1,24 +1,25 @@
# ===========================================
# VARIABLES D'ENVIRONNEMENT MASTER LECOFFRE
# ===========================================
# Variables d'environnement pour l'application back-end
NODE_OPTIONS=--max-old-space-size=2048
NODE_ENV=production
# Configuration IDNOT
IDNOT_ANNUARY_BASE_URL=https://qual-api.notaires.fr/annuaire
# IDNOT_REDIRECT_URI=http://local.4nkweb.com:3004/authorized-client
IDNOT_REDIRECT_URI=http://local.4nkweb.com:3000/authorized-client
IDNOT_TOKEN_URL=https://qual-connexion.idnot.fr/user/IdPOAuth2/token/idnot_idp_v1
IDNOT_API_BASE_URL=https://qual-api.notaires.fr
# Configuration serveur
APP_HOST=dev4.4nkweb.com
# API_BASE_URL=https://demo.4nkweb.com/back
API_BASE_URL=https://dev4.4nkweb.com/back
# DEFAULT_STORAGE=https://demo.4nkweb.com/storage
DEFAULT_STORAGE=https://dev4.4nkweb.com/storage
# Variables d'environnement pour l'application front-end
# NEXT_PUBLIC_4NK_URL=http://demo.4nkweb.com/
NEXT_PUBLIC_4NK_URL=https://dev4.4nkweb.com
# NEXT_PUBLIC_FRONT_APP_HOST=https://demo.4nkweb.com
NEXT_PUBLIC_FRONT_APP_HOST=https://dev4.4nkweb.com/lecoffre
NEXT_PUBLIC_IDNOT_BASE_URL=https://qual-connexion.idnot.fr
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT=/IdPOAuth2/authorize/idnot_idp_v1
@ -27,83 +28,125 @@ NEXT_PUBLIC_BACK_API_HOST=dev4.4nkweb.com
NEXT_PUBLIC_BACK_API_PORT=443
NEXT_PUBLIC_BACK_API_ROOT_URL=/api
NEXT_PUBLIC_BACK_API_VERSION=v1
# NEXT_PUBLIC_ANK_BASE_REDIRECT_URI='http://local.4nkweb.com:3004/authorized-client'
NEXT_PUBLIC_ANK_BASE_REDIRECT_URI=https://dev4.4nkweb.com/lecoffre/authorized-client
NEXT_PUBLIC_TARGET_ORIGIN=https://dev4.4nkweb.com/lecoffre
NEXT_PUBLIC_4NK_IFRAME_URL=https://dev4.4nkweb.com
NEXT_PUBLIC_IDNOT_REDIRECT_URI=https://dev4.4nkweb.com/lecoffre/authorized-client
# ===========================================
# VARIABLES SDK_RELAY
# ===========================================
SDK_RELAY_CORE_URL=http://bitcoin:38332
SDK_RELAY_WS_URL=0.0.0.0:8090
SDK_RELAY_WALLET_NAME=default
SDK_RELAY_NETWORK=signet
SDK_RELAY_BLINDBIT_URL=http://blindbit-proxy:8000
SDK_RELAY_ZMQ_URL=tcp://bitcoin:29000
SDK_RELAY_STORAGE=https://dev4.4nkweb.com/storage
SDK_RELAY_DATA_DIR=/home/bitcoin/.4nk
SDK_RELAY_BITCOIN_DATA_DIR=/home/bitcoin/.bitcoin
SDK_RELAY_BOOTSTRAP_URL=ws://dev3.4nkweb.com:8090
SDK_RELAY_BOOTSTRAP_FAUCET=true
SDK_RELAY_RUST_LOG=DEBUG,reqwest=DEBUG,tokio_tungstenite=DEBUG
NEXT_PUBLIC_DOCAPOSTE_API_URL=
NEXT_PUBLIC_API_URL=https://dev4.4nkweb.com/api
NEXT_PUBLIC_DEFAULT_VALIDATOR_ID=28c9a3a8151bef545ebf700ca5222c63d0031ad593097e95c1de202464304a99
NEXT_PUBLIC_DEFAULT_STORAGE_URLS=https://dev4.4nkweb.com/storage
# WS
# RELAY_URLS=wss://demo.4nkweb.com/ws
RELAY_URLS=wss://dev4.4nkweb.com/ws/,wss://dev3.4nkweb.com/ws/
# SIGNER_WS_URL=ws://dev4.4nkweb.com/signer/
SIGNER_WS_URL=ws://dev3.4nkweb.com:9090
SIGNER_BASE_URL=https://dev3.4nkweb.com
# IHM URLS
# VITE_BOOTSTRAPURL=http://sdk_relay:8090/
VITE_BOOTSTRAPURL=wss://dev3.4nkweb.com/ws/
# Cartes de test Stripe
SUCCES='4242 4242 4242 4242'
DECLINED='4000 0025 0000 3155'
ENABLE_SUBSCRIPTION_STUB=true
CORS_ALLOWED_ORIGINS=http://local.4nkweb.com:3000,https://dev4.4nkweb.com
core_url=http://bitcoin:38332
ws_url=0.0.0.0:8090
wallet_name=default
network=signet
blindbit_url=http://blindbit:8000
zmq_url=tcp://bitcoin:29000
storage=https://dev4.4nkweb.com/storage
data_dir=/home/bitcoin/.4nk
bitcoin_data_dir=/home/bitcoin/.bitcoin
bootstrap_url=wss://dev3.4nkweb.com/ws/
bootstrap_faucet=true
RUST_LOG=DEBUG,
NODE_OPTIONS=--max-old-space-size=2048
# ================== /!\ sensible =========================
# Configuration IDNOT
IDNOT_API_KEY=ba557f84-0bf6-4dbf-844f-df2767555e3e
IDNOT_CLIENT_ID=B3CE56353EDB15A9
IDNOT_CLIENT_SECRET=3F733549E879878344B6C949B366BB5CDBB2DB5B7F7AB7EBBEBB0F0DD0776D1C
NEXT_PUBLIC_IDNOT_CLIENT_ID=B3CE56353EDB15A9
# Configuration OVH
OVH_APP_KEY=5ab0709bbb65ef26
OVH_APP_SECRET=de1fac1779d707d263a611a557cd5766
OVH_CONSUMER_KEY=5fe817829b8a9c780cfa2354f8312ece
OVH_SMS_SERVICE_NAME=sms-tt802880-1
OVH_APPLICATION_KEY=5ab0709bbb65ef26
OVH_APPLICATION_SECRET=de1fac1779d707d263a611a557cd5766
OVH_SERVICE_NAME=sms-tt802880-1
# Configuration SMS Factor
SMS_FACTOR_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4NzgzNiIsImlhdCI6MTcwMTMzOTY1Mi45NDUzOH0.GNoqLb5MDBWuniNlQjbr1PKolwxGqBZe_tf4IMObvHw
# Configuration Mailchimp
MAILCHIMP_API_KEY=md-VVfaml-ApIV4nsGgaJKl0A
MAILCHIMP_KEY=3fa54304bc766dfd0b8043a827b28a3a-us17
MAILCHIMP_LIST_ID=a48d9ad852
# Configuration Stripe
STRIPE_SECRET_KEY=sk_test_51OwKmMP5xh1u9BqSeFpqw0Yr15hHtFsh0pvRGaE0VERhlYtvw33ND1qiGA6Dy1DPmmV61B6BqIimlhuv7bwElhjF00PLQwD60n
STRIPE_PUBLISHABLE_KEY=pk_test_51OwKmMP5xh1u9BqSeFpqw0Yr15hHtFsh0pvRGaE0VERhlYtvw33ND1qiGA6Dy1DPmmV61B6BqIimlhuv7bwElhjF00PLQwD60n
STRIPE_WEBHOOK_SECRET=
STRIPE_STANDARD_SUBSCRIPTION_PRICE_ID=price_1P66fuP5xh1u9BqSHj0O6Uy3
STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID=price_1P9NsRP5xh1u9BqSFgkUDbQY
STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID=price_1P66RqP5xh1u9BqSuUzkQNac
STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID=price_1P9NpKP5xh1u9BqSApFogvUB
# ===========================================
# VARIABLES SDK_SIGNER
# ===========================================
SIGNER_API_KEY=your-api-key-change-this
VITE_JWT_SECRET_KEY=52b3d77617bb00982dfee15b08effd52cfe5b2e69b2f61cc4848cfe1e98c0bc9
# Configuration pour réduire les traces Docker
DOCKER_LOG_LEVEL=info
COMPOSE_LOG_LEVEL=WARNING
# ===========================================
# VARIABLES SDK_SIGNER (manquantes)
# ===========================================
SIGNER_PORT=9090
SIGNER_DATABASE_PATH=./data/server.db
SIGNER_RELAY_URLS=http://localhost:8090
SIGNER_RELAY_URLS=wss://dev4.4nkweb.com/ws/,wss://dev3.4nkweb.com/ws/
SIGNER_AUTO_RESTART=true
SIGNER_MAX_RESTARTS=3
SIGNER_LOG_LEVEL=info
# ===========================================
# VARIABLES IHM_CLIENT
# VARIABLES SDK_RELAY (formatées pour docker-compose)
# ===========================================
SDK_RELAY_CORE_URL=http://bitcoin:38332
SDK_RELAY_WS_URL=0.0.0.0:8090
SDK_RELAY_WALLET_NAME=default
SDK_RELAY_NETWORK=signet
SDK_RELAY_BLINDBIT_URL=http://blindbit:8000
SDK_RELAY_ZMQ_URL=tcp://bitcoin:29000
SDK_RELAY_STORAGE=https://dev4.4nkweb.com/storage
SDK_RELAY_DATA_DIR=/app/.4nk
SDK_RELAY_BITCOIN_DATA_DIR=/app/.bitcoin
SDK_RELAY_BOOTSTRAP_URL=wss://dev3.4nkweb.com/ws/
SDK_RELAY_BOOTSTRAP_FAUCET=true
# ===========================================
# VARIABLES IHM_CLIENT (formatées pour docker-compose)
# ===========================================
VITE_JWT_SECRET_KEY=52b3d77617bb00982dfee15b08effd52cfe5b2e69b2f61cc4848cfe1e98c0bc9
VITE_API_BASE_URL=https://dev4.4nkweb.com/back/api/v1
VITE_WS_URL=wss://dev4.4nkweb.com/ws/
VITE_STORAGE_URL=https://dev4.4nkweb.com/storage
VITE_SIGNER_URL=https://dev4.4nkweb.com/signer
# ===========================================
# VARIABLES STRIPE (si nécessaire)
# ===========================================
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# ===========================================
# VARIABLES MAILCHIMP (si nécessaire)
# ===========================================
MAILCHIMP_API_KEY=your_mailchimp_api_key
MAILCHIMP_SERVER_PREFIX=us1
MAILCHIMP_LIST_ID=your_list_id
# ===========================================
# VARIABLES OVH SMS (si nécessaire)
# ===========================================
OVH_APPLICATION_KEY=your_ovh_app_key
OVH_APPLICATION_SECRET=your_ovh_app_secret
OVH_CONSUMER_KEY=your_ovh_consumer_key
OVH_SERVICE_NAME=your_ovh_service
# ===========================================
# VARIABLES BASE DE DONNÉES (si nécessaire)
# ===========================================
DATABASE_URL=postgresql://user:password@localhost:5432/lecoffre
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=lecoffre
DATABASE_USER=lecoffre_user
DATABASE_PASSWORD=lecoffre_password
# ===========================================
# VARIABLES REDIS (si nécessaire)
# ===========================================
REDIS_URL=redis://localhost:6379
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
# ===========================================
# VARIABLES MONITORING
# ===========================================
@ -111,3 +154,9 @@ GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=admin123
LOKI_URL=http://loki:3100
PROMTAIL_CONFIG_FILE=/etc/promtail/config.yml
# ===========================================
# VARIABLES MANQUANTES POUR DOCKER-COMPOSE
# ===========================================
# Mailchimp
MAILCHIMP_SERVER_PREFIX=us17

92
.gitignore vendored
View File

@ -1,82 +1,14 @@
# Secrets et fichiers sensibles
.env
.env.*
!.env.example
!.env.exemple
env.master
*.key
*.pem
*.p12
*.pfx
secrets/
keys/
!.env.master
miner/.env
miner/signet/priv_key.json
# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Données et volumes
data/
volumes/
bitcoin_data/
sdk_data/
grafana_data/
loki_data/
blindbit_data/
# Backups
backup/
*.backup
*.bak
# Docker
.dockerignore
docker-compose.override.yml
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.npm
.yarn-integrity
# Next.js
.next/
out/
build/
dist/
# Rust
target/
Cargo.lock
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# Temporary files
tmp/
temp/
*.tmp
*.temp
# SSL certificates
*.crt
*.csr
ssl/
# Configuration locale
local.conf
local.yml
local.json
# Sensibles et générés
.cursor/
log/*.log
miner/.env.signet
miner/tools/*.json
conf/nginx/*bak*
conf/nginx/*.tmp
conf/nginx/*.clean
.env.bak

View File

@ -1,11 +1,11 @@
core_url="http://bitcoin:38332"
ws_url="0.0.0.0:8090"
wallet_name="default"
network="signet"
blindbit_url="http://blindbit-oracle:8000"
zmq_url="tcp://bitcoin:29000"
storage="https://dev4.4nkweb.com/storage"
data_dir="/home/bitcoin/.4nk"
bitcoin_data_dir="/home/bitcoin/.bitcoin"
bootstrap_url="wss://dev3.4nkweb.com/ws/"
core_url=http://bitcoin:38332
ws_url=0.0.0.0:8090
wallet_name=default
network=signet
blindbit_url=http://blindbit-oracle:8000
zmq_url=tcp://bitcoin:29000
storage=https://dev4.4nkweb.com/storage
data_dir=/app/.4nk
bitcoin_data_dir=/app/.bitcoin
bootstrap_url=wss://dev3.4nkweb.com/ws/
bootstrap_faucet=true

View File

@ -6,6 +6,11 @@ services:
btcnet:
aliases:
- tor
healthcheck:
test: ["CMD", "sh", "-c", "if nc -z localhost 9050; then echo 'Tor ready: SOCKS proxy listening on port 9050'; exit 0; else echo 'Tor starting: SOCKS proxy not yet ready'; exit 1; fi"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
bitcoin:
@ -27,7 +32,7 @@ services:
chown -R bitcoin:bitcoin /home/bitcoin/.bitcoin || echo 'warn: chown partiel (fichiers bind-mount Windows)';
exec su-exec bitcoin bitcoind -conf=/etc/bitcoin/bitcoin.conf -signet"
healthcheck:
test: ["CMD", "bitcoin-cli", "-conf=/etc/bitcoin/bitcoin.conf", "getblockchaininfo"]
test: ["CMD", "sh", "-c", "info=$(bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}'); blocks=$(echo \"$info\" | jq -r '.blocks // 0'); headers=$(echo \"$info\" | jq -r '.headers // 0'); if [ \"$blocks\" -eq \"$headers\" ] && [ \"$blocks\" -gt 0 ]; then echo \"Bitcoin sync complete: $blocks blocks\"; exit 0; else echo \"Bitcoin IBD: $blocks/$headers blocks ($(($headers - $blocks)) remaining)\"; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
@ -54,7 +59,7 @@ services:
ports:
- "0.0.0.0:8000:8000"
healthcheck:
test: ["CMD-SHELL", "code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1); [ \"$$code\" != \"000\" ]"]
test: ["CMD", "sh", "-c", "code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1); if [ \"$code\" = \"200\" ]; then echo \"BlindBit ready: Oracle service responding\"; exit 0; elif [ \"$code\" = \"000\" ]; then echo \"BlindBit starting: Oracle service not yet ready\"; exit 1; else echo \"BlindBit scanning: Oracle responding with code $code\"; exit 1; fi"]
interval: 15s
timeout: 5s
retries: 10
@ -67,9 +72,9 @@ services:
blindbit:
condition: service_healthy
volumes:
- ./conf/relay/sdk_relay.conf:/home/bitcoin/.conf:ro
- sdk_data:/home/bitcoin/.4nk
- bitcoin_data:/home/bitcoin/.bitcoin
- ./conf/relay/sdk_relay.conf:/app/.conf:ro
- sdk_data:/app/.4nk
- bitcoin_data:/app/.bitcoin
- ./scripts/funds:/scripts/funds:ro
- ./logs/sdk_relay:/var/log/sdk_relay
ports:
@ -85,8 +90,7 @@ services:
max-size: "10m"
max-file: "3"
environment:
- NODE_OPTIONS=${NODE_OPTIONS}
- HOME=/home/bitcoin
- HOME=/app
- CORE_URL=${SDK_RELAY_CORE_URL}
- WS_URL=${SDK_RELAY_WS_URL}
- WALLET_NAME=${SDK_RELAY_WALLET_NAME}
@ -98,10 +102,9 @@ services:
- BITCOIN_DATA_DIR=${SDK_RELAY_BITCOIN_DATA_DIR}
- BOOTSTRAP_URL=${SDK_RELAY_BOOTSTRAP_URL}
- BOOTSTRAP_FAUCET=${SDK_RELAY_BOOTSTRAP_FAUCET}
- RUST_LOG=${SDK_RELAY_RUST_LOG}
- RUST_LOG=INFO
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8091/"]
test: ["CMD", "sh", "-c", "if curl -f http://localhost:8091/ >/dev/null 2>&1; then echo 'SDK Relay ready: WebSocket server responding'; exit 0; else echo 'SDK Relay IBD: Waiting for Bitcoin sync to complete'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
@ -145,7 +148,7 @@ services:
user: appuser
command: ["node", "dist/server.js"]
healthcheck:
test: ["CMD", "sh", "-c", "curl -f http://localhost:8080/api/v1/health || exit 1"]
test: ["CMD", "sh", "-c", "if curl -f http://localhost:8080/api/v1/health >/dev/null 2>&1; then echo 'LeCoffre Backend ready: API responding'; exit 0; else echo 'LeCoffre Backend starting: API not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 5
@ -184,7 +187,7 @@ services:
user: lecoffreuser
command: ["node", "server.js"]
healthcheck:
test: ["CMD", "sh", "-c", "ps aux | grep -v grep | grep next-server || exit 1"]
test: ["CMD", "sh", "-c", "if ps aux | grep -v grep | grep next-server >/dev/null 2>&1; then echo 'LeCoffre Frontend ready: Next.js server running'; exit 0; else echo 'LeCoffre Frontend starting: Next.js server not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
@ -217,7 +220,7 @@ services:
user: root
command: ["npm", "start"]
healthcheck:
test: ["CMD", "sh", "-c", "curl -f http://localhost:3003/ || exit 1"]
test: ["CMD", "sh", "-c", "if curl -f http://localhost:3003/ >/dev/null 2>&1; then echo 'IHM Client ready: Vite dev server responding'; exit 0; else echo 'IHM Client starting: Vite dev server not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
@ -239,6 +242,12 @@ services:
- sdk_signer
user: appuser
command: ["node", "/app/dist/index.js"]
healthcheck:
test: ["CMD", "sh", "-c", "if curl -f http://localhost:9090/ >/dev/null 2>&1; then echo 'SDK Signer ready: WebSocket server responding'; exit 0; else echo 'SDK Signer starting: WebSocket server not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
labels:
- "com.centurylinklabs.watchtower.enable=true"
restart: unless-stopped
@ -261,7 +270,7 @@ services:
volumes:
- ./logs/sdk_storage:/var/log/sdk_storage
healthcheck:
test: ["CMD", "sh", "-c", "curl -f http://localhost:8080/health || exit 1"]
test: ["CMD", "sh", "-c", "if curl -f http://localhost:8080/health >/dev/null 2>&1; then echo 'SDK Storage ready: API responding'; exit 0; else echo 'SDK Storage starting: API not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
@ -323,6 +332,12 @@ services:
btcnet:
aliases:
- grafana
healthcheck:
test: ["CMD", "sh", "-c", "if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then echo 'Grafana ready: Dashboard service responding'; exit 0; else echo 'Grafana starting: Dashboard service not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
labels:
- "com.centurylinklabs.watchtower.enable=true"
restart: unless-stopped
@ -339,6 +354,12 @@ services:
btcnet:
aliases:
- loki
healthcheck:
test: ["CMD", "sh", "-c", "if curl -f http://localhost:3100/ready >/dev/null 2>&1; then echo 'Loki ready: Log aggregation service responding'; exit 0; else echo 'Loki starting: Log aggregation service not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
promtail:
@ -353,6 +374,12 @@ services:
btcnet:
aliases:
- promtail
healthcheck:
test: ["CMD", "sh", "-c", "if curl -f http://localhost:9080/ready >/dev/null 2>&1; then echo 'Promtail ready: Log collection service responding'; exit 0; else echo 'Promtail starting: Log collection service not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
# Service de statut des services
@ -369,6 +396,12 @@ services:
btcnet:
aliases:
- status-api
healthcheck:
test: ["CMD", "sh", "-c", "if curl -f http://localhost:3006/api >/dev/null 2>&1; then echo 'Status API ready: Service monitoring API responding'; exit 0; else echo 'Status API starting: Service monitoring API not yet ready'; exit 1; fi"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
labels:
- "com.centurylinklabs.watchtower.enable=true"
restart: unless-stopped

View File

@ -1,92 +0,0 @@
# Accès Grafana - LeCoffre Node
## Informations de Connexion
### 🔐 **Identifiants d'Accès**
- **URL**: `https://dev4.4nkweb.com/grafana/`
- **Utilisateur**: `admin`
- **Mot de passe**: `Fuy8ZfxQI2xdSdoB8wsGxNjyU`
### 📊 **Dashboards Disponibles**
1. **Bitcoin & Miner Monitoring** (UID: `bitcoin-miner`)
2. **Bitcoin Miner - Détails** (UID: `bitcoin-miner-detailed`)
3. **Bitcoin Services - Monitoring** (UID: `bitcoin-services`)
4. **Frontend Services - Monitoring** (UID: `frontend-services`)
5. **LeCoffre Backend - Monitoring** (UID: `lecoffre-backend`)
6. **LeCoffre Node - Vue d'ensemble** (UID: `lecoffre-overview`)
7. **SDK Services - Monitoring** (UID: `sdk-services`)
8. **Services Applications - Monitoring** (UID: `services-overview`)
### 🔗 **Liens Directs**
- Vue d'ensemble: `https://dev4.4nkweb.com/grafana/d/lecoffre-overview`
- Bitcoin Miner: `https://dev4.4nkweb.com/grafana/d/bitcoin-miner-detailed`
- Backend LeCoffre: `https://dev4.4nkweb.com/grafana/d/lecoffre-backend`
- Services SDK: `https://dev4.4nkweb.com/grafana/d/sdk-services`
- Services Frontend: `https://dev4.4nkweb.com/grafana/d/frontend-services`
- Services Bitcoin: `https://dev4.4nkweb.com/grafana/d/bitcoin-services`
## Configuration
### 📁 **Emplacement de Configuration**
- **Fichier principal**: `/home/debian/lecoffre_node/docker-compose.yml`
- **Ligne**: 284
- **Variable**: `GF_SECURITY_ADMIN_PASSWORD`
### 🔄 **Historique des Mots de Passe**
- **Ancien**: `admin123` (faible)
- **Nouveau**: `Fuy8ZfxQI2xdSdoB8wsGxNjyU` (fort - 25 caractères)
### 🛡️ **Sécurité**
- **Longueur**: 25 caractères
- **Complexité**: Alphanumérique + caractères spéciaux
- **Génération**: OpenSSL random base64
- **Renouvellement**: Automatique lors du déploiement
## Déploiement
### 📋 **Commandes de Déploiement**
```bash
# Redémarrage avec nouveau mot de passe
cd /home/debian/lecoffre_node
docker compose restart grafana
# Redémarrage complet (si nécessaire)
docker compose stop grafana
docker compose rm -f grafana
docker volume rm lecoffre_node_grafana_data
docker compose up -d grafana
```
### ✅ **Validation du Déploiement**
```bash
# Test de connectivité
curl -s -u admin:Fuy8ZfxQI2xdSdoB8wsGxNjyU \
https://dev4.4nkweb.com/grafana/api/search?type=dash-db | \
jq '.[].title'
```
## Notes Importantes
### 🔒 **Sécurité**
- Le mot de passe est stocké dans le docker-compose.yml
- **Ne pas committer** le fichier .env avec le mot de passe
- Utiliser des variables d'environnement pour la production
- Renouveler régulièrement les mots de passe
### 📝 **Maintenance**
- Les dashboards sont provisionnés automatiquement
- Les volumes Docker persistent les données
- Redémarrer Grafana après modification du mot de passe
- Vérifier les logs en cas de problème
### 🚨 **En Cas de Problème**
1. Vérifier les logs: `docker compose logs grafana`
2. Redémarrer le service: `docker compose restart grafana`
3. Réinitialiser si nécessaire (supprimer le volume)
4. Tester la connectivité avec curl
---
**Date de mise à jour**: 21 Septembre 2025
**Version**: 1.0
**Responsable**: Déploiement LeCoffre Node

View File

@ -1,144 +0,0 @@
# REX - Implémentation des Dashboards Grafana
## Résumé
Implémentation réussie de dashboards Grafana spécialisés pour le monitoring des services LeCoffre Node.
## Dashboards Implémentés
### 1. **Bitcoin Miner - Détails** (UID: `bitcoin-miner-detailed`)
- **Objectif**: Monitoring détaillé du mineur Bitcoin Signet
- **Métriques**:
- Blocs minés par minute
- Hashrate du mineur
- Erreurs du mineur (1h)
- Distribution des niveaux de log
- Historique des blocs minés
- **Panneaux**: 5 panneaux spécialisés
### 2. **LeCoffre Backend - Monitoring** (UID: `lecoffre-backend`)
- **Objectif**: Monitoring de l'API backend LeCoffre
- **Métriques**:
- Requêtes HTTP par status code
- Endpoints les plus utilisés
- Temps de réponse moyen
- Erreurs et succès (1h)
- Distribution des méthodes HTTP
- Erreurs récentes
- **Panneaux**: 8 panneaux complets
### 3. **SDK Services - Monitoring** (UID: `sdk-services`)
- **Objectif**: Monitoring des services SDK (relay, signer, storage)
- **Métriques**:
- Messages par service SDK
- Transactions relay
- Signatures signer
- Erreurs par service (1h)
- Total logs SDK
- Erreurs récentes SDK
- **Panneaux**: 8 panneaux spécialisés
### 4. **Frontend Services - Monitoring** (UID: `frontend-services`)
- **Objectif**: Monitoring des services frontend (lecoffre-front, ihm_client)
- **Métriques**:
- Requêtes HTTP par frontend
- Activité Vite (IHM Client)
- Erreurs par service (1h)
- Total logs frontend
- Erreurs Vite
- Erreurs récentes frontend
- **Panneaux**: 7 panneaux dédiés
### 5. **Bitcoin Services - Monitoring** (UID: `bitcoin-services`)
- **Objectif**: Monitoring des services Bitcoin (bitcoin-signet, blindbit-oracle)
- **Métriques**:
- Mises à jour de la chaîne Bitcoin
- Détection de tweak (BlindBit)
- Erreurs Bitcoin et BlindBit (1h)
- Nouveaux blocs et silent payments
- Erreurs Bitcoin services
- **Panneaux**: 7 panneaux spécialisés
## Configuration Technique
### Datasource Loki
- **URL**: `http://loki:3100`
- **Type**: `loki`
- **Accès**: `proxy`
- **UID**: `loki`
- **Configuration simplifiée** pour éviter les erreurs de provisioning
### Scripts Améliorés
- **`test-dashboards.sh`**: Script de test complet avec headers Loki
- **Headers ajoutés**: `X-Scope-OrgID: anonymous` pour l'accès Loki
- **Tests inclus**: API Loki, logs des services, rapport de santé
## Résolution des Problèmes
### Problème 1: Configuration Loki Complexe
- **Symptôme**: Erreur "Datasource provisioning error: data source not found"
- **Cause**: Configuration JSON complexe avec derivedFields
- **Solution**: Simplification de la configuration Loki
### Problème 2: Access Proxy vs Server
- **Symptôme**: Erreurs 502 Bad Gateway via nginx
- **Cause**: Tentative d'accès direct via URL externe
- **Solution**: Utilisation de `access: proxy` avec URL interne Docker
### Problème 3: Headers Loki Manquants
- **Symptôme**: Erreurs d'authentification Loki
- **Cause**: Headers X-Scope-OrgID manquants
- **Solution**: Ajout des headers dans les requêtes API
## Accès et Utilisation
### URL d'Accès
- **Grafana**: `https://dev4.4nkweb.com/grafana/`
- **Identifiants**: `admin` / `admin123`
### Liens Directs
- Vue d'ensemble: `https://dev4.4nkweb.com/grafana/d/lecoffre-overview`
- Bitcoin Miner: `https://dev4.4nkweb.com/grafana/d/bitcoin-miner-detailed`
- Backend LeCoffre: `https://dev4.4nkweb.com/grafana/d/lecoffre-backend`
- Services SDK: `https://dev4.4nkweb.com/grafana/d/sdk-services`
- Services Frontend: `https://dev4.4nkweb.com/grafana/d/frontend-services`
- Services Bitcoin: `https://dev4.4nkweb.com/grafana/d/bitcoin-services`
## Validation
### Tests Réussis
- ✅ **8 dashboards** accessibles et fonctionnels
- ✅ **Configuration Loki** opérationnelle
- ✅ **Scripts de test** améliorés et fonctionnels
- ✅ **Accès externe** via nginx HTTPS
- ✅ **Monitoring temps réel** des services
### Métriques Disponibles
- **Temps réel**: Refresh 5s sur tous les dashboards
- **Historique**: 1h par défaut, configurable
- **Logs centralisés**: Via Loki + Promtail
- **Erreurs**: Détection et affichage en temps réel
## Améliorations Futures
### Dashboards Avancés
1. **Alertes automatiques** sur erreurs critiques
2. **Métriques personnalisées** par service
3. **Corrélations** entre services
4. **Rapports automatiques** de performance
### Configuration
1. **Variables de template** pour filtrage dynamique
2. **Annotations** sur événements importants
3. **Drill-down** entre dashboards
4. **Export** de rapports PDF
## Conclusion
**Mission accomplie**: Tous les dashboards sont implémentés, fonctionnels et accessibles
**Monitoring complet**: Couverture de tous les services critiques
**Accès externe**: Disponible via HTTPS avec authentification
**Scripts améliorés**: Tests et validation automatisés
Le système de monitoring Grafana est maintenant opérationnel et prêt pour la production.

View File

@ -1,184 +0,0 @@
# REX - Optimisation Docker avec Migration vers Debian
## 📅 Date
**2024-12-19**
## 🎯 Objectif
Optimiser tous les Dockerfiles du projet LeCoffre en migrant vers une base Debian standardisée et en réduisant drastiquement la taille des images.
## 🔧 Problèmes identifiés
### 1. Images Docker trop volumineuses
- **Erreur** : `413 Request Entity Too Large` lors du push des images
- **Cause** : Installation de nombreux outils de développement inutiles
- **Impact** : Échec des builds CI pour `sdk_relay`
### 2. Incohérence des bases d'images
- **Problème** : Mélange d'Alpine et Debian
- **Impact** : Difficultés de maintenance et packages manquants (`cscope` non disponible sur Alpine)
### 3. Packages inutiles en production
- **Problème** : Installation de `build-essential`, `clang`, `vim`, `emacs`, etc.
- **Impact** : Images très lourdes sans valeur ajoutée en runtime
## ✅ Solutions appliquées
### 1. Standardisation sur Debian bookworm-slim
```dockerfile
FROM debian:bookworm-slim
```
**Avantages :**
- Base légère mais complète
- Compatibilité avec tous les packages nécessaires
- Possibilité d'ajouter des packages au besoin
- Standardisation de l'architecture
### 2. Packages minimaux optimisés
```dockerfile
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y --fix-missing \
ca-certificates curl jq git && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
```
**Packages installés :**
- `ca-certificates` : Certificats SSL/TLS
- `curl` : Requêtes HTTP
- `jq` : Traitement JSON
- `git` : Clonage de dépôts (si nécessaire)
### 3. Installation Node.js via NodeSource
```dockerfile
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
```
**Avantages :**
- Version officielle et à jour
- Installation propre et sécurisée
- Nettoyage automatique des caches
### 4. Utilisateurs non-root standardisés
```dockerfile
RUN useradd -m -u 1000 appuser && \
mkdir -p /app && chown -R appuser:appuser /app
```
**Sécurité :**
- UID standardisé (1000)
- Utilisateur dédié pour chaque service
- Permissions appropriées
### 5. Image de base réutilisable
Création de `/home/debian/lecoffre_node/base-image/` :
- Dockerfile de base Debian optimisé
- Script `install-packages.sh` pour ajouter des packages au besoin
- Réutilisable pour de futurs services
## 📊 Résultats
### Images optimisées (7/7)
| Service | Base | Commit | Taille estimée |
|---------|------|--------|----------------|
| sdk_relay | Debian bookworm-slim | 96d131a | ~150MB |
| sdk_signer | Debian bookworm-slim | 2355aeb | ~200MB |
| sdk_storage | Debian bookworm-slim | d15c995 | ~120MB |
| lecoffre-back-mini | Debian bookworm-slim | 65b2da6 | ~180MB |
| lecoffre-front | Debian bookworm-slim | baa4e194 | ~220MB |
| ihm_client | Debian bookworm-slim | 34d57c9 | ~190MB |
| miner | Debian bookworm-slim | bc20b99 | ~250MB |
### Réduction de taille estimée
- **Avant** : ~800MB-1.2GB par image
- **Après** : ~120MB-250MB par image
- **Réduction** : ~70-80% de la taille
### Builds CI
- ✅ Tous les tags `ext` créés et poussés
- ✅ Tous les builds CI déclenchés
- ✅ Plus d'erreurs 413 Request Entity Too Large
## 🔄 Processus de migration
### Étapes réalisées
1. **Analyse** des Dockerfiles existants
2. **Création** de l'image de base réutilisable
3. **Migration** progressive de chaque service
4. **Optimisation** des packages et utilisateurs
5. **Tests** et validation
6. **Commit** et push sur la branche `ext`
7. **Déclenchement** des builds CI
### Scripts utilisés
```bash
# Pour chaque service
git add Dockerfile
git commit -m "ci: docker_tag=ext - Migrate to Debian base with minimal packages"
git tag -d ext
git push origin :refs/tags/ext
git push origin ext
git tag ext
git push origin refs/tags/ext:refs/tags/ext
```
## 📝 Leçons apprises
### 1. Importance de la standardisation
- Une base commune simplifie la maintenance
- Réduction des erreurs de compatibilité
- Facilite les mises à jour
### 2. Optimisation des packages
- Seulement les packages nécessaires en runtime
- Nettoyage systématique des caches
- Installation propre de Node.js
### 3. Gestion des utilisateurs
- Utilisateurs non-root pour la sécurité
- UID standardisés pour la cohérence
- Permissions appropriées
### 4. Stratégie de déploiement
- Tags Docker pour déclencher les CI
- Branche `ext` pour le déploiement
- Builds automatisés via Gitea
## 🚀 Recommandations futures
### 1. Monitoring des tailles d'images
- Surveiller la taille des images après chaque build
- Alertes si dépassement de seuils
- Optimisation continue
### 2. Mise à jour de la base
- Mise à jour régulière de Debian bookworm-slim
- Mise à jour des versions Node.js
- Tests de régression
### 3. Documentation
- Mise à jour des README avec les nouvelles bases
- Documentation des packages disponibles
- Guide de contribution
## ✅ Validation
### Tests réalisés
- ✅ Build local de tous les Dockerfiles
- ✅ Push des images vers le registry
- ✅ Déclenchement des builds CI
- ✅ Vérification des tags Docker
### Prochaines étapes
- [ ] Vérifier le succès des builds CI
- [ ] Tester le déploiement des nouvelles images
- [ ] Valider le fonctionnement des services
- [ ] Mettre à jour la documentation utilisateur
---
**Auteur** : Assistant IA
**Validation** : En attente des tests de déploiement
**Statut** : ✅ Optimisation terminée, builds CI en cours

View File

@ -1,162 +0,0 @@
# REX - Redémarrage des Services et Alimentation des Dashboards
## Résumé
Redémarrage complet de tous les services LeCoffre Node pour alimenter les dashboards Grafana avec des données en temps réel.
## Actions Réalisées
### 🔄 **Redémarrage des Services**
- **Arrêt complet**: `docker compose down` pour nettoyer l'environnement
- **Redémarrage**: `docker compose up -d` pour lancer tous les services
- **Ordre de démarrage**: Respect de l'ordre critique (tor → bitcoin → blindbit → sdk_* → applications → monitoring)
### 📊 **Services Redémarrés** (15 services)
1. **tor-proxy** - Proxy anonyme ✅
2. **bitcoin-signet** - Nœud Bitcoin Signet ✅
3. **blindbit-oracle** - Oracle Bitcoin ✅
4. **sdk_storage** - Stockage temporaire ✅
5. **sdk_relay** - Relais des transactions ✅
6. **sdk_signer** - Signature des processus ✅
7. **lecoffre-back** - Backend API ✅
8. **lecoffre-front** - Frontend application ✅
9. **ihm_client** - Interface utilisateur ✅
10. **status-api** - API de statut ✅
11. **loki** - Base de données de logs ✅
12. **promtail** - Agent de collecte des logs ✅
13. **grafana** - Interface de visualisation ✅
14. **signet_miner** - Mineur Bitcoin (déjà en cours) ✅
15. **watchtower** - Surveillance automatique ✅
### 🔧 **Configuration Loki Restaurée**
- **Fichier**: `/home/debian/lecoffre_node/conf/grafana/provisioning/datasources/loki.yml`
- **Configuration**: Datasource Loki avec accès proxy
- **URL**: `http://loki:3100`
- **UID**: `loki`
## Validation des Données
### 📈 **Collecte des Logs**
- **Promtail**: Collecte active des logs de tous les services
- **Sources**: `/var/log/lecoffre/` pour chaque service
- **Labels**: 6 labels disponibles dans Loki
- **Docker**: Collecte automatique des logs des conteneurs
### 🔍 **Données Disponibles**
- **Labels Loki**: `container_name`, `filename`, `job`, `logstream`, `service`, `service_name`
- **Logs Bitcoin**: 1 entrée récente disponible
- **Logs Miner**: Blocs minés, erreurs d'adresse, transactions
- **Logs Services**: Activité de tous les services SDK et applications
### 📊 **Dashboards Opérationnels**
1. **Bitcoin & Miner Monitoring** - Monitoring global ✅
2. **Bitcoin Miner - Détails** - Métriques détaillées du mineur ✅
3. **Bitcoin Services - Monitoring** - Bitcoin Signet + BlindBit ✅
4. **Frontend Services - Monitoring** - LeCoffre Front + IHM Client ✅
5. **LeCoffre Backend - Monitoring** - API backend complète ✅
6. **LeCoffre Node - Vue d'ensemble** - Monitoring global ✅
7. **SDK Services - Monitoring** - Relay, Signer, Storage ✅
8. **Services Applications - Monitoring** - Vue générale ✅
## Tests de Validation
### ✅ **Services Fonctionnels**
```bash
# Loki
curl -s http://localhost:3100/ready
# Résultat: "Ingester not ready: waiting for 15s after being ready"
# Promtail
docker ps --filter name=promtail --format '{{.Status}}'
# Résultat: "Up 4 minutes"
# Grafana
curl -s -I https://dev4.4nkweb.com/grafana/
# Résultat: HTTP/2 302 (redirection normale)
```
### ✅ **Données Disponibles**
```bash
# Labels Loki
curl -s http://localhost:3100/loki/api/v1/labels | jq '.data | length'
# Résultat: 6
# Logs Bitcoin
curl -s 'http://localhost:3100/loki/api/v1/query_range?query={job="bitcoin"}&start=...&end=...&limit=3' | jq '.data.result | length'
# Résultat: 1
```
### ✅ **Accès Grafana**
```bash
# Dashboards
curl -s -u admin:Fuy8ZfxQI2xdSdoB8wsGxNjyU https://dev4.4nkweb.com/grafana/api/search?type=dash-db | jq '.[].title'
# Résultat: 8 dashboards listés
```
## Problèmes Résolus
### 🔧 **Configuration Loki**
- **Problème**: Datasource Loki non accessible depuis Grafana
- **Cause**: Configuration supprimée temporairement
- **Solution**: Restauration de la configuration Loki simplifiée
### 🔧 **Collecte des Logs**
- **Problème**: Dashboards vides sans données
- **Cause**: Services redémarrés sans reconfiguration Promtail
- **Solution**: Redémarrage complet avec configuration Promtail active
### 🔧 **Syntaxe des Requêtes**
- **Problème**: Erreurs de syntaxe dans les requêtes Loki
- **Cause**: Utilisation de requêtes instant au lieu de range
- **Solution**: Utilisation de `query_range` avec paramètres start/end
## État Final
### 🎯 **Services Opérationnels**
- ✅ **Tous les services** en cours d'exécution
- ✅ **Monitoring complet** avec Loki + Promtail + Grafana
- ✅ **Collecte active** des logs de tous les services
- ✅ **Dashboards alimentés** avec données en temps réel
### 📊 **Données Disponibles**
- ✅ **Logs Bitcoin**: Connexions Tor, activité réseau
- ✅ **Logs Miner**: Blocs minés, erreurs d'adresse, transactions
- ✅ **Logs Services**: Activité SDK (relay, signer, storage)
- ✅ **Logs Applications**: Backend, frontend, IHM client
### 🔐 **Sécurité**
- ✅ **Mot de passe fort**: `Fuy8ZfxQI2xdSdoB8wsGxNjyU`
- ✅ **Accès HTTPS**: `https://dev4.4nkweb.com/grafana/`
- ✅ **Configuration sécurisée**: Datasource Loki en proxy
## Accès et Utilisation
### 🔗 **URL d'Accès**
- **Grafana**: `https://dev4.4nkweb.com/grafana/`
- **Utilisateur**: `admin`
- **Mot de passe**: `Fuy8ZfxQI2xdSdoB8wsGxNjyU`
### 📋 **Commandes Utiles**
```bash
# Redémarrage des services
cd /home/debian/lecoffre_node && docker compose restart
# Vérification des logs
docker compose logs [service_name] --tail=10
# Test des dashboards
./scripts/test-dashboards.sh
# Vérification Loki
curl -s http://localhost:3100/loki/api/v1/labels
```
## Conclusion
**Mission accomplie**: Tous les services sont redémarrés et opérationnels
**Dashboards alimentés**: Les dashboards reçoivent maintenant des données en temps réel
**Monitoring complet**: Loki + Promtail + Grafana fonctionnent parfaitement
**Sécurité renforcée**: Mot de passe fort déployé et testé
Le système de monitoring LeCoffre Node est maintenant **pleinement opérationnel** avec des dashboards **alimentés en données temps réel** ! 🎉

View File

@ -1,163 +0,0 @@
# REX - Redéploiement Complet LeCoffre avec Accessibilité Externe
## Date
21 septembre 2025
## Contexte
Redéploiement complet de l'écosystème LeCoffre selon les consignes mises à jour, en s'assurant que **tous les services écoutent sur 0.0.0.0** et sont **accessibles depuis l'extérieur via le nom de domaine**.
## Corrections Apportées
### 1. Correction des Ports Docker Compose
**Problème identifié :**
Les services écoutaient sur `127.0.0.1` au lieu de `0.0.0.0`, les rendant inaccessibles depuis l'extérieur.
**Solution appliquée :**
Modification du fichier `docker-compose.yml` pour tous les services :
```yaml
# Avant
ports:
- "127.0.0.1:8090:8090"
- "127.0.0.1:8091:8091"
# Après
ports:
- "0.0.0.0:8090:8090"
- "0.0.0.0:8091:8091"
```
**Services corrigés :**
- ✅ **blindbit-oracle** : `0.0.0.0:8000`
- ✅ **sdk_relay** : `0.0.0.0:8090-8091`
- ✅ **lecoffre-back** : `0.0.0.0:8080`
- ✅ **lecoffre-front** : `0.0.0.0:3004`
- ✅ **ihm_client** : `0.0.0.0:3003`
- ✅ **sdk_signer** : `0.0.0.0:3001`
- ✅ **sdk_storage** : `0.0.0.0:8081`
- ✅ **grafana** : `0.0.0.0:3005`
- ✅ **loki** : `0.0.0.0:3100`
- ✅ **status-api** : `0.0.0.0:3006`
### 2. Correction de la Configuration Nginx
**Problème identifié :**
La configuration nginx utilisait `127.0.0.1` dans les proxy_pass, causant des erreurs 502.
**Solution appliquée :**
Mise à jour des fichiers de configuration nginx :
- `dev4.4nkweb.com-https.conf`
- `dev4.4nkweb.com.conf`
```nginx
# Avant
proxy_pass http://127.0.0.1:8090/;
# Après
proxy_pass http://localhost:8090/;
```
### 3. Correction du Service IHM Client
**Problème identifié :**
Erreurs Vite : `Failed to resolve import "../pkg/sdk_client.js"`
**Solution appliquée :**
Rebuild de l'image `ihm_client` avec les fichiers correctement copiés.
## Tests de Connectivité Externe
### ✅ Services Accessibles via HTTPS
- **Frontend LeCoffre** : `https://dev4.4nkweb.com/lecoffre` → HTTP 200 ✅
- **IHM Client** : `https://dev4.4nkweb.com/` → HTTP 200 ✅
- **Grafana** : `https://dev4.4nkweb.com/grafana/` → HTTP 302 (redirection login) ✅
- **Page de Statut** : `https://dev4.4nkweb.com/status/` → HTTP 200 ✅
### ⚠️ Services avec Problèmes
- **API Backend** : `https://dev4.4nkweb.com/api/health` → HTTP 404 (endpoint manquant)
- **WebSocket Relay** : `https://dev4.4nkweb.com/ws/` → HTTP 502 (configuration WebSocket)
### 🔧 Services Internes Fonctionnels
- **sdk_relay** : Health check OK, répond sur port 8091 ✅
- **sdk_storage** : Health check OK ✅
- **lecoffre-back** : Health check OK ✅
- **ihm_client** : Démarre correctement ✅
## Architecture de Déploiement
### Services Docker Opérationnels
```
NAME STATUS PORTS
bitcoin-signet Up (healthy)
blindbit-oracle Up (healthy) 0.0.0.0:8000->8000/tcp
sdk_relay Up (healthy) 0.0.0.0:8090-8091->8090-8091/tcp
sdk_signer Up 0.0.0.0:3001->9090/tcp
sdk_storage Up (healthy) 0.0.0.0:8081->8080/tcp
lecoffre-back Up (healthy) 0.0.0.0:8080->8080/tcp
lecoffre-front Up (healthy) 0.0.0.0:3004->3000/tcp
ihm_client Up (healthy) 0.0.0.0:3003->3003/tcp
grafana Up 0.0.0.0:3005->3000/tcp
loki Up 0.0.0.0:3100->3100/tcp
status-api Up 0.0.0.0:3006->3006/tcp
```
### Configuration Nginx
- ✅ **HTTPS actif** sur port 443
- ✅ **Redirection HTTP → HTTPS**
- ✅ **Certificats SSL valides** (expire le 15 déc 2025)
- ✅ **Configuration centralisée** dans `lecoffre_node/conf/nginx/`
## Points d'Attention Identifiés
### 1. Endpoint API Backend
- **Problème** : `/api/health` retourne 404
- **Cause** : Endpoint de santé manquant dans le backend
- **Action** : Vérifier les routes disponibles dans le backend
### 2. WebSocket Relay
- **Problème** : `/ws/` retourne 502
- **Cause** : Configuration WebSocket ou service non accessible
- **Action** : Vérifier la configuration WebSocket dans nginx
### 3. Monitoring
- **Grafana** : Accessible mais nécessite authentification
- **Loki** : Accessible en interne
- **Promtail** : Collecte des logs active
## Validation Finale
### ✅ Critères Respectés
1. **Services sur 0.0.0.0** : Tous les services écoutent sur toutes les interfaces ✅
2. **Accessibilité externe** : Services accessibles via nom de domaine ✅
3. **HTTPS fonctionnel** : Certificats valides et redirection active ✅
4. **Services principaux** : Frontend, IHM, Grafana accessibles ✅
5. **Configuration centralisée** : Nginx configuré correctement ✅
### 🔧 Améliorations Nécessaires
1. **Corriger l'endpoint API** `/api/health`
2. **Résoudre le WebSocket** `/ws/` (502)
3. **Vérifier les routes API** du backend
4. **Tester les WebSockets** avec un client approprié
## Leçons Apprises
### Docker Compose
1. **Ports 0.0.0.0 vs 127.0.0.1** : Crucial pour l'accessibilité externe
2. **Redémarrage nécessaire** après modification des ports
3. **Health checks** : Vérifier que les services répondent correctement
### Nginx
1. **Configuration proxy_pass** : Utiliser `localhost` pour les services locaux
2. **Test de configuration** : `nginx -t` avant reload
3. **Logs d'erreur** : Consulter `/var/log/nginx/error.log` pour diagnostiquer
### Services
1. **Ordre de démarrage** : Respecter les dépendances entre services
2. **Logs Docker** : Utiliser `docker compose logs` pour diagnostiquer
3. **Tests de connectivité** : Tester depuis l'intérieur et l'extérieur
## Statut Final
🎉 **REDÉPLOIEMENT RÉUSSI** - Services accessibles depuis l'extérieur
**Services opérationnels :** 8/10
**Accessibilité externe :** ✅ Fonctionnelle
**Configuration :** ✅ Complète et centralisée

View File

@ -1,194 +0,0 @@
# Test Fonctionnel - Flux Complet LeCoffre
## Date
21 septembre 2025
## Contexte
Test du flux complet fonctionnel : **login notaire → redirection IdNot → validation dans l'iframe → connexion après vérification Stripe**.
## Services Testés et Validés
### ✅ **Frontend LeCoffre**
- **URL** : `https://dev4.4nkweb.com/lecoffre`
- **Statut** : ✅ **OPÉRATIONNEL**
- **Configuration détectée** :
```json
{
"idNotBaseUrl": "https://qual-connexion.idnot.fr",
"idNotAuthorizeEndpoint": "/IdPOAuth2/authorize/idnot_idp_v1",
"idNotClientId": "B3CE56353EDB15A9",
"idNotRedirectUri": "http://local.4nkweb.com:3000/authorized-client",
"_4nkIframeUrl": "https://dev4.4nkweb.com"
}
```
- **Routes disponibles** : `/lecoffre/folders`, `/lecoffre/legal/*`
### ✅ **Redirection IdNot**
- **URL** : `https://dev4.4nkweb.com/api/v1/idnot/auth`
- **Statut** : ✅ **OPÉRATIONNEL**
- **Test** : POST avec `{}` → Retourne erreur de validation attendue
- **Réponse** :
```json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid authentication code"
}
}
```
- **Routes IdNot disponibles** :
- `GET /user/rattachements`
- `GET /office/rattachements`
- `POST /auth`
- `GET /user` (authentifié)
- `POST /logout` (authentifié)
- `GET /validate` (authentifié)
### ✅ **Iframe IHM Client**
- **URL** : `https://dev4.4nkweb.com/`
- **Statut** : ✅ **OPÉRATIONNEL**
- **Contenu** : Interface 4NK Web5 Platform
- **Fonctionnalités** : Iframe pour interactions avec clés privées Bitcoin Silent Payment
### ⚠️ **Validation Compte Stripe**
- **URL** : `https://dev4.4nkweb.com/api/stripe/*`
- **Statut** : ⚠️ **PROBLÈME DÉTECTÉ**
- **Problème** : Toutes les routes Stripe retournent des erreurs HTML
- **Routes Stripe disponibles** :
- `POST /test/create-subscription`
- `POST /subscriptions/checkout`
- `GET /subscriptions/:id`
- `POST /subscriptions/:id/portal`
- `POST /webhooks/stripe`
- **Cause probable** : Variables d'environnement Stripe manquantes ou configuration incorrecte
### ✅ **WebSockets**
- **URL** : `wss://dev4.4nkweb.com/ws/`
- **Statut** : ✅ **OPÉRATIONNEL**
- **Test** : Connexion WebSocket réussie sans erreur
- **Service** : `sdk_relay` sur port 8090
## Flux de Redirection Configuré
### 1. **Login Notaire**
```
https://dev4.4nkweb.com/lecoffre/folders
Redirection vers IdNot
```
### 2. **Authentification IdNot**
```
https://qual-connexion.idnot.fr/IdPOAuth2/authorize/idnot_idp_v1
Client ID: B3CE56353EDB15A9
Redirect URI: http://local.4nkweb.com:3000/authorized-client
```
### 3. **Validation dans l'iframe**
```
http://local.4nkweb.com:3000/authorized-client
Iframe: https://dev4.4nkweb.com/
```
### 4. **Vérification Stripe**
```
https://dev4.4nkweb.com/api/stripe/subscriptions/checkout
Connexion après validation
```
## Tests de Connectivité
### ✅ **Services HTTP/HTTPS**
- **Frontend LeCoffre** : HTTP 200 ✅
- **IHM Client** : HTTP 200 ✅
- **API Backend** : HTTP 200 ✅
- **Health Check** : HTTP 200 ✅
- **Grafana** : HTTP 302 (redirection) ✅
- **Page Statut** : HTTP 200 ✅
### ✅ **Services WebSocket**
- **Relay WebSocket** : Connexion réussie ✅
- **Protocole** : WSS sécurisé ✅
### ✅ **Configuration Nginx**
- **HTTPS** : Certificats valides ✅
- **Redirection HTTP → HTTPS** : Fonctionnelle ✅
- **Routes configurées** :
- `/lecoffre` → Frontend (port 3004) ✅
- `/api/` → Backend (port 8080) ✅
- `/ws/` → Relay WebSocket (port 8090) ✅
- `/` → IHM Client (port 3003) ✅
## Points d'Attention
### 🔧 **Corrections Nécessaires**
1. **Routes Stripe** :
- **Problème** : Toutes les routes retournent des erreurs HTML
- **Impact** : Flux de vérification Stripe bloqué
- **Action** : Vérifier les variables d'environnement Stripe
- **Variables manquantes possibles** :
- `STRIPE_SECRET_KEY`
- `STRIPE_STANDARD_SUBSCRIPTION_PRICE_ID`
- `STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID`
2. **Configuration IdNot** :
- **Redirect URI** : `http://local.4nkweb.com:3000/authorized-client`
- **Vérification** : S'assurer que cette URL est accessible
### ✅ **Services Fonctionnels**
1. **Flux IdNot** : ✅ Complet et opérationnel
2. **Frontend LeCoffre** : ✅ Accessible et configuré
3. **Iframe IHM Client** : ✅ Opérationnel
4. **WebSockets** : ✅ Connexions temps réel fonctionnelles
5. **API Backend** : ✅ Endpoints principaux opérationnels
## Validation du Test Fonctionnel
### 🎯 **Flux Principal**
```
1. Login notaire sur https://dev4.4nkweb.com/lecoffre/folders ✅
2. Redirection IdNot configurée ✅
3. Validation dans iframe https://dev4.4nkweb.com/ ✅
4. Vérification Stripe (⚠️ problème détecté)
```
### 📊 **Statut Global**
- **Services opérationnels** : 6/7 (85.7%)
- **Flux principal** : ✅ **FONCTIONNEL**
- **Blocage identifié** : Routes Stripe uniquement
- **Impact utilisateur** : Flux complet possible sauf validation Stripe
## Recommandations
### 🔧 **Actions Immédiates**
1. **Corriger les routes Stripe** :
- Vérifier les variables d'environnement
- Tester la configuration Stripe
- Valider les clés API
2. **Tester le flux complet** :
- Simuler un login notaire
- Valider la redirection IdNot
- Tester l'iframe de validation
### 🚀 **Déploiement**
- **Statut** : ✅ **PRÊT POUR TEST FONCTIONNEL**
- **Services critiques** : Tous opérationnels
- **Seul blocage** : Validation Stripe (non critique pour le test principal)
## Conclusion
Le flux fonctionnel principal est **OPÉRATIONNEL** :
- ✅ Login notaire accessible
- ✅ Redirection IdNot configurée
- ✅ Iframe de validation fonctionnelle
- ✅ WebSockets temps réel opérationnels
Le seul problème identifié concerne les routes Stripe qui nécessitent une correction de configuration, mais n'empêche pas le test du flux principal de login notaire → IdNot → iframe.

@ -1 +0,0 @@
Subproject commit 66479e38ceb34ed21f40272172cb060899ba1cc9

0
logs/bitcoin/bitcoin.log Normal file → Executable file
View File

0
logs/blindbit/blindbit.log Normal file → Executable file
View File

1
logs/docker-compose.log Executable file
View File

@ -0,0 +1 @@
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.config-hash%22%3Atrue%2C%22com.docker.compose.project%3Dlecoffre%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denied

0
logs/ihm_client/ihm_client.log Normal file → Executable file
View File

0
logs/lecoffre-back/lecoffre-back.log Normal file → Executable file
View File

0
logs/lecoffre-front/lecoffre-front.log Normal file → Executable file
View File

0
logs/miner/miner.log Normal file → Executable file
View File

0
logs/nginx/access.log Executable file
View File

0
logs/nginx/error.log Executable file
View File

0
logs/nginx/nginx.log Normal file → Executable file
View File

0
logs/sdk_relay/sdk_relay.log Normal file → Executable file
View File

0
logs/sdk_signer/sdk_signer.log Normal file → Executable file
View File

0
logs/sdk_storage/sdk_storage.log Normal file → Executable file
View File

0
logs/tor/tor.log Normal file → Executable file
View File

View File

@ -1,11 +1,11 @@
core_url="http://bitcoin:38332"
ws_url="0.0.0.0:8090"
wallet_name="default"
network="signet"
blindbit_url="http://blindbit-oracle:8000"
zmq_url="tcp://bitcoin:29000"
storage="https://dev4.4nkweb.com/storage"
data_dir="/home/bitcoin/.4nk"
bitcoin_data_dir="/home/bitcoin/.bitcoin"
bootstrap_url="wss://dev3.4nkweb.com/ws/"
core_url=http://bitcoin:38332
ws_url=0.0.0.0:8090
wallet_name=default
network=signet
blindbit_url=http://blindbit-oracle:8000
zmq_url=tcp://bitcoin:29000
storage=https://dev4.4nkweb.com/storage
data_dir=/app/.4nk
bitcoin_data_dir=/app/.bitcoin
bootstrap_url=wss://dev3.4nkweb.com/ws/
bootstrap_faucet=true

254
scripts/logs-with-progress.sh Executable file
View File

@ -0,0 +1,254 @@
#!/bin/bash
# Script pour afficher les logs des services avec la progression
# Affiche les logs en temps réel avec des informations de progression
set -e
# Couleurs pour l'affichage
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Fonction pour afficher l'aide
show_help() {
echo -e "${BLUE}Usage: $0 [service_name] [options]${NC}"
echo
echo -e "${PURPLE}Services disponibles:${NC}"
echo -e " ${CYAN}bitcoin${NC} - Bitcoin Signet (affiche la progression IBD)"
echo -e " ${CYAN}blindbit${NC} - BlindBit Oracle (affiche la progression du scan)"
echo -e " ${CYAN}sdk_relay${NC} - SDK Relay (affiche la progression du scan)"
echo -e " ${CYAN}sdk_storage${NC} - SDK Storage"
echo -e " ${CYAN}sdk_signer${NC} - SDK Signer"
echo -e " ${CYAN}lecoffre-back${NC} - LeCoffre Backend"
echo -e " ${CYAN}lecoffre-front${NC} - LeCoffre Frontend"
echo -e " ${CYAN}ihm_client${NC} - IHM Client"
echo -e " ${CYAN}grafana${NC} - Grafana"
echo -e " ${CYAN}loki${NC} - Loki"
echo -e " ${CYAN}promtail${NC} - Promtail"
echo -e " ${CYAN}status-api${NC} - Status API"
echo
echo -e "${PURPLE}Options:${NC}"
echo -e " ${CYAN}-f, --follow${NC} - Suivre les logs en temps réel (défaut)"
echo -e " ${CYAN}-n, --lines N${NC} - Afficher les N dernières lignes (défaut: 50)"
echo -e " ${CYAN}-p, --progress${NC} - Afficher la progression en plus des logs"
echo -e " ${CYAN}-h, --help${NC} - Afficher cette aide"
echo
echo -e "${PURPLE}Exemples:${NC}"
echo -e " ${CYAN}$0 bitcoin -p${NC} - Logs Bitcoin avec progression IBD"
echo -e " ${CYAN}$0 sdk_relay -n 100${NC} - 100 dernières lignes du SDK Relay"
echo -e " ${CYAN}$0 blindbit -f -p${NC} - Logs BlindBit en temps réel avec progression"
}
# Fonction pour afficher la progression Bitcoin
show_bitcoin_progress() {
local container_name="bitcoin-signet"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
local info=$(docker exec "$container_name" bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}')
local blocks=$(echo "$info" | jq -r '.blocks // 0')
local headers=$(echo "$info" | jq -r '.headers // 0')
local progress=0
if [ "$headers" -gt 0 ]; then
progress=$((blocks * 100 / headers))
fi
echo -e "${CYAN}Bitcoin Progress: $blocks/$headers blocks ($(($headers - $blocks)) remaining) - $progress%${NC}"
# Afficher une barre de progression
local bar_length=50
local filled_length=$((progress * bar_length / 100))
local bar=""
for ((i=0; i<filled_length; i++)); do bar+="█"; done
for ((i=filled_length; i<bar_length; i++)); do bar+="░"; done
echo -e "${YELLOW}[$bar] $progress%${NC}"
echo
fi
}
# Fonction pour afficher la progression BlindBit
show_blindbit_progress() {
local container_name="blindbit-oracle"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1 2>/dev/null || echo "000")
case "$response" in
"200")
echo -e "${GREEN}BlindBit Progress: Oracle service ready${NC}"
;;
"000")
echo -e "${YELLOW}BlindBit Progress: Oracle service starting${NC}"
;;
*)
echo -e "${YELLOW}BlindBit Progress: Oracle scanning (code: $response)${NC}"
;;
esac
echo
fi
}
# Fonction pour afficher la progression SDK Relay
show_sdk_relay_progress() {
local container_name="sdk_relay"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
local logs=$(docker logs "$container_name" --tail 3 2>/dev/null | grep -E "(waiting for|blocks to download|IBD)" | tail -1 || echo "")
if [ -n "$logs" ]; then
echo -e "${YELLOW}SDK Relay Progress: $logs${NC}"
else
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8091/ 2>/dev/null || echo "000")
if [ "$response" = "200" ]; then
echo -e "${GREEN}SDK Relay Progress: WebSocket server ready${NC}"
else
echo -e "${YELLOW}SDK Relay Progress: WebSocket server starting${NC}"
fi
fi
echo
fi
}
# Fonction pour afficher les logs avec progression
show_logs_with_progress() {
local service_name="$1"
local container_name="$2"
local lines="${3:-50}"
local follow="${4:-true}"
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} Logs for $service_name${NC}"
echo -e "${BLUE}========================================${NC}"
echo
# Afficher la progression selon le service
case "$service_name" in
"bitcoin")
show_bitcoin_progress
;;
"blindbit")
show_blindbit_progress
;;
"sdk_relay")
show_sdk_relay_progress
;;
esac
echo -e "${PURPLE}Recent logs:${NC}"
echo
if [ "$follow" = "true" ]; then
docker logs -f --tail "$lines" "$container_name" 2>/dev/null || echo -e "${RED}Service $service_name not found or not running${NC}"
else
docker logs --tail "$lines" "$container_name" 2>/dev/null || echo -e "${RED}Service $container_name not found or not running${NC}"
fi
}
# Fonction principale
main() {
local service_name=""
local container_name=""
local lines=50
local follow=true
local show_progress=false
# Parser les arguments
while [[ $# -gt 0 ]]; do
case $1 in
-f|--follow)
follow=true
shift
;;
-n|--lines)
lines="$2"
shift 2
;;
-p|--progress)
show_progress=true
shift
;;
-h|--help)
show_help
exit 0
;;
-*)
echo -e "${RED}Unknown option: $1${NC}"
show_help
exit 1
;;
*)
service_name="$1"
shift
;;
esac
done
# Déterminer le nom du conteneur
case "$service_name" in
"bitcoin")
container_name="bitcoin-signet"
;;
"blindbit")
container_name="blindbit-oracle"
;;
"sdk_relay")
container_name="sdk_relay"
;;
"sdk_storage")
container_name="sdk_storage"
;;
"sdk_signer")
container_name="sdk_signer"
;;
"lecoffre-back")
container_name="lecoffre-back"
;;
"lecoffre-front")
container_name="lecoffre-front"
;;
"ihm_client")
container_name="ihm_client"
;;
"grafana")
container_name="grafana"
;;
"loki")
container_name="loki"
;;
"promtail")
container_name="promtail"
;;
"status-api")
container_name="status-api"
;;
"")
echo -e "${RED}Please specify a service name${NC}"
show_help
exit 1
;;
*)
echo -e "${RED}Unknown service: $service_name${NC}"
show_help
exit 1
;;
esac
# Afficher les logs
if [ "$show_progress" = "true" ]; then
show_logs_with_progress "$service_name" "$container_name" "$lines" "$follow"
else
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} Logs for $service_name${NC}"
echo -e "${BLUE}========================================${NC}"
echo
if [ "$follow" = "true" ]; then
docker logs -f --tail "$lines" "$container_name" 2>/dev/null || echo -e "${RED}Service $service_name not found or not running${NC}"
else
docker logs --tail "$lines" "$container_name" 2>/dev/null || echo -e "${RED}Service $service_name not found or not running${NC}"
fi
fi
}
# Exécution
main "$@"

186
scripts/monitor-progress.sh Executable file
View File

@ -0,0 +1,186 @@
#!/bin/bash
# Script de monitoring de la progression des services LeCoffre Node
# Affiche la progression des différents processus (IBD, scans, etc.)
set -e
# Couleurs pour l'affichage
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Fonction pour afficher un header
print_header() {
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} LeCoffre Node - Monitoring Progress${NC}"
echo -e "${BLUE}========================================${NC}"
echo
}
# Fonction pour afficher le statut d'un service
print_service_status() {
local service_name="$1"
local container_name="$2"
local status=$(docker inspect --format='{{.State.Health.Status}}' "$container_name" 2>/dev/null || echo "no-healthcheck")
local running=$(docker inspect --format='{{.State.Running}}' "$container_name" 2>/dev/null || echo "false")
if [ "$running" = "true" ]; then
case "$status" in
"healthy")
echo -e " ${GREEN}${NC} $service_name: ${GREEN}Ready${NC}"
;;
"unhealthy")
echo -e " ${YELLOW}${NC} $service_name: ${YELLOW}Starting/Processing${NC}"
;;
"starting")
echo -e " ${YELLOW}${NC} $service_name: ${YELLOW}Starting${NC}"
;;
"no-healthcheck")
echo -e " ${BLUE}${NC} $service_name: ${BLUE}Running (no healthcheck)${NC}"
;;
esac
else
echo -e " ${RED}${NC} $service_name: ${RED}Stopped${NC}"
fi
}
# Fonction pour afficher la progression Bitcoin
show_bitcoin_progress() {
local container_name="bitcoin-signet"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
echo -e "${CYAN}Bitcoin Progress:${NC}"
local info=$(docker exec "$container_name" bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}')
local blocks=$(echo "$info" | jq -r '.blocks // 0')
local headers=$(echo "$info" | jq -r '.headers // 0')
local progress=0
if [ "$headers" -gt 0 ]; then
progress=$((blocks * 100 / headers))
fi
if [ "$blocks" -eq "$headers" ] && [ "$blocks" -gt 0 ]; then
echo -e " ${GREEN}✓ Bitcoin sync complete: $blocks blocks${NC}"
else
echo -e " ${YELLOW}⏳ Bitcoin IBD: $blocks/$headers blocks ($(($headers - $blocks)) remaining) - $progress%${NC}"
fi
echo
fi
}
# Fonction pour afficher la progression BlindBit
show_blindbit_progress() {
local container_name="blindbit-oracle"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
echo -e "${CYAN}BlindBit Progress:${NC}"
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1 2>/dev/null || echo "000")
case "$response" in
"200")
echo -e " ${GREEN}✓ BlindBit ready: Oracle service responding${NC}"
;;
"000")
echo -e " ${YELLOW}⏳ BlindBit starting: Oracle service not yet ready${NC}"
;;
*)
echo -e " ${YELLOW}⏳ BlindBit scanning: Oracle responding with code $response${NC}"
;;
esac
echo
fi
}
# Fonction pour afficher la progression SDK Relay
show_sdk_relay_progress() {
local container_name="sdk_relay"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
echo -e "${CYAN}SDK Relay Progress:${NC}"
local logs=$(docker logs "$container_name" --tail 5 2>/dev/null | grep -E "(waiting for|blocks to download|IBD)" | tail -1 || echo "")
if [ -n "$logs" ]; then
echo -e " ${YELLOW}⏳ SDK Relay IBD: $logs${NC}"
else
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8091/ 2>/dev/null || echo "000")
if [ "$response" = "200" ]; then
echo -e " ${GREEN}✓ SDK Relay ready: WebSocket server responding${NC}"
else
echo -e " ${YELLOW}⏳ SDK Relay starting: WebSocket server not yet ready${NC}"
fi
fi
echo
fi
}
# Fonction pour afficher la progression des autres services
show_other_services_progress() {
echo -e "${CYAN}Other Services Progress:${NC}"
# SDK Storage
local storage_response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8081/health 2>/dev/null || echo "000")
if [ "$storage_response" = "200" ]; then
echo -e " ${GREEN}✓ SDK Storage ready: API responding${NC}"
else
echo -e " ${YELLOW}⏳ SDK Storage starting: API not yet ready${NC}"
fi
# SDK Signer
local signer_response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:3001/ 2>/dev/null || echo "000")
if [ "$signer_response" = "101" ] || [ "$signer_response" = "426" ]; then
echo -e " ${GREEN}✓ SDK Signer ready: WebSocket server responding${NC}"
else
echo -e " ${YELLOW}⏳ SDK Signer starting: WebSocket server not yet ready${NC}"
fi
# IHM Client
local ihm_response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:3003/ 2>/dev/null || echo "000")
if [ "$ihm_response" = "200" ]; then
echo -e " ${GREEN}✓ IHM Client ready: Vite dev server responding${NC}"
else
echo -e " ${YELLOW}⏳ IHM Client starting: Vite dev server not yet ready${NC}"
fi
# Grafana
local grafana_response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:3005/api/health 2>/dev/null || echo "000")
if [ "$grafana_response" = "200" ]; then
echo -e " ${GREEN}✓ Grafana ready: Dashboard service responding${NC}"
else
echo -e " ${YELLOW}⏳ Grafana starting: Dashboard service not yet ready${NC}"
fi
echo
}
# Fonction principale
main() {
print_header
echo -e "${PURPLE}Service Status:${NC}"
print_service_status "Tor Proxy" "tor-proxy"
print_service_status "Bitcoin Signet" "bitcoin-signet"
print_service_status "BlindBit Oracle" "blindbit-oracle"
print_service_status "SDK Storage" "sdk_storage"
print_service_status "SDK Relay" "sdk_relay"
print_service_status "SDK Signer" "sdk_signer"
print_service_status "LeCoffre Backend" "lecoffre-back"
print_service_status "LeCoffre Frontend" "lecoffre-front"
print_service_status "IHM Client" "ihm_client"
print_service_status "Grafana" "grafana"
print_service_status "Loki" "loki"
print_service_status "Promtail" "promtail"
print_service_status "Status API" "status-api"
echo
show_bitcoin_progress
show_blindbit_progress
show_sdk_relay_progress
show_other_services_progress
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} Use 'docker logs <container_name>' for detailed logs${NC}"
echo -e "${BLUE}========================================${NC}"
}
# Exécution
main "$@"

199
scripts/start-with-progress.sh Executable file
View File

@ -0,0 +1,199 @@
#!/bin/bash
# Script de démarrage des services LeCoffre Node avec suivi de la progression
# Démarre les services dans l'ordre correct et affiche la progression
set -e
# Couleurs pour l'affichage
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Fonction pour afficher un message
print_message() {
echo -e "${BLUE}[$(date '+%H:%M:%S')]${NC} $1"
}
# Fonction pour attendre qu'un service soit healthy
wait_for_service() {
local service_name="$1"
local container_name="$2"
local max_wait="${3:-300}" # 5 minutes par défaut
local wait_time=0
print_message "Waiting for $service_name to be healthy..."
while [ $wait_time -lt $max_wait ]; do
local status=$(docker inspect --format='{{.State.Health.Status}}' "$container_name" 2>/dev/null || echo "no-healthcheck")
local running=$(docker inspect --format='{{.State.Running}}' "$container_name" 2>/dev/null || echo "false")
if [ "$running" = "true" ] && [ "$status" = "healthy" ]; then
print_message "${GREEN}$service_name is healthy${NC}"
return 0
elif [ "$running" = "false" ]; then
print_message "${RED}$service_name is not running${NC}"
return 1
fi
# Afficher la progression pour Bitcoin
if [ "$service_name" = "Bitcoin Signet" ]; then
local info=$(docker exec "$container_name" bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}')
local blocks=$(echo "$info" | jq -r '.blocks // 0')
local headers=$(echo "$info" | jq -r '.headers // 0')
local progress=0
if [ "$headers" -gt 0 ]; then
progress=$((blocks * 100 / headers))
fi
if [ "$blocks" -eq "$headers" ] && [ "$blocks" -gt 0 ]; then
print_message "${GREEN}✓ Bitcoin sync complete: $blocks blocks${NC}"
return 0
else
print_message "${YELLOW}⏳ Bitcoin IBD: $blocks/$headers blocks ($(($headers - $blocks)) remaining) - $progress%${NC}"
fi
fi
# Afficher la progression pour BlindBit
if [ "$service_name" = "BlindBit Oracle" ]; then
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1 2>/dev/null || echo "000")
case "$response" in
"200")
print_message "${GREEN}✓ BlindBit ready: Oracle service responding${NC}"
return 0
;;
"000")
print_message "${YELLOW}⏳ BlindBit starting: Oracle service not yet ready${NC}"
;;
*)
print_message "${YELLOW}⏳ BlindBit scanning: Oracle responding with code $response${NC}"
;;
esac
fi
# Afficher la progression pour SDK Relay
if [ "$service_name" = "SDK Relay" ]; then
local logs=$(docker logs "$container_name" --tail 3 2>/dev/null | grep -E "(waiting for|blocks to download|IBD)" | tail -1 || echo "")
if [ -n "$logs" ]; then
print_message "${YELLOW}⏳ SDK Relay IBD: $logs${NC}"
else
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8091/ 2>/dev/null || echo "000")
if [ "$response" = "200" ]; then
print_message "${GREEN}✓ SDK Relay ready: WebSocket server responding${NC}"
return 0
else
print_message "${YELLOW}⏳ SDK Relay starting: WebSocket server not yet ready${NC}"
fi
fi
fi
sleep 10
wait_time=$((wait_time + 10))
done
print_message "${RED}✗ Timeout waiting for $service_name${NC}"
return 1
}
# Fonction pour démarrer un service
start_service() {
local service_name="$1"
print_message "Starting $service_name..."
if docker compose --env-file .env.master up -d "$service_name"; then
print_message "${GREEN}$service_name started${NC}"
return 0
else
print_message "${RED}✗ Failed to start $service_name${NC}"
return 1
fi
}
# Fonction principale
main() {
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} LeCoffre Node - Startup with Progress${NC}"
echo -e "${BLUE}========================================${NC}"
echo
# Arrêter tous les services existants
print_message "Stopping existing services..."
docker compose --env-file .env.master down --remove-orphans
# Démarrer les services dans l'ordre correct
print_message "Starting services in correct order..."
echo
# 1. Tor
start_service "tor"
wait_for_service "Tor Proxy" "tor-proxy" 60
# 2. Bitcoin
start_service "bitcoin"
wait_for_service "Bitcoin Signet" "bitcoin-signet" 600 # 10 minutes pour Bitcoin
# 3. BlindBit
start_service "blindbit"
wait_for_service "BlindBit Oracle" "blindbit-oracle" 300
# 4. SDK Storage
start_service "sdk_storage"
wait_for_service "SDK Storage" "sdk_storage" 120
# 5. SDK Relay
start_service "sdk_relay"
wait_for_service "SDK Relay" "sdk_relay" 600 # 10 minutes pour SDK Relay
# 6. SDK Signer
start_service "sdk_signer"
wait_for_service "SDK Signer" "sdk_signer" 120
# 7. IHM Client
start_service "ihm_client"
wait_for_service "IHM Client" "ihm_client" 120
# 8. LeCoffre Backend
start_service "lecoffre-back"
wait_for_service "LeCoffre Backend" "lecoffre-back" 120
# 9. LeCoffre Frontend
start_service "lecoffre-front"
wait_for_service "LeCoffre Frontend" "lecoffre-front" 120
# 10. Services de monitoring
start_service "loki"
start_service "promtail"
start_service "grafana"
start_service "status-api"
start_service "watchtower"
echo
print_message "${GREEN}✓ All services started successfully!${NC}"
echo
print_message "Use './scripts/monitor-progress.sh' to monitor progress"
print_message "Use './scripts/watch-progress.sh' for real-time monitoring"
echo
print_message "Testing external access..."
# Tester l'accès externe
local services=("https://dev4.4nkweb.com/status/" "https://dev4.4nkweb.com/grafana/" "https://dev4.4nkweb.com/" "https://dev4.4nkweb.com/lecoffre/")
for service in "${services[@]}"; do
if curl -s -o /dev/null -w '%{http_code}' "$service" | grep -q "200"; then
print_message "${GREEN}$service is accessible${NC}"
else
print_message "${YELLOW}$service is not yet accessible${NC}"
fi
done
echo
print_message "${GREEN}Startup complete!${NC}"
}
# Exécution
main "$@"

View File

@ -31,7 +31,7 @@ log_error() {
}
# Répertoire racine du projet
PROJECT_ROOT="/home/debian/lecoffre_node"
PROJECT_ROOT="/home/debian/4NK_env/lecoffre_node"
CONF_DIR="$PROJECT_ROOT/conf"
# Vérifier que nous sommes dans le bon répertoire
@ -43,7 +43,7 @@ fi
# Fonction pour synchroniser un projet
sync_project() {
local project_name="$1"
local project_path="/home/debian/$project_name"
local project_path="/home/debian/4NK_env/$project_name"
log "Synchronisation de $project_name..."

View File

@ -7,7 +7,7 @@ echo "🔍 Test de connectivité du monitoring..."
# Test Grafana
echo "Test Grafana..."
if curl -s http://localhost:3005/api/health >/dev/null 2>&1; then
if curl -s http://localhost:3000/api/health >/dev/null 2>&1; then
echo "✅ Grafana: OK"
else
echo "❌ Grafana: Non accessible"

159
scripts/watch-progress.sh Executable file
View File

@ -0,0 +1,159 @@
#!/bin/bash
# Script de surveillance en temps réel de la progression des services LeCoffre Node
# Affiche la progression des différents processus (IBD, scans, etc.) en continu
set -e
# Couleurs pour l'affichage
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Fonction pour effacer l'écran et afficher le header
clear_and_header() {
clear
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} LeCoffre Node - Live Progress Monitor${NC}"
echo -e "${BLUE}========================================${NC}"
echo -e "${YELLOW}Last updated: $(date)${NC}"
echo
}
# Fonction pour afficher la progression Bitcoin
show_bitcoin_progress() {
local container_name="bitcoin-signet"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
echo -e "${CYAN}Bitcoin Progress:${NC}"
local info=$(docker exec "$container_name" bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}')
local blocks=$(echo "$info" | jq -r '.blocks // 0')
local headers=$(echo "$info" | jq -r '.headers // 0')
local progress=0
if [ "$headers" -gt 0 ]; then
progress=$((blocks * 100 / headers))
fi
if [ "$blocks" -eq "$headers" ] && [ "$blocks" -gt 0 ]; then
echo -e " ${GREEN}✓ Bitcoin sync complete: $blocks blocks${NC}"
else
echo -e " ${YELLOW}⏳ Bitcoin IBD: $blocks/$headers blocks ($(($headers - $blocks)) remaining) - $progress%${NC}"
# Afficher une barre de progression
local bar_length=50
local filled_length=$((progress * bar_length / 100))
local bar=""
for ((i=0; i<filled_length; i++)); do bar+="█"; done
for ((i=filled_length; i<bar_length; i++)); do bar+="░"; done
echo -e " ${YELLOW}[$bar] $progress%${NC}"
fi
echo
fi
}
# Fonction pour afficher la progression SDK Relay
show_sdk_relay_progress() {
local container_name="sdk_relay"
if docker ps --format "table {{.Names}}" | grep -q "$container_name"; then
echo -e "${CYAN}SDK Relay Progress:${NC}"
local logs=$(docker logs "$container_name" --tail 3 2>/dev/null | grep -E "(waiting for|blocks to download|IBD)" | tail -1 || echo "")
if [ -n "$logs" ]; then
echo -e " ${YELLOW}⏳ SDK Relay IBD: $logs${NC}"
else
local response=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8091/ 2>/dev/null || echo "000")
if [ "$response" = "200" ]; then
echo -e " ${GREEN}✓ SDK Relay ready: WebSocket server responding${NC}"
else
echo -e " ${YELLOW}⏳ SDK Relay starting: WebSocket server not yet ready${NC}"
fi
fi
echo
fi
}
# Fonction pour afficher le statut des services
show_services_status() {
echo -e "${PURPLE}Services Status:${NC}"
# Services critiques
local services=("tor-proxy:Tor Proxy" "bitcoin-signet:Bitcoin Signet" "blindbit-oracle:BlindBit Oracle" "sdk_storage:SDK Storage" "sdk_relay:SDK Relay" "sdk_signer:SDK Signer" "ihm_client:IHM Client")
for service in "${services[@]}"; do
local container_name="${service%%:*}"
local display_name="${service##*:}"
local status=$(docker inspect --format='{{.State.Health.Status}}' "$container_name" 2>/dev/null || echo "no-healthcheck")
local running=$(docker inspect --format='{{.State.Running}}' "$container_name" 2>/dev/null || echo "false")
if [ "$running" = "true" ]; then
case "$status" in
"healthy")
echo -e " ${GREEN}${NC} $display_name: ${GREEN}Ready${NC}"
;;
"unhealthy")
echo -e " ${YELLOW}${NC} $display_name: ${YELLOW}Processing${NC}"
;;
"starting")
echo -e " ${YELLOW}${NC} $display_name: ${YELLOW}Starting${NC}"
;;
"no-healthcheck")
echo -e " ${BLUE}${NC} $display_name: ${BLUE}Running${NC}"
;;
esac
else
echo -e " ${RED}${NC} $display_name: ${RED}Stopped${NC}"
fi
done
echo
}
# Fonction pour afficher les services en attente
show_waiting_services() {
echo -e "${PURPLE}Services Waiting for Dependencies:${NC}"
# Vérifier les services LeCoffre
local lecoffre_back=$(docker inspect --format='{{.State.Running}}' "lecoffre-back" 2>/dev/null || echo "false")
local lecoffre_front=$(docker inspect --format='{{.State.Running}}' "lecoffre-front" 2>/dev/null || echo "false")
if [ "$lecoffre_back" = "false" ]; then
echo -e " ${YELLOW}⏳ LeCoffre Backend: Waiting for SDK Relay${NC}"
fi
if [ "$lecoffre_front" = "false" ]; then
echo -e " ${YELLOW}⏳ LeCoffre Frontend: Waiting for LeCoffre Backend${NC}"
fi
echo
}
# Fonction principale
main() {
clear_and_header
show_bitcoin_progress
show_sdk_relay_progress
show_services_status
show_waiting_services
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} Press Ctrl+C to stop monitoring${NC}"
echo -e "${BLUE} Refresh every 10 seconds${NC}"
echo -e "${BLUE}========================================${NC}"
}
# Fonction de nettoyage
cleanup() {
echo -e "\n${YELLOW}Monitoring stopped.${NC}"
exit 0
}
# Gestion des signaux
trap cleanup SIGINT SIGTERM
# Boucle principale
while true; do
main
sleep 10
done

17
test_env.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "Testing environment variables in sdk_relay container..."
docker compose --env-file .env.master run --rm --no-deps --entrypoint="" sdk_relay sh -c "
echo 'Environment variables:'
env | grep -E '(CORE_URL|WS_URL|WALLET_NAME|NETWORK)' | sort
echo ''
echo 'File content:'
cat /home/bitcoin/.conf
echo ''
echo 'Testing Rust config parsing...'
echo 'core_url=http://bitcoin:38332' > /tmp/test.conf
echo 'ws_url=0.0.0.0:8090' >> /tmp/test.conf
echo 'wallet_name=default' >> /tmp/test.conf
echo 'network=signet' >> /tmp/test.conf
echo 'Test file created:'
cat /tmp/test.conf
"