@foreach ($deployments as $deployment)
-
data_get($deployment, 'status') === 'queued',
- 'border-yellow-500' => data_get($deployment, 'status') === 'in_progress',
+ 'dark:border-yellow-500' =>
+ data_get($deployment, 'status') === 'in_progress',
])>
-
-
-
- {{ data_get($deployment, 'application_name') }}
-
-
- {{ str(data_get($deployment, 'status'))->headline() }}
-
+
+
+ {{ data_get($deployment, 'application_name') }}
-
-
-
+
+ {{ str(data_get($deployment, 'status'))->headline() }}
+
+
+
+
@endforeach
@empty
diff --git a/resources/views/livewire/tags/index.blade.php b/resources/views/livewire/tags/index.blade.php
index 1fd62cefe..f91d4f00e 100644
--- a/resources/views/livewire/tags/index.blade.php
+++ b/resources/views/livewire/tags/index.blade.php
@@ -2,7 +2,7 @@
Tags
Tags help you to perform actions on multiple resources.
-
+
@if ($tags->count() === 0)
No tags yet defined yet. Go to a resource and add a tag there.
@else
From 331cad276e8b801b6f9842821b2a1d1c64c075ea Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Wed, 8 May 2024 10:36:38 +0200
Subject: [PATCH 10/38] chore: Refactor ApplicationDeploymentJob.php for
improved readability and maintainability
---
app/Jobs/ApplicationDeploymentJob.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 0645b1fab..69bfa29d0 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -1022,7 +1022,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
"command" => "docker rm -f {$this->deployment_uuid}",
"ignore_errors" => true,
"hidden" => true
- ],
+ ]
+ );
+ $this->execute_remote_command(
[
$runCommand,
"hidden" => true,
From 2ea27acddeea955264030066e22c2f13e3f0d863 Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Wed, 8 May 2024 12:29:36 +0200
Subject: [PATCH 11/38] add cloud scripts
---
other/scripts/get-subs.php | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 other/scripts/get-subs.php
diff --git a/other/scripts/get-subs.php b/other/scripts/get-subs.php
new file mode 100644
index 000000000..3a23fc073
--- /dev/null
+++ b/other/scripts/get-subs.php
@@ -0,0 +1,11 @@
+$handle = fopen("/tmp/export.csv", "w");
+App\Models\Team::chunk(100, function ($teams) use ($handle) {
+ foreach ($teams as $team) {
+ if ($team->subscription->stripe_invoice_paid == true) {
+ foreach ($team->members as $member) {
+ fputcsv($handle, [$member->email, $member->name], ",");
+ }
+ }
+ }
+});
+fclose($handle);
From c618e58a117b0b91bd685e8340f619e9ee1c938d Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Wed, 8 May 2024 14:22:35 +0200
Subject: [PATCH 12/38] feat: start Sentinel on servers.
---
app/Actions/Docker/GetContainersStatus.php | 4 ++--
app/Actions/Server/StartSentinel.php | 15 +++++++++++++++
app/Jobs/ServerStatusJob.php | 1 +
app/Models/Server.php | 15 +++++++++++++++
docker-compose.prod.yml | 3 +++
5 files changed, 36 insertions(+), 2 deletions(-)
create mode 100644 app/Actions/Server/StartSentinel.php
diff --git a/app/Actions/Docker/GetContainersStatus.php b/app/Actions/Docker/GetContainersStatus.php
index d606c7532..80f8c7d98 100644
--- a/app/Actions/Docker/GetContainersStatus.php
+++ b/app/Actions/Docker/GetContainersStatus.php
@@ -55,10 +55,10 @@ class GetContainersStatus
$sentinel_found = json_decode($sentinel_found, true);
$status = data_get($sentinel_found, '0.State.Status', 'exited');
if ($status === 'running') {
- ray('Sentinel');
+ ray('Checking with Sentinel');
$this->sentinel();
} else {
- ray('Old way');
+ ray('Checking the Old way');
$this->old_way();
}
}
diff --git a/app/Actions/Server/StartSentinel.php b/app/Actions/Server/StartSentinel.php
new file mode 100644
index 000000000..b8b89a706
--- /dev/null
+++ b/app/Actions/Server/StartSentinel.php
@@ -0,0 +1,15 @@
+server->isFunctional()) {
$this->cleanup(notify: false);
$this->removeCoolifyYaml();
+ $this->server->checkSentinel();
}
} catch (\Throwable $e) {
send_internal_notification('ServerStatusJob failed with: ' . $e->getMessage());
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 19da8d784..16659e2b8 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -3,6 +3,7 @@
namespace App\Models;
use App\Actions\Server\InstallDocker;
+use App\Actions\Server\StartSentinel;
use App\Enums\ProxyTypes;
use App\Notifications\Server\Revived;
use App\Notifications\Server\Unreachable;
@@ -462,6 +463,20 @@ $schema://$host {
Storage::disk('ssh-keys')->delete($sshKeyFileLocation);
Storage::disk('ssh-mux')->delete($this->muxFilename());
}
+ public function checkSentinel() {
+ ray("Checking sentinel on server: {$this->name}");
+ if ($this->is_metrics_enabled) {
+ $sentinel_found = instant_remote_process(["docker inspect coolify-sentinel"], $this, false);
+ $sentinel_found = json_decode($sentinel_found, true);
+ $status = data_get($sentinel_found, '0.State.Status', 'exited');
+ if ($status !== 'running') {
+ ray('Sentinel is not running, starting it...');
+ StartSentinel::dispatch($this);
+ } else {
+ ray('Sentinel is running');
+ }
+ }
+ }
public function isServerReady(int $tries = 3)
{
if ($this->skipServer()) {
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 57dedea92..b934d8222 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -112,6 +112,9 @@ services:
- "127.0.0.1:8888:8888"
healthcheck:
test: curl --fail http://127.0.0.1:8888/api/health || exit 1
+ interval: 10s
+ retries: 2
+ timeout: 5s
postgres:
volumes:
- coolify-db:/var/lib/postgresql/data
From f6396f2e747fed77459c87e7d67d0b007325f84f Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Wed, 8 May 2024 14:42:45 +0200
Subject: [PATCH 13/38] fix: turn off hc for dockerimage/docker base
deployments by default fix: loading github app
---
app/Livewire/Project/New/GithubPrivateRepository.php | 5 ++++-
.../Project/New/GithubPrivateRepositoryDeployKey.php | 10 ++++++----
app/Livewire/Project/New/PublicGitRepository.php | 3 +++
.../project/new/github-private-repository.blade.php | 6 ++++--
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/app/Livewire/Project/New/GithubPrivateRepository.php b/app/Livewire/Project/New/GithubPrivateRepository.php
index 322fd4a4e..58e3fe586 100644
--- a/app/Livewire/Project/New/GithubPrivateRepository.php
+++ b/app/Livewire/Project/New/GithubPrivateRepository.php
@@ -150,7 +150,7 @@ class GithubPrivateRepository extends Component
'repository_project_id' => $this->selected_repository_id,
'git_repository' => "{$this->selected_repository_owner}/{$this->selected_repository_repo}",
'git_branch' => $this->selected_branch_name,
- 'build_pack' => 'nixpacks',
+ 'build_pack' => $this->build_pack,
'ports_exposes' => $this->port,
'publish_directory' => $this->publish_directory,
'environment_id' => $environment->id,
@@ -162,6 +162,9 @@ class GithubPrivateRepository extends Component
$application->settings->is_static = $this->is_static;
$application->settings->save();
+ if ($this->build_pack === 'dockerfile' || $this->build_pack === 'dockerimage') {
+ $application->health_check_enabled = false;
+ }
$fqdn = generateFqdn($destination->server, $application->uuid);
$application->fqdn = $fqdn;
diff --git a/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php b/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
index ad52b9070..691b246fd 100644
--- a/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
+++ b/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
@@ -19,7 +19,7 @@ class GithubPrivateRepositoryDeployKey extends Component
public $current_step = 'private_keys';
public $parameters;
public $query;
- public $private_keys =[];
+ public $private_keys = [];
public int $private_key_id;
public int $port = 3000;
@@ -125,7 +125,7 @@ class GithubPrivateRepositoryDeployKey extends Component
'name' => generate_random_name(),
'git_repository' => $this->git_repository,
'git_branch' => $this->branch,
- 'build_pack' => 'nixpacks',
+ 'build_pack' => $this->build_pack,
'ports_exposes' => $this->port,
'publish_directory' => $this->publish_directory,
'environment_id' => $environment->id,
@@ -138,7 +138,7 @@ class GithubPrivateRepositoryDeployKey extends Component
'name' => generate_random_name(),
'git_repository' => $this->git_repository,
'git_branch' => $this->branch,
- 'build_pack' => 'nixpacks',
+ 'build_pack' => $this->build_pack,
'ports_exposes' => $this->port,
'publish_directory' => $this->publish_directory,
'environment_id' => $environment->id,
@@ -149,7 +149,9 @@ class GithubPrivateRepositoryDeployKey extends Component
'source_type' => $this->git_source->getMorphClass()
];
}
-
+ if ($this->build_pack === 'dockerfile' || $this->build_pack === 'dockerimage') {
+ $application_init['health_check_enabled'] = false;
+ }
$application = Application::create($application_init);
$application->settings->is_static = $this->is_static;
$application->settings->save();
diff --git a/app/Livewire/Project/New/PublicGitRepository.php b/app/Livewire/Project/New/PublicGitRepository.php
index b71a0b670..f4f3008d4 100644
--- a/app/Livewire/Project/New/PublicGitRepository.php
+++ b/app/Livewire/Project/New/PublicGitRepository.php
@@ -205,6 +205,9 @@ class PublicGitRepository extends Component
];
}
+ if ($this->build_pack === 'dockerfile' || $this->build_pack === 'dockerimage') {
+ $application_init['health_check_enabled'] = false;
+ }
$application = Application::create($application_init);
$application->settings->is_static = $this->is_static;
diff --git a/resources/views/livewire/project/new/github-private-repository.blade.php b/resources/views/livewire/project/new/github-private-repository.blade.php
index 21ffb2f67..f5df598db 100644
--- a/resources/views/livewire/project/new/github-private-repository.blade.php
+++ b/resources/views/livewire/project/new/github-private-repository.blade.php
@@ -33,14 +33,16 @@
+
+
+
@endforeach
@endif
@if ($current_step === 'repository')
@if ($repositories->count() > 0)