diff --git a/app/Actions/Server/RemoveServer.php b/app/Actions/Server/DeleteServer.php similarity index 81% rename from app/Actions/Server/RemoveServer.php rename to app/Actions/Server/DeleteServer.php index 8e92a51ae..15c892e75 100644 --- a/app/Actions/Server/RemoveServer.php +++ b/app/Actions/Server/DeleteServer.php @@ -5,13 +5,13 @@ namespace App\Actions\Server; use App\Models\Server; use Lorisleiva\Actions\Concerns\AsAction; -class RemoveServer +class DeleteServer { use AsAction; public function handle(Server $server) { StopSentinel::run($server); - $server->delete(); + $server->forceDelete(); } } diff --git a/app/Actions/Server/StartSentinel.php b/app/Actions/Server/StartSentinel.php index 3fbe4b3a3..cca8138b9 100644 --- a/app/Actions/Server/StartSentinel.php +++ b/app/Actions/Server/StartSentinel.php @@ -34,9 +34,9 @@ class StartSentinel 'COLLECTOR_RETENTION_PERIOD_DAYS' => $metrics_history, ]; if (isDev()) { - data_set($environments, 'DEBUG', 'true'); + // data_set($environments, 'DEBUG', 'true'); $mount_dir = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/sentinel'; - $image = 'sentinel'; + // $image = 'sentinel'; } $docker_environments = '-e "' . implode('" -e "', array_map(fn($key, $value) => "$key=$value", array_keys($environments), $environments)) . '"'; diff --git a/app/Http/Controllers/Api/ServersController.php b/app/Http/Controllers/Api/ServersController.php index 6d47769a9..540069f85 100644 --- a/app/Http/Controllers/Api/ServersController.php +++ b/app/Http/Controllers/Api/ServersController.php @@ -2,7 +2,7 @@ namespace App\Http\Controllers\Api; -use App\Actions\Server\RemoveServer; +use App\Actions\Server\DeleteServer; use App\Actions\Server\ValidateServer; use App\Enums\ProxyStatus; use App\Enums\ProxyTypes; @@ -726,7 +726,8 @@ class ServersController extends Controller if ($server->definedResources()->count() > 0) { return response()->json(['message' => 'Server has resources, so you need to delete them before.'], 400); } - RemoveServer::dispatch($server); + $server->delete(); + DeleteServer::dispatch($server); return response()->json(['message' => 'Server deleted.']); } diff --git a/app/Livewire/Destination/Show.php b/app/Livewire/Destination/Show.php index 5650e82ba..37583a944 100644 --- a/app/Livewire/Destination/Show.php +++ b/app/Livewire/Destination/Show.php @@ -66,7 +66,7 @@ class Show extends Component return ! $alreadyAddedNetworks->contains('network', $network['Name']); }); if ($this->networks->count() === 0) { - $this->dispatch('success', 'No new networks found.'); + $this->dispatch('success', 'No new destinations found on this server.'); return; } diff --git a/app/Livewire/Server/Advanced.php b/app/Livewire/Server/Advanced.php new file mode 100644 index 000000000..0103ac5f6 --- /dev/null +++ b/app/Livewire/Server/Advanced.php @@ -0,0 +1,61 @@ + 'required|integer|min:1', + 'server.settings.dynamic_timeout' => 'required|integer|min:1', + 'server.settings.force_docker_cleanup' => 'required|boolean', + 'server.settings.docker_cleanup_frequency' => 'required_if:server.settings.force_docker_cleanup,true|string', + 'server.settings.docker_cleanup_threshold' => 'required_if:server.settings.force_docker_cleanup,false|integer|min:1|max:100', + 'server.settings.delete_unused_volumes' => 'boolean', + 'server.settings.delete_unused_networks' => 'boolean', + ]; + + protected $validationAttributes = [ + + 'server.settings.concurrent_builds' => 'Concurrent Builds', + 'server.settings.dynamic_timeout' => 'Dynamic Timeout', + 'server.settings.force_docker_cleanup' => 'Force Docker Cleanup', + 'server.settings.docker_cleanup_frequency' => 'Docker Cleanup Frequency', + 'server.settings.docker_cleanup_threshold' => 'Docker Cleanup Threshold', + 'server.settings.delete_unused_volumes' => 'Delete Unused Volumes', + 'server.settings.delete_unused_networks' => 'Delete Unused Networks', + ]; + public function instantSave() + { + try { + $this->validate(); + $this->server->settings->save(); + $this->dispatch('success', 'Server updated.'); + $this->dispatch('refreshServerShow'); + } catch (\Throwable $e) { + $this->server->settings->refresh(); + return handleError($e, $this); + } + } + public function submit() + { + try { + $frequency = $this->server->settings->docker_cleanup_frequency; + if (empty($frequency) || ! validate_cron_expression($frequency)) { + $this->server->settings->docker_cleanup_frequency = '*/10 * * * *'; + throw new \Exception('Invalid Cron / Human expression for Docker Cleanup Frequency. Resetting to default 10 minutes.'); + } + $this->server->settings->save(); + $this->dispatch('success', 'Server updated.'); + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + public function render() + { + return view('livewire.server.advanced'); + } +} diff --git a/app/Livewire/Server/CloudflareTunnels.php b/app/Livewire/Server/CloudflareTunnels.php new file mode 100644 index 000000000..5b0f43329 --- /dev/null +++ b/app/Livewire/Server/CloudflareTunnels.php @@ -0,0 +1,45 @@ + 'required|boolean', + ]; + + protected $validationAttributes = [ + 'server.settings.is_cloudflare_tunnel' => 'Cloudflare Tunnel', + ]; + + public function instantSave() + { + try { + $this->validate(); + $this->server->settings->save(); + $this->dispatch('success', 'Server updated.'); + $this->dispatch('refreshServerShow'); + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + + + public function manualCloudflareConfig() + { + $this->server->settings->is_cloudflare_tunnel = true; + $this->server->settings->save(); + $this->server->refresh(); + $this->dispatch('success', 'Cloudflare Tunnels enabled.'); + } + + public function render() + { + return view('livewire.server.cloudflare-tunnels'); + } +} diff --git a/app/Livewire/Server/Delete.php b/app/Livewire/Server/Delete.php index 2af56cb1c..0c1fa2745 100644 --- a/app/Livewire/Server/Delete.php +++ b/app/Livewire/Server/Delete.php @@ -2,7 +2,7 @@ namespace App\Livewire\Server; -use App\Actions\Server\RemoveServer; +use App\Actions\Server\DeleteServer; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; @@ -28,8 +28,8 @@ class Delete extends Component return; } - RemoveServer::run($this->server); - + $this->server->delete(); + DeleteServer::dispatch($this->server); return redirect()->route('server.index'); } catch (\Throwable $e) { return handleError($e, $this); diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.php index 40bff3873..109306e54 100644 --- a/app/Livewire/Server/Form.php +++ b/app/Livewire/Server/Form.php @@ -7,7 +7,6 @@ use App\Actions\Server\StopSentinel; use App\Jobs\DockerCleanupJob; use App\Jobs\PullSentinelImageJob; use App\Models\Server; -use Illuminate\Support\Facades\Http; use Livewire\Component; class Form extends Component @@ -47,27 +46,19 @@ class Form extends Component 'server.ip' => 'required', 'server.user' => 'required', 'server.port' => 'required', - 'server.settings.is_cloudflare_tunnel' => 'required|boolean', + 'wildcard_domain' => 'nullable|url', 'server.settings.is_reachable' => 'required', 'server.settings.is_swarm_manager' => 'required|boolean', 'server.settings.is_swarm_worker' => 'required|boolean', 'server.settings.is_build_server' => 'required|boolean', - 'server.settings.concurrent_builds' => 'required|integer|min:1', - 'server.settings.dynamic_timeout' => 'required|integer|min:1', 'server.settings.is_metrics_enabled' => 'required|boolean', 'server.settings.sentinel_token' => 'required', 'server.settings.sentinel_metrics_refresh_rate_seconds' => 'required|integer|min:1', 'server.settings.sentinel_metrics_history_days' => 'required|integer|min:1', 'server.settings.sentinel_push_interval_seconds' => 'required|integer|min:10', - 'wildcard_domain' => 'nullable|url', 'server.settings.sentinel_custom_url' => 'nullable|url', 'server.settings.is_sentinel_enabled' => 'required|boolean', 'server.settings.server_timezone' => 'required|string|timezone', - 'server.settings.force_docker_cleanup' => 'required|boolean', - 'server.settings.docker_cleanup_frequency' => 'required_if:server.settings.force_docker_cleanup,true|string', - 'server.settings.docker_cleanup_threshold' => 'required_if:server.settings.force_docker_cleanup,false|integer|min:1|max:100', - 'server.settings.delete_unused_volumes' => 'boolean', - 'server.settings.delete_unused_networks' => 'boolean', ]; protected $validationAttributes = [ @@ -76,23 +67,18 @@ class Form extends Component 'server.ip' => 'IP address/Domain', 'server.user' => 'User', 'server.port' => 'Port', - 'server.settings.is_cloudflare_tunnel' => 'Cloudflare Tunnel', 'server.settings.is_reachable' => 'Is reachable', 'server.settings.is_swarm_manager' => 'Swarm Manager', 'server.settings.is_swarm_worker' => 'Swarm Worker', 'server.settings.is_build_server' => 'Build Server', - 'server.settings.concurrent_builds' => 'Concurrent Builds', - 'server.settings.dynamic_timeout' => 'Dynamic Timeout', 'server.settings.is_metrics_enabled' => 'Metrics', 'server.settings.sentinel_token' => 'Metrics Token', 'server.settings.sentinel_metrics_refresh_rate_seconds' => 'Metrics Interval', 'server.settings.sentinel_metrics_history_days' => 'Metrics History', 'server.settings.sentinel_push_interval_seconds' => 'Push Interval', 'server.settings.is_sentinel_enabled' => 'Server API', - 'server.settings.sentinel_custom_url' => 'Sentinel URL', + 'server.settings.sentinel_custom_url' => 'Coolify URL', 'server.settings.server_timezone' => 'Server Timezone', - 'server.settings.delete_unused_volumes' => 'Delete Unused Volumes', - 'server.settings.delete_unused_networks' => 'Delete Unused Networks', ]; public function mount(Server $server) @@ -100,13 +86,10 @@ class Form extends Component $this->server = $server; $this->timezones = collect(timezone_identifiers_list())->sort()->values()->toArray(); $this->wildcard_domain = $this->server->settings->wildcard_domain; - $this->server->settings->docker_cleanup_threshold = $this->server->settings->docker_cleanup_threshold; - $this->server->settings->docker_cleanup_frequency = $this->server->settings->docker_cleanup_frequency; - $this->server->settings->delete_unused_volumes = $server->settings->delete_unused_volumes; - $this->server->settings->delete_unused_networks = $server->settings->delete_unused_networks; } - public function checkSyncStatus(){ + public function checkSyncStatus() + { $this->server->refresh(); $this->server->settings->refresh(); } @@ -114,9 +97,10 @@ class Form extends Component public function regenerateSentinelToken() { try { - $this->server->generateSentinelToken(); + $this->server->settings->generateSentinelToken(); $this->server->settings->refresh(); - $this->dispatch('success', 'Sentinel token regenerated. Please restart your Sentinel.'); + $this->restartSentinel(notification: false); + $this->dispatch('success', 'Token regenerated & Sentinel restarted.'); } catch (\Throwable $e) { return handleError($e, $this); } @@ -152,25 +136,35 @@ class Form extends Component $this->dispatch('proxyStatusUpdated'); } - public function updatedServerSettingsIsSentinelEnabled($value){ - if($value === false){ + public function updatedServerSettingsIsSentinelEnabled($value) + { + $this->validate(); + $this->validate([ + 'server.settings.sentinel_custom_url' => 'required|url', + ]); + if ($value === false) { StopSentinel::dispatch($this->server); $this->server->settings->is_metrics_enabled = false; $this->server->settings->save(); $this->server->sentinelHeartbeat(isReset: true); } else { - StartSentinel::run($this->server); + try { + StartSentinel::run($this->server); + } catch (\Throwable $e) { + return handleError($e, $this); + } } } - public function updatedServerSettingsIsMetricsEnabled(){ + public function updatedServerSettingsIsMetricsEnabled() + { $this->restartSentinel(); } - public function instantSave() { try { + $this->validate(); refresh_server_connection($this->server->privateKey); $this->validateServer(false); @@ -179,6 +173,14 @@ class Form extends Component $this->dispatch('success', 'Server updated.'); $this->dispatch('refreshServerShow'); + // if ($this->server->isSentinelEnabled()) { + // StartSentinel::run($this->server); + // } else { + // StopSentinel::run($this->server); + // $this->server->settings->is_metrics_enabled = false; + // $this->server->settings->save(); + // $this->server->sentinelHeartbeat(isReset: true); + // } // if ($this->server->isSentinelEnabled()) { // PullSentinelImageJob::dispatchSync($this->server); // ray('Sentinel is enabled'); @@ -196,16 +198,24 @@ class Form extends Component // $this->checkPortForServerApi(); } catch (\Throwable $e) { + $this->server->settings->refresh(); + return handleError($e, $this); } } - public function restartSentinel() + public function restartSentinel($notification = true) { try { + $this->validate(); + $this->validate([ + 'server.settings.sentinel_custom_url' => 'required|url', + ]); $version = get_latest_sentinel_version(); StartSentinel::run($this->server, $version, true); - $this->dispatch('success', 'Sentinel started.'); + if ($notification) { + $this->dispatch('success', 'Sentinel started.'); + } } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Server/Proxy/Modal.php b/app/Livewire/Server/Proxy/Modal.php deleted file mode 100644 index 5679944d0..000000000 --- a/app/Livewire/Server/Proxy/Modal.php +++ /dev/null @@ -1,16 +0,0 @@ -dispatch('proxyStatusUpdated'); - } -} diff --git a/app/Livewire/Server/Resources.php b/app/Livewire/Server/Resources.php index 800344ac3..f549b43cb 100644 --- a/app/Livewire/Server/Resources.php +++ b/app/Livewire/Server/Resources.php @@ -15,7 +15,9 @@ class Resources extends Component public $parameters = []; - public Collection $unmanagedContainers; + public Collection $containers; + + public $activeTab = 'managed'; public function getListeners() { @@ -50,14 +52,29 @@ class Resources extends Component public function refreshStatus() { $this->server->refresh(); - $this->loadUnmanagedContainers(); + if ($this->activeTab === 'managed') { + $this->loadManagedContainers(); + } else { + $this->loadUnmanagedContainers(); + } $this->dispatch('success', 'Resource statuses refreshed.'); } + public function loadManagedContainers() + { + try { + $this->activeTab = 'managed'; + $this->containers = $this->server->refresh()->definedResources(); + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + public function loadUnmanagedContainers() { + $this->activeTab = 'unmanaged'; try { - $this->unmanagedContainers = $this->server->loadUnmanagedContainers(); + $this->containers = $this->server->loadUnmanagedContainers(); } catch (\Throwable $e) { return handleError($e, $this); } @@ -65,13 +82,14 @@ class Resources extends Component public function mount() { - $this->unmanagedContainers = collect(); + $this->containers = collect(); $this->parameters = get_route_parameters(); try { $this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first(); if (is_null($this->server)) { return redirect()->route('server.index'); } + $this->loadManagedContainers(); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Server/ShowPrivateKey.php b/app/Livewire/Server/ShowPrivateKey.php index 92869c44b..1be22882d 100644 --- a/app/Livewire/Server/ShowPrivateKey.php +++ b/app/Livewire/Server/ShowPrivateKey.php @@ -2,7 +2,6 @@ namespace App\Livewire\Server; -use App\Models\PrivateKey; use App\Models\Server; use Livewire\Component; @@ -14,15 +13,29 @@ class ShowPrivateKey extends Component public $parameters; + public function mount() + { + $this->parameters = get_route_parameters(); + } + public function setPrivateKey($privateKeyId) { + $originalPrivateKeyId = $this->server->getOriginal('private_key_id'); try { - $privateKey = PrivateKey::findOrFail($privateKeyId); - $this->server->update(['private_key_id' => $privateKey->id]); - $this->server->refresh(); - $this->dispatch('success', 'Private key updated successfully.'); + $this->server->update(['private_key_id' => $privateKeyId]); + ['uptime' => $uptime, 'error' => $error] = $this->server->validateConnection(); + if ($uptime) { + $this->dispatch('success', 'Private key updated successfully.'); + } else { + throw new \Exception('Server is not reachable.

Check this documentation for further help.

Error: '.$error); + } } catch (\Exception $e) { + $this->server->update(['private_key_id' => $originalPrivateKeyId]); + $this->server->validateConnection(); $this->dispatch('error', 'Failed to update private key: '.$e->getMessage()); + } finally { + $this->dispatch('refreshServerShow'); + $this->server->refresh(); } } @@ -33,18 +46,16 @@ class ShowPrivateKey extends Component if ($uptime) { $this->dispatch('success', 'Server is reachable.'); } else { - ray($error); $this->dispatch('error', 'Server is not reachable.

Check this documentation for further help.

Error: '.$error); - return; } } catch (\Throwable $e) { return handleError($e, $this); + } finally { + $this->dispatch('refreshServerShow'); + $this->server->refresh(); } } - public function mount() - { - $this->parameters = get_route_parameters(); - } + } diff --git a/app/Models/Server.php b/app/Models/Server.php index cb5aa4524..2468fc2b4 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -7,6 +7,7 @@ use App\Enums\ProxyTypes; use App\Jobs\PullSentinelImageJob; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; +use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; @@ -17,7 +18,6 @@ use OpenApi\Attributes as OA; use Spatie\SchemalessAttributes\Casts\SchemalessAttributes; use Spatie\SchemalessAttributes\SchemalessAttributesTrait; use Spatie\Url\Url; -use Illuminate\Support\Str; use Symfony\Component\Yaml\Yaml; #[OA\Schema( @@ -45,7 +45,7 @@ use Symfony\Component\Yaml\Yaml; class Server extends BaseModel { - use SchemalessAttributesTrait; + use SchemalessAttributesTrait,SoftDeletes; public static $batch_counter = 0; @@ -97,7 +97,8 @@ class Server extends BaseModel } } }); - static::deleting(function ($server) { + + static::forceDeleting(function ($server) { $server->destinations()->each(function ($destination) { $destination->delete(); }); @@ -527,34 +528,6 @@ $schema://$host { Storage::disk('ssh-mux')->delete($this->muxFilename()); } - public function generateSentinelUrl() { - if ($this->isLocalhost()) { - return 'http://host.docker.internal:8000'; - } - $settings = InstanceSettings::get(); - if ($settings->fqdn) { - return $settings->fqdn; - } - if ($settings->ipv4) { - return $settings->ipv4 . ':8000'; - } - if ($settings->ipv6) { - return $settings->ipv6 . ':8000'; - } - return null; - } - public function generateSentinelToken() - { - $data = [ - 'server_uuid' => $this->uuid, - ]; - $token = json_encode($data); - $encrypted = encrypt($token); - $this->settings->sentinel_token = $encrypted; - $this->settings->save(); - - return $encrypted; - } public function sentinelHeartbeat(bool $isReset = false) { @@ -568,7 +541,7 @@ $schema://$host { public function isSentinelEnabled() { - return $this->isMetricsEnabled() || $this->isServerApiEnabled() || !$this->isBuildServer(); + return ($this->isMetricsEnabled() || $this->isServerApiEnabled()) && !$this->isBuildServer(); } public function isMetricsEnabled() diff --git a/app/Models/ServerSetting.php b/app/Models/ServerSetting.php index 2b9ce0cd0..8ef1420e0 100644 --- a/app/Models/ServerSetting.php +++ b/app/Models/ServerSetting.php @@ -59,10 +59,59 @@ class ServerSetting extends Model protected static function booted() { static::creating(function ($setting) { - $setting->is_sentinel_enabled = true; + try { + if (str($setting->sentinel_token)->isEmpty()) { + $setting->generateSentinelToken(save: false); + } + if (str($setting->sentinel_custom_url)->isEmpty()) { + $url = $setting->generateSentinelUrl(save: false); + if (str($url)->isEmpty()) { + $setting->is_sentinel_enabled = false; + } else { + $setting->is_sentinel_enabled = true; + } + } + } catch (\Throwable $e) { + loggy('Error creating server setting: ' . $e->getMessage()); + } }); } + public function generateSentinelToken(bool $save = true) + { + $data = [ + 'server_uuid' => $this->server->uuid, + ]; + $token = json_encode($data); + $encrypted = encrypt($token); + $this->sentinel_token = $encrypted; + if ($save) { + $this->save(); + } + + return $encrypted; + } + + public function generateSentinelUrl(bool $save = true) + { + $domain = null; + $settings = InstanceSettings::get(); + if ($this->server->isLocalhost()) { + $domain = 'http://host.docker.internal:8000'; + } else if ($settings->fqdn) { + $domain = $settings->fqdn; + } else if ($settings->ipv4) { + $domain = $settings->ipv4 . ':8000'; + } else if ($settings->ipv6) { + $domain = $settings->ipv6 . ':8000'; + } + $this->sentinel_custom_url = $domain; + if ($save) { + $this->save(); + } + return $domain; + } + public function server() { return $this->belongsTo(Server::class); diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index b619d1dd1..14f44ed47 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -126,7 +126,7 @@ function refreshSession(?Team $team = null): void } function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null) { - ray($error); + loggy($error); if ($error instanceof TooManyRequestsException) { if (isset($livewire)) { return $livewire->dispatch('error', "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds."); diff --git a/database/migrations/2024_10_17_093722_add_soft_delete_to_servers.php b/database/migrations/2024_10_17_093722_add_soft_delete_to_servers.php new file mode 100644 index 000000000..7a7f28e24 --- /dev/null +++ b/database/migrations/2024_10_17_093722_add_soft_delete_to_servers.php @@ -0,0 +1,28 @@ +softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('servers', function (Blueprint $table) { + $table->dropSoftDeletes(); + }); + } +}; diff --git a/database/seeders/SentinelSeeder.php b/database/seeders/SentinelSeeder.php index 2d29c1a8d..117ba6782 100644 --- a/database/seeders/SentinelSeeder.php +++ b/database/seeders/SentinelSeeder.php @@ -9,22 +9,23 @@ class SentinelSeeder extends Seeder { public function run() { - try { - Server::chunk(100, function ($servers) { - foreach ($servers as $server) { + Server::chunk(100, function ($servers) { + foreach ($servers as $server) { + try { if (str($server->settings->sentinel_token)->isEmpty()) { - $server->generateSentinelToken(); + $server->settings->generateSentinelToken(); } if (str($server->settings->sentinel_custom_url)->isEmpty()) { - $url = $server->generateSentinelUrl(); - $server->settings->sentinel_custom_url = $url; - $server->settings->save(); + $url = $server->settings->generateSentinelUrl(); + if (str($url)->isEmpty()) { + $server->settings->is_sentinel_enabled = false; + $server->settings->save(); + } } + } catch (\Throwable $e) { + loggy("Error: {$e->getMessage()}\n"); } - }); - } catch (\Throwable $e) { - echo "Error: {$e->getMessage()}\n"; - ray($e->getMessage()); - } + } + }); } } diff --git a/resources/views/components/server/navbar.blade.php b/resources/views/components/server/navbar.blade.php index 18f923289..162514278 100644 --- a/resources/views/components/server/navbar.blade.php +++ b/resources/views/components/server/navbar.blade.php @@ -1,5 +1,14 @@
- + + + + + + + Close + + +

Server

@if ($server->proxySet()) @@ -13,20 +22,9 @@ href="{{ route('server.show', [ 'server_uuid' => data_get($parameters, 'server_uuid'), ]) }}"> - - - - - - - + + @if (!$server->isSwarmWorker() && !$server->settings->is_build_server) - - - - - - @endif
diff --git a/resources/views/livewire/destination/show.blade.php b/resources/views/livewire/destination/show.blade.php index ecc68dc5c..be36899b6 100644 --- a/resources/views/livewire/destination/show.blade.php +++ b/resources/views/livewire/destination/show.blade.php @@ -5,10 +5,10 @@ - Scan Destinations + Scan for Destinations
-
Destinations are used to segregate resources by network.
-
+
Destinations are used to segregate resources by network.
+
Available for using: @forelse ($server->standaloneDockers as $docker) diff --git a/resources/views/livewire/server/advanced.blade.php b/resources/views/livewire/server/advanced.blade.php new file mode 100644 index 000000000..b1d21402a --- /dev/null +++ b/resources/views/livewire/server/advanced.blade.php @@ -0,0 +1,84 @@ +
+
+
+

Advanced

+ Save + +
+
Advanced configuration for your server.
+
+
+
+
+

Docker Cleanup

+ +
+
+ @if ($server->settings->force_docker_cleanup) + + @else + + @endif +
+ +
+ +
+

+ Warning: Enable these + options only if you fully understand their implications and + consequences!
Improper use will result in data loss and could cause + functional issues. +

+
+ + +
+
+
+

Builds

+
Customize the build process.
+
+ + +
+
+
+
diff --git a/resources/views/livewire/server/cloudflare-tunnels.blade.php b/resources/views/livewire/server/cloudflare-tunnels.blade.php new file mode 100644 index 000000000..acca66d60 --- /dev/null +++ b/resources/views/livewire/server/cloudflare-tunnels.blade.php @@ -0,0 +1,42 @@ +
diff --git a/resources/views/livewire/server/delete.blade.php b/resources/views/livewire/server/delete.blade.php index 360e1e0c6..917000273 100644 --- a/resources/views/livewire/server/delete.blade.php +++ b/resources/views/livewire/server/delete.blade.php @@ -1,6 +1,6 @@
@if ($server->id !== 0) -

Danger Zone

+

Danger Zone

Woah. I hope you know what are you doing.

Delete Server

This will remove this server from Coolify. Beware! There is no coming diff --git a/resources/views/livewire/server/destination/show.blade.php b/resources/views/livewire/server/destination/show.blade.php index 1a1bbeb1b..fb9ab4fbb 100644 --- a/resources/views/livewire/server/destination/show.blade.php +++ b/resources/views/livewire/server/destination/show.blade.php @@ -2,6 +2,6 @@ {{ data_get_str($server, 'name')->limit(10) }} > Server Destinations | Coolify - + {{-- --}}
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php index 43d982b6c..f75b9762f 100644 --- a/resources/views/livewire/server/form.blade.php +++ b/resources/views/livewire/server/form.blade.php @@ -119,197 +119,82 @@
-
+
@if (!$server->isLocalhost()) - -
-
-

Cloudflare Tunnels

- -
- @if ($server->settings->is_cloudflare_tunnel) -
- -
- @elseif (!$server->isFunctional()) -
- To automatically configure Cloudflare Tunnels, please - validate your server first. Then you will need a Cloudflare token and an SSH - domain configured. -
- To manually configure Cloudflare Tunnels, please - click here, then you should validate the server. -

- For more information, please read our documentation. -
- @endif - @if (!$server->settings->is_cloudflare_tunnel && $server->isFunctional()) - - - - @endif - @if ($server->isFunctional() && !$server->settings->is_cloudflare_tunnel) -
- I have configured Cloudflare Tunnels manually -
- @endif - +
+
+ @if (!$server->isBuildServer() && !$server->settings->is_cloudflare_tunnel)

Swarm (experimental)

Read the docs here.
- @if ($server->settings->is_swarm_worker) - - @else - - @endif +
+ @if ($server->settings->is_swarm_worker) + + @else + + @endif - @if ($server->settings->is_swarm_manager) - - @else - - @endif + @if ($server->settings->is_swarm_manager) + + @else + + @endif +
@endif @endif
- - @if ($server->isFunctional()) -

Settings

-
-
-
-
- -
- -
- @if ($server->settings->force_docker_cleanup) - - @else - - @endif -
- -
-

Warning: Enable these - options only if you fully understand their implications and - consequences!
Improper use will result in data loss and could cause - functional issues.

- - -
-
-
- -
- - -
-
- @if (isDev()) -
-

Sentinel

- @if ($server->isSentinelEnabled()) -
settings->sentinel_push_interval_seconds }}s="checkSyncStatus"> - @if ($server->isSentinelLive()) - - @else - - @endif + @if (isDev()) +
+

