457 lines
16 KiB
HTML
457 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>LeCoffre Node - Status des Services</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1400px;
|
|
margin: 0 auto;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
border-radius: 15px;
|
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.header {
|
|
background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
|
|
color: white;
|
|
padding: 30px;
|
|
text-align: center;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 2.5em;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.header p {
|
|
font-size: 1.1em;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.refresh-btn {
|
|
background: #27ae60;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 24px;
|
|
border-radius: 25px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
margin: 20px 0;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.refresh-btn:hover {
|
|
background: #229954;
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.last-update {
|
|
text-align: center;
|
|
color: #666;
|
|
margin-bottom: 20px;
|
|
font-style: italic;
|
|
}
|
|
|
|
.services-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
|
gap: 20px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.service-card {
|
|
background: white;
|
|
border-radius: 10px;
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
overflow: hidden;
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.service-card:hover {
|
|
transform: translateY(-5px);
|
|
}
|
|
|
|
.service-header {
|
|
padding: 20px;
|
|
border-bottom: 1px solid #eee;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.service-name {
|
|
font-size: 1.3em;
|
|
font-weight: bold;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.status-badge {
|
|
padding: 8px 16px;
|
|
border-radius: 20px;
|
|
font-weight: bold;
|
|
text-transform: uppercase;
|
|
font-size: 0.8em;
|
|
}
|
|
|
|
.status-running {
|
|
background: #d4edda;
|
|
color: #155724;
|
|
}
|
|
|
|
.status-stopped {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
|
|
.status-error {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
|
|
.status-unknown {
|
|
background: #fff3cd;
|
|
color: #856404;
|
|
}
|
|
|
|
.service-details {
|
|
padding: 20px;
|
|
}
|
|
|
|
.detail-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 10px;
|
|
padding: 8px 0;
|
|
border-bottom: 1px solid #f8f9fa;
|
|
}
|
|
|
|
.detail-label {
|
|
font-weight: bold;
|
|
color: #495057;
|
|
}
|
|
|
|
.detail-value {
|
|
color: #6c757d;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.network-info {
|
|
background: #f8f9fa;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.network-title {
|
|
font-weight: bold;
|
|
color: #495057;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.external-services {
|
|
background: #e8f4fd;
|
|
padding: 20px;
|
|
margin: 20px;
|
|
border-radius: 10px;
|
|
border-left: 5px solid #3498db;
|
|
}
|
|
|
|
.external-title {
|
|
font-size: 1.5em;
|
|
color: #2c3e50;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.external-service {
|
|
background: white;
|
|
padding: 15px;
|
|
margin-bottom: 10px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.loading {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: #666;
|
|
}
|
|
|
|
.spinner {
|
|
border: 4px solid #f3f3f3;
|
|
border-top: 4px solid #3498db;
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
animation: spin 2s linear infinite;
|
|
margin: 0 auto 20px;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.error-message {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
margin: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.footer {
|
|
background: #2c3e50;
|
|
color: white;
|
|
text-align: center;
|
|
padding: 20px;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.services-grid {
|
|
grid-template-columns: 1fr;
|
|
padding: 10px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 2em;
|
|
}
|
|
|
|
.detail-row {
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<h1>🚀 LeCoffre Node</h1>
|
|
<p>Status des Services et Connexions</p>
|
|
<button class="refresh-btn" onclick="refreshStatus()">🔄 Actualiser</button>
|
|
</div>
|
|
|
|
<div class="last-update" id="lastUpdate">
|
|
Dernière mise à jour: <span id="updateTime">Chargement...</span>
|
|
</div>
|
|
|
|
<div id="loading" class="loading">
|
|
<div class="spinner"></div>
|
|
<p>Chargement des informations des services...</p>
|
|
</div>
|
|
|
|
<div id="errorMessage" class="error-message" style="display: none;">
|
|
Erreur lors du chargement des données
|
|
</div>
|
|
|
|
<div id="servicesContainer" class="services-grid" style="display: none;">
|
|
<!-- Les services seront injectés ici -->
|
|
</div>
|
|
|
|
<div class="external-services">
|
|
<div class="external-title">🌐 Services Externes Connectés</div>
|
|
<div id="externalServices">
|
|
<!-- Les services externes seront injectés ici -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<p>LeCoffre Node - Monitoring en temps réel | <span id="footerTime"></span></p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Configuration des services à surveiller
|
|
const services = [
|
|
{ name: 'Bitcoin Signet', container: 'bitcoin', port: 8332, protocol: 'RPC', description: 'Nœud Bitcoin Signet' },
|
|
{ name: 'BlindBit Oracle', container: 'blindbit', port: 8000, protocol: 'HTTP', description: 'Oracle pour les Silent Payments' },
|
|
{ name: 'SDK Relay', container: 'sdk_relay', port: 8090, protocol: 'WebSocket', description: 'Relais des transactions' },
|
|
{ name: 'SDK Signer', container: 'sdk_signer', port: 9090, protocol: 'WebSocket', description: 'Service de signature' },
|
|
{ name: 'SDK Storage', container: 'sdk_storage', port: 8080, protocol: 'HTTP', description: 'Stockage temporaire' },
|
|
{ name: 'LeCoffre Backend', container: 'lecoffre-back', port: 8080, protocol: 'HTTP', description: 'API Backend' },
|
|
{ name: 'LeCoffre Frontend', container: 'lecoffre-front', port: 3000, protocol: 'HTTP', description: 'Interface utilisateur' },
|
|
{ name: 'IHM Client', container: 'ihm_client', port: 3001, protocol: 'HTTP', description: 'Interface de gestion des clés' },
|
|
{ name: 'Tor Proxy', container: 'tor-proxy', port: 9050, protocol: 'SOCKS', description: 'Proxy anonyme' },
|
|
{ name: 'Grafana', container: 'grafana', port: 3000, protocol: 'HTTP', description: 'Monitoring et dashboards' },
|
|
{ name: 'Loki', container: 'loki', port: 3100, protocol: 'HTTP', description: 'Agrégation des logs' },
|
|
{ name: 'Promtail', container: 'promtail', port: 9080, protocol: 'HTTP', description: 'Collecteur de logs' },
|
|
{ name: 'Miner Signet', container: 'signet_miner', port: null, protocol: 'Bitcoin', description: 'Mineur de blocs' }
|
|
];
|
|
|
|
const externalServices = [
|
|
{ name: 'Mempool Signet', url: 'https://mempool2.4nkweb.com', protocol: 'HTTPS', description: 'Explorateur de blockchain' },
|
|
{ name: 'Relay Bootstrap', url: 'wss://dev3.4nkweb.com/ws/', protocol: 'WebSocket', description: 'Relais de bootstrap' },
|
|
{ name: 'Signer Bootstrap', url: 'https://dev3.4nkweb.com', protocol: 'HTTPS', description: 'Signer de bootstrap' },
|
|
{ name: 'Git Repository', url: 'git.4nkweb.com', protocol: 'SSH', description: 'Dépôt de code' }
|
|
];
|
|
|
|
async function refreshStatus() {
|
|
document.getElementById('loading').style.display = 'block';
|
|
document.getElementById('errorMessage').style.display = 'none';
|
|
document.getElementById('servicesContainer').style.display = 'none';
|
|
|
|
try {
|
|
const response = await fetch('/status/api');
|
|
const data = await response.json();
|
|
|
|
displayServices(data.services);
|
|
displayExternalServices(data.external);
|
|
updateTime();
|
|
|
|
document.getElementById('loading').style.display = 'none';
|
|
document.getElementById('servicesContainer').style.display = 'grid';
|
|
|
|
} catch (error) {
|
|
console.error('Erreur:', error);
|
|
document.getElementById('loading').style.display = 'none';
|
|
document.getElementById('errorMessage').style.display = 'block';
|
|
}
|
|
}
|
|
|
|
function displayServices(servicesData) {
|
|
const container = document.getElementById('servicesContainer');
|
|
container.innerHTML = '';
|
|
|
|
services.forEach(service => {
|
|
const serviceData = servicesData.find(s => s.name === service.name) || {
|
|
status: 'unknown',
|
|
image: 'N/A',
|
|
ip: 'N/A',
|
|
ports: [],
|
|
uptime: 'N/A',
|
|
health: 'unknown'
|
|
};
|
|
|
|
const statusClass = `status-${serviceData.status}`;
|
|
const statusText = getStatusText(serviceData.status);
|
|
|
|
const serviceCard = document.createElement('div');
|
|
serviceCard.className = 'service-card';
|
|
serviceCard.innerHTML = `
|
|
<div class="service-header">
|
|
<div class="service-name">${service.name}</div>
|
|
<div class="status-badge ${statusClass}">${statusText}</div>
|
|
</div>
|
|
<div class="service-details">
|
|
<div class="detail-row">
|
|
<span class="detail-label">Description:</span>
|
|
<span class="detail-value">${service.description}</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">Image Docker:</span>
|
|
<span class="detail-value">${serviceData.image}</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">Protocole:</span>
|
|
<span class="detail-value">${service.protocol}</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">Port:</span>
|
|
<span class="detail-value">${service.port || 'N/A'}</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">IP d'écoute:</span>
|
|
<span class="detail-value">${serviceData.ip}</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">Uptime:</span>
|
|
<span class="detail-value">${serviceData.uptime}</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">Santé:</span>
|
|
<span class="detail-value">${serviceData.health}</span>
|
|
</div>
|
|
${serviceData.ports && serviceData.ports.length > 0 ? `
|
|
<div class="network-info">
|
|
<div class="network-title">Ports exposés:</div>
|
|
${serviceData.ports.map(port => `<div>${port}</div>`).join('')}
|
|
</div>
|
|
` : ''}
|
|
</div>
|
|
`;
|
|
container.appendChild(serviceCard);
|
|
});
|
|
}
|
|
|
|
function displayExternalServices(externalData) {
|
|
const container = document.getElementById('externalServices');
|
|
container.innerHTML = '';
|
|
|
|
externalServices.forEach(service => {
|
|
const serviceData = externalData.find(s => s.name === service.name) || {
|
|
status: 'unknown',
|
|
response_time: 'N/A'
|
|
};
|
|
|
|
const statusClass = `status-${serviceData.status}`;
|
|
const statusText = getStatusText(serviceData.status);
|
|
|
|
const serviceDiv = document.createElement('div');
|
|
serviceDiv.className = 'external-service';
|
|
serviceDiv.innerHTML = `
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
|
<div style="font-weight: bold; color: #2c3e50;">${service.name}</div>
|
|
<div class="status-badge ${statusClass}">${statusText}</div>
|
|
</div>
|
|
<div style="margin-bottom: 8px;">
|
|
<strong>URL:</strong> ${service.url}
|
|
</div>
|
|
<div style="margin-bottom: 8px;">
|
|
<strong>Protocole:</strong> ${service.protocol}
|
|
</div>
|
|
<div style="margin-bottom: 8px;">
|
|
<strong>Description:</strong> ${service.description}
|
|
</div>
|
|
<div>
|
|
<strong>Temps de réponse:</strong> ${serviceData.response_time}
|
|
</div>
|
|
`;
|
|
container.appendChild(serviceDiv);
|
|
});
|
|
}
|
|
|
|
function getStatusText(status) {
|
|
switch(status) {
|
|
case 'running': return '🟢 En cours';
|
|
case 'stopped': return '🔴 Arrêté';
|
|
case 'error': return '⚠️ Erreur';
|
|
case 'healthy': return '✅ Sain';
|
|
case 'unhealthy': return '❌ Malsain';
|
|
default: return '❓ Inconnu';
|
|
}
|
|
}
|
|
|
|
function updateTime() {
|
|
const now = new Date();
|
|
const timeString = now.toLocaleString('fr-FR');
|
|
document.getElementById('updateTime').textContent = timeString;
|
|
document.getElementById('footerTime').textContent = timeString;
|
|
}
|
|
|
|
// Auto-refresh toutes les 30 secondes
|
|
setInterval(refreshStatus, 30000);
|
|
|
|
// Chargement initial
|
|
refreshStatus();
|
|
</script>
|
|
</body>
|
|
</html>
|