auto_clea

This commit is contained in:
Nicolas Cantu 2025-09-25 15:03:41 +00:00
parent b876f93753
commit 912fe1c96d
7 changed files with 2 additions and 184 deletions

View File

@ -60,9 +60,7 @@ services:
if [ ! -f /root/.blindbit-oracle/blindbit.toml ]; then
cp /tmp/blindbit.toml /root/.blindbit-oracle/blindbit.toml;
fi &&
echo 'Waiting for Bitcoin to be ready...' &&
while ! nc -z bitcoin 38332; do sleep 2; done &&
echo 'Bitcoin is ready, starting BlindBit...' &&
echo 'Starting BlindBit (bitcoin health is ensured by depends_on)...' &&
exec ./main -datadir /root/.blindbit-oracle"
networks:
btcnet:

1
tests Symbolic link
View File

@ -0,0 +1 @@
/home/debian/4NK_env/tests/lecoffre_node

View File

@ -1,27 +0,0 @@
## Axes de tests — lecoffre_node
### Pré-requis
- Nginx rechargé et conf active (`dev4.4nkweb.com.conf`)
- Réseau Docker `4nk_node_btcnet` présent
- Volumes montés (`4nk_node_bitcoin_data`, `blindbit_data`, `sdk_data`)
### Démarrage et dépendances
- Ordre de démarrage observé vs recommandé (voir docs/analyse.md)
- Healthchecks: `bitcoin` (CLI), `blindbit` (HTTP), `sdk_relay` (`/health`)
### Routage Nginx
- `/back/*` et `/api/*` → backend 8080 (statuts 200, pas de HTML)
- `/lecoffre/` et `/_next/` → front 3004 avec basePath OK
- `/signer/` WebSocket (101), `/blindbit/` (200)
### CORS
- Origines autorisées: `http://dev3.4nkweb.com`, `https://dev4.4nkweb.com`
- Prévols `OPTIONS` (204) et en-têtes `Access-Control-*`
### Non-régression
- Absence de `localhost:8080` dans les bundles front servis via `/lecoffre/`
- Redirections locales `dev3.4nkweb.com``https://dev4.4nkweb.com/lecoffre/`
### Observabilité
- Journaux Nginx (`error.log`) sans erreurs après reload
- Logs `sdk_relay` présents dans `/home/bitcoin/.4nk/logs/sdk_relay.log`

View File

@ -1,71 +0,0 @@
### Tests de routage API et front (dev4)
Pré-requis: Nginx rechargé et services Docker démarrés.
1) Santé backend via Nginx (HTTP)
Commande:
curl -sS -D - http://127.0.0.1/back/v1/health -o /dev/null | sed -n '1,10p'
Attendu: `HTTP/1.1 200` (ou `302` selon auth), jamais du HTML de front.
2) Santé backend via Nginx (HTTPS)
Commande:
curl -sS -D - https://dev4.4nkweb.com/back/v1/health -o /dev/null | sed -n '1,10p'
Attendu: `HTTP/2 200`.
3) Front `/lecoffre` (HTTPS)
Commande:
curl -sS -D - https://dev4.4nkweb.com/lecoffre/ -o /dev/null | sed -n '1,10p'
Attendu: `HTTP/2 200` et pas de 301/302 en boucle.
### Plan de tests — routage API via Nginx
#### Pré-requis
- Nginx actif avec `conf/nginx/dev4.4nkweb.com.conf` chargé.
- Services: backend (8080), storage (8081), ws relay (8090), blindbit (8000), front (3000/3003).
#### Vérifications HTTP
- GET `https://dev4.4nkweb.com/back/health` → 200
- (Si alias validé) GET `https://dev4.4nkweb.com/api/health` → 200
- GET `https://dev4.4nkweb.com/storage/health` → 200
#### Vérifications front
- Ouvrir `https://dev4.4nkweb.com/lecoffre/` → 200, pas derreurs CORS ni `ERR_BLOCKED_BY_CLIENT`.
- Ouvrir la console réseau: les appels API doivent cibler `/back/...` (ou `/api/...`) sous le même hôte.
#### Non-régression: absence de `localhost:8080` dans les bundles
- Télécharger la page et scanner les scripts:
- `curl -sS https://dev4.4nkweb.com/lecoffre/ -o /tmp/lecoffre_index.html`
- `grep -oP '(?<=<script src=")[^"]+' /tmp/lecoffre_index.html | sed 's#^/#https://dev4.4nkweb.com/#' | while read u; do curl -sS "$u" | grep -q 'localhost:8080' && echo "KO: $u"; done`
- Attendu: aucun `KO:`
#### Vérification réécriture `sub_filter`
- Contrôler quaucune requête ne vise `http://localhost:8080`:
- Recharger avec cache vidé et surveiller longlet Réseau.
- Télécharger une ressource HTML/JS et vérifier labsence de `http://localhost:8080`.
#### Redirections locales
- `curl -I http://dev3.4nkweb.com/` → 301 Location `https://dev4.4nkweb.com/lecoffre/`
- `curl -I http://dev3.4nkweb.com/authorized-client?code=ABC` → 301 Location `https://dev4.4nkweb.com/lecoffre/authorized-client?code=ABC`
#### WebSocket
- `wss://dev4.4nkweb.com/ws` handshake OK (101)
#### Journaux Nginx
- `error.log`: aucun message critique après rechargement.