Sentinel

+ @if ($server->isSentinelEnabled()) +
settings->sentinel_push_interval_seconds }}s="checkSyncStatus"> + @if ($server->isSentinelLive()) + Restart -
- @endif -
-
-
- - @if ($server->isSentinelEnabled()) - @else - + + Sync @endif
+ @endif +
+
+
+ + @if ($server->isSentinelEnabled()) + + @else + + @endif +
+ @if ($server->isSentinelEnabled())
- - Regenerate
+ + +
-
- @endif + @endif +
@endif +
diff --git a/resources/views/livewire/server/log-drains.blade.php b/resources/views/livewire/server/log-drains.blade.php index 1c19e3662..ac905e8bb 100644 --- a/resources/views/livewire/server/log-drains.blade.php +++ b/resources/views/livewire/server/log-drains.blade.php @@ -2,7 +2,7 @@ {{ data_get_str($server, 'name')->limit(10) }} > Server LogDrains | Coolify - + {{-- --}} @if ($server->isFunctional())

Log Drains

Sends service logs to 3rd party tools.
diff --git a/resources/views/livewire/server/private-key/show.blade.php b/resources/views/livewire/server/private-key/show.blade.php index 3cf190bca..014de2e7c 100644 --- a/resources/views/livewire/server/private-key/show.blade.php +++ b/resources/views/livewire/server/private-key/show.blade.php @@ -2,6 +2,5 @@ Server Connection | Coolify -
diff --git a/resources/views/livewire/server/proxy/modal.blade.php b/resources/views/livewire/server/proxy/modal.blade.php deleted file mode 100644 index 3dfb2d31c..000000000 --- a/resources/views/livewire/server/proxy/modal.blade.php +++ /dev/null @@ -1,12 +0,0 @@ -
- - - - - - - Close - - - -
diff --git a/resources/views/livewire/server/resources.blade.php b/resources/views/livewire/server/resources.blade.php index 1e361728c..609995f8e 100644 --- a/resources/views/livewire/server/resources.blade.php +++ b/resources/views/livewire/server/resources.blade.php @@ -2,24 +2,30 @@ {{ data_get_str($server, 'name')->limit(10) }} > Server Resources | Coolify - -
- + {{-- --}} +
-
-
-
-

