Files
jobifygarden/bootstrap/app.php
T

82 lines
3.2 KiB
PHP
Raw Normal View History

2026-04-02 23:00:12 +03:00
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
2026-04-03 00:29:05 +03:00
use Illuminate\Console\Scheduling\Schedule;
2026-04-02 23:00:12 +03:00
2026-04-18 19:42:44 +03:00
$path = "/home/jobifyg/domains/jobifygarden.com/public_html";
$app = new Illuminate\Foundation\Application($path);
//$app->usePublicPath($app->basePath('public_html'));
2026-04-02 23:00:12 +03:00
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
2026-04-03 01:04:19 +03:00
api: __DIR__.'/../routes/api.php',
2026-04-02 23:00:12 +03:00
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
})
2026-04-03 00:29:05 +03:00
->withSchedule(function (Schedule $schedule): void {
2026-04-04 18:52:19 +03:00
// =========================================================================
// Job Fetching - Fetch fresh jobs from external APIs
// =========================================================================
// Fetch jobs every 2 hours to keep listings fresh
// Limit per source to avoid rate limits and keep queue manageable
$schedule->command('jobs:fetch --limit=50')
->everyTwoHours()
2026-04-03 00:29:05 +03:00
->withoutOverlapping()
2026-04-04 18:52:19 +03:00
->onOneServer()
->runInBackground();
2026-04-03 00:29:05 +03:00
2026-04-04 18:52:19 +03:00
// =========================================================================
// Job Enrichment - Auto-categorize and enhance job data
// =========================================================================
2026-04-03 00:29:05 +03:00
2026-04-04 18:52:19 +03:00
// Enrich new jobs every 6 hours (categorization, experience level detection)
// This runs after jobs have been fetched to categorize uncategorized jobs
$schedule->command('jobs:enrich')
->everySixHours()
->withoutOverlapping()
->onOneServer()
->runInBackground();
// =========================================================================
// Job Deduplication - Remove duplicate job listings
// =========================================================================
// Deduplicate jobs daily at 3 AM (after fetch cycles have completed)
// Daily is better than weekly to keep listings clean
2026-04-03 00:29:05 +03:00
$schedule->command('jobs:deduplicate')
2026-04-04 18:52:19 +03:00
->dailyAt('03:00')
->onOneServer()
->runInBackground();
// =========================================================================
// Job Cleanup - Remove expired and old jobs
// =========================================================================
// Clean up expired and old jobs daily at 2 AM
// Keeps database lean and removes stale listings
$schedule->command('jobs:clean --days=45')
->dailyAt('02:00')
->onOneServer()
->runInBackground();
// =========================================================================
// Cache Management - Keep caches fresh
// =========================================================================
// Prune stale cache tags hourly
$schedule->command('cache:prune-stale-tags')
->hourly()
2026-04-03 00:29:05 +03:00
->onOneServer();
})
2026-04-02 23:00:12 +03:00
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();