4 Commits

Author SHA1 Message Date
ncantu
e0ce7a9d83 Optimize sync-utxos RPC calls and document bitcoind crash issues
**Motivations:**
- Prevent bitcoind crashes caused by heavy RPC calls without timeout
- Document bitcoind crash and wallet loading stuck issues
- Clean up obsolete files (configure-nginx-proxy.sh, userwallet components, website-skeleton, old fixKnowledge docs)

**Root causes:**
- RPC calls without timeout causing bitcoind crashes
- No pre-check of bitcoind health before heavy operations
- Large wallet (315MB) causing long loading times and potential hangs
- Missing retry mechanism for transient errors

**Correctifs:**
- Add timeouts on RPC calls (5 minutes for listunspent, 10 seconds for healthcheck)
- Add bitcoind health check before synchronization
- Implement retry with exponential backoff
- Reduce maximumCount limit from 9999999 to 500000 UTXOs
- Improve cron script with pre-checks and better error handling
- Add container status verification before script execution

**Evolutions:**
- New check-services-status.sh script for service diagnostics
- Documentation of crash issues in fixKnowledge
- Improved logging with timestamps
- Better error messages and handling

**Pages affectées:**
- data/sync-utxos-spent-status.mjs
- data/sync-utxos-cron.sh
- data/restart-services-cron.sh
- data/check-services-status.sh (new)
- fixKnowledge/sync-utxos-rpc-optimization.md (new)
- fixKnowledge/signet-bitcoind-crash-mining-stopped.md (new)
- fixKnowledge/signet-bitcoind-crash-wallet-loading-stuck.md (new)
- Removed obsolete files: configure-nginx-proxy.sh, userwallet components, website-skeleton files, old fixKnowledge docs

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 08:18:26 +01:00
ncantu
937646cc45 Daily backup to git cron, backup/restore scripts, docs
**Motivations:**
- Export Signet and mining wallet backups to git with only 2 versions kept
- Document and add backup/restore scripts for signet and mining wallet

**Correctifs:**
- Backup-to-git uses SSH URL for passwordless cron; copy timestamped files only; prune to 2 versions; remove *-latest from backup repo

**Evolutions:**
- data/backup-to-git-cron.sh: daily export to git.4nkweb.com/4nk/backup
- save-signet-datadir-backup.sh, restore-signet-from-backup.sh, export-mining-wallet.sh, import-mining-wallet.sh
- features/backup-to-git-daily-cron.md, docs/MAINTENANCE.md backup section
- .gitignore: data/backup-to-git.log

**Pages affectées:**
- .gitignore, data/backup-to-git-cron.sh, docs/MAINTENANCE.md, features/backup-to-git-daily-cron.md
- save-signet-datadir-backup.sh, restore-signet-from-backup.sh, export-mining-wallet.sh, import-mining-wallet.sh
- Plus autres fichiers modifiés ou non suivis déjà présents dans le working tree
2026-02-04 03:07:57 +01:00
ncantu
31fd2c3c8b Fix: Improve Docker services automatic startup and restart order
**Motivations:**
- Docker services (bitcoind and mempool) were not starting automatically after reboot
- Mempool API was unhealthy because it tried to connect to bitcoind before it was ready
- No restart policy for bitcoind container
- Restart script started mempool before bitcoind, causing connection errors

**Root causes:**
- Bitcoind container had no restart policy (restart: no)
- Restart script started mempool before bitcoind
- No wait for bitcoind RPC to be ready before starting mempool
- No boot startup script for Docker services

**Correctifs:**
- Configured restart policy for bitcoind container: docker update --restart=always
- Improved restart-services-cron.sh:
  - Start/restart bitcoind BEFORE mempool
  - Wait for bitcoind RPC to be ready (max 60s) before starting mempool
  - Detect if container is stopped (start) or running (restart)
  - Use 'docker compose up -d' for mempool instead of 'restart'
- Created start-docker-services.sh:
  - Start bitcoind first
  - Wait for bitcoind RPC to be ready (max 120s at boot)
  - Start mempool after bitcoind
  - Logging to data/start-docker-services.log
- Created docker-services.service:
  - Systemd service to start Docker services at boot
  - Runs after docker.service and network.target
  - Executes start-docker-services.sh

**Evolutions:**
- Automatic startup at boot: Docker services start automatically after reboot
- Guaranteed startup order: Bitcoind always starts before mempool
- Availability check: Wait for bitcoind to be ready before starting mempool
- Restart policy: Bitcoind container restarts automatically if stopped
- Better observability: Detailed logs for diagnosis

**Pages affectées:**
- data/restart-services-cron.sh: Improved startup order and availability checks
- data/start-docker-services.sh: New boot startup script
- data/docker-services.service: New systemd service for automatic startup
- fixKnowledge/docker-services-boot-startup.md: Documentation of improvements
2026-01-28 11:48:25 +01:00
ncantu
6bf37be44e Cron restart services (bitcoind, mempool), service-login-verify, website-skeleton, docs
**Motivations:**
- Consigner l'état actuel du dépôt (cron, service-login-verify, website-skeleton, userwallet, docs).
- Centraliser les modifications en attente.

**Root causes:**
- N/A (commit groupé).

**Correctifs:**
- N/A.

**Evolutions:**
- Cron quotidien restart services : script local sans SSH, systemd (bitcoin-signet, bitcoin, APIs, dashboard, userwallet, website-skeleton) + Docker (mempool, bitcoin-signet-instance).
- Feature cron-restart-services-local : documentation et règle scripts locaux / pas d'SSH.
- service-login-verify : module vérification login (buildAllowedPubkeys, verifyLoginProof, nonceCache).
- website-skeleton : app iframe UserWallet, config, systemd unit.
- userwallet : collectSignatures, relay.
- docs : DOMAINS_AND_PORTS, README, WEBSITE_SKELETON ; features userwallet-contrat-login, timeouts-backoff, service-login-verify.

**Pages affectées:**
- data/restart-services-cron.sh, data/restart-services.log, data/sync-utxos.log
- features/cron-restart-services-local.md, features/service-login-verify.md, features/userwallet-contrat-login-reste-a-faire.md, features/userwallet-timeouts-backoff.md
- docs/DOMAINS_AND_PORTS.md, docs/README.md, docs/WEBSITE_SKELETON.md
- configure-nginx-proxy.sh
- service-login-verify/ (src, dist, node_modules)
- userwallet/src/utils/collectSignatures.ts, userwallet/src/utils/relay.ts
- website-skeleton/
2026-01-28 00:48:37 +01:00