Create Transcriber service health check

This commit is contained in:
2025-07-14 10:35:07 -05:00
parent 1ad31614d6
commit 802dca4cee

View File

@ -0,0 +1,29 @@
import { createClient } from 'redis';
import { Client as PgClient } from 'pg';
const POSTGRES_URL = process.env.POSTGRES_URL;
const REDIS_URL = process.env.REDIS_URL || 'redis://redis:6379';
async function healthCheck() {
try {
// Test PostgreSQL connection
const pgClient = new PgClient({ connectionString: POSTGRES_URL });
await pgClient.connect();
await pgClient.query('SELECT 1');
await pgClient.end();
// Test Redis connection
const redisClient = createClient({ url: REDIS_URL });
await redisClient.connect();
await redisClient.ping();
await redisClient.quit();
console.log('Health check passed');
process.exit(0);
} catch (error) {
console.error('Health check failed:', error.message);
process.exit(1);
}
}
healthCheck();