Skip to content

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.

fix: prevent cleanup exceptions from marking successful deployments as failed

Andras Bacsaicfea11f1896c
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 6df9a86235..9ca69e265a 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -3187,6 +3187,19 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
$this->graceful_shutdown_container($this->container_name);
}
} catch (Exception $e) {
+ // If new version is healthy, this is just cleanup - don't fail the deployment
+ if ($this->newVersionIsHealthy || $force) {
+ $this->application_deployment_queue->addLogEntry(
+ "Warning: Could not remove old container: {$e->getMessage()}",
+ 'stderr',
+ hidden: true
+ );
+ \Log::warning("Failed to stop running container {$this->container_name}: {$e->getMessage()}");
+
+ return; // Don't re-throw - cleanup failures shouldn't fail successful deployments
+ }
+
+ // Only re-throw if deployment hasn't succeeded yet
throw new DeploymentException("Failed to stop running container: {$e->getMessage()}", $e->getCode(), $e);
}
}