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(deployment): use mainServer consistently instead of redundant original_server
Andras Bacsai81780d652f97
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex c8ca0ced60..84f362519d 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -87,9 +87,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueprivate bool $use_build_server = false;- // Save original server between phases- private Server $original_server;-private Server $mainServer;private bool $is_this_additional_server = false;@@ -325,18 +322,14 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueif ($buildServers->count() === 0) {$this->application_deployment_queue->addLogEntry('No suitable build server found. Using the deployment server.');$this->build_server = $this->server;- $this->original_server = $this->server;} else {$this->build_server = $buildServers->random();$this->application_deployment_queue->build_server_id = $this->build_server->id;$this->application_deployment_queue->addLogEntry("Found a suitable build server ({$this->build_server->name}).");- $this->original_server = $this->server;$this->use_build_server = true;}} else {- // Set build server & original_server to the same as deployment server$this->build_server = $this->server;- $this->original_server = $this->server;}$this->detectBuildKitCapabilities();$this->decide_what_to_do();@@ -937,7 +930,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue{if ($this->preserveRepository) {if ($this->use_build_server) {- $this->server = $this->original_server;+ $this->server = $this->mainServer;}if (str($this->configuration_dir)->isNotEmpty()) {$this->execute_remote_command(@@ -960,7 +953,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue}if (isset($this->docker_compose_base64)) {if ($this->use_build_server) {- $this->server = $this->original_server;+ $this->server = $this->mainServer;}$readme = generate_readme_file($this->application->name, $this->application_deployment_queue->updated_at);@@ -1342,7 +1335,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue// Also create in configuration directoryif ($this->use_build_server) {- $this->server = $this->original_server;+ $this->server = $this->mainServer;$this->execute_remote_command(["touch $this->configuration_dir/.env",@@ -1359,7 +1352,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue} else {// For non-Docker Compose deployments, clean up any existing .env filesif ($this->use_build_server) {- $this->server = $this->original_server;+ $this->server = $this->mainServer;$this->execute_remote_command(['command' => "rm -f $this->configuration_dir/.env",@@ -1407,7 +1400,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue// Write .env file to configuration directoryif ($this->use_build_server) {- $this->server = $this->original_server;+ $this->server = $this->mainServer;$this->execute_remote_command(["echo '$envs_base64' | base64 -d | tee $this->configuration_dir/.env > /dev/null",@@ -1744,7 +1737,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue} else {if ($this->use_build_server) {$this->write_deployment_configurations();- $this->server = $this->original_server;+ $this->server = $this->mainServer;}if (count($this->application->ports_mappings_array) > 0 || (bool) $this->application->settings->is_consistent_container_name_enabled || str($this->application->settings->custom_internal_name)->isNotEmpty() || $this->pull_request_id !== 0 || str($this->application->custom_docker_run_options)->contains('--ip') || str($this->application->custom_docker_run_options)->contains('--ip6')) {$this->application_deployment_queue->addLogEntry('----------------------------------------');@@ -1913,7 +1906,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueprivate function create_workdir(){if ($this->use_build_server) {- $this->server = $this->original_server;+ $this->server = $this->mainServer;$this->execute_remote_command(['command' => "mkdir -p {$this->configuration_dir}",@@ -2563,7 +2556,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueif (! is_null($this->application->limits_cpuset)) {data_set($docker_compose, 'services.'.$this->container_name.'.cpuset', $this->application->limits_cpuset);}- if ($this->server->isSwarm()) {+ if ($this->mainServer->isSwarm()) {data_forget($docker_compose, 'services.'.$this->container_name.'.container_name');data_forget($docker_compose, 'services.'.$this->container_name.'.expose');data_forget($docker_compose, 'services.'.$this->container_name.'.restart');@@ -2613,7 +2606,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue} else {$docker_compose['services'][$this->container_name]['labels'] = $labels;}- if ($this->original_server->isLogDrainEnabled() && $this->application->isLogDrainEnabled()) {+ if ($this->mainServer->isLogDrainEnabled() && $this->application->isLogDrainEnabled()) {$docker_compose['services'][$this->container_name]['logging'] = generate_fluentd_configuration();}if ($this->application->settings->is_gpu_enabled) {