61 lines
4.3 KiB
Python
61 lines
4.3 KiB
Python
#!/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:int-dev", "ip": "172.20.0.4", "port": "8090", "protocol": "WebSocket", "uptime": "2h 5m", "health": "healthy"},
|
|
{"name": "SDK Signer", "status": "running", "image": "sdk_signer:int-dev", "ip": "172.20.0.5", "port": "9090", "protocol": "WebSocket", "uptime": "2h 0m", "health": "healthy"},
|
|
{"name": "SDK Storage", "status": "running", "image": "sdk_storage:int-dev", "ip": "172.20.0.6", "port": "8080", "protocol": "HTTP", "uptime": "1h 55m", "health": "healthy"},
|
|
{"name": "LeCoffre Backend", "status": "running", "image": "lecoffre-back:int-dev", "ip": "172.20.0.7", "port": "8080", "protocol": "HTTP", "uptime": "1h 50m", "health": "healthy"},
|
|
{"name": "LeCoffre Frontend", "status": "running", "image": "lecoffre-front:int-dev", "ip": "172.20.0.8", "port": "3000", "protocol": "HTTP", "uptime": "1h 45m", "health": "healthy"},
|
|
{"name": "IHM Client", "status": "running", "image": "ihm_client:int-dev", "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:int-dev", "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()
|