feat: Add comprehensive documentation suite and reorganize project structure
- Created complete documentation in docs/ directory - Added PROJECT_OVERVIEW.md with feature highlights and getting started guide - Added ARCHITECTURE.md with system design and technical details - Added SECURITY.md with comprehensive security implementation guide - Added DEVELOPMENT.md with development workflows and best practices - Added DEPLOYMENT.md with production deployment instructions - Added API.md with complete REST API documentation - Added CONTRIBUTING.md with contribution guidelines - Added CHANGELOG.md with version history and migration notes - Reorganized all documentation files into docs/ directory for better organization - Updated README.md with proper documentation links and quick navigation - Enhanced project structure with professional documentation standards
This commit is contained in:
75
status.php
Normal file
75
status.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*******************************************************************************************************************
|
||||
| EasyStream Health Check Endpoint
|
||||
| Container health monitoring for Docker deployment
|
||||
|*******************************************************************************************************************/
|
||||
|
||||
// Set headers for health check
|
||||
header('Content-Type: application/json');
|
||||
header('X-Container: vs-php');
|
||||
header('X-Hostname: ' . gethostname());
|
||||
|
||||
// Basic health check data
|
||||
$health = [
|
||||
'status' => 'healthy',
|
||||
'timestamp' => date('c'),
|
||||
'container' => 'vs-php',
|
||||
'hostname' => gethostname(),
|
||||
'php_version' => PHP_VERSION,
|
||||
'memory_usage' => memory_get_usage(true),
|
||||
'memory_peak' => memory_get_peak_usage(true)
|
||||
];
|
||||
|
||||
// Check core system files
|
||||
$core_files = [
|
||||
'f_core/config.core.php',
|
||||
'index.php',
|
||||
'.htaccess'
|
||||
];
|
||||
|
||||
$files_ok = true;
|
||||
foreach ($core_files as $file) {
|
||||
if (!file_exists($file)) {
|
||||
$health['status'] = 'unhealthy';
|
||||
$health['error'] = "Missing core file: $file";
|
||||
$files_ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check database connection if core files exist
|
||||
if ($files_ok) {
|
||||
try {
|
||||
if (file_exists('f_core/config.core.php')) {
|
||||
include_once 'f_core/config.core.php';
|
||||
|
||||
// Test database connection
|
||||
if (isset($class_database) && is_object($class_database)) {
|
||||
$health['database'] = 'connected';
|
||||
} else {
|
||||
$health['database'] = 'disconnected';
|
||||
$health['status'] = 'degraded';
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$health['database'] = 'error';
|
||||
$health['database_error'] = $e->getMessage();
|
||||
$health['status'] = 'degraded';
|
||||
}
|
||||
}
|
||||
|
||||
// Set appropriate HTTP status code
|
||||
switch ($health['status']) {
|
||||
case 'healthy':
|
||||
http_response_code(200);
|
||||
break;
|
||||
case 'degraded':
|
||||
http_response_code(200); // Still operational
|
||||
break;
|
||||
case 'unhealthy':
|
||||
http_response_code(503);
|
||||
break;
|
||||
}
|
||||
|
||||
echo json_encode($health, JSON_PRETTY_PRINT);
|
||||
?>
|
||||
Reference in New Issue
Block a user