From a5b8f1a2dbb1ec4efb057b4954a6451ccc3198d8 Mon Sep 17 00:00:00 2001 From: Nicolas Cantu Date: Fri, 19 Sep 2025 08:01:47 +0000 Subject: [PATCH] ci: docker_tag=ext chore(node): redeploy images ext --- .env.exemple | 11 +++++---- conf/nginx/dev4.4nkweb.com.conf | 3 +++ docker-compose.yml | 2 +- docs/analyse.md | 40 +++++++++++++++++++++++++++++++++ tests/analyse.md | 28 +++++++++++++++++++++++ 5 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 tests/analyse.md diff --git a/.env.exemple b/.env.exemple index 5ee9a28..07c1c5e 100644 --- a/.env.exemple +++ b/.env.exemple @@ -7,7 +7,7 @@ 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/annuaire +IDNOT_API_BASE_URL=https://qual-api.notaires.fr # Configuration serveur APP_HOST=dev4.4nkweb.com @@ -39,14 +39,14 @@ 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 -SIGNER_BASE_URL=https://dev3.4nkweb.com/signer/ -CORS_ALLOWED_ORIGINS=http://local.4nkweb.com:3000,https://dev4.4nkweb.com # WS # RELAY_URLS=wss://demo.4nkweb.com/ws RELAY_URLS=wss://dev4.4nkweb.com/ws + # SIGNER_WS_URL=ws://dev4.4nkweb.com/signer/ SIGNER_WS_URL=ws://dev3.4nkweb.com +SIGNER_BASE_URL=https://dev3.4nkweb.com # IHM URLS @@ -56,6 +56,8 @@ VITE_BOOTSTRAPURL=https://dev4.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 # ================================= /!\ sensible ======================== @@ -86,4 +88,5 @@ STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID= STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID= STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID= -SIGNER_API_KEY=your-api-key-change-this \ No newline at end of file +SIGNER_API_KEY=your-api-key-change-this +VITE_JWT_SECRET_KEY=52b3d77617bb00982dfee15b08effd52cfe5b2e69b2f61cc4848cfe1e98c0bc9 \ No newline at end of file diff --git a/conf/nginx/dev4.4nkweb.com.conf b/conf/nginx/dev4.4nkweb.com.conf index 1ebb982..6c38085 100644 --- a/conf/nginx/dev4.4nkweb.com.conf +++ b/conf/nginx/dev4.4nkweb.com.conf @@ -3,6 +3,9 @@ server { listen 80; server_name dev4.4nkweb.com; + # Forcer l'upgrade des requêtes HTTP en HTTPS pour éviter les contenus mixtes + add_header Content-Security-Policy "upgrade-insecure-requests" always; + # ACME HTTP-01 challenges location /.well-known/acme-challenge/ { root /var/www/letsencrypt; diff --git a/docker-compose.yml b/docker-compose.yml index 789680d..7b6f4eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,7 +52,7 @@ services: ports: - "127.0.0.1:8000:8000" healthcheck: - test: ["CMD-SHELL", "code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1); [ \"$code\" != \"000\" ]"] + test: ["CMD-SHELL", "code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/tweaks/1); [ \"$$code\" != \"000\" ]"] interval: 15s timeout: 5s retries: 10 diff --git a/docs/analyse.md b/docs/analyse.md index 5dc0f45..e631ba4 100644 --- a/docs/analyse.md +++ b/docs/analyse.md @@ -25,3 +25,43 @@ Analyse synthétique de l’orchestrateur `lecoffre_node` (Docker Compose + Ngin - **Tags d’images**: 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 d’images (`docker-support-v2` si applicable) et éviter `latest` en prod +- Vérifier l’alignement `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) diff --git a/tests/analyse.md b/tests/analyse.md new file mode 100644 index 0000000..084ad4b --- /dev/null +++ b/tests/analyse.md @@ -0,0 +1,28 @@ +## 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://local.4nkweb.com:3000`, `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 `local.4nkweb.com:3000` → `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` +