lecoffre_node/docs/analyse.md

68 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### Objet
Analyse synthétique de lorchestrateur `lecoffre_node` (Docker Compose + Nginx locaux).
### Services et ordre de démarrage
- **tor** → **bitcoin****blindbit****sdk_relay****sdk_signer**/**sdk_storage** → **ihm_client****lecoffre-back****lecoffre-front**
### Détails par service (extraits)
- **bitcoin**: image `git.4nkweb.com/4nk/bitcoin:latest`, volume `4nk_node_bitcoin_data`, healthcheck `getblockchaininfo`
- **blindbit**: oracle, ports `127.0.0.1:8000`, healthcheck HTTP, dépend de `bitcoin`
- **sdk_relay**: ports `127.0.0.1:8090`, logs vers `/home/bitcoin/.4nk/logs/sdk_relay.log`, healthcheck `/health`
- **lecoffre-back**: image `git.4nkweb.com/4nk/lecoffre-back-mini:ext`, ports `127.0.0.1:8080`
- **lecoffre-front**: image `git.4nkweb.com/4nk/lecoffre-front:ext`, ports `127.0.0.2:3004:3000`
- **sdk_signer**: ports `127.0.0.1:3001`
- **sdk_storage**: ports `127.0.0.1:8081`
- **watchtower**: mise à jour images via labels
### Réseau et volumes
- **Réseau**: `btcnet` (bridge) avec IPAM `172.20.0.0/16`
- **Volumes**: `4nk_node_bitcoin_data`, `blindbit_data`, `sdk_data`
### Nginx local
- **Conf**: `conf/nginx/*` (vhosts locaux et dev4) pour proxy et basePath `/lecoffre`
### Points dattention
- **Tags dimages**: homogénéiser (`latest`, `dev`, `ext`) selon politique CI
- **Exposition locale**: vérif des binds `127.0.0.1` vs `127.0.0.2`
- **Watchtower**: intervalle 30s, labels présents sur services applicatifs
### Topologie Docker Compose (détails)
- **tor**: `btcpayserver/tor:0.4.8.10` (alias `tor` sur `btcnet`)
- **bitcoin**: `git.4nkweb.com/4nk/bitcoin:latest`, volume `4nk_node_bitcoin_data`, healthcheck `bitcoin-cli getblockchaininfo`
- **blindbit**: `git.4nkweb.com/4nk/blindbit-oracle:dev`, ports `127.0.0.1:8000:8000`, healthcheck HTTP, dépend de `bitcoin`
- **sdk_relay**: `git.4nkweb.com/4nk/sdk_relay:dev`, ports `127.0.0.1:8090:8090`, logs dans `/home/bitcoin/.4nk/logs/sdk_relay.log`, healthcheck `/health`
- **sdk_signer**: `git.4nkweb.com/4nk/sdk_signer:latest`, ports `127.0.0.1:3001:3001`
- **sdk_storage**: `git.4nkweb.com/4nk/sdk_storage:latest`, ports `127.0.0.1:8081:8081`
- **lecoffre-back**: `git.4nkweb.com/4nk/lecoffre-back-mini:ext`, ports `127.0.0.1:8080:8080`
- **lecoffre-front**: `git.4nkweb.com/4nk/lecoffre-front:ext`, ports `127.0.0.2:3004:3000`
- **ihm_client**: `git.4nkweb.com/4nk/ihm_client:ext`, ports `127.0.0.1:3003:3003`
- **watchtower**: `containrrr/watchtower`, `--interval 30 --label-enable`
### Réseau et volumes
- **Réseau**: `btcnet` (bridge) IPAM `172.20.0.0/16`, alias par service (bitcoin, blindbit, sdk_relay, etc.)
- **Volumes**: `4nk_node_bitcoin_data`, `blindbit_data`, `sdk_data`
### Nginx dev4.4nkweb.com (résumé configuration)
- `/api/``http://127.0.0.1:8080/api/` avec CORS dynamique (origines autorisées: `http://local.4nkweb.com:3000`, `https://dev4.4nkweb.com`)
- `/back/(.*)``http://127.0.0.1:8080/api/$1`
- `/apiv1/(.*)` → réécrit vers `/api/v1/$1`
- `/``http://127.0.0.1:3003` (ihm_client)
- `/lecoffre` et `/lecoffre/``http://127.0.0.2:3004/lecoffre/` (basePath Next.js)
- `/_next/``http://127.0.0.2:3004/_next/`
- `/blindbit/``http://127.0.0.1:8000/`
- `/signer/` (WebSocket) → `http://127.0.0.1:3001/` avec `Upgrade/Connection` adaptés
### Ordre de démarrage recommandé
- Recommandé: `tor``bitcoin``blindbit``sdk_storage``sdk_relay``sdk_signer``ihm_client``lecoffre-back``lecoffre-front`
- Écart observé: Compose démarre `sdk_relay` avant `sdk_storage`. À harmoniser si dépendances runtime avérées.
### Variables .env clefs (rappels)
- Front: `NEXT_PUBLIC_*` (host/port/API/basePath/Idnot/Docaposte/4NK)
- Back: `PORT`, `DEFAULT_STORAGE`, `APP_HOST`, `STRIPE_*`, `IDNOT_*`, `CORS_ALLOWED_ORIGINS`
### Risques et recommandations
- Uniformiser les tags dimages (`docker-support-v2` si applicable) et éviter `latest` en prod
- Vérifier lalignement `basePath` Next `/lecoffre` ↔ proxys Nginx (routes et assets)
- Geler les origines CORS en prod et journaliser les refus
- Surveiller la santé `blindbit` et `sdk_relay` (healthchecks ↔ restart policy)