Initial Ladill Hosting app with Gitea deploy pipeline.
Deploy Ladill Hosting / deploy (push) Failing after 17s
Deploy Ladill Hosting / deploy (push) Failing after 17s
Shared web hosting extracted from the platform monolith, with CI deploy to /var/www/ladill-hosting matching Bird/Domains/Email. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\ProvisionHostingAccountJob;
|
||||
use App\Models\HostingAccount;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ProvisionPendingHostingAccountsCommand extends Command
|
||||
{
|
||||
protected $signature = 'hosting:provision-pending {--dry-run : Show accounts without dispatching jobs}';
|
||||
|
||||
protected $description = 'Dispatch provisioning jobs for hosting accounts stuck in pending status';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$pendingAccounts = HostingAccount::query()
|
||||
->whereIn('status', ['pending', 'failed'])
|
||||
->whereNotNull('hosting_node_id')
|
||||
->whereNull('provisioned_at')
|
||||
->with(['user:id,name,email', 'product:id,name', 'node:id,name'])
|
||||
->get();
|
||||
|
||||
if ($pendingAccounts->isEmpty()) {
|
||||
$this->info('No pending hosting accounts found.');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$this->info("Found {$pendingAccounts->count()} pending account(s):");
|
||||
$this->newLine();
|
||||
|
||||
foreach ($pendingAccounts as $account) {
|
||||
$this->line(" • [{$account->id}] {$account->username} - {$account->user?->name} ({$account->user?->email})");
|
||||
$this->line(" Product: {$account->product?->name}, Node: {$account->node?->name}, Status: {$account->status}");
|
||||
}
|
||||
|
||||
$this->newLine();
|
||||
|
||||
if ($this->option('dry-run')) {
|
||||
$this->warn('Dry run mode - no jobs dispatched.');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
if (! $this->confirm('Dispatch provisioning jobs for these accounts?')) {
|
||||
$this->info('Aborted.');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$dispatched = 0;
|
||||
foreach ($pendingAccounts as $account) {
|
||||
// Reset status to pending if it was failed
|
||||
if ($account->status === 'failed') {
|
||||
$account->update(['status' => 'pending', 'notes' => null]);
|
||||
}
|
||||
|
||||
ProvisionHostingAccountJob::dispatch($account->id);
|
||||
$dispatched++;
|
||||
$this->info("Dispatched job for account #{$account->id} ({$account->username})");
|
||||
}
|
||||
|
||||
$this->newLine();
|
||||
$this->info("Dispatched {$dispatched} provisioning job(s). Check queue worker for progress.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user