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.

do not use sentinel for container details for now

Andras Bacsaiba40f93386f5
diff --git a/app/Actions/Docker/GetContainersStatus.php b/app/Actions/Docker/GetContainersStatus.php
index 881e7de8dc..f2715fe851 100644
--- a/app/Actions/Docker/GetContainersStatus.php
+++ b/app/Actions/Docker/GetContainersStatus.php
@@ -45,36 +45,34 @@ class GetContainersStatus
$this->applications = $this->applications->filter(function ($value, $key) use ($skip_these_applications) {
return !$skip_these_applications->pluck('id')->contains($value->id);
});
- if ($this->server->isSwarm()) {
- $this->old_way();
- } else {
- if (!$this->server->is_metrics_enabled) {
- $this->old_way();
- return;
- }
- $sentinel_found = instant_remote_process(["docker inspect coolify-sentinel"], $this->server, false);
- $sentinel_found = json_decode($sentinel_found, true);
- $status = data_get($sentinel_found, '0.State.Status', 'exited');
- if ($status === 'running') {
- ray('Checking with Sentinel');
- $this->sentinel();
- } else {
- ray('Checking the Old way');
- $this->old_way();
- }
- }
+ $this->old_way();
+ // if ($this->server->isSwarm()) {
+ // $this->old_way();
+ // } else {
+ // if (!$this->server->is_metrics_enabled) {
+ // $this->old_way();
+ // return;
+ // }
+ // $sentinel_found = instant_remote_process(["docker inspect coolify-sentinel"], $this->server, false);
+ // $sentinel_found = json_decode($sentinel_found, true);
+ // $status = data_get($sentinel_found, '0.State.Status', 'exited');
+ // if ($status === 'running') {
+ // ray('Checking with Sentinel');
+ // $this->sentinel();
+ // } else {
+ // ray('Checking the Old way');
+ // $this->old_way();
+ // }
+ // }
}
private function sentinel()
{
try {
- $containers = instant_remote_process(['docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/containers"'], $this->server, false);
- if (is_null($containers)) {
+ $containers = $this->server->getContainers();
+ if ($containers->count() === 0) {
return;
}
- $containers = data_get(json_decode($containers, true), 'containers', []);
- $containers = collect($containers);
-
$databases = $this->server->databases();
$services = $this->server->services()->get();
$previews = $this->server->previews();
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 16659e2b8b..4d201bba3b 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -5,10 +5,12 @@ namespace App\Models;
use App\Actions\Server\InstallDocker;
use App\Actions\Server\StartSentinel;
use App\Enums\ProxyTypes;
+use App\Jobs\PullSentinelImageJob;
use App\Notifications\Server\Revived;
use App\Notifications\Server\Unreachable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
+use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
@@ -463,7 +465,8 @@ $schema://$host {
Storage::disk('ssh-keys')->delete($sshKeyFileLocation);
Storage::disk('ssh-mux')->delete($this->muxFilename());
}
- public function checkSentinel() {
+ 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);
@@ -471,7 +474,7 @@ $schema://$host {
$status = data_get($sentinel_found, '0.State.Status', 'exited');
if ($status !== 'running') {
ray('Sentinel is not running, starting it...');
- StartSentinel::dispatch($this);
+ PullSentinelImageJob::dispatch($this);
} else {
ray('Sentinel is running');
}
@@ -563,7 +566,36 @@ $schema://$host {
{
return instant_remote_process(["docker start $id"], $this);
}
- public function loadUnmanagedContainers()
+ public function getContainers(): Collection
+ {
+ $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') {
+ $containers = instant_remote_process(['docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/containers"'], $this, false);
+ if (is_null($containers)) {
+ return collect([]);
+ }
+ $containers = data_get(json_decode($containers, true), 'containers', []);
+ return collect($containers);
+ } else {
+ if ($this->isSwarm()) {
+ $containers = instant_remote_process(["docker service inspect $(docker service ls -q) --format '{{json .}}'"], $this, false);
+ } else {
+ $containers = instant_remote_process(["docker container ls -q"], $this, false);
+ if (!$containers) {
+ return collect([]);
+ }
+ $containers = instant_remote_process(["docker container inspect $(docker container ls -q) --format '{{json .}}'"], $this, false);
+ }
+ if (is_null($containers)) {
+ return collect([]);
+ }
+
+ return format_docker_command_output_to_json($containers);
+ }
+ }
+ public function loadUnmanagedContainers(): Collection
{
if ($this->isFunctional()) {
$containers = instant_remote_process(["docker ps -a --format '{{json .}}'"], $this);
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 2594822ced..91e90b989d 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -19,12 +19,6 @@ services:
PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
volumes:
- .:/var/www/html/:cached
- sentinel:
- ports:
- - "127.0.0.1:8888:8888"
- volumes:
- - /var/run/docker.sock:/var/run/docker.sock:ro
- - .:/var/www/html/:cached
postgres:
pull_policy: always
ports:
diff --git a/resources/views/livewire/server/resources.blade.php b/resources/views/livewire/server/resources.blade.php
index a5ff69ea17..29648cafe0 100644
--- a/resources/views/livewire/server/resources.blade.php
+++ b/resources/views/livewire/server/resources.blade.php
@@ -1,7 +1,7 @@
<div>
<x-server.navbar :server="$server" :parameters="$parameters" />
- <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'managed' }" class="flex h-full flex-col md:flex-row gap-8">
- <div class="flex md:flex-col gap-4 flex-row">
+ <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'managed' }" class="flex flex-col h-full gap-8 md:flex-row">
+ <div class="flex flex-row gap-4 md:flex-col">
<a :class="activeTab === 'managed' && 'dark:text-white'"
@click.prevent="activeTab = 'managed'; window.location.hash = 'managed'" href="#">Managed</a>
<a :class="activeTab === 'unmanaged' && 'dark:text-white'"