3 Commits

Author SHA1 Message Date
a1219b92ce Should fix
All checks were successful
Push image to registry / build-image (push) Successful in 7m31s
2025-02-28 17:05:47 +01:00
ce13d1b0dd Job qui enlève les vieilles jobRun
All checks were successful
Push image to registry / build-image (push) Successful in 6m18s
2025-02-27 18:54:40 +01:00
a80a32eee8 Added links to browser downloads and others
All checks were successful
Push image to registry / build-image (push) Successful in 6m20s
2025-02-27 17:57:54 +01:00
10 changed files with 72 additions and 4 deletions

View File

@ -40,7 +40,7 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
$this->jobRun->save();
$browser->visit('https://hellcase.com');
$browser->waitForText("Store", 30, true);
$browser->waitForText("CASES", 30, true);
$this->removePopups($browser);
sleep(5);
$this->signin($browser);

View File

@ -0,0 +1,35 @@
<?php
namespace App\Jobs;
use App\Models\Job;
use App\Models\JobRun;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class PruneOldJobRuns implements ShouldQueue
{
use Queueable;
/**
* Create a new job instance.
*/
public function __construct()
{
//
}
/**
* Execute the job.
*/
public function handle(): void
{
// For each job, keep only the last N runs
foreach (Job::all() as $job) {
$job->jobRuns()
->orderByDesc('id')
->skip(config('jobs.pruneOldJobRuns.max_runs_per_job'))
->delete();
}
}
}

View File

@ -75,6 +75,10 @@ return [
'links' => [
public_path('storage') => storage_path('app/public'),
public_path('console') => base_path('app/Browser/console'),
public_path('downloads') => base_path('app/Browser/downloads'),
public_path('screenshots') => base_path('app/Browser/screenshots'),
public_path('source') => base_path('app/Browser/source'),
],
];

20
config/jobs.php Normal file
View File

@ -0,0 +1,20 @@
<?php
use Laravel\Telescope\Http\Middleware\Authorize;
use Laravel\Telescope\Watchers;
return [
/**
* Remove old job runs from the database.
*/
'pruneOldJobRuns' => [
'enabled' => true,
/**
* How many job runs a job can keep before we start pruning old ones.
*/
'max_runs_per_job' => 50,
],
];

1
public/console Symbolic link
View File

@ -0,0 +1 @@
/home/ninluc/Documents/codage/DatBrowser/app/Browser/console

1
public/downloads Symbolic link
View File

@ -0,0 +1 @@
/home/ninluc/Documents/codage/DatBrowser/app/Browser/downloads

1
public/screenshots Symbolic link
View File

@ -0,0 +1 @@
/home/ninluc/Documents/codage/DatBrowser/app/Browser/screenshots

1
public/source Symbolic link
View File

@ -0,0 +1 @@
/home/ninluc/Documents/codage/DatBrowser/app/Browser/source

View File

@ -1,7 +1,7 @@
<?php
use App\Browser\Jobs\Hellcase\HellcaseJob;
use App\Models\Job;
use App\Jobs\PruneOldJobRuns;
use App\Services\BrowserJobsInstances;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
@ -13,6 +13,11 @@ Artisan::command('inspire', function () {
// Telescope
Schedule::command('telescope:prune')->monthly();
// Prune old job runs
Schedule::job(new PruneOldJobRuns)->monthly()->onOneServer()->withoutOverlapping()->name('prune-old-job-runs')->description('Prune old job runs')->skip(function () {
return !config('jobs.pruneOldJobRuns.enabled');
});
// Jobs
Schedule::job(new HellcaseJob)->daily()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
// Schedule::job(new HellcaseJob)->everyMinute()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');

View File

@ -7,10 +7,10 @@
- → Notification
- Ou ajouter des images base64 dans les jobRun
- Risque de devenir volumineux
- Sauf avec le jobqui enlève les vieilles jobRun
- Sauf avec le job qui enlève les vieilles jobRun
- Notification live websocket
- Websocket installé
- Serveur php plus propre (nginx, apache, n'importe)
- Job qui supprime les vieilles JobRun
- Epic games
## Pour deploy Lama