diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a9a725..462578a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -273,5 +273,5 @@ Merci à tous les contributeurs qui rendent ce projet possible ! --- -**Dernière mise à jour** : 2024-09-25 +**Dernière mise à jour** : 2024-09-25 **Version** : 1.0.0 \ No newline at end of file diff --git a/IA_agents/README.md b/IA_agents/README.md index e4b12ac..843ec9f 100644 --- a/IA_agents/README.md +++ b/IA_agents/README.md @@ -35,6 +35,7 @@ Ce répertoire contient toute la documentation nécessaire pour les agents IA tr ### **4. Documents de Déploiement** - [`prompts/prompt-deploy.md`](prompts/prompt-deploy.md) - Prompt de déploiement complet +- **Scripts centralisés** : Tous les scripts d'agents IA sont maintenant dans `projects/lecoffre/lecoffre_node/scripts/` ## 🚨 RÈGLES CRITIQUES @@ -48,7 +49,8 @@ docker compose start ### **✅ OBLIGATIONS ABSOLUES** ```bash -# ✅ Utiliser UNIQUEMENT ces scripts (NOUVEAU) +# ✅ Utiliser UNIQUEMENT ces scripts (NOUVEAU - centralisés) +cd projects/lecoffre/lecoffre_node ./scripts/start.sh # Démarrage séquentiel avec progression ./scripts/validate-deployment.sh # Validation complète ./scripts/maintenance.sh # Menu de maintenance interactif @@ -85,7 +87,7 @@ Phase 5: Services Utilitaires ## 🔧 Scripts de Déploiement -### **Scripts OBLIGATOIRES** +### **Scripts OBLIGATOIRES** (centralisés dans `projects/lecoffre/lecoffre_node/scripts/`) | Script | Usage | Phases | |--------|-------|--------| | `start-with-progress.sh` | Démarrage complet avec phases | 1, 2, 3, 5 | diff --git a/IA_agents/prompts/prompt-CI_all/prompt.md b/IA_agents/prompts/prompt-CI_all/prompt.md index 0291e7b..bb1f7c8 100644 --- a/IA_agents/prompts/prompt-CI_all/prompt.md +++ b/IA_agents/prompts/prompt-CI_all/prompt.md @@ -24,7 +24,8 @@ Apprend et retient : `4NK_env/IA_agents/prompts/prompt-global.md`. * [ ] Supprime du repos distant tous les fichiers non suivis de tout l'historique des commit de la branche. * [ ] Supprime du repos distant tous les fichiers non suivis de tout l'historique des commit de la branche. Soit très prudent vérifie avant. * [ ] pour tronquer l’historique Git de la branche « ext » et ne conserver que les cinq derniers commits avec les paramètre suivants `BR="ext"`, `REMOTE="origin"`, `DATE_TAG="$(date -u +'%Y%m%d-%H%M%S')"`, `BACKUP_TAG="backup/${BR}-pre-truncate-${DATE_TAG}"` pour `repo_clean.sh`. Soit très prudent vérifie avant. -* [ ] Relance tous les services de `lecoffre_node/` avec `--remove-orphans` et affiche les variables d'environnement de chacun +* [ ] Relance tous les services de `projects/lecoffre/lecoffre_node/` avec `--remove-orphans` et affiche les variables d'environnement de chacun +* [ ] Utilise les scripts centralisés dans `projects/lecoffre/lecoffre_node/scripts/` pour toutes les opérations de déploiement --- diff --git a/IA_agents/prompts/prompt-CI_all/scripts/repo_clean.sh b/IA_agents/prompts/prompt-CI_all/scripts/repo_clean.sh deleted file mode 100644 index 0eab18f..0000000 --- a/IA_agents/prompts/prompt-CI_all/scripts/repo_clean.sh +++ /dev/null @@ -1,51 +0,0 @@ -set -euo pipefail - -BR="ext" -REMOTE="origin" -DATE_TAG="$(date -u +'%Y%m%d-%H%M%S')" -BACKUP_TAG="backup/${BR}-pre-truncate-${DATE_TAG}" - -# 1) Pré-vol -git fetch --prune "${REMOTE}" -test -z "$(git status --porcelain)" # fail si index sale -git rev-parse --verify "${BR}" >/dev/null -git ls-remote --exit-code "${REMOTE}" "refs/heads/${BR}" >/dev/null - -# 2) Mémos de contrôle -echo "[INFO] Avant: 5 derniers SHAs sur ${BR}" -git rev-list --max-count=5 "${BR}" | tee /tmp/pre_last5.txt - -# 3) Tag de sauvegarde (rollback) -git tag -a "${BACKUP_TAG}" -m "Backup avant tronquage ${BR}" -git push "${REMOTE}" "refs/tags/${BACKUP_TAG}" - -# 4) Construction d’un nouvel historique with orphan + cherry-pick -git checkout "${BR}" -git checkout --orphan "${BR}-truncate-work" -# Démarrer sur un commit vide pour faciliter les cherry-pick -git commit --allow-empty -m "Base vide pour reconstruction des 5 derniers commits" - -# 5) Rejouer exactement les 5 derniers commits dans l’ordre chronologique -COMMITS=$(git rev-list --reverse "${BR}@{1}~5..${BR}@{1}") -# Remarque: ${BR}@{1} fige la référence de ${BR} avant checkout orphan -for C in ${COMMITS}; do - git cherry-pick --allow-empty --keep-redundant-commits "${C}" -done - -# 6) Remplacer la branche -git branch -D "${BR}" || true -git branch -m "${BR}-truncate-work" "${BR}" - -# 7) Vérifications locales -echo "[INFO] Après: 5 derniers SHAs sur ${BR}" -git rev-list --max-count=5 "${BR}" | tee /tmp/post_last5.txt -diff -u /tmp/pre_last5.txt /tmp/post_last5.txt >/dev/null || { - echo "[ERROR] Les 5 SHAs ne correspondent pas" - exit 2 -} -git fsck - -# 8) Publication (push sécurisé) -git push --force-with-lease "${REMOTE}" "refs/heads/${BR}" - -echo "[OK] Tronquage terminé. Tag de secours: ${BACKUP_TAG}" \ No newline at end of file diff --git a/IA_agents/prompts/prompt-confs/prompt.md b/IA_agents/prompts/prompt-confs/prompt.md index 4bd6a6a..d297c74 100644 --- a/IA_agents/prompts/prompt-confs/prompt.md +++ b/IA_agents/prompts/prompt-confs/prompt.md @@ -12,7 +12,7 @@ Centraliser toutes les configurations dans `4NK_env/confs//` et faire po - Vérifier/compléter la migration des autres services si de nouvelles configs apparaissent. - Éviter les symlinks: toujours référencer le chemin centralisé `4NK_env/confs//...` dans compose, Dockerfile, scripts, Nginx. - Mettre à jour la documentation existante qui mentionnait `lecoffre_node/conf/**`. -- Adapter les scripts (`scripts/**`) qui manipulent encore `lecoffre_node/conf/**`. +- Adapter les scripts (`projects/lecoffre/lecoffre_node/scripts/**`) qui manipulent encore `lecoffre_node/conf/**`. ### Bonnes pratiques - Conserver `confs/` hors du contrôle de versions sensible si nécessaire; veiller aux secrets. diff --git a/IA_agents/prompts/prompt-confs/scripts/apply-configs.sh b/IA_agents/prompts/prompt-confs/scripts/apply-configs.sh deleted file mode 100755 index 7a87119..0000000 --- a/IA_agents/prompts/prompt-confs/scripts/apply-configs.sh +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Charge les variables depuis /home/debian/4NK_env/confs/.env si présent -ENV_FILE="/home/debian/4NK_env/confs/.env" -ROOT_DIR_DEFAULT="/home/debian/4NK_env" - -safe_source() { - # Source un fichier en désactivant nounset pour éviter les erreurs variables non liées - local f="$1" - if [ -f "$f" ]; then - set +u - # shellcheck disable=SC1090 - . "$f" - set -u - fi -} - -if [ -f "$ENV_FILE" ]; then - set -a - safe_source "$ENV_FILE" - set +a -else - echo "[WARN] $ENV_FILE introuvable; tentative de chargement des env//.env" - for f in \ - /home/debian/4NK_env/env/lecoffre_node/.env \ - /home/debian/4NK_env/env/sdk_relay/.env \ - /home/debian/4NK_env/env/sdk_storage/.env \ - /home/debian/4NK_env/env/ihm_client/.env \ - /home/debian/4NK_env/env/lecoffre-front/.env \ - /home/debian/4NK_env/env/monitoring/.env; do - set -a - safe_source "$f" - set +a - done -fi - -ROOT_DIR="${ROOT_DIR:-$ROOT_DIR_DEFAULT}" -ROOT_URL="${ROOT_URL:-https://dev4.4nkweb.com}" -BOOTSTRAP_HOST="${BOOTSTRAP_HOST:-dev3.4nkweb.com}" - -# helper: test presence of all vars -have_vars() { - for name in "$@"; do - eval "val=\${$name-}" - if [ -z "${val}" ]; then - return 1 - fi - done - return 0 -} - -# 1) bitcoin.conf -btc_conf="$ROOT_DIR/confs/bitcoin/bitcoin.conf" -if [ -f "$btc_conf" ]; then - if have_vars BITCOIN_DATA_DIR BITCOIN_BIND BITCOIN_ZMQPUBRAWTX_PORT BITCOIN_ZMQPBUBHASHBLOCK_PORT BITCOIN_SIGNET_P2P_PORT BITCOIN_SIGNET_RPC_PORT; then - sed -i \ - -e "s|^datadir=.*$|datadir=${BITCOIN_DATA_DIR}|" \ - -e "s|^zmqpubrawtx=.*$|zmqpubrawtx=tcp://${BITCOIN_BIND}:${BITCOIN_ZMQPUBRAWTX_PORT}|" \ - -e "s|^zmqpubhashblock=.*$|zmqpubhashblock=tcp://${BITCOIN_BIND}:${BITCOIN_ZMQPBUBHASHBLOCK_PORT}|" \ - -e "s|^bind=.*$|bind=${BITCOIN_BIND}:${BITCOIN_SIGNET_P2P_PORT}|" \ - -e "s|^rpcbind=.*$|rpcbind=${BITCOIN_BIND}:${BITCOIN_SIGNET_RPC_PORT}|" \ - "$btc_conf" - echo "[OK] bitcoin.conf mis à jour" - else - echo "[SKIP] bitcoin.conf (variables manquantes)" - fi -fi - -# 2) blindbit.toml -bb_conf="$ROOT_DIR/confs/blindbit-oracle/blindbit.toml" -if [ -f "$bb_conf" ]; then - if have_vars BLINDBIT_PORT BITCOIN_DOCKER_HOST BITCOIN_SIGNET_RPC_PORT BITCOIN_DATA_DIR; then - sed -i \ - -e "s|^host\s*=.*$|host = \"0.0.0.0:${BLINDBIT_PORT}\"|" \ - -e "s|^rpc_endpoint\s*=.*$|rpc_endpoint = \"http://${BITCOIN_DOCKER_HOST}:${BITCOIN_SIGNET_RPC_PORT}\"|" \ - -e "s|^cookie_path\s*=.*$|cookie_path = \"${BITCOIN_DATA_DIR}/signet/.cookie\"|" \ - "$bb_conf" - echo "[OK] blindbit.toml mis à jour" - else - echo "[SKIP] blindbit.toml (variables manquantes)" - fi -fi - -# 3) grafana.ini -gf_conf="$ROOT_DIR/confs/grafana/grafana.ini" -if [ -f "$gf_conf" ]; then - sed -i \ - -e "s|^\s*root_url\s*=.*$|root_url = ${ROOT_URL}/grafana/|" \ - "$gf_conf" - echo "[OK] grafana.ini mis à jour" -fi - -# 4) loki-config.yaml -loki_conf="$ROOT_DIR/confs/loki/loki-config.yaml" -if [ -f "$loki_conf" ]; then - if have_vars LOKI_HTTP_LISTEN_PORT; then - sed -i \ - -e "s|^\s*http_listen_port:.*$|http_listen_port: ${LOKI_HTTP_LISTEN_PORT}|" \ - "$loki_conf" - echo "[OK] loki-config.yaml mis à jour" - else - echo "[SKIP] loki-config.yaml (variables manquantes)" - fi -fi - -# 5) promtail.yml -pt_conf="$ROOT_DIR/confs/promtail/promtail.yml" -if [ -f "$pt_conf" ]; then - if have_vars LOKI_DOCKER_HOST LOKI_HTTP_LISTEN_PORT; then - sed -i \ - -e "s|url: .*|url: http://${LOKI_DOCKER_HOST}:${LOKI_HTTP_LISTEN_PORT}/loki/api/v1/push|" \ - "$pt_conf" - fi - sed -i \ - -e "s|/home/debian/4NK_env/|${ROOT_DIR}/|g" \ - "$pt_conf" - echo "[OK] promtail.yml mis à jour" -fi - -# 6) sdk_relay.conf -relay_conf="$ROOT_DIR/confs/relay/sdk_relay.conf" -if [ -f "$relay_conf" ]; then - if have_vars BITCOIN_DOCKER_HOST BITCOIN_SIGNET_RPC_PORT RELAY_PORT BITCOIN_WALLET_NAME BLINDBIT_DOCKER_NAME BLINDBIT_PORT BITCOIN_BIND BITCOIN_ZMQPBUBHASHBLOCK_PORT BITCOIN_DATA_DIR BOOTSTRAP_HOST; then - sed -i \ - -e "s|^core_url=.*$|core_url=http://${BITCOIN_DOCKER_HOST}:${BITCOIN_SIGNET_RPC_PORT}|" \ - -e "s|^ws_url=.*$|ws_url=0.0.0.0:${RELAY_PORT}|" \ - -e "s|^wallet_name=.*$|wallet_name=${BITCOIN_WALLET_NAME}|" \ - -e "s|^blindbit_url=.*$|blindbit_url=http://${BLINDBIT_DOCKER_NAME}:${BLINDBIT_PORT}|" \ - -e "s|^zmq_url=.*$|zmq_url=tcp://${BITCOIN_BIND}:${BITCOIN_ZMQPBUBHASHBLOCK_PORT}|" \ - -e "s|^storage=.*$|storage=https://dev4.4nkweb.com/storage|" \ - -e "s|^data_dir=.*$|data_dir=${ROOT_DIR}/data|" \ - -e "s|^bitcoin_data_dir=.*$|bitcoin_data_dir=${BITCOIN_DATA_DIR}|" \ - -e "s|^bootstrap_url=.*$|bootstrap_url=wss://${BOOTSTRAP_HOST}/ws|" \ - "$relay_conf" - echo "[OK] sdk_relay.conf mis à jour" - else - echo "[SKIP] sdk_relay.conf (variables manquantes)" - fi -fi - -# 7) env/grafana/.env -gf_env="$ROOT_DIR/env/grafana/.env" -if [ -f "$gf_env" ]; then - sed -i \ - -e "s|^GF_SERVER_ROOT_URL=.*$|GF_SERVER_ROOT_URL=${ROOT_URL}/grafana/|" \ - "$gf_env" - echo "[OK] env grafana mis à jour" -fi - -# 8) env/ihm_client/.env -ihm_env="$ROOT_DIR/env/ihm_client/.env" -if [ -f "$ihm_env" ]; then - sed -i \ - -e "s|^NEXT_PUBLIC_4NK_IFRAME_URL=.*$|NEXT_PUBLIC_4NK_IFRAME_URL=${ROOT_URL}/|" \ - -e "s|^VITE_JWT_SECRET_KEY=.*$|VITE_JWT_SECRET_KEY=${VITE_JWT_SECRET_KEY:-FAKE-DATA-IA-CHANGE-ME}|" \ - -e "s|^VITE_API_BASE_URL=.*$|VITE_API_BASE_URL=${ROOT_URL}/lecoffre/api|" \ - -e "s|^VITE_WS_URL=.*$|VITE_WS_URL=wss://${BOOTSTRAP_HOST}/ws/|" \ - -e "s|^VITE_SIGNER_URL=.*$|VITE_SIGNER_URL=https://${BOOTSTRAP_HOST}/signer|" \ - -e "s|^VITE_BOOTSTRAPURL=.*$|VITE_BOOTSTRAPURL=wss://${BOOTSTRAP_HOST}/ws/|" \ - "$ihm_env" - # RELAY_URLS nécessite ROOT_HOST; fallback best-effort - relay_urls="wss://${BOOTSTRAP_HOST}/ws/" - if [ -n "${ROOT_HOST:-}" ]; then relay_urls="wss://${ROOT_HOST}/ws/,${relay_urls}"; fi - sed -i -e "s|^RELAY_URLS=.*$|RELAY_URLS=${relay_urls}|" "$ihm_env" - echo "[OK] env ihm_client mis à jour" -fi - -# 9) env/lecoffre-front/.env -front_env="$ROOT_DIR/env/lecoffre-front/.env" -if [ -f "$front_env" ]; then - sed -i \ - -e "s|^SIGNER_API_KEY=.*$|SIGNER_API_KEY=${VITE_BOOTSTRAPURL:-}|" \ - -e "s|^VITE_JWT_SECRET_KEY=.*$|VITE_JWT_SECRET_KEY=${VITE_JWT_SECRET_KEY:-FAKE-DATA-IA-CHANGE-ME}|" \ - -e "s|^NEXT_PUBLIC_4NK_URL=.*$|NEXT_PUBLIC_4NK_URL=${IHM_CLIENT_URL:-${ROOT_URL}}|" \ - -e "s|^NEXT_PUBLIC_FRONT_APP_HOST=.*$|NEXT_PUBLIC_FRONT_APP_HOST=https://${LECOFFRE_FRONT_URL:-dev4.4nkweb.com}/lecoffre|" \ - -e "s|^NEXT_PUBLIC_BACK_API_HOST=.*$|NEXT_PUBLIC_BACK_API_HOST=${LECOFFRE_BACK_URL:-dev3.4nkweb.com}|" \ - -e "s|^NEXT_PUBLIC_4NK_IFRAME_URL=.*$|NEXT_PUBLIC_4NK_IFRAME_URL=${ROOT_URL}|" \ - -e "s|^NEXT_PUBLIC_API_URL=.*$|NEXT_PUBLIC_API_URL=https://${LECOFFRE_BACK_URL:-dev3.4nkweb.com}/api|" \ - -e "s|^NEXT_PUBLIC_DEFAULT_STORAGE_URLS=.*$|NEXT_PUBLIC_DEFAULT_STORAGE_URLS=${ROOT_URL}/storage|" \ - "$front_env" - echo "[OK] env lecoffre-front mis à jour" -fi - -# 10) env/sdk_storage/.env -storage_env="$ROOT_DIR/env/sdk_storage/.env" -if [ -f "$storage_env" ]; then - sed -i \ - -e "s|^DOMAIN=.*$|DOMAIN=${ROOT_HOST:-dev4.4nkweb.com}|" \ - -e "s|^STORAGE_URL=.*$|STORAGE_URL=http://${STORAGE_DOCKER_HOST:-sdk_storage}:${STORAGE_PORT:-8080}|" \ - -e "s|^STORAGE_PORT=.*$|STORAGE_PORT=${STORAGE_PORT:-8080}|" \ - -e "s|^STORAGE_DATA_DIR=.*$|STORAGE_DATA_DIR=${ROOT_DIR}/data/storage|" \ - -e "s|^VITE_STORAGE_URL=.*$|VITE_STORAGE_URL=${ROOT_URL}/storage|" \ - "$storage_env" - echo "[OK] env sdk_storage mis à jour" -fi - -echo "[DONE] Configuration appliquée (best-effort)" diff --git a/IA_agents/prompts/prompt-data/prompt.md b/IA_agents/prompts/prompt-data/prompt.md index f51de6b..4c2dc7d 100644 --- a/IA_agents/prompts/prompt-data/prompt.md +++ b/IA_agents/prompts/prompt-data/prompt.md @@ -14,7 +14,7 @@ Centraliser toutes les données applicatives dans `4NK_env/data//` pour - Remplacer les liens symboliques par des chemins directs dans les configurations: - docker-compose: volumes pointant vers `/home/debian/4NK_env/data/` - Dockerfile/entrypoints: chemins de lecture/écriture adaptés - - Scripts: variables d’environnement/chemins mis à jour + - Scripts: variables d'environnement/chemins mis à jour dans `projects/lecoffre/lecoffre_node/scripts/` - Applications: paramètres et `.env` alignés si des chemins étaient codés en dur - Vérifier les permissions/ownership sur `4NK_env/data/**` (conteneurs non-root). - Mettre à jour la documentation et tests impactés. @@ -22,6 +22,6 @@ Centraliser toutes les données applicatives dans `4NK_env/data//` pour ### Bonnes pratiques - Pas de liens symboliques pour la donnée persistée; préférer des références directes. - Éviter d’intégrer `data/` au dépôt; conserver l’ignore dans `.gitignore`, `.cursorignore`, `.dockerignore`. -- Couvrir par une sauvegarde régulière via `scripts/backup_all.sh` (section data). +- Couvrir par une sauvegarde régulière via `projects/lecoffre/lecoffre_node/scripts/backup_all.sh` (section data). diff --git a/IA_agents/prompts/prompt-deploy/prompt.md b/IA_agents/prompts/prompt-deploy/prompt.md index a55bee5..59d6c22 100644 --- a/IA_agents/prompts/prompt-deploy/prompt.md +++ b/IA_agents/prompts/prompt-deploy/prompt.md @@ -2,14 +2,14 @@ ### Gestion des branches ext (submodules + repo racine) -Script: `scripts/push-commit.sh` +Script: `projects/lecoffre/lecoffre_node/scripts/push-commit.sh` -- Objectif: basculer chaque sous-module et le repo racine sur `ext`, committer uniquement s’il y a des changements, et pousser sur `origin ext`. -- Sécurité: crée `ext` depuis `origin/ext` si absente; n’échoue pas s’il n’y a rien à committer. +- Objectif: basculer chaque sous-module et le repo racine sur `ext`, committer uniquement s'il y a des changements, et pousser sur `origin ext`. +- Sécurité: crée `ext` depuis `origin/ext` si absente; n'échoue pas s'il n'y a rien à committer. Usage: ```bash -bash /home/debian/4NK_env/scripts/push-commit.sh +bash /home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts/push-commit.sh ``` Apprend et retient : `4NK_env/IA_agents/prompts/prompt-global.md`. @@ -317,20 +317,20 @@ Le prompt inclut des cases à cocher pour suivre l'avancement : ## Scripts utiles (exécution depuis 4NK_env) ### Synchronisation des configurations depuis Vault -- Script: `IA_agents/prompts/prompt-deploy/scripts/sync-vault-full.sh` +- Script: `projects/lecoffre/lecoffre_node/scripts/sync-vault-full.sh` - Rôle: clone/MAJ du dépôt `4NK_vault` dans `vault/`, build du SDK `vault/sdk-client`, synchronisation des fichiers déchiffrés vers `confs/`, suppression du miroir `vault/confs/`. - Pré‑requis: fichier `vault/.env` (ex: `VAULT_BASE_URL`, `VAULT_USER` ou `VAULT_USER_ID`, `VAULT_ENV`). - Commande: ```sh -sh IA_agents/prompts/prompt-deploy/scripts/sync-vault-full.sh +sh projects/lecoffre/lecoffre_node/scripts/sync-vault-full.sh ``` ### Vérification rapide de la santé des services -- Script: `IA_agents/prompts/prompt-deploy/scripts/quick-health-check.sh` +- Script: `projects/lecoffre/lecoffre_node/scripts/quick-health-check.sh` - Rôle: lance `scripts/lecoffre_node/quick-health-check.sh` en chemins relatifs. - Commande: ```sh -sh IA_agents/prompts/prompt-deploy/scripts/quick-health-check.sh +sh projects/lecoffre/lecoffre_node/scripts/quick-health-check.sh ``` ### Notes diff --git a/IA_agents/prompts/prompt-deploy/scripts/bitcoin-progress.sh b/IA_agents/prompts/prompt-deploy/scripts/bitcoin-progress.sh deleted file mode 100755 index d0f7e36..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/bitcoin-progress.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Script de test de progression pour Bitcoin Signet -info=$(bitcoin-cli -signet -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}') -blocks=$(echo "$info" | jq -r '.blocks // 0') -headers=$(echo "$info" | jq -r '.headers // 0') -ibd=$(echo "$info" | jq -r '.initialblockdownload // false') -verification_progress=$(echo "$info" | jq -r '.verificationprogress // 0') - -# Bitcoin est considéré comme ready s'il répond aux commandes et a au moins quelques blocs -if [ "$blocks" -gt 0 ]; then - if [ "$ibd" = "false" ] || [ "$blocks" -eq "$headers" ]; then - echo "Bitcoin ready: Synced ($blocks blocks)" - else - remaining=$((headers - blocks)) - progress=$((blocks * 100 / headers)) - verification_percent=$(echo "$verification_progress * 100" | bc -l | cut -d. -f1) - echo "Bitcoin IBD: $blocks/$headers ($remaining remaining) - $progress% - Verification: $verification_percent%" - fi - exit 0 -else - echo "Bitcoin starting: No blocks yet" - exit 1 -fi diff --git a/IA_agents/prompts/prompt-deploy/scripts/blindbit-progress.sh b/IA_agents/prompts/prompt-deploy/scripts/blindbit-progress.sh deleted file mode 100755 index 737eace..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/blindbit-progress.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Script de test de progression pour BlindBit -# Vérifier si le processus BlindBit est en cours d'exécution -if pgrep main > /dev/null 2>/dev/null; then - # Vérifier l'API - essais multiples et deux hôtes (127.0.0.1 et 0.0.0.0) - for i in 1 2 3; do - if wget -q --spider http://127.0.0.1:8000/tweaks/1 2>/dev/null || wget -q --spider http://0.0.0.0:8000/tweaks/1 2>/dev/null; then - echo 'BlindBit ready: Oracle service responding' - exit 0 - fi - sleep 2 - done - echo 'BlindBit starting: Oracle service initializing' - exit 1 -else - echo 'BlindBit starting: Process not ready' - exit 1 -fi diff --git a/IA_agents/prompts/prompt-deploy/scripts/deploy-all.sh b/IA_agents/prompts/prompt-deploy/scripts/deploy-all.sh deleted file mode 100644 index d101198..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/deploy-all.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env sh -set -euo pipefail - -# Determine project root and compose dir -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)" -COMPOSE_DIR="$ROOT_DIR/lecoffre_node" - -# Healthcheck helpers now colocated here -HC_TOR="$SCRIPT_DIR/tor-progress.sh" -HC_BITCOIN="$SCRIPT_DIR/bitcoin-progress.sh" -HC_BLINDBIT="$SCRIPT_DIR/blindbit-progress.sh" -HC_RELAY="$SCRIPT_DIR/sdk-relay-progress.sh" - -cd "$COMPOSE_DIR" - -progress_line() { - svc="$1"; kind="$2" - case "$kind" in - tor) sh "$HC_TOR" 2>/dev/null | tail -1 || true ;; - bitcoin) sh "$HC_BITCOIN" 2>/dev/null | tail -1 || true ;; - blindbit) sh "$HC_BLINDBIT" 2>/dev/null | tail -1 || true ;; - relay) sh "$HC_RELAY" 2>/dev/null | tail -1 || true ;; - *) echo "[$svc] waiting ..." ;; - esac -} - -wait_healthy() { - svc="$1"; tries=${2:-60}; sleep_s=${3:-5}; kind=${4:-generic} - i=0 - while [ $i -lt $tries ]; do - state=$(docker inspect --format='{{json .State.Health.Status}}' "$svc" 2>/dev/null || echo "\"unknown\"") - [ "$state" = '"healthy"' ] && { echo "[$svc] healthy"; return 0; } - progress_line "$svc" "$kind" - sleep "$sleep_s"; i=$((i+1)) - done - echo "[$svc] not healthy after wait"; return 1 -} - -check_ports_urls() { - svc="$1" - case "$svc" in - tor-proxy) - # Ports: 9050-9051 local; no HTTP - nc -z 127.0.0.1 9050 && echo "[tor] port 9050 OK" || echo "[tor] 9050 FAIL" || true - nc -z 127.0.0.1 9051 && echo "[tor] port 9051 OK" || echo "[tor] 9051 FAIL" || true - ;; - bitcoin-signet) - # Internal RPC port (38332 signet), no external URL - nc -z 127.0.0.1 38332 && echo "[bitcoin] RPC 38332 OK" || echo "[bitcoin] 38332 FAIL" || true - ;; - blindbit-oracle) - # Internal: http://localhost:8000/tweaks/1 - curl -fsS http://127.0.0.1:8000/tweaks/1 >/dev/null && echo "[blindbit] API OK" || echo "[blindbit] API FAIL" || true - ;; - sdk_storage) - curl -fsS http://127.0.0.1:8081/health >/dev/null && echo "[storage] health OK" || echo "[storage] health FAIL" || true - ;; - sdk_relay) - # WS bind + HTTP health - curl -fsS http://127.0.0.1:8091/ >/dev/null && echo "[relay] health port 8091 OK" || echo "[relay] 8091 FAIL" || true - nc -z 0.0.0.0 8090 && echo "[relay] ws 8090 OK" || echo "[relay] ws 8090 FAIL" || true - # Third-party bootstrap - curl -fsS https://dev3.4nkweb.com/api/v1/health >/dev/null && echo "[relay] dev3 api OK" || echo "[relay] dev3 api FAIL" || true - ;; - ihm_client) - curl -fsS http://127.0.0.1:3003/ >/dev/null && echo "[ihm] local OK" || echo "[ihm] local FAIL" || true - ;; - lecoffre-front) - curl -fsS http://127.0.0.1:3004/ >/dev/null && echo "[front] local OK" || echo "[front] local FAIL" || true - # External front - curl -fsS https://dev4.4nkweb.com/lecoffre/ >/dev/null && echo "[front] external OK" || echo "[front] external FAIL" || true - ;; - loki) - curl -fsS http://127.0.0.1:3100/ready >/dev/null && echo "[loki] ready OK" || echo "[loki] ready FAIL" || true - ;; - promtail) - echo "[promtail] positions/inputs checked by health" ;; - grafana) - curl -fsS http://127.0.0.1:3005/api/health >/dev/null && echo "[grafana] local api OK" || echo "[grafana] local api FAIL" || true - curl -fsS https://dev4.4nkweb.com/grafana/ >/dev/null && echo "[grafana] external OK" || echo "[grafana] external FAIL" || true - ;; - status-api) - curl -fsS http://127.0.0.1:3006/api >/dev/null && echo "[status] api OK" || echo "[status] api FAIL" || true - ;; - esac -} - -# Phase 1: base -docker compose up -d tor || true -wait_healthy tor-proxy 80 3 tor || true -check_ports_urls tor-proxy || true - -# Phase 2: blockchain -docker compose up -d bitcoin || true -wait_healthy bitcoin-signet 120 5 bitcoin || true -check_ports_urls bitcoin-signet || true - -docker compose up -d blindbit || true -wait_healthy blindbit-oracle 120 5 blindbit || true -check_ports_urls blindbit-oracle || true - -# Phase 3: apps (storage -> relay -> ihm/front) -docker compose up -d sdk_storage || true -wait_healthy sdk_storage 60 5 || true -check_ports_urls sdk_storage || true - -docker compose up -d sdk_relay || true -wait_healthy sdk_relay 120 5 relay || true -check_ports_urls sdk_relay || true - -docker compose up -d ihm_client lecoffre-front || true -wait_healthy ihm_client 60 5 || true -check_ports_urls ihm_client || true -wait_healthy lecoffre-front 60 5 || true -check_ports_urls lecoffre-front || true - -# Phase 4: monitoring (loki -> promtail -> grafana) -docker compose up -d loki || true -wait_healthy loki 120 5 || true -check_ports_urls loki || true - -docker compose up -d promtail || true -wait_healthy promtail 60 5 || true -check_ports_urls promtail || true - -docker compose up -d grafana || true -wait_healthy grafana 120 5 || true -check_ports_urls grafana || true - -# Phase 5: utils -docker compose up -d status-api watchtower || true -wait_healthy status-api 60 5 || true -check_ports_urls status-api || true - -echo "[OK] Déploiement séquentiel terminé" diff --git a/IA_agents/prompts/prompt-deploy/scripts/nginx-config-symlink.sh b/IA_agents/prompts/prompt-deploy/scripts/nginx-config-symlink.sh deleted file mode 100755 index 7cc1c42..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/nginx-config-symlink.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Script pour remplacer les configurations nginx par des liens symboliques -# vers les fichiers centralisés dans /home/debian/4NK_env/confs/nginx - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)" -NGINX_CONF_DIR="/home/debian/4NK_env/confs/nginx" -NGINX_ACTIVE_DIR="/etc/nginx/sites-available" -NGINX_ENABLED_DIR="/etc/nginx/sites-enabled" - -echo "==========================================" -echo " Configuration Nginx - Liens Symboliques" -echo "==========================================" - -# Vérifier que le répertoire de configuration centralisé existe -if [ ! -d "$NGINX_CONF_DIR" ]; then - echo "❌ Erreur: Le répertoire $NGINX_CONF_DIR n'existe pas" - exit 1 -fi - -echo "📁 Répertoire de configuration centralisé: $NGINX_CONF_DIR" -echo "📁 Répertoire nginx sites-available: $NGINX_ACTIVE_DIR" -echo "📁 Répertoire nginx sites-enabled: $NGINX_ENABLED_DIR" - -# Fonction pour créer un lien symbolique -create_symlink() { - local source="$1" - local target="$2" - local description="$3" - - echo "🔗 Création du lien: $description" - echo " Source: $source" - echo " Cible: $target" - - # Supprimer le fichier/cible existant s'il existe - if [ -e "$target" ] || [ -L "$target" ]; then - echo " Suppression de l'ancien fichier/lien: $target" - sudo rm -f "$target" - fi - - # Créer le lien symbolique - sudo ln -sf "$source" "$target" - - if [ -L "$target" ]; then - echo " ✅ Lien créé avec succès" - else - echo " ❌ Erreur lors de la création du lien" - return 1 - fi -} - -echo "" -echo "🔧 Création des liens symboliques..." - -# Lister les fichiers de configuration dans le répertoire centralisé -config_files=$(find "$NGINX_CONF_DIR" -name "*.conf" -type f) - -if [ -z "$config_files" ]; then - echo "❌ Aucun fichier .conf trouvé dans $NGINX_CONF_DIR" - exit 1 -fi - -echo "📋 Fichiers de configuration trouvés:" -echo "$config_files" | while read -r file; do - echo " - $(basename "$file")" -done - -echo "" -echo "🔗 Création des liens dans sites-available..." - -# Créer les liens dans sites-available -echo "$config_files" | while read -r source_file; do - filename=$(basename "$source_file") - target_file="$NGINX_ACTIVE_DIR/$filename" - - create_symlink "$source_file" "$target_file" "$filename" -done - -echo "" -echo "📋 Configuration actuelle de nginx..." - -# Lister les configurations actives (sites-available) -echo "📁 Fichiers dans sites-available:" -if [ -d "$NGINX_ACTIVE_DIR" ]; then - ls -la "$NGINX_ACTIVE_DIR" | grep -E "\.(conf|link)$" || echo " Aucun fichier .conf trouvé" -else - echo " ❌ Répertoire $NGINX_ACTIVE_DIR n'existe pas" -fi - -# Lister les configurations activées (sites-enabled) -echo "" -echo "📁 Fichiers dans sites-enabled:" -if [ -d "$NGINX_ENABLED_DIR" ]; then - ls -la "$NGINX_ENABLED_DIR" | grep -E "\.(conf|link)$" || echo " Aucun fichier .conf activé" -else - echo " ❌ Répertoire $NGINX_ENABLED_DIR n'existe pas" -fi - -echo "" -echo "🧪 Test de la configuration nginx..." - -# Tester la configuration nginx -if sudo nginx -t; then - echo "✅ Configuration nginx valide" - - echo "" - echo "🔄 Redémarrage de nginx..." - - # Redémarrer nginx - if sudo systemctl reload nginx; then - echo "✅ Nginx rechargé avec succès" - else - echo "❌ Erreur lors du rechargement de nginx" - echo "🔄 Tentative de redémarrage complet..." - if sudo systemctl restart nginx; then - echo "✅ Nginx redémarré avec succès" - else - echo "❌ Erreur lors du redémarrage de nginx" - exit 1 - fi - fi - - echo "" - echo "📊 Statut de nginx:" - sudo systemctl status nginx --no-pager -l - -else - echo "❌ Configuration nginx invalide" - echo "🔍 Détails de l'erreur:" - sudo nginx -t 2>&1 || true - exit 1 -fi - -echo "" -echo "==========================================" -echo "✅ Configuration nginx terminée avec succès" -echo "==========================================" - -# Afficher un résumé des liens créés -echo "" -echo "📋 Résumé des liens créés:" -echo "$config_files" | while read -r source_file; do - filename=$(basename "$source_file") - target_file="$NGINX_ACTIVE_DIR/$filename" - if [ -L "$target_file" ]; then - echo " ✅ $filename -> $(readlink "$target_file")" - else - echo " ❌ $filename -> Lien non créé" - fi -done - - diff --git a/IA_agents/prompts/prompt-deploy/scripts/quick-health-check.sh b/IA_agents/prompts/prompt-deploy/scripts/quick-health-check.sh deleted file mode 100644 index 18c5152..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/quick-health-check.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env sh -set -euo pipefail - -# Determine project root (4NK_env) relative to this script -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)" - -CHECK="$ROOT_DIR/scripts/lecoffre_node/quick-health-check.sh" -if [ ! -x "$CHECK" ]; then - echo "[ERROR] Script introuvable ou non exécutable: $CHECK" >&2 - exit 2 -fi - -exec "$CHECK" - - - - diff --git a/IA_agents/prompts/prompt-deploy/scripts/sdk-relay-progress.sh b/IA_agents/prompts/prompt-deploy/scripts/sdk-relay-progress.sh deleted file mode 100755 index caf0b86..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/sdk-relay-progress.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Script de test de progression pour SDK Relay -# Vérifier si le processus SDK Relay est en cours d'exécution -if pgrep sdk_relay > /dev/null 2>/dev/null; then - # Vérifier l'API WebSocket - if curl -f http://localhost:8091/ >/dev/null 2>&1; then - echo 'SDK Relay ready: WebSocket server responding' - exit 0 - else - # Récupérer les logs récents pour voir la progression - relay_logs=$(tail -20 /var/log/sdk_relay/sdk_relay.log 2>/dev/null | grep -E "(IBD|blocks|headers|waiting|scanning|connecting)" | tail -1 || echo "") - if [ -n "$relay_logs" ]; then - echo "SDK Relay sync: $relay_logs" - exit 1 - else - echo 'SDK Relay starting: WebSocket server initializing' - exit 1 - fi - fi -else - echo 'SDK Relay starting: Process not ready' - exit 1 -fi diff --git a/IA_agents/prompts/prompt-deploy/scripts/sdk-signer-progress.sh b/IA_agents/prompts/prompt-deploy/scripts/sdk-signer-progress.sh deleted file mode 100755 index d9cc2f9..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/sdk-signer-progress.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# Healthcheck for SDK Signer -# Prefer checking the HTTP endpoint first; fall back to log-based progress hints diff --git a/IA_agents/prompts/prompt-deploy/scripts/sync-vault-full.sh b/IA_agents/prompts/prompt-deploy/scripts/sync-vault-full.sh deleted file mode 100644 index 88afc1f..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/sync-vault-full.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env sh -set -euo pipefail - -# Déterminer la racine du projet (4NK_env) relativement à ce script -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)" - -REPO_URL="https://git.4nkweb.com/4nk/4NK_vault.git" -VAULT_ROOT="$ROOT_DIR/vault" -SDK_DIR="$VAULT_ROOT/sdk-client" -CONFS_DIR="$ROOT_DIR/confs" -VAULT_ENV_FILE="$VAULT_ROOT/.env" -SYNC_JS="$ROOT_DIR/scripts/sync-vault-configs.js" - -# 0) Charger l'env Vault si présent (VAULT_BASE_URL, VAULT_USER/VAULT_USER_ID, VAULT_ENV, etc.) -if [ -f "$VAULT_ENV_FILE" ]; then - set -a - . "$VAULT_ENV_FILE" - set +a -fi - -# 1) Cloner / mettre à jour le dépôt directement dans vault/ -mkdir -p "$VAULT_ROOT" -if [ -d "$VAULT_ROOT/.git" ]; then - echo "[git] Mise à jour du dépôt existant dans $VAULT_ROOT" - git -C "$VAULT_ROOT" remote set-url origin "$REPO_URL" 2>/dev/null || true - git -C "$VAULT_ROOT" fetch --prune origin - git -C "$VAULT_ROOT" checkout -B master origin/master - git -C "$VAULT_ROOT" reset --hard origin/master -else - echo "[git] Initialisation du dépôt dans $VAULT_ROOT" - git -C "$VAULT_ROOT" init - git -C "$VAULT_ROOT" remote add origin "$REPO_URL" 2>/dev/null || git -C "$VAULT_ROOT" remote set-url origin "$REPO_URL" - git -C "$VAULT_ROOT" fetch --depth 1 origin master - git -C "$VAULT_ROOT" checkout -B master origin/master -fi - -# 2) Construire le SDK client (TypeScript) -if [ ! -d "$SDK_DIR" ]; then - echo "[ERROR] Dossier sdk-client introuvable dans le dépôt $VAULT_ROOT" - exit 2 -fi -cd "$SDK_DIR" -# Tenter npm ci puis fallback npm install, puis compiler via tsc -npm ci --no-audit --progress=false || npm install --no-audit --progress=false -npx tsc || ./node_modules/.bin/tsc - -# 3) Démo: init/routes/sync locale (écrit sous vault/confs) -node "$SDK_DIR/dist/examples/usage.js" || true - -# 4) Copier le miroir local vers confs si présent; sinon fallback sync directe via SDK local -mkdir -p "$CONFS_DIR" -if [ -d "$VAULT_ROOT/confs" ]; then - echo "[copy] Synchronisation $VAULT_ROOT/confs -> $CONFS_DIR" - rm -rf "$CONFS_DIR" - mkdir -p "$CONFS_DIR" - cp -a "$VAULT_ROOT/confs/." "$CONFS_DIR/" - rm -rf "$VAULT_ROOT/confs" - echo "[cleanup] Suppression du miroir $VAULT_ROOT/confs" -else - echo "[fallback] Miroir inexistant, tentative de sync directe via SDK" - if [ -f "$SYNC_JS" ]; then - node "$SYNC_JS" || true - else - echo "[WARN] Script de sync SDK introuvable: $SYNC_JS" - fi -fi - -echo "[OK] Sync Vault terminée vers $CONFS_DIR" diff --git a/IA_agents/prompts/prompt-deploy/scripts/tor-progress.sh b/IA_agents/prompts/prompt-deploy/scripts/tor-progress.sh deleted file mode 100755 index c66e603..0000000 --- a/IA_agents/prompts/prompt-deploy/scripts/tor-progress.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Script de test de progression pour Tor -# Test simple : considérer Tor comme prêt après un délai -# Tor a terminé son bootstrap selon les logs Docker -echo 'Tor ready: Bootstrap complete (100%)' -exit 0 diff --git a/IA_agents/prompts/prompt-docs/prompt.md b/IA_agents/prompts/prompt-docs/prompt.md index 5958f23..65594e3 100644 --- a/IA_agents/prompts/prompt-docs/prompt.md +++ b/IA_agents/prompts/prompt-docs/prompt.md @@ -28,7 +28,8 @@ Centraliser toute la documentation des projets dans `4NK_env/docs//` et ```bash grep -R "\bdocs/\b" /home/debian/4NK_env | grep -v "/home/debian/4NK_env/docs/" || true ``` -- S’assurer que les READMEs des projets mentionnent explicitement `4NK_env/docs//`. +- S'assurer que les READMEs des projets mentionnent explicitement `4NK_env/docs//`. +- Scripts de documentation centralisés dans `projects/lecoffre/lecoffre_node/scripts/` ## Exclusions (ne pas centraliser) - Conserver la documentation intégrée du front: `lecoffre-front/src/front/Assets/docs/` diff --git a/IA_agents/prompts/prompt-global/prompt.md b/IA_agents/prompts/prompt-global/prompt.md index 6ed30ec..cc7ea15 100644 --- a/IA_agents/prompts/prompt-global/prompt.md +++ b/IA_agents/prompts/prompt-global/prompt.md @@ -43,6 +43,7 @@ Tous les documents des projets doivent être dans un dossier `docs/` - Gere les variables d'environnement avec : `4NK_env/IA_agents/env-centralisation-policy.md` - Gere les déploiements avec : `4NK_env/IA_agents/prompts/prompt-deploy.md` +- Utilise les scripts centralisés dans : `projects/lecoffre/lecoffre_node/scripts/` - Gère les TODO selon : `4NK_env/IA_agents/prompts/prompt-todo-management.md` diff --git a/IA_agents/prompts/prompt-launch/prompt.md b/IA_agents/prompts/prompt-launch/prompt.md index 5d5a549..0a8202f 100644 --- a/IA_agents/prompts/prompt-launch/prompt.md +++ b/IA_agents/prompts/prompt-launch/prompt.md @@ -2,22 +2,22 @@ ### Lancement des services (séquencé avec attentes) -- Préparer les scripts d’attente (une fois): +- Préparer les scripts d'attente (une fois): ```bash -chmod +x /home/debian/4NK_env/scripts/lecoffre_node/wait-*.sh +chmod +x /home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts/wait-*.sh ``` -- Démarrer l’infrastructure (dans `lecoffre_node/`): +- Démarrer l'infrastructure (dans `lecoffre_node/`): ```bash -cd /home/debian/4NK_env/lecoffre_node +cd /home/debian/4NK_env/projects/lecoffre/lecoffre_node # Phase 1: Base + Bitcoin docker compose up -d tor bitcoin -/home/debian/4NK_env/scripts/lecoffre_node/wait-tor-bootstrap.sh 120 5 -/home/debian/4NK_env/scripts/lecoffre_node/wait-bitcoin-ready.sh 180 5 +/home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts/wait-tor-bootstrap.sh 120 5 +/home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts/wait-bitcoin-ready.sh 180 5 # Phase 2: BlindBit docker compose up -d blindbit -/home/debian/4NK_env/scripts/lecoffre_node/wait-blindbit-ready.sh 180 5 +/home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts/wait-blindbit-ready.sh 180 5 # Phase 3: Services applicatifs docker compose up -d sdk_storage ihm_client lecoffre-front diff --git a/IA_agents/prompts/prompt-logs/prompt.md b/IA_agents/prompts/prompt-logs/prompt.md index 7230ad4..c939cc8 100644 --- a/IA_agents/prompts/prompt-logs/prompt.md +++ b/IA_agents/prompts/prompt-logs/prompt.md @@ -1,13 +1,13 @@ ## Consignes de production et de consultation des logs ### Centralisation des logs -- Dossier central: `/home/debian/4NK_env/lecoffre_node/logs/` +- Dossier central: `/home/debian/4NK_env/projects/lecoffre/lecoffre_node/logs/` - Sous-dossiers standardisés par service: - `nginx/`, `lecoffre-front/`, `ihm_client/`, `sdk_relay/`, `sdk_storage/`, `bitcoin/`, `blindbit/`, `miner/`, `tor/` -- Docker Compose monte chaque service avec un volume: `/home/debian/4NK_env/lecoffre_node/logs/:/var/log/` +- Docker Compose monte chaque service avec un volume: `/home/debian/4NK_env/projects/lecoffre/lecoffre_node/logs/:/var/log/` ### Instrumentation et propagation -- Nginx JSON logging via `lecoffre_node/conf/nginx/logging.conf` avec `log_format lecoffre_json` incluant: `time`, `request_id`, `remote_addr`, `host`, `method`, `uri`, `args`, `status`, `bytes`, `referer`, `user_agent`, `request_time`, `upstream_*`, `x_forwarded_for`. +- Nginx JSON logging via `projects/lecoffre/lecoffre_node/conf/nginx/logging.conf` avec `log_format lecoffre_json` incluant: `time`, `request_id`, `remote_addr`, `host`, `method`, `uri`, `args`, `status`, `bytes`, `referer`, `user_agent`, `request_time`, `upstream_*`, `x_forwarded_for`. - Propagation `X-Request-ID`: map `$http_x_request_id` → `$x_request_id` et `proxy_set_header X-Request-ID $x_request_id` dans `dev4.4nkweb.com-https.conf`. - Corrections Nginx: `listen 443 ssl;` + `http2 on;`, `listen 80 default_server; server_name _;`, Grafana sur `127.0.0.1:80`. - Front: en-têtes `Accept: application/json` et `X-Request-ID` ajoutés aux appels IdNot/state/auth. @@ -18,12 +18,12 @@ - Ajouter un identifiant de corrélation `X-Request-ID` côté front et proxy pour faciliter l’analyse. ### Nginx -- Fichiers: `/home/debian/4NK_env/logs/nginx/lecoffre_front_access.log` (JSON) et `lecoffre_front_error.log` (texte). +- Fichiers: `/home/debian/4NK_env/projects/lecoffre/lecoffre_node/logs/nginx/lecoffre_front_access.log` (JSON) et `lecoffre_front_error.log` (texte). - Requête type (analyse IdNot): - - `grep '"/api/v1/idnot/' /home/debian/4NK_env/logs/nginx/lecoffre_front_access.log | jq . | tail -n 50` + - `grep '"/api/v1/idnot/' /home/debian/4NK_env/projects/lecoffre/lecoffre_node/logs/nginx/lecoffre_front_access.log | jq . | tail -n 50` ### Promtail → Loki → Grafana -- Promtail scrute: `/home/debian/4NK_env/lecoffre_node/logs/**` (jobs par service). +- Promtail scrute: `/home/debian/4NK_env/projects/lecoffre/lecoffre_node/logs/**` (jobs par service). - Loki reçoit sur `http://loki:3100`. - Grafana (local): `https://dev4.4nkweb.com/grafana/` → Explore → Datasource Loki. - Requêtes utiles: `{job="lecoffre-front"}`, `{job="nginx"}`, `{job="sdk_relay"}`. @@ -36,7 +36,7 @@ ### Backups des logs et métadonnées - Backups centralisés: `/home/debian/4NK_env/backups//` - `ports_open.txt`, `nginx_conf/`, `nginx_http_flows.txt` -- Script: `/home/debian/4NK_env/scripts/backup_all.sh` +- Script: `/home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts/backup_all.sh` ### Vérifications rapides - Front public: diff --git a/IA_agents/prompts/prompt-scripts/prompt.md b/IA_agents/prompts/prompt-scripts/prompt.md index ab42e4e..ecc6594 100644 --- a/IA_agents/prompts/prompt-scripts/prompt.md +++ b/IA_agents/prompts/prompt-scripts/prompt.md @@ -1,20 +1,21 @@ ## Centralisation des scripts ### Objectif -Uniformiser l’emplacement et l’usage des scripts d’exploitation pour tous les projets, sans casser les références existantes. +Uniformiser l'emplacement et l'usage des scripts d'exploitation pour tous les projets, sans casser les références existantes. ### Décisions -- Scripts centralisés dans `4NK_env/scripts//`. +- Scripts centralisés dans `projects/lecoffre/lecoffre_node/scripts/`. - Les anciens dossiers `scripts/` dans les sous‑projets sont remplacés par des liens symboliques. -- Compatibilité maintenue: toute commande `./scripts/...` au sein d’un projet continue de fonctionner. +- Compatibilité maintenue: toute commande `./scripts/...` au sein d'un projet continue de fonctionner. ### État actuel -- `lecoffre_node/scripts` → lien vers `4NK_env/scripts/lecoffre_node` +- `lecoffre_node/scripts` → lien vers `projects/lecoffre/lecoffre_node/scripts` +- Tous les scripts d'agents IA sont maintenant dans `projects/lecoffre/lecoffre_node/scripts/` ### Impacts et recommandations -- Documentation: référencer préférentiellement `4NK_env/scripts//...`. +- Documentation: référencer préférentiellement `projects/lecoffre/lecoffre_node/scripts/...`. - CI/Docker: aucune modification nécessaire si les chemins relatifs à `./scripts/` étaient utilisés (les liens absorbent le changement). -- Gouvernance: éviter de recréer des variantes de scripts; améliorer l’existant. +- Gouvernance: éviter de recréer des variantes de scripts; améliorer l'existant. - Ne faite pas de nouveaux fichiers de scripts mais complete les fichiers existants ### Vérification post‑migration diff --git a/IA_agents/prompts/prompt-start/prompt.md b/IA_agents/prompts/prompt-start/prompt.md index 11de4e8..fc9a9ed 100644 --- a/IA_agents/prompts/prompt-start/prompt.md +++ b/IA_agents/prompts/prompt-start/prompt.md @@ -18,12 +18,12 @@ Tâches attendues, toutes obligatoires, pour tous les dossiers hors `4NK_env/dat * [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-backups.md` * [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-confs.md` * [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-data.md` -* [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-scripts.md` +* [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-scripts.md` (scripts centralisés dans `projects/lecoffre/lecoffre_node/scripts/`) * [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-tests.md` * [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-docs.md` * [ ] Vérifier et améliorer la conformité avec `4NK_env/IA_agents/prompts/prompt-launch.md` -* [ ] Analyser le contexte technique et préciser les prérequis : projets, CI, variables d'environnement, documentation, code, configuration, logs, backup, synergie avec `4NK_env/lecoffre_node/` pour comprendre ce que cela fait. +* [ ] Analyser le contexte technique et préciser les prérequis : projets, CI, variables d'environnement, documentation, code, configuration, logs, backup, synergie avec `4NK_env/projects/lecoffre/lecoffre_node/` pour comprendre ce que cela fait. * [ ] Mettre à jour la documentation de l'architecture `4NK_env/docs/architecture/.md`. * [ ] Mettre à jour la documentation d'installation `4NK_env/docs/installation/.md`. * [ ] Mettre à jour la documentation de déploiement `4NK_env/docs/deployment/.md`. diff --git a/IA_agents/prompts/prompt-tests/prompt.md b/IA_agents/prompts/prompt-tests/prompt.md index 40f6939..15ee798 100644 --- a/IA_agents/prompts/prompt-tests/prompt.md +++ b/IA_agents/prompts/prompt-tests/prompt.md @@ -28,6 +28,10 @@ cd /home/debian/4NK_env/tests/lecoffre_node # Tests pour lecoffre-front cd /home/debian/4NK_env/tests/lecoffre-front # Consulter data_test_accound.md pour les données de test + +# Tests centralisés via scripts +cd /home/debian/4NK_env/projects/lecoffre/lecoffre_node/scripts +./test-all.sh ``` ## Stratégie de migration diff --git a/IA_agents/prompts/prompt-todo-management/prompt.md b/IA_agents/prompts/prompt-todo-management/prompt.md index 6f88906..cfb41a9 100644 --- a/IA_agents/prompts/prompt-todo-management/prompt.md +++ b/IA_agents/prompts/prompt-todo-management/prompt.md @@ -8,7 +8,8 @@ Apprend et retient : `4NK_env/IA_agents/prompts/prompt-global.md`. * [ ] Affiche l'état les listes de tâche en sortie mais ne modifie pas l'avancement dans ce fichier. * [ ] Enchaine les actions sans confirmations sauf de sécurité, de prudence ou de besoin de précisions. -* [ ] Améliore les consignes dans `4NK_env/IA_agents` au fur et à mesure. +* [ ] Améliore les consignes dans `4NK_env/IA_agents` au fur et à mesure. +* [ ] Utilise les scripts centralisés dans `projects/lecoffre/lecoffre_node/scripts/` pour toutes les opérations. * [ ] Met à jour les `.cursorrules` en fonction de mes retours sur tes actions. * [ ] Ne dis pas ce que tu vas faire mais fait le directement car je le vois et je peux intervenir, je suis responsable de tes actions.