mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-24 23:40:16 -05:00
fix(sentinel): restore hourly version checks for enabled servers
Dispatch Sentinel checks hourly for eligible servers, including healthy installations, while continuing to exclude build servers.
This commit is contained in:
@@ -166,6 +166,12 @@ class ServerManagerJob implements ShouldBeEncrypted, ShouldQueue
|
||||
}
|
||||
}
|
||||
|
||||
if ($server->isSentinelEnabled()
|
||||
&& shouldRunCronNow('0 * * * *', $serverTimezone, "sentinel-version-check:{$server->id}", $this->executionTime)
|
||||
) {
|
||||
CheckAndStartSentinelJob::dispatch($server);
|
||||
}
|
||||
|
||||
// Dispatch ServerStorageCheckJob if due (only when Sentinel is out of sync or disabled)
|
||||
// When Sentinel is active, PushServerUpdateJob handles storage checks with real-time data
|
||||
if ($sentinelOutOfSync) {
|
||||
|
||||
@@ -13,6 +13,7 @@ uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
Queue::fake();
|
||||
InstanceSettings::forceCreate(['id' => 0]);
|
||||
|
||||
// Create user (which automatically creates a team)
|
||||
$user = User::factory()->create();
|
||||
@@ -123,10 +124,9 @@ it('respects server timezone when checking sentinel updates', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not dispatch sentinel check for servers without sentinel enabled', function () {
|
||||
// Disable sentinel
|
||||
it('does not dispatch sentinel check for build servers', function () {
|
||||
$this->server->settings->update([
|
||||
'is_sentinel_enabled' => false,
|
||||
'is_build_server' => true,
|
||||
]);
|
||||
|
||||
$instanceSettings = InstanceSettings::first();
|
||||
@@ -144,13 +144,13 @@ it('does not dispatch sentinel check for servers without sentinel enabled', func
|
||||
Queue::assertNotPushed(CheckAndStartSentinelJob::class);
|
||||
});
|
||||
|
||||
it('handles multiple servers with different sentinel configurations', function () {
|
||||
// Create a second server with sentinel disabled
|
||||
it('handles multiple servers with different sentinel eligibility', function () {
|
||||
// Create a second server that cannot run Sentinel
|
||||
$server2 = Server::factory()->create([
|
||||
'team_id' => $this->team->id,
|
||||
]);
|
||||
$server2->settings->update([
|
||||
'is_sentinel_enabled' => false,
|
||||
'is_build_server' => true,
|
||||
'server_timezone' => 'UTC',
|
||||
]);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ afterEach(function () {
|
||||
Carbon::setTestNow();
|
||||
});
|
||||
|
||||
it('does not dispatch CheckAndStartSentinelJob hourly anymore', function () {
|
||||
it('dispatches an hourly Sentinel version check for a healthy Sentinel', function () {
|
||||
$settings = Mockery::mock(InstanceSettings::class);
|
||||
$settings->instance_timezone = 'UTC';
|
||||
$this->app->instance(InstanceSettings::class, $settings);
|
||||
@@ -39,8 +39,9 @@ it('does not dispatch CheckAndStartSentinelJob hourly anymore', function () {
|
||||
$job = new ServerManagerJob;
|
||||
$job->handle();
|
||||
|
||||
// Hourly CheckAndStartSentinelJob dispatch was removed — ServerCheckJob handles it when Sentinel is out of sync
|
||||
Queue::assertNotPushed(CheckAndStartSentinelJob::class);
|
||||
Queue::assertPushed(CheckAndStartSentinelJob::class, function ($job) use ($server) {
|
||||
return $job->server->id === $server->id;
|
||||
});
|
||||
});
|
||||
|
||||
it('does not schedule periodic Sentinel restart checks', function () {
|
||||
|
||||
Reference in New Issue
Block a user