**Motivations:** - Complete documentation for dashboard, domains, ports and environment configuration - Add new services (ClamAV API, Watermark API) to the infrastructure - Enhance dashboard with new pages and improved functionality - Improve deployment scripts and service configurations **Root causes:** - Missing comprehensive documentation for infrastructure setup - Need for antivirus scanning service integration - Need for watermark service integration - Dashboard required additional pages and features **Correctifs:** - Added comprehensive documentation in docs/ (DASHBOARD.md, DOMAINS_AND_PORTS.md, ENVIRONMENT.md) - Updated systemd service files with proper environment variables - Enhanced nginx proxy configuration script - Updated maintenance documentation **Evolutions:** - Added new ClamAV API service (api-clamav) for file scanning - Added new Watermark API service (api-filigrane) for document watermarking - Enhanced signet-dashboard with new learn.html page - Improved dashboard UI with better styles and navigation - Enhanced app.js with new functionality and better error handling - Updated API documentation page with complete endpoint descriptions - Added deployment scripts for watermark and nginx configuration - Updated hash and UTXO lists with latest data - Enhanced server.js with new routes and improved Bitcoin RPC integration **Pages affectées:** - docs/DASHBOARD.md: New comprehensive dashboard documentation - docs/DOMAINS_AND_PORTS.md: New infrastructure domains and ports documentation - docs/ENVIRONMENT.md: New environment variables documentation - docs/MAINTENANCE.md: Updated maintenance procedures - docs/README.md: Updated main documentation - signet-dashboard/public/app.js: Enhanced with new features - signet-dashboard/public/styles.css: Improved styling - signet-dashboard/public/index.html: Enhanced main page - signet-dashboard/public/learn.html: New educational page - signet-dashboard/public/api-docs.html: Enhanced API documentation - signet-dashboard/public/hash-list.html: Updated hash list page - signet-dashboard/public/utxo-list.html: Updated UTXO list page - signet-dashboard/public/join-signet.html: Updated join signet page - signet-dashboard/src/server.js: Enhanced server with new routes - signet-dashboard/start.sh: Updated startup script - signet-dashboard/signet-dashboard.service: Updated systemd service - api-anchorage/anchorage-api.service: Updated systemd service - api-faucet/faucet-api.service: Updated systemd service - configure-nginx-proxy.sh: Enhanced nginx configuration script - add-watermark-certificate.sh: New watermark certificate script - deploy-watermark-nginx.sh: New deployment script - api-clamav/: New ClamAV API service - api-filigrane/: New Watermark API service - hash_list.txt, utxo_list.txt: Updated with latest data - anchor_count.txt: Updated anchor count
323 lines
8.2 KiB
Markdown
323 lines
8.2 KiB
Markdown
# Fichiers d'Environnement - Configuration
|
|
|
|
**Auteur** : Équipe 4NK
|
|
**Date** : 2026-01-24
|
|
**Version** : 1.0
|
|
|
|
## Vue d'Ensemble
|
|
|
|
Ce document décrit tous les fichiers d'environnement utilisés dans le projet et leurs variables.
|
|
|
|
## Fichiers d'Environnement
|
|
|
|
### 1. Fichier `.env` à la racine du projet
|
|
|
|
**Emplacement :** `/home/ncantu/Bureau/code/bitcoin/.env`
|
|
|
|
**Utilisé par :**
|
|
- Docker (Bitcoin Core)
|
|
- Scripts de configuration
|
|
- Génération de `bitcoin.conf`
|
|
|
|
**Variables principales :**
|
|
|
|
```bash
|
|
# Mining Configuration
|
|
BLOCKPRODUCTIONDELAY=600 # Délai entre blocs (secondes)
|
|
MINERENABLED=1 # Activer le mining (1 = oui, 0 = non)
|
|
NBITS=1e0377ae # Difficulté minimale (hex)
|
|
PRIVKEY=<clé_privée> # Clé privée du signer (générée si vide)
|
|
MINETO=<adresse> # Adresse de mining (optionnel)
|
|
SIGNETCHALLENGE=<challenge> # Challenge du signet
|
|
|
|
# RPC Configuration
|
|
RPCUSER=bitcoin # Utilisateur RPC
|
|
RPCPASSWORD=bitcoin # Mot de passe RPC
|
|
|
|
# User Agent
|
|
UACOMMENT=CustomSignet # Commentaire User Agent
|
|
|
|
# ZMQ Configuration
|
|
ZMQPUBRAWBLOCK=tcp://0.0.0.0:28332
|
|
ZMQPUBRAWTX=tcp://0.0.0.0:28333
|
|
ZMQPUBHASHBLOCK=tcp://0.0.0.0:28334
|
|
|
|
# Network Configuration
|
|
RPCBIND=0.0.0.0:38332 # Port RPC
|
|
RPCALLOWIP=0.0.0.0/0 # IPs autorisées pour RPC
|
|
WHITELIST=0.0.0.0/0 # IPs whitelistées
|
|
ADDNODE=<ip> # Nœuds à ajouter (optionnel)
|
|
EXTERNAL_IP=<ip> # IP externe (optionnel)
|
|
```
|
|
|
|
**Fichier d'exemple :** `env.example`
|
|
|
|
### 2. Fichier `.env` de l'API Anchorage
|
|
|
|
**Emplacement :** `/home/ncantu/Bureau/code/bitcoin/api-anchorage/.env`
|
|
|
|
**Variables :**
|
|
|
|
```bash
|
|
# Bitcoin RPC Configuration
|
|
BITCOIN_RPC_HOST=localhost
|
|
BITCOIN_RPC_PORT=38332
|
|
BITCOIN_RPC_USER=bitcoin
|
|
BITCOIN_RPC_PASSWORD=bitcoin
|
|
BITCOIN_RPC_TIMEOUT=30000
|
|
|
|
# API Configuration
|
|
API_PORT=3010 # Port fixe (défini aussi dans systemd)
|
|
API_HOST=0.0.0.0
|
|
|
|
# API Keys (séparées par des virgules)
|
|
API_KEYS=your-api-key-here,another-api-key
|
|
|
|
# Logging
|
|
LOG_LEVEL=info # error, warn, info, debug
|
|
NODE_ENV=production
|
|
```
|
|
|
|
**Note :** Le port est fixe (3010) et défini aussi dans le service systemd.
|
|
|
|
### 3. Fichier `.env` de l'API Faucet
|
|
|
|
**Emplacement :** `/home/ncantu/Bureau/code/bitcoin/api-faucet/.env`
|
|
|
|
**Variables :**
|
|
|
|
```bash
|
|
# Bitcoin RPC Configuration
|
|
BITCOIN_RPC_HOST=localhost
|
|
BITCOIN_RPC_PORT=38332
|
|
BITCOIN_RPC_USER=bitcoin
|
|
BITCOIN_RPC_PASSWORD=bitcoin
|
|
BITCOIN_RPC_TIMEOUT=30000
|
|
|
|
# API Configuration
|
|
FAUCET_API_PORT=3021 # Port fixe (défini aussi dans systemd)
|
|
FAUCET_API_HOST=0.0.0.0
|
|
|
|
# API Keys (séparées par des virgules)
|
|
API_KEYS=your-api-key-here,another-api-key
|
|
|
|
# Faucet Configuration
|
|
FAUCET_AMOUNT=50000 # Montant en sats (0.0005 BTC)
|
|
FAUCET_WALLET_NAME=faucet # Nom du wallet (optionnel)
|
|
|
|
# Logging
|
|
LOG_LEVEL=info
|
|
NODE_ENV=production
|
|
```
|
|
|
|
**Note :** Le port est fixe (3021) et défini aussi dans le service systemd.
|
|
|
|
### 4. Fichier `.env` de l'API Filigrane
|
|
|
|
**Emplacement :** `/home/ncantu/Bureau/code/bitcoin/api-filigrane/.env`
|
|
|
|
**Variables :**
|
|
|
|
```bash
|
|
# API Configuration
|
|
WATERMARK_API_PORT=3022 # Port fixe (défini aussi dans systemd)
|
|
WATERMARK_API_HOST=0.0.0.0
|
|
|
|
# API Anchorage (pour ancrer les documents)
|
|
ANCHOR_API_URL=http://localhost:3010
|
|
# Ou en production :
|
|
# ANCHOR_API_URL=https://certificator.4nkweb.com
|
|
|
|
# API Blockchain (pour récupérer les infos de bloc)
|
|
BLOCKCHAIN_API_URL=http://localhost:3020
|
|
# Ou en production :
|
|
# BLOCKCHAIN_API_URL=https://dashboard.certificator.4nkweb.com
|
|
|
|
# API ClamAV (pour scanner les fichiers)
|
|
CLAMAV_API_URL=http://localhost:3023
|
|
# Ou en production :
|
|
# CLAMAV_API_URL=https://antivir.certificator.4nkweb.com
|
|
|
|
# Logging
|
|
LOG_LEVEL=info
|
|
NODE_ENV=production
|
|
```
|
|
|
|
**Note :** Le port est fixe (3022) et défini aussi dans le service systemd.
|
|
|
|
### 5. Fichier `.env` de l'API ClamAV
|
|
|
|
**Emplacement :** `/home/ncantu/Bureau/code/bitcoin/api-clamav/.env`
|
|
|
|
**Variables :**
|
|
|
|
```bash
|
|
# API Configuration
|
|
CLAMAV_API_PORT=3023 # Port fixe (défini dans le code)
|
|
CLAMAV_API_HOST=0.0.0.0
|
|
|
|
# ClamAV Daemon Configuration
|
|
CLAMAV_HOST=localhost # Host du daemon ClamAV
|
|
CLAMAV_PORT=3310 # Port du daemon ClamAV
|
|
CLAMAV_TIMEOUT=30000 # Timeout en millisecondes
|
|
|
|
# Logging
|
|
LOG_LEVEL=info
|
|
NODE_ENV=production
|
|
```
|
|
|
|
**Note :** Le port est fixe (3023) et défini directement dans le code (`src/server.js`).
|
|
|
|
### 6. Fichier `.env` du Dashboard
|
|
|
|
**Emplacement :** `/home/ncantu/Bureau/code/bitcoin/signet-dashboard/.env`
|
|
|
|
**Variables :**
|
|
|
|
```bash
|
|
# Dashboard Configuration
|
|
DASHBOARD_PORT=3020 # Port fixe (défini aussi dans systemd)
|
|
DASHBOARD_HOST=0.0.0.0
|
|
|
|
# Bitcoin RPC Configuration
|
|
BITCOIN_RPC_HOST=localhost
|
|
BITCOIN_RPC_PORT=38332
|
|
BITCOIN_RPC_USER=bitcoin
|
|
BITCOIN_RPC_PASSWORD=bitcoin
|
|
BITCOIN_RPC_TIMEOUT=30000
|
|
|
|
# API Anchorage Configuration
|
|
ANCHOR_API_URL=http://localhost:3010
|
|
# Ou en production :
|
|
# ANCHOR_API_URL=https://certificator.4nkweb.com
|
|
ANCHOR_API_KEY=your-api-key-here
|
|
|
|
# API Faucet Configuration
|
|
FAUCET_API_URL=http://localhost:3021
|
|
# Ou en production :
|
|
# FAUCET_API_URL=https://faucet.certificator.4nkweb.com
|
|
|
|
# API Filigrane Configuration
|
|
WATERMARK_API_URL=http://localhost:3022
|
|
# Ou en production :
|
|
# WATERMARK_API_URL=https://watermark.certificator.4nkweb.com
|
|
|
|
# Logging
|
|
LOG_LEVEL=info
|
|
NODE_ENV=production
|
|
```
|
|
|
|
**Note :** Le port est fixe (3020) et défini aussi dans le service systemd.
|
|
|
|
## Variables d'Environnement dans les Services Systemd
|
|
|
|
Les services systemd définissent aussi des variables d'environnement pour garantir que les ports sont fixes :
|
|
|
|
### API Anchorage (`api-anchorage/anchorage-api.service`)
|
|
|
|
```ini
|
|
Environment=API_PORT=3010
|
|
Environment=API_HOST=0.0.0.0
|
|
```
|
|
|
|
### API Faucet (`api-faucet/faucet-api.service`)
|
|
|
|
```ini
|
|
Environment=FAUCET_API_PORT=3021
|
|
Environment=FAUCET_API_HOST=0.0.0.0
|
|
```
|
|
|
|
### API Filigrane (`api-filigrane/filigrane-api.service`)
|
|
|
|
```ini
|
|
Environment=WATERMARK_API_PORT=3022
|
|
Environment=WATERMARK_API_HOST=0.0.0.0
|
|
```
|
|
|
|
### API ClamAV (`api-clamav/clamav-api.service`)
|
|
|
|
```ini
|
|
Environment=CLAMAV_API_PORT=3023
|
|
Environment=CLAMAV_API_HOST=0.0.0.0
|
|
Environment=CLAMAV_HOST=localhost
|
|
Environment=CLAMAV_PORT=3310
|
|
```
|
|
|
|
### Dashboard (`signet-dashboard/signet-dashboard.service`)
|
|
|
|
```ini
|
|
Environment=DASHBOARD_PORT=3020
|
|
Environment=DASHBOARD_HOST=0.0.0.0
|
|
```
|
|
|
|
## Ordre de Priorité
|
|
|
|
Les variables d'environnement sont chargées dans cet ordre :
|
|
|
|
1. **Variables du service systemd** (priorité la plus haute)
|
|
2. **Fichier `.env`** dans le répertoire de l'API
|
|
3. **Variables d'environnement système** (`process.env`)
|
|
4. **Valeurs par défaut** dans le code
|
|
|
|
## Création des Fichiers `.env`
|
|
|
|
### Depuis les exemples
|
|
|
|
```bash
|
|
# À la racine du projet
|
|
cp env.example .env
|
|
|
|
# Pour chaque API
|
|
cd api-anchorage && cp .env.example .env
|
|
cd ../api-faucet && cp .env.example .env
|
|
cd ../api-filigrane && cp .env.example .env
|
|
cd ../api-clamav && cp .env.example .env
|
|
cd ../signet-dashboard && cp .env.example .env
|
|
```
|
|
|
|
### Variables Sensibles
|
|
|
|
**⚠️ Important :** Les fichiers `.env` contiennent des informations sensibles :
|
|
- Clés API
|
|
- Mots de passe RPC
|
|
- Clés privées Bitcoin
|
|
|
|
**Sécurité :**
|
|
- Ne jamais commiter les fichiers `.env` dans Git
|
|
- Utiliser `.gitignore` pour exclure les fichiers `.env`
|
|
- Changer les valeurs par défaut en production
|
|
- Utiliser des clés API fortes et uniques
|
|
|
|
## Vérification des Variables
|
|
|
|
### Vérifier qu'un fichier `.env` est chargé
|
|
|
|
```bash
|
|
# Dans le code Node.js, les variables sont loggées au démarrage
|
|
# Vérifier les logs du service
|
|
sudo journalctl -u anchorage-api | grep ENV
|
|
```
|
|
|
|
### Tester les variables
|
|
|
|
```bash
|
|
# Charger et afficher les variables (sans exposer les secrets)
|
|
cd api-anchorage
|
|
node -e "require('dotenv').config(); console.log('API_PORT:', process.env.API_PORT);"
|
|
```
|
|
|
|
## Migration et Mise à Jour
|
|
|
|
Lors de la mise à jour des variables :
|
|
|
|
1. **Mettre à jour le fichier `.env`**
|
|
2. **Mettre à jour le service systemd** si nécessaire
|
|
3. **Redémarrer le service** : `sudo systemctl restart <service-name>`
|
|
4. **Vérifier les logs** : `sudo journalctl -u <service-name> -f`
|
|
|
|
## Références
|
|
|
|
- [Documentation Domaines et Ports](./DOMAINS_AND_PORTS.md)
|
|
- [Documentation Maintenance](./MAINTENANCE.md)
|
|
- [Documentation Dashboard](./DASHBOARD.md)
|