Skip to content

Commit

Permalink
chore: Add isAnyDeploymentInprogress function to check if any deploym…
Browse files Browse the repository at this point in the history
…ents are in progress
  • Loading branch information
andrasbacsai committed Jun 11, 2024
1 parent d051514 commit 8731d04
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bootstrap/helpers/shared.php
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
9 changes: 9 additions & 0 deletions scripts/cloud_upgrade.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8731d04

Please sign in to comment.