Fix deployment issues
- Remove healthcheck from Dockerfile (Coolify handles this) - Make database connection non-blocking - Add Coolify-specific docker-compose file - Improve error handling for database connection
This commit is contained in:
16
server.js
16
server.js
@@ -21,14 +21,16 @@ const pool = new Pool({
|
||||
connectionTimeoutMillis: 2000,
|
||||
});
|
||||
|
||||
// Test database connection
|
||||
pool.query('SELECT NOW()', (err, res) => {
|
||||
if (err) {
|
||||
console.error('Database connection error:', err);
|
||||
} else {
|
||||
// Test database connection (non-blocking)
|
||||
pool.query('SELECT NOW()')
|
||||
.then((res) => {
|
||||
console.log('Database connected successfully at:', res.rows[0].now);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Database connection error:', err.message);
|
||||
console.error('Application will continue but database operations will fail');
|
||||
console.error('Please ensure PostgreSQL is running and accessible');
|
||||
});
|
||||
|
||||
// Middleware
|
||||
app.use(express.json({ limit: '10mb' }));
|
||||
|
||||
Reference in New Issue
Block a user