diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 894df686d..6ef04ced8 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -240,6 +240,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted } $this->next(ApplicationDeploymentStatus::FINISHED->value); $this->application->isConfigurationChanged(false); + $this->run_post_deployment_command(); return; } else if ($this->pull_request_id !== 0) { $this->deploy_pull_request(); @@ -1700,11 +1701,11 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); if ($containers->count() == 0) { return; } - $this->application_deployment_queue->addLogEntry("Executing pre deployment command: {$this->application->post_deployment_command}"); + $this->application_deployment_queue->addLogEntry("Executing pre-deployment command (see debug log for output): {$this->application->pre_deployment_command}"); foreach ($containers as $container) { $containerName = data_get($container, 'Names'); - if ($containers->count() == 1 || str_starts_with($containerName, $this->application->pre_deployment_command_container. '-' . $this->application->uuid)) { + if ($containers->count() == 1 || str_starts_with($containerName, $this->application->pre_deployment_command_container . '-' . $this->application->uuid)) { $cmd = 'sh -c "' . str_replace('"', '\"', $this->application->pre_deployment_command) . '"'; $exec = "docker exec {$containerName} {$cmd}"; $this->execute_remote_command( @@ -1715,7 +1716,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); return; } } - throw new RuntimeException('Pre deployment command: Could not find a valid container. Is the container name correct?'); + throw new RuntimeException('Pre-deployment command: Could not find a valid container. Is the container name correct?'); } private function run_post_deployment_command() @@ -1723,12 +1724,12 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); if (empty($this->application->post_deployment_command)) { return; } - $this->application_deployment_queue->addLogEntry("Executing post deployment command: {$this->application->post_deployment_command}"); + $this->application_deployment_queue->addLogEntry("Executing post-deployment command (see debug log for output): {$this->application->post_deployment_command}"); $containers = getCurrentApplicationContainerStatus($this->server, $this->application->id, $this->pull_request_id); foreach ($containers as $container) { $containerName = data_get($container, 'Names'); - if ($containers->count() == 1 || str_starts_with($containerName, $this->application->post_deployment_command_container. '-' . $this->application->uuid)) { + if ($containers->count() == 1 || str_starts_with($containerName, $this->application->post_deployment_command_container . '-' . $this->application->uuid)) { $cmd = 'sh -c "' . str_replace('"', '\"', $this->application->post_deployment_command) . '"'; $exec = "docker exec {$containerName} {$cmd}"; $this->execute_remote_command( @@ -1739,7 +1740,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); return; } } - throw new RuntimeException('Post deployment command: Could not find a valid container. Is the container name correct?'); + throw new RuntimeException('Post-deployment command: Could not find a valid container. Is the container name correct?'); } private function next(string $status) diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 2c00fa842..449c83dbc 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -45,11 +45,11 @@ @endif @if ($application->build_pack === 'dockercompose') -
- -
+
+ +
@if (count($parsedServices) > 0 && !$application->settings->is_raw_compose_deployment_enabled) @foreach (data_get($parsedServices, 'services') as $serviceName => $service) @if (!isDatabaseImage(data_get($service, 'image'))) @@ -210,10 +210,10 @@ id="application.custom_docker_run_options" label="Custom Docker Options" /> @endif @else - + @endif @if ($application->build_pack === 'dockercompose') Reload Compose File @@ -251,18 +251,19 @@ Reset to Coolify Generated Labels @endif -

Deployment scripts

+

Pre/Post Deployment Commands

- - + +
- - + +