Resources

- Refresh -
-
Here you can find all resources that are managed by Coolify.
+
+
+

Resources

+ Refresh
- @if ($server->definedResources()->count() > 0) +
Here you can find all resources that are managed by Coolify.
+
+
$activeTab === 'managed', + ]) wire:click="loadManagedContainers"> + Managed
+
$activeTab === 'unmanaged', + ]) wire:click="loadUnmanagedContainers"> + Unmanaged
+
+
+ @if ($containers->count() > 0) + @if ($activeTab === 'managed')
@@ -78,19 +84,7 @@
- @else -
No resources found.
- @endif -
-
-
-
-

Resources

- Refresh -
-
Here you can find all other containers running on the server.
-
- @if ($unmanagedContainers->count() > 0) + @elseif ($activeTab === 'unmanaged')
@@ -114,7 +108,7 @@ - @forelse ($unmanagedContainers->sortBy('name',SORT_NATURAL) as $resource) + @forelse ($containers->sortBy('name',SORT_NATURAL) as $resource) {{ data_get($resource, 'Names') }} @@ -152,11 +146,14 @@
-
- @else -
No resources found.
@endif -
+ @else + @if ($activeTab === 'managed') +
No managed resources found.
+ @elseif ($activeTab === 'unmanaged') +
No unmanaged resources found.
+ @endif + @endif
diff --git a/resources/views/livewire/server/show-private-key.blade.php b/resources/views/livewire/server/show-private-key.blade.php index 86bf2568e..f84086bff 100644 --- a/resources/views/livewire/server/show-private-key.blade.php +++ b/resources/views/livewire/server/show-private-key.blade.php @@ -1,5 +1,5 @@
-
+