View File

@ -1,18 +0,0 @@
# Test manuel: import des descripteurs Signet
## Préparation
- Vérifier `miner/.env.signet` (tprv, fingerprint, path)
## Étapes
1. `cd miner && ./tools/import_signet_descriptors.sh`
2. Vérifier sortie:
- Deux entrées `success: true` (external/internal)
- Une entrée `success: true` pour le challenge (warnings admis)
- `COINBASE_ADDRESS=tb1...` affichée
3. `docker compose up -d --build signet_miner`
4. `docker logs --tail=200 signet_miner`
- Attendre `Mined block at height ...`
## Échecs courants
- `Cannot import descriptor without private keys...` => utiliser descripteurs xprv+#checksum, pas la version normalisée (tpub).
- Wallet non-descriptor => recréer via le script (unload + rm -rf + createwallet descriptors=true).

View File

@ -1,27 +0,0 @@
# Tests de fumée dev4
HTTP/HTTPS
- GET / (ihm_client) attend 200 → Observé: 200
- GET /lecoffre/ attend 200 → Observé: 404 (page 404 servie, app OK sous /lecoffre/404)
- GET /back/ attend 200 → Observé: 200
- GET /storage/ attend 200 → Observé: 404 (à valider: endpoint /storage/health?)
WebSocket
- wss://dev4.4nkweb.com/ws handshake OK → À vérifier (outil ws requis côté serveur)
Redirections
- GET http://dev3.4nkweb.com/ attend 301 → Location: https://dev4.4nkweb.com/lecoffre/
- GET http://dev3.4nkweb.com/authorized-client?code=... attend 301 → Location: https://dev4.4nkweb.com/lecoffre/authorized-client?code=...
DNS côté client
- dev3.4nkweb.com doit résoudre vers 92.243.24.12 (pas 127.0.0.1)
- Test: nslookup dev3.4nkweb.com sur machine cliente
Nginx
- Certificats valides
- Pas derreurs critiques dans error.log
Résultats (17/09/2025)
- /lecoffre/ → 404
- /lecoffre/404 → 404 (avec `runtimeConfig` présent et `assetPrefix` = /lecoffre)
- /back/ → 200
- /blindbit/ → 200
- /storage/ → 404

View File

@ -1,38 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[TEST] sdk_relay: vérification santé"
health=$(curl -sS http://127.0.0.1:8091/health || true)
echo "Health: ${health}"
if [[ "${health}" != *'"status":"ok"'* ]]; then
echo "[ERREUR] Healthcheck non OK" >&2
exit 1
fi
echo "[TEST] sdk_relay: variables d'environnement effectives"
envs=$(docker inspect --format='{{range .Config.Env}}{{println .}}{{end}}' sdk_relay | sort)
echo "ENV:\n${envs}"
echo "Vérif HOME=/home/bitcoin"
grep -q '^HOME=/home/bitcoin$' <<<"${envs}"
echo "Vérif RUST_LOG=DEBUG"
grep -q '^RUST_LOG=DEBUG$' <<<"${envs}"
echo "Vérif NODE_OPTIONS --max-old-space-size=2048"
grep -q '^NODE_OPTIONS=--max-old-space-size=2048$' <<<"${envs}"
echo "[TEST] sdk_relay: logs récents (erreurs connues)"
logs=$(docker logs --since=10m sdk_relay 2>&1 || true)
echo "--- DERNIERS LOGS (tronqués) ---"
echo "${logs}" | tail -n 200
echo "--- FIN LOGS ---"
if echo "${logs}" | grep -qi 'failed to open bitcoind cookie file'; then
echo "[ERREUR] Problème d'accès au cookie RPC bitcoin détecté" >&2
exit 1
fi
echo "[SUCCES] Tests sdk_relay passés"