Complete Next.js website with Docker containerization: - Next.js 14 with TypeScript and Tailwind CSS - Responsive design with modern UI components - Hero section, features showcase, testimonials - FAQ section with comprehensive content - Contact forms and newsletter signup - Docker production build with Nginx - Health checks and monitoring support - SEO optimization and performance tuning Ready for integration as git submodule in main CHORUS project. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* CHORUS Services Website - Simplified Health Check Script
|
|
* Validates that Next.js server is running correctly
|
|
* Used by Docker HEALTHCHECK instruction
|
|
*/
|
|
|
|
const http = require('http');
|
|
const process = require('process');
|
|
|
|
const PORT = process.env.PORT || 80;
|
|
const TIMEOUT = 5000; // 5 seconds
|
|
|
|
/**
|
|
* Make HTTP request to check service health
|
|
* @returns {Promise<boolean>} - True if healthy
|
|
*/
|
|
function checkHealth() {
|
|
return new Promise((resolve) => {
|
|
const options = {
|
|
hostname: 'localhost',
|
|
port: PORT,
|
|
path: '/',
|
|
method: 'HEAD',
|
|
timeout: TIMEOUT,
|
|
headers: {
|
|
'User-Agent': 'HealthCheck/1.0'
|
|
}
|
|
};
|
|
|
|
const req = http.request(options, (res) => {
|
|
const isHealthy = res.statusCode >= 200 && res.statusCode < 400;
|
|
resolve(isHealthy);
|
|
});
|
|
|
|
req.on('error', () => {
|
|
resolve(false);
|
|
});
|
|
|
|
req.on('timeout', () => {
|
|
req.destroy();
|
|
resolve(false);
|
|
});
|
|
|
|
req.setTimeout(TIMEOUT);
|
|
req.end();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Main health check function
|
|
*/
|
|
async function main() {
|
|
try {
|
|
const healthy = await checkHealth();
|
|
process.exit(healthy ? 0 : 1);
|
|
} catch (error) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Handle process signals
|
|
process.on('SIGTERM', () => process.exit(1));
|
|
process.on('SIGINT', () => process.exit(1));
|
|
|
|
// Run health check
|
|
main(); |