add swarm server grouping
fixes for swarm
This commit is contained in:
@@ -21,7 +21,10 @@ class CheckProxy
|
||||
$status = getContainerStatus($server, 'coolify-proxy_traefik');
|
||||
$server->proxy->set('status', $status);
|
||||
$server->save();
|
||||
return false;
|
||||
if ($status === 'running') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
$status = getContainerStatus($server, 'coolify-proxy');
|
||||
if ($status === 'running') {
|
||||
|
||||
@@ -123,7 +123,7 @@ class Select extends Component
|
||||
$this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false);
|
||||
break;
|
||||
}
|
||||
if (str($type)->startsWith('one-click-service')) {
|
||||
if (str($type)->startsWith('one-click-service') || str($type)->startsWith('docker-compose-empty') || str($type)->startsWith('docker-image')) {
|
||||
$this->isDatabase = true;
|
||||
$this->includeSwarm = false;
|
||||
$this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false);
|
||||
|
||||
@@ -23,8 +23,9 @@ class ByIp extends Component
|
||||
public int $port = 22;
|
||||
public bool $is_swarm_manager = false;
|
||||
public bool $is_swarm_worker = false;
|
||||
public $selected_swarm_cluster = null;
|
||||
|
||||
|
||||
public $swarm_managers = [];
|
||||
protected $rules = [
|
||||
'name' => 'required|string',
|
||||
'description' => 'nullable|string',
|
||||
@@ -48,6 +49,10 @@ class ByIp extends Component
|
||||
{
|
||||
$this->name = generate_random_name();
|
||||
$this->private_key_id = $this->private_keys->first()->id;
|
||||
$this->swarm_managers = Server::isUsable()->get()->where('settings.is_swarm_manager', true);
|
||||
if ($this->swarm_managers->count() > 0) {
|
||||
$this->selected_swarm_cluster = $this->swarm_managers->first()->id;
|
||||
}
|
||||
}
|
||||
|
||||
public function setPrivateKey(string $private_key_id)
|
||||
@@ -57,7 +62,7 @@ class ByIp extends Component
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
$this->dispatch('success', 'Application settings updated!');
|
||||
// $this->dispatch('success', 'Application settings updated!');
|
||||
}
|
||||
|
||||
public function submit()
|
||||
@@ -67,7 +72,7 @@ class ByIp extends Component
|
||||
if (is_null($this->private_key_id)) {
|
||||
return $this->dispatch('error', 'You must select a private key');
|
||||
}
|
||||
$server = Server::create([
|
||||
$payload = [
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'ip' => $this->ip,
|
||||
@@ -79,7 +84,11 @@ class ByIp extends Component
|
||||
"type" => ProxyTypes::TRAEFIK_V2->value,
|
||||
"status" => ProxyStatus::EXITED->value,
|
||||
],
|
||||
]);
|
||||
];
|
||||
if ($this->is_swarm_worker) {
|
||||
$payload['swarm_cluster'] = $this->selected_swarm_cluster;
|
||||
}
|
||||
$server = Server::create($payload);
|
||||
$server->settings->is_swarm_manager = $this->is_swarm_manager;
|
||||
$server->settings->is_swarm_worker = $this->is_swarm_worker;
|
||||
$server->settings->save();
|
||||
|
||||
Reference in New Issue
Block a user