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.

chore: Add isAnyDeploymentInprogress function to check if any deployments are in progress

Andras Bacsai8731d0416b77
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 7828bf47fa..9a09adee12 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -1,5 +1,7 @@
<?php
+use App\Enums\ApplicationDeploymentStatus;
+use App\Models\ApplicationDeploymentQueue;
use App\Jobs\ServerFilesFromServerJob;
use App\Models\Application;
use App\Models\ApplicationPreview;
@@ -2268,3 +2270,14 @@ function get_public_ips()
echo "Error: {$e->getMessage()}\n";
}
}
+
+function isAnyDeploymentInprogress() {
+ // Only use it in the deployment script
+ $count = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS, ApplicationDeploymentStatus::QUEUED])->count();
+ if ($count > 0) {
+ echo "There are $count deployments in progress. Exiting...\n";
+ exit(1);
+ }
+ echo "No deployments in progress.\n";
+ exit(0);
+}
diff --git a/scripts/cloud_upgrade.sh b/scripts/cloud_upgrade.sh
new file mode 100644
index 0000000000..fc1bc959a7
--- /dev/null
+++ b/scripts/cloud_upgrade.sh
@@ -0,0 +1,9 @@
+set -e
+export IMAGE=$1
+docker exec coolify sh -c "php artisan tinker --execute='isAnyDeploymentInprogress()'"
+docker system prune -af
+docker compose pull
+read -p "Press Enter to update Coolify to $IMAGE..." </dev/tty
+docker compose up --remove-orphans --force-recreate -d --wait
+echo $IMAGE > last_version
+docker compose logs -f