**Motivations:** - Centraliser les fichiers Cursor (rules, skills, agents, commands, hooks) par user et par projet **Root causes:** - N/A **Correctifs:** - N/A **Evolutions:** - desk: rules, skills-cursor, agents, commands, hooks, argv/hooks/mcp.json - ncantu: README placeholder - 4NK_node, algo, builazoo, ia_local, lecoffre_ng, lecoffre_ng_pprod, lecoffre_ng_test: .cursor contents **Pages affectées:** - cursor/desk/, cursor/ncantu/, cursor/<project>/
543 lines
14 KiB
Markdown
543 lines
14 KiB
Markdown
# Infrastructure Cloud 4NK - Guide Complet
|
|
|
|
## Table des Matières
|
|
|
|
1. [Vue d'Ensemble](#vue-densemble)
|
|
2. [Architecture Réseau](#architecture-réseau)
|
|
3. [Serveurs et Rôles](#serveurs-et-rôles)
|
|
4. [Services et Domaines](#services-et-domaines)
|
|
5. [Configuration des Ports](#configuration-des-ports)
|
|
6. [Accès SSH](#accès-ssh)
|
|
7. [DNS et Certificats SSL](#dns-et-certificats-ssl)
|
|
8. [NAT et Routage](#nat-et-routage)
|
|
9. [Guide d'Utilisation](#guide-dutilisation)
|
|
10. [Dépannage](#dépannage)
|
|
|
|
---
|
|
|
|
## Vue d'Ensemble
|
|
|
|
L'infrastructure cloud 4NK est composée de **serveurs** organisés en architecture privée avec un serveur proxy public. Tous les services sont accessibles via HTTPS et certains services Bitcoin sont exposés via NAT.
|
|
|
|
### Caractéristiques Principales
|
|
|
|
- **Réseau privé:** 192.168.1.x (DHCP)
|
|
- **Point d'entrée public:** Proxy (4nk.myftp.biz)
|
|
- **Environnements:** Test, Pre-Production, Production, Services, Bitcoin, IA
|
|
- **Authentification:** SSH keys uniquement (pas de mots de passe)
|
|
|
|
---
|
|
|
|
## Architecture Réseau
|
|
|
|
### Topologie
|
|
|
|
```
|
|
Internet
|
|
│
|
|
├─→ 4nk.myftp.biz (DynDNS)
|
|
│ └─→ 192.168.1.100 (proxy) - Point d'entrée unique
|
|
│ │
|
|
│ ├─→ 192.168.1.101 (test) - Environnement de test
|
|
│ ├─→ 192.168.1.102 (pprod) - Pre-production
|
|
│ ├─→ 192.168.1.103 (prod) - Production
|
|
│ └─→ 192.168.1.104 (services) - Services partagés
|
|
│ └─→ 192.168.1.105 (bitcoin) - Services bitcoin
|
|
│ └─→ 192.168.1.173 (ia) - Services ia
|
|
```
|
|
|
|
### Adresses IP et MAC
|
|
|
|
| Hostname | IP Address | MAC Address | Rôle |
|
|
|----------|------------|-------------|------|
|
|
| proxy | 192.168.1.100 | 64:00:6a:28:88:b7 | Serveur proxy principal (point d'entrée) |
|
|
| test | 192.168.1.101 | b0:83:fe:ad:2e:ca | Environnement de test |
|
|
| pprod | 192.168.1.102 | 64:00:6a:28:8c:a0 | Pre-production |
|
|
| prod | 192.168.1.103 | b0:41:6f:0a:10:da | Production |
|
|
| services | 192.168.1.104 | ee:39:9d:48:68:3f | Services partagés (Git, Mempool, Rocket.Chat) |
|
|
| services | 192.168.1.105 | bitcoin
|
|
| services | 192.168.1.173 | ia
|
|
|
|
### Configuration DHCP
|
|
|
|
Toutes les adresses IP sont attribuées automatiquement par DHCP avec réservation basée sur les adresses MAC.
|
|
|
|
### DynDNS
|
|
|
|
- **Provider:** no-ip.com
|
|
- **Login:** nicolascantu
|
|
- **Domaine:** 4nk.myftp.biz
|
|
- **Usage:** Tous les domaines pointent vers ce DynDNS via CNAME
|
|
|
|
---
|
|
|
|
## Serveurs et Rôles
|
|
|
|
### 1. Proxy (192.168.1.100)
|
|
|
|
**Rôle:** Point d'entrée unique pour tous les services
|
|
|
|
**Fonctions:**
|
|
- Reverse proxy Nginx pour le routage HTTP/HTTPS
|
|
- Routage des domaines vers les serveurs backend appropriés
|
|
- Gestion des certificats SSL/TLS (Let's Encrypt)
|
|
- Bastion SSH pour l'accès aux serveurs backend
|
|
- Exposition des ports Bitcoin via NAT (stream Nginx)
|
|
|
|
**Accès externe:**
|
|
- SSH: Port 22
|
|
- HTTP: Port 80
|
|
- HTTPS: Port 443
|
|
|
|
**Domaine public:** 4nk.myftp.biz
|
|
|
|
### 2. Test (192.168.1.101)
|
|
|
|
**Rôle:** Environnement de développement et de test
|
|
|
|
- LeCoffreIO, 4nk.network, docv.fr, zapwall.fr, 4nk.organic
|
|
|
|
**Ports utilisés:** 3001, 3005-3009, 3011-3014
|
|
|
|
### 3. Pre-Production (192.168.1.102)
|
|
|
|
**Rôle:** Environnement de validation avant production
|
|
|
|
- LeCoffreIO, 4nk.network, docv.fr, zapwall.fr, 4nk.organic
|
|
|
|
**Ports utilisés:** 3001, 3005-3009, 3011-3014
|
|
|
|
### 4. Production (192.168.1.103)
|
|
|
|
**Rôle:** Environnement de production
|
|
|
|
**Ports utilisés:** 3001-3014
|
|
|
|
### 5. Services (192.168.1.104)
|
|
|
|
**Rôle:** Services d'infrastructure partagés
|
|
|
|
**Services hébergés:** 3 domaines
|
|
- **mempool1.4nkweb.com:** Explorateur de transactions Bitcoin (port 3015)
|
|
- **git1.4nkweb.com:** Serveur Git (ports 3016 HTTP/HTTPS + 9418 Git Protocol)
|
|
- **rocket1.4nkweb.com:** Rocket.Chat (port 3017)
|
|
|
|
**Ports utilisés:** 3015-3017, 9418
|
|
|
|
### 5. Bitcoin (192.168.1.105)
|
|
|
|
---
|
|
|
|
## Services et Domaines
|
|
|
|
### Liste Complète des Domaines par Environnement
|
|
|
|
#### Test (192.168.1.101)
|
|
|
|
| Domaine | Port | Service |
|
|
|---------|------|---------|
|
|
| test.lecoffreio.4nkweb.com | 3009 | LeCoffreIO |
|
|
| test.4nk.network | 3011 | 4nk.network |
|
|
| test.docv.fr | 3012 | DocV |
|
|
| test.zapwall.fr | 3013 | Zapwall |
|
|
| test.4nk.organic | 3014 | 4nk.organic |
|
|
|
|
#### Pre-Production (192.168.1.102) - 11 domaines
|
|
|
|
Même configuration que test, avec préfixe `pprod.` au lieu de `test.`
|
|
|
|
#### Production (192.168.1.103) - 15 domaines
|
|
|
|
**Avec préfixe prod.:**
|
|
- prod.lecoffreio.4nkweb.com (3009)
|
|
- prod.4nk.network (3011)
|
|
- prod.docv.fr (3012)
|
|
- prod.zapwall.fr (3013)
|
|
- prod.4nk.organic (3014)
|
|
|
|
**Sans préfixe (4 domaines, uniquement en prod):**
|
|
|
|
#### Services (192.168.1.104) - 3 domaines
|
|
|
|
| Domaine | Ports | Service |
|
|
|---------|-------|---------|
|
|
| mempool1.4nkweb.com | 3015 | Mempool (Bitcoin explorer) |
|
|
| git1.4nkweb.com | 3016 (HTTP/HTTPS) + 9418 (Git Protocol) | Serveur Git |
|
|
| rocket1.4nkweb.com | 3017 | Rocket.Chat |
|
|
|
|
### Structure de Déploiement
|
|
|
|
Tous les services sont déployés dans `/srv/4NK/<domaine>/` sur chaque serveur backend.
|
|
|
|
**Exemple:**
|
|
|
|
---
|
|
|
|
## Configuration des Ports
|
|
|
|
### Ports Web (HTTP/HTTPS)
|
|
|
|
Tous les services web sont accessibles via le proxy principal (192.168.1.100:443) qui route directement vers les ports applicatifs.
|
|
|
|
| Port | Type de Service | Domaines |
|
|
|------|-----------------|----------|
|
|
test/pprod/prod.storagetemp.4nkweb.com |
|
|
| 3007 | userwallet | test/pprod/prod.userwallet.4nkweb.com | 3009 | lecoffreio | test/pprod/prod.lecoffreio.4nkweb.com |
|
|
| 3011 | 4nk.network | test/pprod/prod.4nk.network |
|
|
| 3012 | docv.fr | test/pprod/prod.docv.fr |
|
|
| 3013 | zapwall.fr | test/pprod/prod.zapwall.fr |
|
|
| 3014 | 4nk.organic | test/pprod/prod.4nk.organic |
|
|
| 3015 | mempool| mempool.4nkweb.com |
|
|
| 3016 | git1 (HTTP/HTTPS) | git1.4nkweb.com |
|
|
| 3017 | rocket1 | rocket1.4nkweb.com |
|
|
|
|
### Ports Bitcoin (Production uniquement)
|
|
|
|
Les domaines signet (bitcoin uniquement) exposent également les ports Bitcoin via NAT:
|
|
|
|
| Port | Protocole | Service | Domaine |
|
|
|------|-----------|---------|---------|
|
|
| 8333 | TCP |
|
|
| 38333 | TCP/UDP
|
|
| 28332 | TCP | ZMQ
|
|
|
|
### Ports Git
|
|
|
|
| Port | Protocole | Service | Domaine |
|
|
|------|-----------|---------|---------|
|
|
| 9418 | TCP | Git Protocol | git1.4nkweb.com |
|
|
|
|
---
|
|
|
|
## Accès SSH
|
|
|
|
### Architecture SSH
|
|
|
|
Tous les serveurs backend sont sur un réseau privé et ne sont pas directement accessibles depuis Internet. L'accès se fait via le **proxy** qui agit comme un bastion host.
|
|
|
|
```
|
|
Client Externe → 4nk.myftp.biz (proxy) → Serveur Backend (192.168.1.10x)
|
|
```
|
|
|
|
### Configuration SSH Recommandée
|
|
|
|
Ajoutez cette configuration dans votre `~/.ssh/config` local:
|
|
|
|
```ssh-config
|
|
# Proxy server (accès direct)
|
|
Host proxy
|
|
HostName 4nk.myftp.biz
|
|
User ncantu
|
|
Port 22
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
|
|
# Test server (via proxy)
|
|
Host test
|
|
HostName 192.168.1.101
|
|
User ncantu
|
|
Port 22
|
|
ProxyJump ncantu@4nk.myftp.biz
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
StrictHostKeyChecking accept-new
|
|
|
|
# Pre-production server (via proxy)
|
|
Host pprod
|
|
HostName 192.168.1.102
|
|
User ncantu
|
|
Port 22
|
|
ProxyJump ncantu@4nk.myftp.biz
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
StrictHostKeyChecking accept-new
|
|
|
|
# Production server (via proxy)
|
|
Host prod
|
|
HostName 192.168.1.103
|
|
User ncantu
|
|
Port 22
|
|
ProxyJump ncantu@4nk.myftp.biz
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
StrictHostKeyChecking accept-new
|
|
|
|
# Services server (via proxy)
|
|
Host services
|
|
HostName 192.168.1.104
|
|
User ncantu
|
|
Port 22
|
|
ProxyJump ncantu@4nk.myftp.biz
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
StrictHostKeyChecking accept-new
|
|
```
|
|
|
|
|
|
# Bitcoin server (via proxy)
|
|
Host bitcoin
|
|
HostName 192.168.1.105
|
|
User ncantu
|
|
Port 22
|
|
ProxyJump ncantu@4nk.myftp.biz
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
StrictHostKeyChecking accept-new
|
|
```
|
|
|
|
|
|
# IA server (via proxy)
|
|
Host bitcoin
|
|
HostName 192.168.1.173
|
|
User ncantu
|
|
Port 22
|
|
ProxyJump ncantu@4nk.myftp.biz
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
IdentitiesOnly yes
|
|
PreferredAuthentications publickey
|
|
PasswordAuthentication no
|
|
StrictHostKeyChecking accept-new
|
|
```
|
|
|
|
|
|
### Commandes SSH
|
|
|
|
**Avec la configuration SSH (recommandé):**
|
|
```bash
|
|
ssh proxy # Connexion au proxy
|
|
ssh test # Connexion au serveur test
|
|
ssh pprod # Connexion au serveur pre-production
|
|
ssh prod # Connexion au serveur production
|
|
ssh services # Connexion au serveur services
|
|
ssh bitcoin # Connexion au serveur bitcoin
|
|
ssh ia # Connexion au serveur ia
|
|
```
|
|
|
|
**Sans configuration (ProxyJump manuel):**
|
|
```bash
|
|
ssh -J ncantu@4nk.myftp.biz ncantu@192.168.1.101 # test
|
|
ssh -J ncantu@4nk.myftp.biz ncantu@192.168.1.102 # pprod
|
|
ssh -J ncantu@4nk.myftp.biz ncantu@192.168.1.103 # prod
|
|
ssh -J ncantu@4nk.myftp.biz ncantu@192.168.1.104 # services
|
|
ssh -J ncantu@4nk.myftp.biz ncantu@192.168.1.105 # bitcoin
|
|
```
|
|
|
|
### Authentification
|
|
|
|
- **Méthode:** SSH keys uniquement (pas de mots de passe)
|
|
- **Clé publique autorisée:** `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIITcSsup4VjkH6FXa0Prwy44mQ1JOgG/ZzocdrJ91Svu aamroughriss@gmail.com`
|
|
- **Utilisateur:** `ncantu` sur tous les serveurs
|
|
|
|
---
|
|
|
|
## DNS et Certificats SSL
|
|
|
|
### Configuration DNS
|
|
|
|
Tous les domaines utilisent des enregistrements **CNAME** pointant vers `4nk.myftp.biz` (DynDNS).
|
|
|
|
**Exemple de configuration DNS (Gandi):**
|
|
```
|
|
signet.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
|
```
|
|
|
|
### Certificats SSL/TLS
|
|
|
|
- **Provider:** Let's Encrypt
|
|
- **Renouvellement:** Automatique via Certbot
|
|
- **Couverture:** Tous les domaines ont des certificats SSL valides
|
|
- **Protocole:** HTTPS uniquement (redirection HTTP → HTTPS)
|
|
|
|
### Vérification des Certificats
|
|
|
|
```bash
|
|
# Vérifier un certificat
|
|
openssl s_client -connect domain:443 -servername domain
|
|
|
|
# Lister tous les certificats
|
|
sudo certbot certificates
|
|
```
|
|
|
|
---
|
|
|
|
## NAT et Routage
|
|
|
|
### Configuration NAT
|
|
|
|
Le routeur/firewall expose les ports suivants vers Internet:
|
|
|
|
| Port Externe | Protocole | IP Destination | Port Destination | Service |
|
|
|--------------|-----------|----------------|-----------------|---------|
|
|
| 22 | TCP | 192.168.1.100 | 22 | SSH (proxy) |
|
|
| 80 | TCP | 192.168.1.100 | 80 | HTTP (proxy) |
|
|
| 443 | TCP | 192.168.1.100 | 443 | HTTPS (proxy) |
|
|
| 38333 | TCP/UDP | 192.168.1.105 | 38333 | Bitcoin Signet (bitcoin) |
|
|
| 9418 | TCP | 192.168.1.104 | 9418 | Git Protocol |
|
|
|
|
### Routage Web
|
|
|
|
Le proxy Nginx route tous les domaines HTTP/HTTPS vers les serveurs backend appropriés:
|
|
|
|
```
|
|
Client → 4nk.myftp.biz:443 → Nginx (proxy) → Backend:Port
|
|
```
|
|
|
|
**Exemple:**
|
|
- `mempoo1.4nkweb.com` → 192.168.1.104:3015
|
|
|
|
### Routage Bitcoin
|
|
|
|
Les ports Bitcoin sont exposés via NAT et routés par Nginx stream:
|
|
|
|
```
|
|
Client → 4nk.myftp.biz:38333 → Nginx Stream → bitcoin:38333
|
|
```
|
|
|
|
---
|
|
|
|
## Guide d'Utilisation
|
|
|
|
### Accéder aux Services Web
|
|
|
|
Tous les services sont accessibles via HTTPS:
|
|
|
|
```bash
|
|
# Exemples
|
|
curl https://signet.4nkweb.com
|
|
```
|
|
|
|
### Accéder aux Services Bitcoin
|
|
|
|
**Bitcoin Signet (prod uniquement):**
|
|
```bash
|
|
# Connexion Bitcoin Signet
|
|
bitcoin-cli -rpcconnect=signet.4nkweb.com -rpcport=38333 getblockchaininfo
|
|
|
|
# Test de connexion
|
|
nc -zv signet.4nkweb.com 38333
|
|
```
|
|
|
|
### Utiliser Git
|
|
|
|
**Cloner un dépôt:**
|
|
```bash
|
|
# Via HTTPS
|
|
git clone https://git1.4nkweb.com/username/repo.git
|
|
|
|
# Via Git Protocol
|
|
git clone git://git1.4nkweb.com/username/repo.git
|
|
```
|
|
|
|
### Accéder à Mempool
|
|
|
|
Ouvrir dans un navigateur: `https://mempool1.4nkweb.com`
|
|
|
|
### Accéder à Rocket.Chat
|
|
|
|
Ouvrir dans un navigateur: `https://rocket1.4nkweb.com`
|
|
|
|
### Déployer un Service
|
|
|
|
1. **Se connecter au serveur approprié:**
|
|
```bash
|
|
ssh test # ou pprod, prod, services
|
|
```
|
|
|
|
4. **Vérifier que l'application écoute sur le bon port:**
|
|
```bash
|
|
ss -tlnp | grep <port>
|
|
```
|
|
|
|
5. **Tester l'accès:**
|
|
```bash
|
|
curl https://<domaine>
|
|
```
|
|
|
|
---
|
|
|
|
## Dépannage
|
|
|
|
### Problèmes de Connexion SSH
|
|
|
|
**Erreur: "Connection refused"**
|
|
- Vérifier que le proxy (4nk.myftp.biz) est accessible
|
|
- Vérifier que le port 22 est ouvert sur le firewall
|
|
- Vérifier la configuration NAT (port 22 → 192.168.1.100:22)
|
|
|
|
**Erreur: "Permission denied"**
|
|
- Vérifier que votre clé SSH publique est dans `~/.ssh/authorized_keys` sur le serveur
|
|
- Vérifier les permissions: `chmod 600 ~/.ssh/authorized_keys`
|
|
- Vérifier la clé: `ssh-keygen -l -f ~/.ssh/id_ed25519.pub`
|
|
|
|
**Erreur: "Host key verification failed"**
|
|
- Supprimer l'ancienne clé: `ssh-keygen -R 192.168.1.10x`
|
|
- Ou utiliser `StrictHostKeyChecking accept-new` dans la config
|
|
|
|
### Problèmes d'Accès Web
|
|
|
|
**Erreur: "Connection refused" ou timeout**
|
|
- Vérifier que le service écoute sur le bon port: `ss -tlnp | grep <port>`
|
|
- Vérifier la configuration Nginx sur le proxy
|
|
- Vérifier les logs Nginx: `sudo tail -f /var/log/nginx/error.log`
|
|
|
|
**Erreur: "SSL certificate error"**
|
|
- Vérifier que le certificat est valide: `sudo certbot certificates`
|
|
- Renouveler le certificat si nécessaire: `sudo certbot renew`
|
|
|
|
**Erreur: "502 Bad Gateway"**
|
|
- Vérifier que l'application backend est démarrée
|
|
- Vérifier la connectivité réseau entre proxy et backend
|
|
- Vérifier les logs de l'application
|
|
|
|
### Problèmes DNS
|
|
|
|
**Le domaine ne résout pas**
|
|
- Vérifier la configuration DNS (CNAME vers 4nk.myftp.biz)
|
|
- Vérifier la propagation DNS: `dig <domaine>`
|
|
- Attendre la propagation (peut prendre jusqu'à 24h)
|
|
|
|
### Problèmes de Ports Bitcoin
|
|
|
|
**Impossible de se connecter aux ports Bitcoin**
|
|
- Vérifier la configuration NAT (port 38333 → 192.168.1.103:38333)
|
|
- Vérifier la configuration Nginx stream
|
|
- Vérifier que le service Bitcoin écoute: `ss -tlnp | grep 38333`
|
|
|
|
### Commandes de Diagnostic
|
|
|
|
```bash
|
|
# Vérifier la connectivité réseau
|
|
ping 192.168.1.100
|
|
ping 192.168.1.101
|
|
|
|
# Vérifier les ports ouverts
|
|
ss -tlnp
|
|
|
|
# Vérifier les logs Nginx
|
|
sudo tail -f /var/log/nginx/access.log
|
|
sudo tail -f /var/log/nginx/error.log
|
|
|
|
# Vérifier les certificats SSL
|
|
sudo certbot certificates
|
|
|
|
# Vérifier la configuration Nginx
|
|
sudo nginx -t
|
|
|
|
# Tester un domaine
|
|
curl -I https://<domaine>
|
|
```
|
|
|
|
|