- 134-tool registry with programmatic SEO (unique titles/H1/descriptions, JSON-LD graphs, sitemap index, canonical 301 enforcement via required filter) - DB-backed job queue (SKIP LOCKED) with drivers: Ffmpeg, Images (GD), Pdf (qpdf/gs/poppler), Youtube (thumbnails), Qr (server-side PNG) - Security: SSRF guard, MIME validation, rate limits, API-key auth, bcrypt admin login, security headers - Admin panel: dashboard, tools/categories/guides CRUD, SEO audit, analytics, job inspector with retry, system health, feature flags - Docker deployment (nginx + web/api FPM pools + scalable workers), PHPUnit suite (19 tests / 1139 assertions), PWA manifest + service worker
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controllers;
|
|
|
|
/**
|
|
* Health & readiness probes for load balancers / Docker.
|
|
* GET /health — process alive. GET /ready — DB + queue reachable.
|
|
*/
|
|
final class Health extends \CodeIgniter\Controller
|
|
{
|
|
public function index(): \CodeIgniter\HTTP\Response
|
|
{
|
|
return response()->setJSON([
|
|
'status' => 'ok',
|
|
'time' => gmdate('c'),
|
|
]);
|
|
}
|
|
|
|
public function ready(): \CodeIgniter\HTTP\Response
|
|
{
|
|
$checks = [
|
|
'database' => false,
|
|
'storage' => is_writable(\App\Libraries\Pipeline::storageDir()) || @mkdir(\App\Libraries\Pipeline::storageDir(), 0750, true),
|
|
'ffmpeg' => null,
|
|
];
|
|
|
|
try {
|
|
db_connect()->query('SELECT 1');
|
|
$checks['database'] = true;
|
|
} catch (\Throwable) {
|
|
}
|
|
|
|
$path = config('Site')->binaries['ffmpeg'];
|
|
if ($path !== null && file_exists($path)) {
|
|
$checks['ffmpeg'] = is_executable($path);
|
|
}
|
|
|
|
$ready = $checks['database'] && $checks['storage'];
|
|
|
|
return response()->setStatusCode($ready ? 200 : 503)->setJSON([
|
|
'status' => $ready ? 'ready' : 'not_ready',
|
|
'checks' => array_filter($checks, static fn ($v) => $v !== null),
|
|
'time' => gmdate('c'),
|
|
]);
|
|
}
|
|
}
|