An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
save
Andras Bacsai0f28acac008c
diff --git a/app/Actions/Proxy/CheckProxySettingsInSync.php b/app/Actions/Proxy/CheckProxySettingsInSync.phpindex 88c01d624f..874dd830ea 100644--- a/app/Actions/Proxy/CheckProxySettingsInSync.php+++ b/app/Actions/Proxy/CheckProxySettingsInSync.php@@ -20,7 +20,7 @@ class CheckProxySettingsInSync$final_output = Str::of($output)->trim()->value;}$docker_compose_yml_base64 = base64_encode($final_output);- $server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;+ $server->extra_attributes->proxy_last_saved_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;$server->save();if (is_null($output) || $reset) {instant_remote_process([diff --git a/app/Actions/Proxy/InstallProxy.php b/app/Actions/Proxy/InstallProxy.phpindex 8e447ae075..d0a1a83563 100644--- a/app/Actions/Proxy/InstallProxy.php+++ b/app/Actions/Proxy/InstallProxy.php@@ -31,41 +31,24 @@ class InstallProxy$configuration = Str::of($configuration)->trim()->value;}$docker_compose_yml_base64 = base64_encode($configuration);- $server->extra_attributes->last_applied_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;+ $server->extra_attributes->proxy_last_applied_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;$server->save();-- // $env_file_base64 = base64_encode(- // $this->getEnvContents()- // );$activity = remote_process([+ "echo 'Creating required Docker networks...'",...$create_networks_command,- "echo 'Docker networks created...'","mkdir -p $proxy_path","cd $proxy_path","echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml",- // "echo '$env_file_base64' | base64 -d > $proxy_path/.env",- "echo 'Docker compose file created...'",+ "echo 'Creating Docker Compose file...'","echo 'Pulling docker image...'",'docker compose pull -q',- "echo 'Stopping proxy...'",+ "echo 'Stopping old proxy...'",'docker compose down -v --remove-orphans',- "echo 'Starting proxy...'",+ "echo 'Starting new proxy...'",'docker compose up -d --remove-orphans',"echo 'Proxy installed successfully...'"], $server);return $activity;}-- // protected function getEnvContents()- // {- // $data = [- // 'LETS_ENCRYPT_EMAIL' => '',- // ];-- // return collect($data)- // ->map(fn ($v, $k) => "{$k}={$v}")- // ->push(PHP_EOL)- // ->implode(PHP_EOL);- // }}diff --git a/app/Http/Livewire/ActivityMonitor.php b/app/Http/Livewire/ActivityMonitor.phpindex 47cd31c361..4352b9dc94 100644--- a/app/Http/Livewire/ActivityMonitor.php+++ b/app/Http/Livewire/ActivityMonitor.php@@ -8,6 +8,7 @@ use Spatie\Activitylog\Models\Activity;class ActivityMonitor extends Component{+ public bool $header = false;public $activityId;public $isPollingActive = false;@@ -50,8 +51,4 @@ class ActivityMonitor extends Component]);$this->activity->save();}- public function render()- {- return view('livewire.activity-monitor');- }}diff --git a/app/Http/Livewire/Project/Application/Previews.php b/app/Http/Livewire/Project/Application/Previews.phpindex 5bbc876907..9e924c0c19 100644--- a/app/Http/Livewire/Project/Application/Previews.php+++ b/app/Http/Livewire/Project/Application/Previews.php@@ -2,7 +2,7 @@namespace App\Http\Livewire\Project\Application;-use App\Jobs\ContainerStatusJob;+use App\Jobs\ApplicationContainerStatusJob;use App\Models\Application;use App\Models\ApplicationPreview;use Illuminate\Support\Collection;@@ -24,7 +24,7 @@ class Previews extends Component}public function loadStatus($pull_request_id){- dispatch(new ContainerStatusJob(+ dispatch(new ApplicationContainerStatusJob(application: $this->application,container_name: generate_container_name($this->application->uuid, $pull_request_id),pull_request_id: $pull_request_iddiff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.phpindex 83d7567f50..21fc9b281a 100644--- a/app/Http/Livewire/Server/Form.php+++ b/app/Http/Livewire/Server/Form.php@@ -30,7 +30,6 @@ class Form extends Componentpublic function installDocker(){$activity = resolve(InstallDocker::class)($this->server);-$this->emit('newMonitorActivity', $activity->id);}public function validateServer()diff --git a/app/Http/Livewire/Server/Proxy.php b/app/Http/Livewire/Server/Proxy.phpindex 8c637e1fe7..59eb816356 100644--- a/app/Http/Livewire/Server/Proxy.php+++ b/app/Http/Livewire/Server/Proxy.php@@ -11,25 +11,21 @@ use Livewire\Component;class Proxy extends Component{- protected $listeners = ['serverValidated'];public Server $server;public ProxyTypes $selectedProxy = ProxyTypes::TRAEFIK_V2;public $proxy_settings = null;- public function mount()- {- $this->proxyStatus();- }+ protected $listeners = ['serverValidated', 'saveConfiguration'];public function serverValidated(){- $this->server->settings->refresh();+ $this->server->refresh();}public function installProxy(){if (- $this->server->extra_attributes->last_applied_proxy_settings &&- $this->server->extra_attributes->last_saved_proxy_settings !== $this->server->extra_attributes->last_applied_proxy_settings+ $this->server->extra_attributes->proxy_last_applied_settings &&+ $this->server->extra_attributes->proxy_last_saved_settings !== $this->server->extra_attributes->proxy_last_applied_settings) {$this->saveConfiguration($this->server);}@@ -37,15 +33,9 @@ class Proxy extends Component$this->emit('newMonitorActivity', $activity->id);}- public function proxyStatus()- {- $this->server->extra_attributes->proxy_status = get_container_status(server: $this->server, container_id: 'coolify-proxy');- $this->server->save();- $this->server->refresh();- }- public function setProxy()+ public function setProxy(string $proxy_type){- $this->server->extra_attributes->proxy_type = $this->selectedProxy->value;+ $this->server->extra_attributes->proxy_type = $proxy_type;$this->server->extra_attributes->proxy_status = 'exited';$this->server->save();}@@ -57,17 +47,17 @@ class Proxy extends Component$this->server->extra_attributes->proxy_status = 'exited';$this->server->save();}- public function saveConfiguration()+ public function saveConfiguration(Server $server){try {$proxy_path = config('coolify.proxy_config_path');$this->proxy_settings = Str::of($this->proxy_settings)->trim()->value;$docker_compose_yml_base64 = base64_encode($this->proxy_settings);- $this->server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;- $this->server->save();+ $server->extra_attributes->proxy_last_saved_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;+ $server->save();instant_remote_process(["echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml",- ], $this->server);+ ], $server);} catch (\Exception $e) {return general_error_handler($e);}diff --git a/app/Http/Livewire/Server/Proxy/Deploy.php b/app/Http/Livewire/Server/Proxy/Deploy.phpnew file mode 100644index 0000000000..58f5e58518--- /dev/null+++ b/app/Http/Livewire/Server/Proxy/Deploy.php@@ -0,0 +1,43 @@+<?php++namespace App\Http\Livewire\Server\Proxy;++use App\Actions\Proxy\InstallProxy;+use App\Models\Server;+use Livewire\Component;+use Str;++class Deploy extends Component+{+ public Server $server;+ public $proxy_settings = null;+ protected $listeners = ['proxyStatusUpdated', 'serverValidated' => 'proxyStatusUpdated'];+ public function proxyStatusUpdated()+ {+ $this->server->refresh();+ }+ public function deploy()+ {+ if (+ $this->server->extra_attributes->proxy_last_applied_settings &&+ $this->server->extra_attributes->proxy_last_saved_settings !== $this->server->extra_attributes->proxy_last_applied_settings+ ) {+ $this->saveConfiguration($this->server);+ }+ $activity = resolve(InstallProxy::class)($this->server);+ $this->emit('newMonitorActivity', $activity->id);+ }+ public function stop()+ {+ instant_remote_process([+ "docker rm -f coolify-proxy",+ ], $this->server);+ $this->server->extra_attributes->proxy_status = 'exited';+ $this->server->save();+ $this->emit('proxyStatusUpdated');+ }+ private function saveConfiguration(Server $server)+ {+ $this->emit('saveConfiguration', $server);+ }+}diff --git a/app/Http/Livewire/Server/Proxy/Status.php b/app/Http/Livewire/Server/Proxy/Status.phpnew file mode 100644index 0000000000..513e90b9b7--- /dev/null+++ b/app/Http/Livewire/Server/Proxy/Status.php@@ -0,0 +1,29 @@+<?php++namespace App\Http\Livewire\Server\Proxy;++use App\Jobs\ProxyContainerStatusJob;+use App\Models\Server;+use Livewire\Component;++class Status extends Component+{+ public Server $server;+ protected $listeners = ['proxyStatusUpdated', 'serverValidated' => 'proxyStatusUpdated'];+ public function proxyStatusUpdated()+ {+ ray('Status: ' . $this->server->extra_attributes->proxy_status);+ $this->server->refresh();+ }+ public function proxyStatus()+ {+ try {+ dispatch(new ProxyContainerStatusJob(+ server: $this->server+ ));+ $this->emit('proxyStatusUpdated');+ } catch (\Exception $e) {+ ray($e->getMessage());+ }+ }+}diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ApplicationContainerStatusJob.phpsimilarity index 51%rename from app/Jobs/ContainerStatusJob.phprename to app/Jobs/ApplicationContainerStatusJob.phpindex 9ff18f9ba7..78145eb1c9 100644--- a/app/Jobs/ContainerStatusJob.php+++ b/app/Jobs/ApplicationContainerStatusJob.php@@ -13,7 +13,7 @@ use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;use Illuminate\Support\Facades\Log;-class ContainerStatusJob implements ShouldQueue, ShouldBeUnique+class ApplicationContainerStatusJob implements ShouldQueue, ShouldBeUnique{use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;@@ -35,7 +35,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeUnique{try {$status = get_container_status(server: $this->application->destination->server, container_id: $this->container_name, throwError: false);- ray('Container ' . $this->container_name . ' statuus is ' . $status);if ($this->pull_request_id) {$preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);$preview->status = $status;@@ -55,34 +54,4 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeUnique$this->application->save();}}- // protected function check_all_servers()- // {- // $servers = Server::all()->reject(fn (Server $server) => $server->settings->is_build_server);- // $applications = Application::all();- // $not_found_applications = $applications;- // $containers = collect();- // foreach ($servers as $server) {- // $output = instant_remote_process(['docker ps -a -q --format \'{{json .}}\''], $server);- // $containers = $containers->concat(format_docker_command_output_to_json($output));- // }- // foreach ($containers as $container) {- // $found_application = $applications->filter(function ($value, $key) use ($container) {- // return $value->uuid == $container['Names'];- // })->first();- // if ($found_application) {- // $not_found_applications = $not_found_applications->filter(function ($value, $key) use ($found_application) {- // return $value->uuid != $found_application->uuid;- // });- // $found_application->status = $container['State'];- // $found_application->save();- // Log::info('Found application: ' . $found_application->uuid . '. Set status to: ' . $found_application->status);- // }- // }- // foreach ($not_found_applications as $not_found_application) {- // $not_found_application->status = 'exited';- // $not_found_application->save();- // Log::info('Not found application: ' . $not_found_application->uuid . '. Set status to: ' . $not_found_application->status);- // }- // }-}diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex f772726577..296f5237b2 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -277,7 +277,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}'status' => $status,]);}- dispatch(new ContainerStatusJob(+ dispatch(new ApplicationContainerStatusJob(application: $this->application,container_name: $this->container_name,pull_request_id: $this->pull_request_iddiff --git a/app/Jobs/ProxyContainerStatusJob.php b/app/Jobs/ProxyContainerStatusJob.phpnew file mode 100644index 0000000000..b9341f2758--- /dev/null+++ b/app/Jobs/ProxyContainerStatusJob.php@@ -0,0 +1,57 @@+<?php++namespace App\Jobs;++use App\Enums\ProxyTypes;+use App\Models\Application;+use App\Models\ApplicationPreview;+use App\Models\Server;+use Illuminate\Bus\Queueable;+use Illuminate\Contracts\Queue\ShouldBeUnique;+use Illuminate\Contracts\Queue\ShouldQueue;+use Illuminate\Foundation\Bus\Dispatchable;+use Illuminate\Queue\InteractsWithQueue;+use Illuminate\Queue\SerializesModels;+use Str;+use Illuminate\Queue\Middleware\WithoutOverlapping;++class ProxyContainerStatusJob implements ShouldQueue, ShouldBeUnique+{+ use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;++ public Server $server;+ public $tries = 1;+ public $timeout = 120;+ public function middleware(): array+ {+ return [new WithoutOverlapping($this->server->id)];+ }+ public function __construct(Server $server)+ {+ $this->server = $server;+ }+ public function uniqueId(): int+ {+ return $this->server->id;+ }+ public function handle(): void+ {+ try {+ $container = get_container_status(server: $this->server, all_data: true, container_id: 'coolify-proxy', throwError: false);+ $status = $container['State']['Status'];+ if ($this->server->extra_attributes->proxy_status !== $status) {+ $this->server->extra_attributes->proxy_status = $status;+ if ($this->server->extra_attributes->proxy_status === 'running') {+ $traefik = $container['Config']['Labels']['org.opencontainers.image.title'];+ $version = $container['Config']['Labels']['org.opencontainers.image.version'];+ if (isset($version) && isset($traefik) && $traefik === 'Traefik' && Str::of($version)->startsWith('v2')) {+ $this->server->extra_attributes->proxy_type = ProxyTypes::TRAEFIK_V2->value;+ }+ }+ $this->server->save();+ }+ } catch (\Exception $e) {+ ray($e->getMessage());+ }+ }+}diff --git a/app/Models/Server.php b/app/Models/Server.phpindex c6c183ef7b..81d790fc6a 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -58,6 +58,7 @@ class Server extends BaseModel{return Server::where('team_id', session('currentTeam')->id)->whereRelation('settings', 'is_validated', true)->get();}+static public function destinations(string|null $server_uuid = null){if ($server_uuid) {diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.phpindex 0efd25c84e..def7886687 100644--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@ -29,14 +29,17 @@ function format_docker_labels_to_json($rawOutput): Collection})[0];}-function get_container_status(Server $server, string $container_id, bool $throwError = false)+function get_container_status(Server $server, string $container_id, bool $all_data = false, bool $throwError = false){- $container = instant_remote_process(["docker inspect --format '{{json .State}}' {$container_id}"], $server, $throwError);+ $container = instant_remote_process(["docker inspect --format '{{json .}}' {$container_id}"], $server, $throwError);if (!$container) {return 'exited';}$container = format_docker_command_output_to_json($container);- return $container[0]['Status'];+ if ($all_data) {+ return $container[0];+ }+ return $container[0]['State']['Status'];}function generate_container_name(string $uuid, int|null $pull_request_id = null)diff --git a/database/seeders/ServerSeeder.php b/database/seeders/ServerSeeder.phpindex 423c259f28..e60f7da7d9 100644--- a/database/seeders/ServerSeeder.php+++ b/database/seeders/ServerSeeder.php@@ -36,10 +36,7 @@ class ServerSeeder extends Seeder'description' => "This is a test docker container",'ip' => "coolify-testing-host-2",'team_id' => $root_team->id,- 'private_key_id' => $private_key_1->id,- 'extra_attributes' => ServerMetadata::from([- //- ]),+ 'private_key_id' => $private_key_1->id]);}}diff --git a/database/seeders/ServerSettingSeeder.php b/database/seeders/ServerSettingSeeder.phpindex e36edcc7a2..c05e630a22 100644--- a/database/seeders/ServerSettingSeeder.php+++ b/database/seeders/ServerSettingSeeder.php@@ -19,7 +19,7 @@ class ServerSettingSeeder extends Seeder$server_2->settings->save();$server_3 = Server::find(2)->load(['settings']);- $server_3->settings->is_part_of_swarm = true;+ $server_3->settings->is_part_of_swarm = false;$server_3->settings->is_validated = false;$server_3->settings->save();}diff --git a/resources/views/components/applications/navbar.blade.php b/resources/views/components/applications/navbar.blade.phpindex 87caed2d78..fd6ba61e79 100644--- a/resources/views/components/applications/navbar.blade.php+++ b/resources/views/components/applications/navbar.blade.php@@ -15,8 +15,8 @@]) }}"><button>Deployments</button></a>+ <livewire:project.application.status :application="$application" /><div class="flex-1"></div>-<div class="dropdown dropdown-bottom"><label tabindex="0"><x-forms.button>@@ -60,5 +60,4 @@</div></div><livewire:project.application.deploy :applicationId="$application->id" />- <livewire:project.application.status :application="$application" /></nav>diff --git a/resources/views/components/forms/textarea.blade.php b/resources/views/components/forms/textarea.blade.phpindex 3514c88568..60ebb525d4 100644--- a/resources/views/components/forms/textarea.blade.php+++ b/resources/views/components/forms/textarea.blade.php@@ -4,12 +4,11 @@'label' => $attributes->has('label'),'helper' => $attributes->has('helper'),'instantSave' => $attributes->has('instantSave'),- 'noLabel' => $attributes->has('noLabel'),'noDirty' => $attributes->has('noDirty'),])<div class=" form-control">- @if (!$noLabel)+ @if ($label)<label class="label"><span class="label-text">@if ($label)diff --git a/resources/views/components/loading.blade.php b/resources/views/components/loading.blade.phpindex fb99b0ff7a..c7a7577fb3 100644--- a/resources/views/components/loading.blade.php+++ b/resources/views/components/loading.blade.php@@ -1 +1 @@-<span class="loading loading-spinner"></span>+<span class="loading loading-bars"></span>diff --git a/resources/views/components/server/navbar.blade.php b/resources/views/components/server/navbar.blade.phpindex c606023862..4e9dadb67b 100644--- a/resources/views/components/server/navbar.blade.php+++ b/resources/views/components/server/navbar.blade.php@@ -1,6 +1,6 @@<div class="pb-6"><h1>Server</h1>- <div class="text-sm breadcrumbs pb-11">+ <div class="pb-10 text-sm breadcrumbs"><ul><li>{{ data_get($server, 'name') }}</li></ul>@@ -18,5 +18,7 @@]) }}"><button>Proxy</button></a>+ <div class="flex-1"></div>+ <livewire:server.proxy.deploy :server="$server" /></nav></div>diff --git a/resources/views/livewire/activity-monitor.blade.php b/resources/views/livewire/activity-monitor.blade.phpindex 8182c797de..85c0d33368 100644--- a/resources/views/livewire/activity-monitor.blade.php+++ b/resources/views/livewire/activity-monitor.blade.php@@ -1,7 +1,13 @@<div>@if ($this->activity)+ @if ($header)+ <h2>Logs</h2>+ @endif<divclass="scrollbar flex flex-col-reverse w-full overflow-y-auto border border-solid rounded border-coolgray-300 max-h-[32rem] p-4 text-xs text-white">+ @if ($isPollingActive)+ <span class="loading loading-bars"></span>+ @endif<pre class="font-mono whitespace-pre-wrap" @if ($isPollingActive) wire:poll.2000ms="polling" @endif>{{ \App\Actions\CoolifyTask\RunRemoteProcess::decodeOutput($this->activity) }}</pre>{{-- @else<pre class="whitespace-pre-wrap">Output will be here...</pre> --}}diff --git a/resources/views/livewire/project/application/deployments.blade.php b/resources/views/livewire/project/application/deployments.blade.phpindex 692f5111aa..e2ee4d68ce 100644--- a/resources/views/livewire/project/application/deployments.blade.php+++ b/resources/views/livewire/project/application/deployments.blade.php@@ -1,62 +1,64 @@<div class="flex flex-col gap-2" wire:init='load_deployments'@if ($skip == 0) wire:poll.5000ms='reload_deployments' @endif>- @if (count($deployments) > 0)- <h2 class="pt-4">Deployments <span class="text-xs">({{ $deployments_count }})</span></h2>- @if ($show_next)- <x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Show More- </x-forms.button>- @else- <x-forms.button disabled>Show More- </x-forms.button>- @endif- @foreach ($deployments as $deployment)- <a @class([- 'bg-coolgray-200 p-2 border-l border-dashed transition-colors hover:no-underline',- 'cursor-not-allowed hover:bg-coolgray-200' =>- data_get($deployment, 'status') === 'queued' ||- data_get($deployment, 'status') === 'cancelled by system',- 'border-warning hover:bg-warning hover:text-black' =>- data_get($deployment, 'status') === 'in_progress',- 'border-error hover:bg-error' =>- data_get($deployment, 'status') === 'error',- 'border-success hover:bg-success' =>- data_get($deployment, 'status') === 'finished',- ]) @if (data_get($deployment, 'status') !== 'cancelled by system' && data_get($deployment, 'status') !== 'queued')- href="{{ $current_url . '/' . data_get($deployment, 'deployment_uuid') }}"- @endif- class="hover:no-underline">- <div class="flex flex-col justify-start">+ <h2 class="pt-4">Deployments <span class="text-xs">({{ $deployments_count }})</span></h2>+ @if (count($deployments) === 0)+ <x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Load Deployments+ </x-forms.button>+ @endif+ <div wire:loading wire:target='load_deployments'>+ <x-loading />+ </div>+ @if ($show_next)+ <x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Show More+ </x-forms.button>+ @endif+ @foreach ($deployments as $deployment)+ <a @class([+ 'bg-coolgray-200 p-2 border-l border-dashed transition-colors hover:no-underline',+ 'cursor-not-allowed hover:bg-coolgray-200' =>+ data_get($deployment, 'status') === 'queued' ||+ data_get($deployment, 'status') === 'cancelled by system',+ 'border-warning hover:bg-warning hover:text-black' =>+ data_get($deployment, 'status') === 'in_progress',+ 'border-error hover:bg-error' =>+ data_get($deployment, 'status') === 'error',+ 'border-success hover:bg-success' =>+ data_get($deployment, 'status') === 'finished',+ ]) @if (data_get($deployment, 'status') !== 'cancelled by system' && data_get($deployment, 'status') !== 'queued')+ href="{{ $current_url . '/' . data_get($deployment, 'deployment_uuid') }}"+ @endif+ class="hover:no-underline">+ <div class="flex flex-col justify-start">+ <div>+ {{ $deployment->id }} <span class="text-sm text-warning">></span> {{ $deployment->deployment_uuid }}+ <span class="text-sm text-warning">></span>+ {{ $deployment->status }}+ </div>+ @if (data_get($deployment, 'pull_request_id'))<div>- {{ $deployment->id }} <span class="text-sm text-warning">></span> {{ $deployment->deployment_uuid }}- <span class="text-sm text-warning">></span>- {{ $deployment->status }}+ Pull Request #{{ data_get($deployment, 'pull_request_id') }}+ @if (data_get($deployment, 'is_webhook'))+ (Webhook)+ @endif</div>- @if (data_get($deployment, 'pull_request_id'))- <div>- Pull Request #{{ data_get($deployment, 'pull_request_id') }}- @if (data_get($deployment, 'is_webhook'))- (Webhook)- @endif- </div>- @elseif (data_get($deployment, 'is_webhook'))- <div>Webhook (sha- @if (data_get($deployment, 'commit'))- {{ data_get($deployment, 'commit') }})- @else- HEAD)- @endif- </div>- @endif- <div class="flex flex-col" x-data="elapsedTime('{{ $deployment->deployment_uuid }}', '{{ $deployment->status }}', '{{ $deployment->created_at }}', '{{ $deployment->updated_at }}')">- <div>Finished <span x-text="measure_since_started()">0s</span> in <span class="font-bold"- x-text="measure_finished_time()">0s</span></div>+ @elseif (data_get($deployment, 'is_webhook'))+ <div>Webhook (sha+ @if (data_get($deployment, 'commit'))+ {{ data_get($deployment, 'commit') }})+ @else+ HEAD)+ @endif</div>+ @endif+ <div class="flex flex-col" x-data="elapsedTime('{{ $deployment->deployment_uuid }}', '{{ $deployment->status }}', '{{ $deployment->created_at }}', '{{ $deployment->updated_at }}')">+ <div>Finished <span x-text="measure_since_started()">0s</span> in <span class="font-bold"+ x-text="measure_finished_time()">0s</span></div></div>- </a>+ </div>+ </a>@endforeach- @else- <span wire:loading.remove wire:target='load_deployments' class="loading loading-spinner"></span>- @endif++<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script><script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/utc.js"></script><script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.js"></script>diff --git a/resources/views/livewire/project/application/status.blade.php b/resources/views/livewire/project/application/status.blade.phpindex ea22b3f412..103319a641 100644--- a/resources/views/livewire/project/application/status.blade.php+++ b/resources/views/livewire/project/application/status.blade.php@@ -2,14 +2,12 @@@if ($application->status === 'running')<span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span><div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>- <span class="flex w-3 h-3 rounded-full bg-success"></span>- <span class="text-green-500">Running</span>+ <div class="text-xs font-medium tracking-wide text-white badge border-success">Running</div></div>@else<span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span><div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>- <span class="flex w-3 h-3 rounded-full bg-error"></span>- <span class="text-error">Stopped</span>+ <div class="text-xs font-medium tracking-wide text-white badge border-error">Stopped</div></div>@endif</div>diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.phpindex d3adf08f22..2801b2e718 100644--- a/resources/views/livewire/server/form.blade.php+++ b/resources/views/livewire/server/form.blade.php@@ -37,17 +37,20 @@@endif</div></div>- <h3 class="pt-8 pb-4">Quick Actions</h3>- <div class="flex items-center gap-2">- <x-forms.button wire:click.prevent='validateServer'>- @if ($server->settings->is_validated)- Check Connection- @else- Validate Server- @endif+ @if (!$server->settings->is_validated)+ <x-forms.button class="mt-4" isHighlighted wire:click.prevent='validateServer'>+ Validate Server</x-forms.button>- {{-- <x-forms.button wire:click.prevent='installDocker'>Install Docker</x-forms.button> --}}- </div>+ @endif+ @if ($server->settings->is_validated)+ <h3 class="pt-8 pb-4">Quick Actions</h3>+ <div class="flex items-center gap-2">+ <x-forms.button wire:click.prevent='validateServer'>+ Check Connection+ </x-forms.button>+ {{-- <x-forms.button wire:click.prevent='installDocker'>Install Docker</x-forms.button> --}}+ </div>+ @endif<div class="pt-3 text-sm">@isset($uptime)<p>Uptime: {{ $uptime }}</p>@@ -76,10 +79,12 @@</a></div><div>- @foreach ($server->standaloneDockers as $docker)+ @forelse ($server->standaloneDockers as $docker)<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}"><button class="text-white btn-link">{{ data_get($docker, 'network') }}</button></a>- @endforeach+ @empty+ <div class="text-sm">No destinations added</div>+ @endforelse</div></div>diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.phpindex c91cbc78b8..d0da925949 100644--- a/resources/views/livewire/server/proxy.blade.php+++ b/resources/views/livewire/server/proxy.blade.php@@ -2,38 +2,6 @@<x-naked-modal show="stopProxy" action="stopProxy"message='Are you sure you would like to stop the proxy? All resources will be unavailable.' />@if ($server->settings->is_validated)- <div class="flex items-center gap-2 mb-2">- <h2>Proxy</h2>- @if ($server->extra_attributes->proxy_type)- <x-forms.button isHighlighted wire:click.prevent="installProxy">- Start/Reconfigure Proxy- </x-forms.button>- <x-forms.button x-on:click.prevent="stopProxy = true">Stop- </x-forms.button>- <div wire:poll.5000ms="proxyStatus">- @if (- $server->extra_attributes->last_applied_proxy_settings &&- $server->extra_attributes->last_saved_proxy_settings !== $server->extra_attributes->last_applied_proxy_settings)- <div class="text-red-500">Configuration out of sync.</div>- @endif- </div>- @endif- @if ($server->extra_attributes->proxy_status === 'running')- <span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>- <div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>- <span class="flex w-3 h-3 rounded-full bg-success"></span>- <span class="text-green-500">Running</span>- </div>- @else- <span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>- <div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>- <span class="flex w-3 h-3 rounded-full bg-error"></span>- <span class="text-error">Stopped</span>- </div>- @endif- </div>-- <livewire:activity-monitor />@if ($server->extra_attributes->proxy_type)<div x-init="$wire.checkProxySettingsInSync"><div wire:loading wire:target="checkProxySettingsInSync">@@ -41,15 +9,23 @@</div>@isset($proxy_settings)@if ($selectedProxy->value === 'TRAEFIK_V2')- <form wire:submit.prevent='saveConfiguration'>+ <form wire:submit.prevent='saveConfiguration({{ $server }})'><div class="flex items-center gap-2">- <h3>Configuration</h3>- <x-forms.button type="submit">Save</x-forms.button>- <x-forms.button wire:click.prevent="resetProxy">- Reset Configuration- </x-forms.button>+ <h2>Proxy</h2>+ <livewire:server.proxy.status :server="$server" /></div>- <h4>traefik.conf</h4>+ <div class="pb-4 text-sm">Traefik v2</div>+ @if (+ $server->extra_attributes->proxy_last_applied_settings &&+ $server->extra_attributes->proxy_last_saved_settings !== $server->extra_attributes->proxy_last_applied_settings)+ <div class="text-sm text-red-500">Configuration out of sync. Restart to get the new configs.+ </div>+ @endif+ <x-forms.button type="submit">Save</x-forms.button>+ <x-forms.button wire:click.prevent="resetProxy">+ Reset to default+ </x-forms.button>+ <div class="pt-4 pb-0 text-xs">traefik.conf</div><x-forms.textarea class="text-xs" noDirty name="proxy_settings"wire:model.defer="proxy_settings" rows="30" /></form>@@ -57,14 +33,16 @@@endisset</div>@else- <select wire:model="selectedProxy">- <option value="{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}">- {{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}- </option>- </select>- <x-forms.button wire:click="setProxy">Set Proxy</x-forms.button>+ <div>+ <h2>Select a Proxy</h2>+ <x-forms.button wire:click="setProxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')">Traefik v2+ </x-forms.button>+ </div>@endif+ <div class="container w-full pt-4 mx-auto">+ <livewire:activity-monitor :header="true" />+ </div>@else- <p>Server is not validated. Validate first.</p>+ <div class="text-sm">Server is not validated. Validate first.</div>@endif</div>diff --git a/resources/views/livewire/server/proxy/deploy.blade.php b/resources/views/livewire/server/proxy/deploy.blade.phpnew file mode 100644index 0000000000..97191d82a2--- /dev/null+++ b/resources/views/livewire/server/proxy/deploy.blade.php@@ -0,0 +1,44 @@+<div>+ @if ($server->settings->is_validated)+ @if ($server->extra_attributes->proxy_status === 'running')+ <div class="dropdown dropdown-bottom">+ <x-forms.button isHighlighted tabindex="0">+ Actions+ <x-chevron-down />+ </x-forms.button>+ <ul tabindex="0"+ class="mt-1 text-xs text-white normal-case rounded min-w-max dropdown-content menu bg-coolgray-200">+ <li>+ <div class="rounded-none hover:bg-coollabs" wire:click='deploy'><svg+ xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"+ stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path d="M9 4.55a8 8 0 0 1 6 14.9m0 -4.45v5h5" />+ <path d="M5.63 7.16l0 .01" />+ <path d="M4.06 11l0 .01" />+ <path d="M4.63 15.1l0 .01" />+ <path d="M7.16 18.37l0 .01" />+ <path d="M11 19.94l0 .01" />+ </svg>Restart</div>+ </li>+ <li>+ <div class="rounded-none hover:bg-red-500" wire:click='stop'> <svg+ xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"+ stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path+ d="M5 5m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z" />+ </svg>Stop</div>+ </li>+ </ul>+ </div>+ @else+ <x-forms.button isHighlighted wire:click='deploy'> <svg xmlns="http://www.w3.org/2000/svg" class="icon"+ width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"+ fill="none" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path d="M7 4v16l13 -8z" />+ </svg>Start</x-forms.button>+ @endif+ @endif+</div>diff --git a/resources/views/livewire/server/proxy/status.blade.php b/resources/views/livewire/server/proxy/status.blade.phpnew file mode 100644index 0000000000..dc8a589207--- /dev/null+++ b/resources/views/livewire/server/proxy/status.blade.php@@ -0,0 +1,17 @@+<div>+ @if ($server->settings->is_validated)+ <div wire:poll.5000ms="proxyStatus">+ @if ($server->extra_attributes->proxy_status === 'running')+ <span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>+ <div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>+ <div class="text-xs font-medium tracking-wide text-white badge border-success">Running</div>+ </div>+ @else+ <span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>+ <div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>+ <div class="text-xs font-medium tracking-wide text-white badge border-error">Stopped</div>+ </div>+ @endif+ </div>+ @endif+</div>diff --git a/resources/views/servers.blade.php b/resources/views/servers.blade.phpindex 5b0cd7c1a5..fb9b4ab171 100644--- a/resources/views/servers.blade.php+++ b/resources/views/servers.blade.php@@ -7,14 +7,16 @@</li></ul></div>- @forelse ($servers as $server)- <a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"- class="box">{{ $server->name }}</a>- @empty- <div class="flex flex-col">- <div>Without a server, you won't be able to do much.</div>- <div>Let's <a class="text-lg underline text-warning" href="{{ route('server.new') }}">create</a> your- first one.</div>- </div>- @endforelse+ <div class="flex flex-col gap-2">+ @forelse ($servers as $server)+ <a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"+ class="box">{{ $server->name }}</a>+ @empty+ <div class="flex flex-col">+ <div>Without a server, you won't be able to do much.</div>+ <div>Let's <a class="text-lg underline text-warning" href="{{ route('server.new') }}">create</a> your+ first one.</div>+ </div>+ @endforelse+ </div></x-layout>diff --git a/routes/web.php b/routes/web.phpindex 686a0ca1b9..2f329e0161 100644--- a/routes/web.php+++ b/routes/web.php@@ -195,10 +195,8 @@ Route::middleware(['auth'])->group(function () {})->name('source.github.show');});Route::middleware(['auth'])->group(function () {--Route::get('/servers', fn () => view('servers', [- 'servers' => Server::validated(),+ 'servers' => Server::where('team_id', session('currentTeam')->id)->get(),]))->name('servers');Route::get('/server/new', fn () => view('server.new', [