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
fix: live event
Andras Bacsaia249ee1b1ff0
diff --git a/app/Actions/Service/StartService.php b/app/Actions/Service/StartService.phpindex 7b79b2f32d..6f73c2f45a 100644--- a/app/Actions/Service/StartService.php+++ b/app/Actions/Service/StartService.php@@ -21,7 +21,7 @@ class StartService$commands[] = "echo 'Pulling images.'";$commands[] = "docker compose pull";$commands[] = "echo 'Starting containers.'";- $commands[] = "docker compose up -d --remove-orphans --force-recreate --build";+ $commands[] = "docker compose up --wait --remove-orphans --force-recreate --build";$commands[] = "docker network connect $service->uuid coolify-proxy >/dev/null 2>&1 || true";$compose = data_get($service, 'docker_compose', []);$serviceNames = data_get(Yaml::parse($compose), 'services', []);diff --git a/app/Livewire/ActivityMonitor.php b/app/Livewire/ActivityMonitor.phpindex 2bfbe73485..703899b653 100644--- a/app/Livewire/ActivityMonitor.php+++ b/app/Livewire/ActivityMonitor.php@@ -8,7 +8,7 @@ use Spatie\Activitylog\Models\Activity;class ActivityMonitor extends Component{- public string|null $header = null;+ public ?string $header = null;public $activityId;public $isPollingActive = false;@@ -26,31 +26,30 @@ class ActivityMonitor extends Componentpublic function hydrateActivity(){- $this->activity = Activity::query()- ->find($this->activityId);+ $this->activity = Activity::find($this->activityId);}public function polling(){$this->hydrateActivity();- $this->setStatus(ProcessStatus::IN_PROGRESS);+ // $this->setStatus(ProcessStatus::IN_PROGRESS);$exit_code = data_get($this->activity, 'properties.exitCode');if ($exit_code !== null) {if ($exit_code === 0) {- $this->setStatus(ProcessStatus::FINISHED);+ // $this->setStatus(ProcessStatus::FINISHED);} else {- $this->setStatus(ProcessStatus::ERROR);+ // $this->setStatus(ProcessStatus::ERROR);}$this->isPollingActive = false;$this->dispatch('activityFinished');}}- protected function setStatus($status)- {- $this->activity->properties = $this->activity->properties->merge([- 'status' => $status,- ]);- $this->activity->save();- }+ // protected function setStatus($status)+ // {+ // $this->activity->properties = $this->activity->properties->merge([+ // 'status' => $status,+ // ]);+ // $this->activity->save();+ // }}diff --git a/app/Livewire/Project/Service/Index.php b/app/Livewire/Project/Service/Index.phpindex 4f3f9ce118..c2114bf15a 100644--- a/app/Livewire/Project/Service/Index.php+++ b/app/Livewire/Project/Service/Index.php@@ -38,6 +38,7 @@ class Index extends Component{dispatch_sync(new ContainerStatusJob($this->service->server));$this->refreshStacks();+ $this->dispatch('serviceStatusChanged');}public function refreshStacks(){diff --git a/app/Livewire/Project/Service/Navbar.php b/app/Livewire/Project/Service/Navbar.phpindex 25cbeb17e8..b3551b8746 100644--- a/app/Livewire/Project/Service/Navbar.php+++ b/app/Livewire/Project/Service/Navbar.php@@ -29,9 +29,8 @@ class Navbar extends Component}public function getListeners(){- $userId = auth()->user()->id;return [- "echo-private:custom.{$userId},ServiceStatusChanged" => 'serviceStatusChanged',+ "serviceStatusChanged"];}public function serviceStatusChanged()diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.phpindex c0a373c383..ec8bcb3401 100644--- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php+++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php@@ -10,6 +10,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use Illuminate\Support\Sleep;use Livewire\Component;class ExecuteContainerCommand extends Component@@ -23,7 +24,16 @@ class ExecuteContainerCommand extends Componentpublic string $workDir = '';public Server $server;public $servers = [];-+ public function getListeners()+ {+ return [+ "serviceStatusChanged",+ ];+ }+ public function serviceStatusChanged()+ {+ $this->getContainers();+ }protected $rules = ['server' => 'required','container' => 'required',@@ -33,8 +43,12 @@ class ExecuteContainerCommand extends Componentpublic function mount(){- $this->containers = collect();$this->parameters = get_route_parameters();+ $this->getContainers();+ }+ public function getContainers()+ {+ $this->containers = collect();if (data_get($this->parameters, 'application_uuid')) {$this->type = 'application';$this->resource = Application::where('uuid', $this->parameters['application_uuid'])->firstOrFail();@@ -92,10 +106,12 @@ class ExecuteContainerCommand extends Component{$this->validate();try {+ // Wrap command to prevent escaped execution in the host.+ $cmd = 'sh -c "' . str_replace('"', '\"', $this->command) . '"';if (!empty($this->workDir)) {- $exec = "docker exec -w {$this->workDir} {$this->container} {$this->command}";+ $exec = "docker exec -w {$this->workDir} {$this->container} {$cmd}";} else {- $exec = "docker exec {$this->container} {$this->command}";+ $exec = "docker exec {$this->container} {$cmd}";}$activity = remote_process([$exec], $this->server, ignore_errors: true);$this->dispatch('newMonitorActivity', $activity->id);diff --git a/resources/views/livewire/project/service/index.blade.php b/resources/views/livewire/project/service/index.blade.phpindex ed25dd1694..ec1d769222 100644--- a/resources/views/livewire/project/service/index.blade.php+++ b/resources/views/livewire/project/service/index.blade.php@@ -115,7 +115,7 @@<livewire:project.shared.webhooks :resource="$service" /></div><div x-cloak x-show="activeTab === 'execute-command'">- <livewire:project.shared.execute-container-command :resource="$service" />+ <livewire:project.shared.execute-container-command :resource="$service" /></div><div x-cloak x-show="activeTab === 'environment-variables'"><div x-cloak x-show="activeTab === 'environment-variables'">