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,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\HostingNode;
|
||||
use App\Services\Hosting\NodeCapacityService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class RecalculateHostingNodeCapacityCommand extends Command
|
||||
{
|
||||
protected $signature = 'hosting:recalculate-node-capacity {--node=} {--shared-only}';
|
||||
|
||||
protected $description = 'Recalculate logical capacity, allocated disk, and load for hosting nodes.';
|
||||
|
||||
public function handle(NodeCapacityService $capacityService): int
|
||||
{
|
||||
$nodes = HostingNode::query()
|
||||
->when($this->option('node'), fn ($query, $nodeId) => $query->where('id', $nodeId))
|
||||
->when($this->option('shared-only'), fn ($query) => $query->where('type', HostingNode::TYPE_SHARED))
|
||||
->get();
|
||||
|
||||
foreach ($nodes as $node) {
|
||||
$node = $capacityService->refreshNodeResourceTotals($node);
|
||||
$capacityService->checkNode($node);
|
||||
|
||||
$this->line(sprintf(
|
||||
'%s: accounts=%d allocated=%dGB used=%dGB logical=%.2fGB load=%.2f%%',
|
||||
$node->name,
|
||||
$node->current_accounts,
|
||||
$node->allocated_disk_gb,
|
||||
$node->used_disk_gb,
|
||||
$node->logicalCapacityGb(),
|
||||
(float) $node->current_load_percent
|
||||
));
|
||||
}
|
||||
|
||||
$this->info("Recalculated capacity for {$nodes->count()} node(s).");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user