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.

feat(sentinel): add support for custom Docker images in StartSentinel and related methods

Andras Bacsai4027c1426c18
diff --git a/app/Actions/Server/StartSentinel.php b/app/Actions/Server/StartSentinel.php
index dd1a7ed536..1f248aec1f 100644
--- a/app/Actions/Server/StartSentinel.php
+++ b/app/Actions/Server/StartSentinel.php
@@ -10,7 +10,7 @@ class StartSentinel
{
use AsAction;
- public function handle(Server $server, bool $restart = false, ?string $latestVersion = null)
+ public function handle(Server $server, bool $restart = false, ?string $latestVersion = null, ?string $customImage = null)
{
if ($server->isSwarm() || $server->isBuildServer()) {
return;
@@ -44,7 +44,9 @@ class StartSentinel
];
if (isDev()) {
// data_set($environments, 'DEBUG', 'true');
- // $image = 'sentinel';
+ if ($customImage && ! empty($customImage)) {
+ $image = $customImage;
+ }
$mountDir = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/sentinel';
}
$dockerEnvironments = '-e "'.implode('" -e "', array_map(fn ($key, $value) => "$key=$value", array_keys($environments), $environments)).'"';
diff --git a/app/Livewire/Server/Show.php b/app/Livewire/Server/Show.php
index f4ae6dd7e8..c95cc6122f 100644
--- a/app/Livewire/Server/Show.php
+++ b/app/Livewire/Server/Show.php
@@ -63,6 +63,8 @@ class Show extends Component
public bool $isSentinelDebugEnabled;
+ public ?string $sentinelCustomDockerImage = null;
+
public string $serverTimezone;
public function getListeners()
@@ -267,7 +269,8 @@ class Show extends Component
{
try {
$this->authorize('manageSentinel', $this->server);
- $this->server->restartSentinel();
+ $customImage = isDev() ? $this->sentinelCustomDockerImage : null;
+ $this->server->restartSentinel($customImage);
$this->dispatch('success', 'Restarting Sentinel.');
} catch (\Throwable $e) {
return handleError($e, $this);
@@ -300,7 +303,8 @@ class Show extends Component
try {
$this->authorize('manageSentinel', $this->server);
if ($value === true) {
- StartSentinel::run($this->server, true);
+ $customImage = isDev() ? $this->sentinelCustomDockerImage : null;
+ StartSentinel::run($this->server, true, null, $customImage);
} else {
$this->isMetricsEnabled = false;
$this->isSentinelDebugEnabled = false;
diff --git a/app/Models/Server.php b/app/Models/Server.php
index b417cea499..ae7f3f6c1a 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -1252,13 +1252,13 @@ $schema://$host {
return str($this->ip)->contains(':');
}
- public function restartSentinel(bool $async = true)
+ public function restartSentinel(?string $customImage = null, bool $async = true)
{
try {
if ($async) {
- StartSentinel::dispatch($this, true);
+ StartSentinel::dispatch($this, true, null, $customImage);
} else {
- StartSentinel::run($this, true);
+ StartSentinel::run($this, true, null, $customImage);
}
} catch (\Throwable $e) {
return handleError($e);