Improve database connection reliability and add debugging tools

Enhances database connection robustness with retry logic and introduces `debug-docker.sh` for easier debugging.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/6e755801-08e8-4492-805e-ac3610de5a2a.jpg
This commit is contained in:
michaelschal committed 2025-07-09 20:50:34 +00:00
1 parent 3028259f6e
commit a2e4588776
3 files changed
+78 -9

No files matched your search

+20 -7
View File
@@ -118,13 +118,26 @@ export async function registerRoutes(app: Express): Promise<Server> {
});
// Health check endpoint for Docker
app.get('/health', (req, res) => {
res.status(200).json({
status: 'healthy',
timestamp: new Date().toISOString(),
uptime: process.uptime(),
environment: process.env.NODE_ENV || 'development'
});
app.get('/health', async (req, res) => {
try {
// Test de connexion à la base de données
await storage.initializeDefaults();
res.status(200).json({
status: 'healthy',
timestamp: new Date().toISOString(),
uptime: process.uptime(),
database: 'connected',
environment: process.env.NODE_ENV || 'development'
});
} 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'
});
}
});
app.get('/api/auth/me', requireAuth, async (req, res) => {