diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index a4c37a084..eeabb185f 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -284,9 +284,20 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted private function rolling_update() { - $this->start_by_compose_file(); - $this->health_check(); - $this->stop_running_container(); + if (count($this->application->ports_mappings_array) > 0){ + $this->execute_remote_command( + ["echo -n 'Application has ports mapped to the host system, rolling update is not supported. Stopping current container.'"], + ); + $this->stop_running_container(force: true); + $this->start_by_compose_file(); + } else { + $this->execute_remote_command( + ["echo -n 'Rolling update started.'"], + ); + $this->start_by_compose_file(); + $this->health_check(); + $this->stop_running_container(); + } } private function health_check() { @@ -704,10 +715,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } } - private function stop_running_container() + private function stop_running_container(bool $force = false) { if ($this->currently_running_container_name) { - if ($this->newVersionIsHealthy) { + if ($this->newVersionIsHealthy || $force) { $this->execute_remote_command( ["echo -n 'Removing old version of your application.'"], [executeInDocker($this->deployment_uuid, "docker rm -f $this->currently_running_container_name >/dev/null 2>&1"), "hidden" => true], @@ -724,7 +735,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); private function start_by_compose_file() { $this->execute_remote_command( - ["echo -n 'Rolling update started.'"], + ["echo -n 'Starting application (could take a while).'"], [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} up -d >/dev/null"), "hidden" => true], ); } diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index a0089079a..5d789edcf 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -63,7 +63,7 @@ helper="A comma separated list of ports your application uses. The first port will be used as default healthcheck port if nothing defined in the Healthcheck menu. Be sure to set this correctly." /> @endif + helper="A comma separated list of ports you would like to map to the host system. Useful when you do not want to use domains.

Example:
3000:3000,3002:3002

Rolling update is not supported if you have a port mapped to the host." />

Advanced