diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php new file mode 100644 index 000000000..45ac000c9 --- /dev/null +++ b/app/Console/Commands/Init.php @@ -0,0 +1,36 @@ +get(); + ray($halted_deployments); + } catch (\Exception $e) { + echo "Error: {$e->getMessage()}\n"; + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d8d5dabd5..3b320366f 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -19,6 +19,7 @@ protected function schedule(Schedule $schedule): void } else { $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->job(new InstanceDockerCleanupJob)->everyFiveMinutes(); + $schedule->job(new InstanceProxyCheckJob)->everyFiveMinutes(); $schedule->job(new InstanceAutoUpdateJob)->everyTenMinutes(); } } diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index 3dbd6115d..a1b303802 100644 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -41,7 +41,8 @@ public function deployments() if (!$application) { return redirect()->route('dashboard'); } - return view('project.application.deployments', ['application' => $application]); + ['deployments' => $deployments, 'count' => $count] = $application->deployments(0, 8); + return view('project.application.deployments', ['application' => $application, 'deployments' => $deployments, 'deployments_count' => $count]); } public function deployment() diff --git a/app/Http/Livewire/Project/Application/Deployments.php b/app/Http/Livewire/Project/Application/Deployments.php index 9dd6e9631..16b40895b 100644 --- a/app/Http/Livewire/Project/Application/Deployments.php +++ b/app/Http/Livewire/Project/Application/Deployments.php @@ -7,7 +7,7 @@ class Deployments extends Component { - public int $application_id; + public Application $application; public $deployments = []; public int $deployments_count = 0; public string $current_url; @@ -18,6 +18,17 @@ class Deployments extends Component public function mount() { $this->current_url = url()->current(); + $this->show_more(); + } + private function show_more() + { + if (count($this->deployments) !== 0) { + $this->show_next = true; + if (count($this->deployments) < $this->default_take) { + $this->show_next = false; + } + return; + } } public function reload_deployments() { @@ -28,17 +39,11 @@ public function load_deployments(int|null $take = null) if ($take) { $this->skip = $this->skip + $take; } - $take = $this->default_take; - ['deployments' => $deployments, 'count' => $count] = Application::find($this->application_id)->deployments($this->skip, $take); + + ['deployments' => $deployments, 'count' => $count] = $this->application->deployments($this->skip, $take); $this->deployments = $deployments; $this->deployments_count = $count; - if (count($this->deployments) !== 0) { - $this->show_next = true; - if (count($this->deployments) < $take) { - $this->show_next = false; - } - return; - } + $this->show_more(); } } diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 416340565..87fca814c 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -309,6 +309,8 @@ private function next(string $status) $this->application_deployment_queue->update([ 'status' => $status, ]); + ray($this->application_deployment_queue)->purple(); + ray($this->activity)->purple(); $this->activity->properties = $this->activity->properties->merge([ 'status' => $status, ]); diff --git a/app/Jobs/InstanceProxyCheckJob.php b/app/Jobs/InstanceProxyCheckJob.php index 4387cd318..6d90f1be3 100755 --- a/app/Jobs/InstanceProxyCheckJob.php +++ b/app/Jobs/InstanceProxyCheckJob.php @@ -29,7 +29,7 @@ public function handle() { try { $container_name = 'coolify-proxy'; - $servers = Server::whereRelation('settings', 'is_reachable', true)->where('proxy->type', ProxyTypes::TRAEFIK_V2)->get(); + $servers = Server::whereRelation('settings', 'is_usable', true)->where('proxy->type', ProxyTypes::TRAEFIK_V2)->get(); foreach ($servers as $server) { $status = get_container_status(server: $server, container_id: $container_name); diff --git a/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-seeder/dependencies.d/db-migration b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/dependencies.d/init-seeder similarity index 100% rename from docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-seeder/dependencies.d/db-migration rename to docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/dependencies.d/init-seeder diff --git a/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/type b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/type @@ -0,0 +1 @@ +oneshot diff --git a/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up new file mode 100644 index 000000000..09595f708 --- /dev/null +++ b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up @@ -0,0 +1,2 @@ +#!/command/execlineb -P +php /var/www/html/artisan app:init diff --git a/resources/views/livewire/project/application/deployments.blade.php b/resources/views/livewire/project/application/deployments.blade.php index 1385025af..0bca78a43 100644 --- a/resources/views/livewire/project/application/deployments.blade.php +++ b/resources/views/livewire/project/application/deployments.blade.php @@ -1,5 +1,4 @@ -