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.

Update application deployment status in job handling

Andras Bacsai60f590454d87
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 93dad8e8a0..022368548e 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -166,10 +166,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
public function handle(): void
{
- $this->application_deployment_queue->update([
- 'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
- ]);
-
// Generate custom host<->ip mapping
$allContainers = instant_remote_process(["docker network inspect {$this->destination->network} -f '{{json .Containers}}' "], $this->server);
if (!is_null($allContainers)) {
diff --git a/bootstrap/helpers/applications.php b/bootstrap/helpers/applications.php
index de381212f8..5e0040872f 100644
--- a/bootstrap/helpers/applications.php
+++ b/bootstrap/helpers/applications.php
@@ -1,5 +1,6 @@
<?php
+use App\Enums\ApplicationDeploymentStatus;
use App\Jobs\ApplicationDeploymentJob;
use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
@@ -29,6 +30,9 @@ function queue_application_deployment(Application $application, string $deployme
]);
if (next_queuable($server_id, $application_id)) {
+ $deployment->update([
+ 'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
+ ]);
dispatch(new ApplicationDeploymentJob(
application_deployment_queue_id: $deployment->id,
));
@@ -40,6 +44,9 @@ function queue_next_deployment(Application $application)
$server_id = $application->destination->server_id;
$next_found = ApplicationDeploymentQueue::where('server_id', $server_id)->where('status', 'queued')->get()->sortBy('created_at')->first();
if ($next_found) {
+ $next_found->update([
+ 'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
+ ]);
dispatch(new ApplicationDeploymentJob(
application_deployment_queue_id: $next_found->id,
));