mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 23:42:34 +00:00
Add load balancer (#453)
This commit is contained in:
@ -34,7 +34,7 @@ public function data(array $input): array
|
||||
|
||||
public function editRules(array $input): array
|
||||
{
|
||||
return [];
|
||||
return $this->createRules($input);
|
||||
}
|
||||
|
||||
protected function progress(int $percentage): void
|
||||
|
58
app/SiteTypes/LoadBalancer.php
Executable file
58
app/SiteTypes/LoadBalancer.php
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\SiteTypes;
|
||||
|
||||
use App\Enums\LoadBalancerMethod;
|
||||
use App\Enums\SiteFeature;
|
||||
use App\Exceptions\SSHError;
|
||||
use App\SSH\Services\Webserver\Webserver;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class LoadBalancer extends AbstractSiteType
|
||||
{
|
||||
public function language(): string
|
||||
{
|
||||
return 'yaml';
|
||||
}
|
||||
|
||||
public function supportedFeatures(): array
|
||||
{
|
||||
return [
|
||||
SiteFeature::SSL,
|
||||
];
|
||||
}
|
||||
|
||||
public function createRules(array $input): array
|
||||
{
|
||||
return [
|
||||
'method' => [
|
||||
'required',
|
||||
Rule::in(LoadBalancerMethod::all()),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function data(array $input): array
|
||||
{
|
||||
return [
|
||||
'method' => $input['method'] ?? LoadBalancerMethod::ROUND_ROBIN,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function install(): void
|
||||
{
|
||||
$this->isolate();
|
||||
|
||||
/** @var Webserver $webserver */
|
||||
$webserver = $this->site->server->webserver()->handler();
|
||||
$webserver->createVHost($this->site);
|
||||
}
|
||||
|
||||
public function edit(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user