42 lines
1.7 KiB
PHP
42 lines
1.7 KiB
PHP
<?php
|
|
|
|
use App\Console\TickProvisioning;
|
|
use Illuminate\Foundation\Inspiring;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Illuminate\Support\Facades\Schedule;
|
|
|
|
Artisan::command('inspire', function () {
|
|
$this->comment(Inspiring::quote());
|
|
})->purpose('Display an inspiring quote');
|
|
|
|
// Advance every due provisioning run once a minute (runs in the scheduler service).
|
|
Schedule::call(fn () => app(TickProvisioning::class)())
|
|
->everyMinute()
|
|
->name('provisioning-tick')
|
|
->withoutOverlapping();
|
|
|
|
// Refresh the VPN peer state (handshakes, traffic) so the console does not go
|
|
// stale while nobody has it open. The job itself runs on the provisioning
|
|
// queue — that worker owns wg0.
|
|
Schedule::job(new \App\Provisioning\Jobs\SyncVpnPeers)
|
|
->everyMinute()
|
|
->name('vpn-sync');
|
|
|
|
// Sample network counters and enforce the monthly allowance. Runs on the
|
|
// provisioning queue, which is where the Proxmox credentials are usable.
|
|
Schedule::job(new \App\Provisioning\Jobs\CollectInstanceTraffic)
|
|
->everyFifteenMinutes()
|
|
->name('traffic-collect');
|
|
|
|
// Discard Stripe events that were held for a contract which never appeared.
|
|
// Most of them never will: Stripe also delivers events for subscriptions
|
|
// belonging to other environments pointed at this endpoint, and for objects
|
|
// made by hand in the dashboard. A week is far longer than the moment a
|
|
// checkout takes to become a contract, and short enough that the table stays
|
|
// a holding area rather than a second copy of Stripe's event log.
|
|
Schedule::call(fn () => \App\Models\StripePendingEvent::query()
|
|
->where('created_at', '<', now()->subWeek())
|
|
->delete())
|
|
->daily()
|
|
->name('stripe-pending-prune');
|