fix: improve build server functionalities

This commit is contained in:
Andras Bacsai 2024-05-24 12:01:04 +02:00
parent a01e604443
commit 5c72541044
6 changed files with 56 additions and 42 deletions

View File

@ -22,7 +22,6 @@ class CheckProxy
}
$proxyType = $server->proxyType();
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) {
ray('Not starting proxy');
return false;
}
['uptime' => $uptime, 'error' => $error] = $server->validateConnection();

View File

@ -15,7 +15,7 @@ class StartProxy
{
try {
$proxyType = $server->proxyType();
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) {
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop || $server->isBuildServer()) {
return 'OK';
}
$commands = collect([]);

View File

@ -58,6 +58,12 @@ class Form extends Component
$this->server->refresh();
$this->server->settings->refresh();
}
public function updatedServerSettingsIsBuildServer()
{
$this->dispatch('serverInstalled');
$this->dispatch('serverRefresh');
$this->dispatch('proxyStatusUpdated');
}
public function instantSave()
{
try {

View File

@ -129,6 +129,9 @@ class ValidateAndInstall extends Component
}
}
if ($this->server->isBuildServer()) {
return;
}
$this->dispatch('startProxy');
}
public function render()

View File

@ -72,7 +72,7 @@
<div class="w-64">
@if ($server->isFunctional())
@if (!$server->isLocalhost())
<x-forms.checkbox instantSave disabled id="server.settings.is_build_server"
<x-forms.checkbox instantSave id="server.settings.is_build_server"
label="Use it as a build server?" />
<div class="flex items-center gap-1 pt-6">
<h3 class="">Cloudflare Tunnels
@ -87,12 +87,14 @@
<livewire:server.configure-cloudflare-tunnels :server_id="$server->id" />
</x-modal-input>
@endif
@if (!$server->isBuildServer())
<h3 class="pt-6">Swarm <span class="text-xs text-neutral-500">(experimental)</span></h3>
<div class="pb-4">Read the docs <a class='underline dark:text-white'
href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>.
</div>
@if ($server->settings->is_swarm_worker)
<x-forms.checkbox disabled instantSave type="checkbox" id="server.settings.is_swarm_manager"
<x-forms.checkbox disabled instantSave type="checkbox"
id="server.settings.is_swarm_manager"
helper="For more information, please read the documentation <a class='dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>."
label="Is it a Swarm Manager?" />
@else
@ -102,7 +104,8 @@
@endif
@if ($server->settings->is_swarm_manager)
<x-forms.checkbox disabled instantSave type="checkbox" id="server.settings.is_swarm_worker"
<x-forms.checkbox disabled instantSave type="checkbox"
id="server.settings.is_swarm_worker"
helper="For more information, please read the documentation <a class='dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>."
label="Is it a Swarm Worker?" />
@else
@ -111,6 +114,7 @@
label="Is it a Swarm Worker?" />
@endif
@endif
@endif
@else
<div class="flex items-center gap-1 pt-6">
<h3 class="">Cloudflare Tunnels
@ -132,7 +136,7 @@
@if ($server->isFunctional())
<h3 class="py-4">Settings</h3>
<div class="flex gap-2 flex-wrap sm:flex-nowrap">
<div class="flex flex-wrap gap-2 sm:flex-nowrap">
<x-forms.input id="cleanup_after_percentage" label="Disk cleanup threshold (%)" required
helper="The disk cleanup task will run when the disk usage exceeds this threshold." />
<x-forms.input id="server.settings.concurrent_builds" label="Number of concurrent builds" required

View File

@ -99,9 +99,10 @@
@else
<div class="w-64"><x-loading text="Minimum Docker version:" /></div>
@endisset
@if (!$server->isBuildServer())
@if ($proxy_started)
<div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-success" viewBox="0 0 256 256"
xmlns="http://www.w3.org/2000/svg">
<div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-success"
viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<g fill="currentColor">
<path
d="m237.66 85.26l-128.4 128.4a8 8 0 0 1-11.32 0l-71.6-72a8 8 0 0 1 0-11.31l24-24a8 8 0 0 1 11.32 0l36.68 35.32a8 8 0 0 0 11.32 0l92.68-91.32a8 8 0 0 1 11.32 0l24 23.6a8 8 0 0 1 0 11.31"
@ -121,6 +122,7 @@
<div class="w-64"><x-loading text="Proxy started:" /></div>
@endif
@endif
@endif
@else
@if ($error)
<div class="flex w-64 gap-2">Docker Compose is installed: <svg class="w-5 h-5 text-error"