mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-21 06:08:18 +02:00
Update the application's production environment for enhanced performance
Refactors the Docker setup, upgrades Node.js and PostgreSQL versions, and improves security. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 4b008663-bd72-492b-b0b6-fa252367e730 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/4b008663-bd72-492b-b0b6-fa252367e730/6nnsA2m
This commit is contained in:
1 parent
de8434c508
commit
a939b1068d
9 files changed
+717
-109
No files matched your search
+39
-15
@@ -126,25 +126,57 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
});
|
||||
|
||||
// Health check endpoint for Docker
|
||||
// Production health check endpoint with comprehensive monitoring
|
||||
app.get('/health', async (req, res) => {
|
||||
try {
|
||||
// Test de connexion à la base de données
|
||||
const dbStart = Date.now();
|
||||
await storage.initializeDefaults();
|
||||
const dbLatency = Date.now() - dbStart;
|
||||
|
||||
// Informations système
|
||||
const memUsage = process.memoryUsage();
|
||||
const cpuUsage = process.cpuUsage();
|
||||
|
||||
res.status(200).json({
|
||||
status: 'healthy',
|
||||
timestamp: new Date().toISOString(),
|
||||
uptime: process.uptime(),
|
||||
database: 'connected',
|
||||
environment: process.env.NODE_ENV || 'development'
|
||||
uptime: Math.floor(process.uptime()),
|
||||
version: '2025.1.0',
|
||||
environment: process.env.NODE_ENV || 'development',
|
||||
database: {
|
||||
status: 'connected',
|
||||
latency: `${dbLatency}ms`
|
||||
},
|
||||
system: {
|
||||
memory: {
|
||||
used: Math.round(memUsage.heapUsed / 1024 / 1024),
|
||||
total: Math.round(memUsage.heapTotal / 1024 / 1024),
|
||||
unit: 'MB'
|
||||
},
|
||||
cpu: {
|
||||
user: cpuUsage.user,
|
||||
system: cpuUsage.system
|
||||
}
|
||||
},
|
||||
features: {
|
||||
backup_scheduler: 'active',
|
||||
data_purge: 'active',
|
||||
photo_storage: 'enabled',
|
||||
session_store: 'postgresql'
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Health check failed:', error);
|
||||
res.status(503).json({
|
||||
status: 'unhealthy',
|
||||
timestamp: new Date().toISOString(),
|
||||
database: 'disconnected',
|
||||
error: error instanceof Error ? error.message : 'Unknown error'
|
||||
database: {
|
||||
status: 'disconnected',
|
||||
error: error instanceof Error ? error.message : 'Unknown error'
|
||||
},
|
||||
uptime: Math.floor(process.uptime()),
|
||||
environment: process.env.NODE_ENV || 'development'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -651,15 +683,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
});
|
||||
|
||||
// Health check endpoint for production monitoring
|
||||
app.get('/health', (req, res) => {
|
||||
res.status(200).json({
|
||||
status: 'healthy',
|
||||
timestamp: new Date().toISOString(),
|
||||
uptime: process.uptime(),
|
||||
environment: process.env.NODE_ENV
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const httpServer = createServer(app);
|
||||
return httpServer;
|
||||
|
||||
Reference in new issue
Block a user