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>
63 lines
2.0 KiB
PHP
63 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\HostingAccount;
|
|
use App\Services\Hosting\Providers\SharedNodeProvider;
|
|
use Illuminate\Console\Command;
|
|
|
|
class ReprovisionHostingAccount extends Command
|
|
{
|
|
protected $signature = 'hosting:reprovision {account_id}';
|
|
protected $description = 'Re-provision a hosting account on its node (creates user, directories, etc.)';
|
|
|
|
public function handle(SharedNodeProvider $provider): int
|
|
{
|
|
$account = HostingAccount::with('node')->find($this->argument('account_id'));
|
|
|
|
if (!$account) {
|
|
$this->error('Account not found');
|
|
return 1;
|
|
}
|
|
|
|
if (!$account->node) {
|
|
$this->error('Account has no hosting node assigned');
|
|
return 1;
|
|
}
|
|
|
|
$this->info("Re-provisioning account: {$account->username} on node {$account->node->hostname}");
|
|
|
|
try {
|
|
$result = $provider->createAccount($account);
|
|
|
|
$account->update([
|
|
'status' => HostingAccount::STATUS_ACTIVE,
|
|
'home_directory' => $result['home_directory'],
|
|
'provisioned_at' => now(),
|
|
]);
|
|
|
|
$this->info("Account provisioned successfully!");
|
|
$this->info("Username: {$result['username']}");
|
|
$this->info("Password: {$result['password']}");
|
|
$this->info("Home Directory: {$result['home_directory']}");
|
|
|
|
// Also provision any existing sites
|
|
foreach ($account->sites as $site) {
|
|
$this->info("Provisioning site: {$site->domain}");
|
|
try {
|
|
$provider->addSite($site);
|
|
$site->update(['status' => 'active']);
|
|
$this->info(" - Site provisioned");
|
|
} catch (\Exception $e) {
|
|
$this->warn(" - Failed: {$e->getMessage()}");
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} catch (\Exception $e) {
|
|
$this->error("Failed to provision: {$e->getMessage()}");
|
|
return 1;
|
|
}
|
|
}
|
|
}
|