Private Key

@@ -9,29 +9,25 @@
-
- @if (data_get($server, 'privateKey.uuid')) -
- Currently attached Private Key: - - - -
- @else -
No private key attached.
- @endif - +
+
Change your server's private key.
-

Choose another Key

-
+
@forelse ($privateKeys as $private_key) -
+
{{ $private_key->name }}
{{ $private_key->description }}
+ @if (data_get($server, 'privateKey.uuid') !== $private_key->uuid) + + Use this key + + @else + + Currently used + + @endif
@empty
No private keys found.
diff --git a/resources/views/livewire/server/show.blade.php b/resources/views/livewire/server/show.blade.php index 4a2729d3c..458d8cd2f 100644 --- a/resources/views/livewire/server/show.blade.php +++ b/resources/views/livewire/server/show.blade.php @@ -3,11 +3,75 @@ {{ data_get_str($server, 'name')->limit(10) }} > Server Configurations | Coolify - - @if ($server->isFunctional() && $server->isMetricsEnabled()) -
- +
+
+ General + @if ($server->isFunctional()) + Advanced + + @endif + Private + Key + @if ($server->isFunctional()) + Cloudflare Tunnels + Resources + Destinations + Log + Drains + Metrics + @endif + @if (!$server->isLocalhost()) + Danger + @endif
- @endif - +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ @if ($server->isFunctional() && $server->isMetricsEnabled()) +
+ +
+ @else + No metrics available. + @endif +
+ @if (!$server->isLocalhost()) +
+ +
+ @endif +
+