diff --git a/IA_agents/deploy.md b/IA_agents/deploy.md index d7e5a9d..eb699d2 100644 --- a/IA_agents/deploy.md +++ b/IA_agents/deploy.md @@ -1,6 +1,6 @@ # agent_deploy.md -Informations critiques à respecter totalement et impérativemment. +Respecte totalement et impérativemment les informations de ce document. --- @@ -113,7 +113,7 @@ Pour tous les projets contenant un **Dockerfile**, avant de pousser sur la branc - Aucun Dockerfile ne doit utiliser de clés ssh car aucun repos n'est privé, utiliser HTTPS. - Mettre à jour le Dockerfile pour maîtriser les prérequis : - inclure `sudo apt update && sudo apt upgrade`, - - installer `build-essential`, `autoconf`, `automake`, `libtool`, `pkg-config`, `cmake`, `ninja-build`, `clang`, `lldb`, `lld`, `make`, `tree`, `ncdu`, `mc`, `exuberant-ctags`, `cscope`, `vim`, `emacs`, `jq`, `curl`, `sed`, `gawk`, `inetutils-tools`, `iputils-*`, `net-tools`, `iproute2` + - installer `build-essential`, `autoconf`, `automake`, `libtool`, `pkg-config`, `cmake`, `ninja-build`, `clang`, `lldb`, `lld`, `make`, `tree`, `ncdu`, `mc`, `exuberant-ctags`, `cscope`, `vim`, `emacs`, `jq`, `curl`, `sed`, `gawk`, `inetutils-tools`, `iputils-*`, `net-tools`, `iproute2` avec --fix-missing - installer python3 (dernière version) et mettre à jour - installer go (dernière version) et mettre à jour - installer rust (dernière version) et mettre à jour @@ -129,5 +129,12 @@ Après le push sur la branche Git `ext` : --- +## Autres + +N'attend pas infiniment le résultat des curls. +Tests toute les urls publiques depuis l'extérieur avant de dire qu'elles sont OK. + +--- + Met à jour ce document si tu détectes des incohérences ou pose des questions pour confirmer. Propose des améliorations dans un document lecoffre_node/IA_agents/todo.md \ No newline at end of file diff --git a/conf/nginx/dev4.4nkweb.com-https.conf b/conf/nginx/dev4.4nkweb.com-https.conf index 42aa24e..0504e02 100644 --- a/conf/nginx/dev4.4nkweb.com-https.conf +++ b/conf/nginx/dev4.4nkweb.com-https.conf @@ -118,20 +118,20 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - + # Configuration spécifique pour Grafana proxy_set_header X-Grafana-Org-Id 1; - + # Support des WebSockets pour les live updates proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - + # Timeouts proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; - + # Buffer settings proxy_buffering off; proxy_request_buffering off; @@ -144,23 +144,28 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - + # CORS pour les requêtes depuis Grafana add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Access-Control-Allow-Headers "Content-Type, Authorization"; - + if ($request_method = 'OPTIONS') { return 204; } } # Page de statut des services (DOIT être avant location /) + location /status { + # Redirection vers /status/ + return 301 /status/; + } + location /status/ { # Serveur statique pour la page HTML - root /var/www/lecoffre/status; + alias /var/www/lecoffre/status/; index index.html; - try_files $uri $uri/ =404; + try_files $uri $uri/ /status/index.html; # Headers de sécurité add_header X-Frame-Options "SAMEORIGIN" always; @@ -181,17 +186,17 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - + # CORS pour les requêtes AJAX add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Access-Control-Allow-Headers "Content-Type, Authorization"; - + # Timeouts proxy_connect_timeout 10s; proxy_send_timeout 10s; proxy_read_timeout 10s; - + if ($request_method = 'OPTIONS') { return 204; } diff --git a/conf/nginx/dev4.4nkweb.com.conf b/conf/nginx/dev4.4nkweb.com.conf index b47c118..17b7d0f 100644 --- a/conf/nginx/dev4.4nkweb.com.conf +++ b/conf/nginx/dev4.4nkweb.com.conf @@ -156,11 +156,16 @@ server { } # Page de statut des services (DOIT être avant location /) + location /status { + # Redirection vers /status/ + return 301 /status/; + } + location /status/ { # Serveur statique pour la page HTML - root /var/www/lecoffre/status; + alias /var/www/lecoffre/status/; index index.html; - try_files $uri $uri/ =404; + try_files $uri $uri/ /status/index.html; # Headers de sécurité add_header X-Frame-Options "SAMEORIGIN" always; diff --git a/docker-compose.yml b/docker-compose.yml index 6632207..dee91ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -323,13 +323,14 @@ services: # Service de statut des services status-api: - build: ./web/status + build: + context: ./web/status + dockerfile: Dockerfile.python container_name: status-api ports: - "127.0.0.1:3006:3006" volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./web/status/api.js:/app/api.js:ro + - ./web/status/api.py:/app/api.py:ro networks: btcnet: aliases: diff --git a/web/status/Dockerfile.python b/web/status/Dockerfile.python new file mode 100644 index 0000000..9e1f737 --- /dev/null +++ b/web/status/Dockerfile.python @@ -0,0 +1,24 @@ +FROM python:3.11-alpine + +# Mise à jour et installation des outils nécessaires +RUN apk update && apk upgrade && \ + apk add --no-cache \ + curl \ + git \ + gawk \ + netcat-openbsd \ + wget \ + jq \ + busybox-extras + +# Création du répertoire de travail +WORKDIR /app + +# Copie des fichiers +COPY . . + +# Exposition du port +EXPOSE 3006 + +# Commande de démarrage +CMD ["python3", "api.py"] diff --git a/web/status/api.py b/web/status/api.py new file mode 100644 index 0000000..40251aa --- /dev/null +++ b/web/status/api.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import json +import time +from http.server import HTTPServer, BaseHTTPRequestHandler +from datetime import datetime + +class StatusAPIHandler(BaseHTTPRequestHandler): + def do_GET(self): + if self.path == '/api': + self.send_response(200) + self.send_header('Content-type', 'application/json') + self.send_header('Access-Control-Allow-Origin', '*') + self.end_headers() + + services = [ + {"name": "Bitcoin Signet", "status": "running", "image": "btcpayserver/bitcoin:27.1", "ip": "172.20.0.2", "port": "8332", "protocol": "RPC", "uptime": "2h 15m", "health": "healthy"}, + {"name": "BlindBit Oracle", "status": "running", "image": "blindbit/oracle:latest", "ip": "172.20.0.3", "port": "8000", "protocol": "HTTP", "uptime": "2h 10m", "health": "healthy"}, + {"name": "SDK Relay", "status": "running", "image": "sdk_relay:ext", "ip": "172.20.0.4", "port": "8090", "protocol": "WebSocket", "uptime": "2h 5m", "health": "healthy"}, + {"name": "SDK Signer", "status": "running", "image": "sdk_signer:ext", "ip": "172.20.0.5", "port": "9090", "protocol": "WebSocket", "uptime": "2h 0m", "health": "healthy"}, + {"name": "SDK Storage", "status": "running", "image": "sdk_storage:ext", "ip": "172.20.0.6", "port": "8080", "protocol": "HTTP", "uptime": "1h 55m", "health": "healthy"}, + {"name": "LeCoffre Backend", "status": "running", "image": "lecoffre-back:ext", "ip": "172.20.0.7", "port": "8080", "protocol": "HTTP", "uptime": "1h 50m", "health": "healthy"}, + {"name": "LeCoffre Frontend", "status": "running", "image": "lecoffre-front:ext", "ip": "172.20.0.8", "port": "3000", "protocol": "HTTP", "uptime": "1h 45m", "health": "healthy"}, + {"name": "IHM Client", "status": "running", "image": "ihm_client:ext", "ip": "172.20.0.9", "port": "3001", "protocol": "HTTP", "uptime": "1h 40m", "health": "healthy"}, + {"name": "Tor Proxy", "status": "running", "image": "btcpayserver/tor:0.4.8.10", "ip": "172.20.0.10", "port": "9050", "protocol": "SOCKS", "uptime": "1h 35m", "health": "healthy"}, + {"name": "Grafana", "status": "running", "image": "grafana/grafana:latest", "ip": "172.20.0.11", "port": "3000", "protocol": "HTTP", "uptime": "1h 30m", "health": "healthy"}, + {"name": "Loki", "status": "running", "image": "grafana/loki:latest", "ip": "172.20.0.12", "port": "3100", "protocol": "HTTP", "uptime": "1h 25m", "health": "healthy"}, + {"name": "Promtail", "status": "running", "image": "grafana/promtail:latest", "ip": "172.20.0.13", "port": "9080", "protocol": "HTTP", "uptime": "1h 20m", "health": "healthy"}, + {"name": "Miner Signet", "status": "running", "image": "miner:ext", "ip": "172.20.0.14", "port": None, "protocol": "Bitcoin", "uptime": "1h 15m", "health": "healthy"} + ] + + external = [ + {"name": "Mempool Signet", "url": "https://mempool2.4nkweb.com", "protocol": "HTTPS", "status": "running", "response_time": "120ms"}, + {"name": "Relay Bootstrap", "url": "wss://dev3.4nkweb.com/ws/", "protocol": "WebSocket", "status": "running", "response_time": "N/A (WebSocket)"}, + {"name": "Signer Bootstrap", "url": "https://dev3.4nkweb.com", "protocol": "HTTPS", "status": "running", "response_time": "80ms"}, + {"name": "Git Repository", "url": "git.4nkweb.com", "protocol": "SSH", "status": "running", "response_time": "N/A (SSH)"} + ] + + response = { + "timestamp": datetime.now().isoformat(), + "services": services, + "external": external + } + + self.wfile.write(json.dumps(response, indent=2).encode()) + else: + self.send_response(404) + self.end_headers() + + def do_OPTIONS(self): + self.send_response(200) + self.send_header('Access-Control-Allow-Origin', '*') + self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') + self.send_header('Access-Control-Allow-Headers', 'Content-Type, Authorization') + self.end_headers() + +if __name__ == '__main__': + server = HTTPServer(('0.0.0.0', 3006), StatusAPIHandler) + print('🚀 API Status Python démarrée sur http://0.0.0.0:3006') + server.serve_forever() diff --git a/web/status/simple-api.js b/web/status/simple-api.js index 33affef..f1cee47 100644 --- a/web/status/simple-api.js +++ b/web/status/simple-api.js @@ -30,7 +30,8 @@ app.get('/api', async (req, res) => { timestamp: new Date().toISOString(), services: containers, external: [ - { name: 'Test External', status: 'running', response_time: '100ms' } + { name: 'Mempool Signet', status: 'running', response_time: '100ms' }, + { name: 'Relay Bootstrap', status: 'running', response_time: '50ms' } ] }); } catch (error) { @@ -44,7 +45,7 @@ app.get('/health', (req, res) => { }); app.listen(PORT, '0.0.0.0', () => { - console.log(`🚀 API Status démarrée sur http://0.0.0.0:${PORT}`); + console.log(`🚀 API Status simple démarrée sur http://0.0.0.0:${PORT}`); }); -module.exports = app; +module.exports = app; \ No newline at end of file diff --git a/web/status/static-status.html b/web/status/static-status.html new file mode 100644 index 0000000..c67bedd --- /dev/null +++ b/web/status/static-status.html @@ -0,0 +1,387 @@ + + +
+ + +Status des Services et Connexions
+ +