#11953·coolify

[Bug]: Sentinel restart loop on servers managed by a non-root SSH user (CheckAndStartSentinelJob checks run without sudo)

Author: nrondelCreated Sep 23, 2026Updated Sep 28, 2026
Labels🔍 Triage

Description and Error Message

Since upgrading to 4.3.23, Sentinel (1.0.1) on remote servers managed with a non-root SSH user (user = coolify, passwordless sudo, not in the docker group) is recreated every ~60 s. The server stays Out of sync and Coolify falls back to SSH checks, generating ~200k sudo/PAM log events per day on one server. localhost (user root) is unaffected. Network, token and Sentinel version are fine, and pushes to /api/v1/sentinel/push return 200.

Root cause

  1. CheckAndStartSentinelJob runs docker inspect coolify-sentinel and docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/version" via instant_remote_process_with_timeout. On non-root servers these commands are not sudo-wrapped: they never appear in the sudo journal, whereas StartSentinel's docker rm -f coolify-sentinel does. As the SSH user has no Docker socket access, docker inspect fails, State.Status defaults to 'exited', and the job calls StartSentinel although the container is running.
  2. StartSentinel calls sentinelHeartbeat(isReset: true), which sets sentinel_updated_at = now()->subMinutes(6000).
  3. ServerManagerJob then sees the server out of sync and dispatches ServerCheckJob every minute, which runs CheckAndStartSentinelJob again. With the default sentinel_push_interval_seconds = 60, the first push of the fresh container arrives at the same moment as the next check and loses the race, so the loop never ends.
  4. Even once in sync, the hourly CheckAndStartSentinelJob (0 * * * *) restarts Sentinel for the same reason and can re-enter the loop.

Evidence

As the SSH user on the managed server: $ id coolify uid=1002(coolify) gid=1002(coolify) groups=1002(coolify),27(sudo) $ sudo -u coolify docker inspect coolify-sentinel --format '{{.State.Status}}' permission denied while trying to connect to the docker API at unix:///var/run/docker.sock

Sudo journal on the managed server: docker rm -f coolify-sentinel every minute while out of sync, then at xx:00 once in sync. No sudo entries for the inspect or api/version commands.

servers.sentinel_updated_at for the remote servers is always ~100 h in the past (now() - 6000 min), updated on every restart. localhost shows the current time.

Container recreated at :06/:07 each minute, while tcpdump shows the first push leaving at :07.264.

Expected Behavior

  • CheckAndStartSentinelJob should run its checks with the same sudo handling as other remote commands (as instant_remote_process does), so a running, up-to-date Sentinel is not restarted on non-root servers.
  • A failed docker inspect (command error) should not be treated as a stopped container.
  • A freshly started Sentinel should get a grace period before being considered dead, e.g. honor sentinel_waiting_since + firstSentinelReportTimeoutSeconds(), and/or have Sentinel push immediately on startup, so the default 60 s push interval cannot race the 60 s check.

Steps to Reproduce

  1. Add a remote server using a non-root SSH user with passwordless sudo, not in the docker group (per the non-root setup docs).
  2. Enable Sentinel with default settings (push interval 60 s).
  3. Watch the sudo journal on the server: journalctl -t sudo -f | grep 'rm -f coolify-sentinel'. The container is recreated every ~60 s.
  4. In php artisan tinker: \DB::table('servers')->pluck('sentinel_updated_at','name'). The remote server is ~100 h in the past.
  5. Run sudo -u <ssh_user> docker inspect coolify-sentinel on the server: permission denied.
  6. Workaround check: set the push interval to 20 s, and the server becomes In sync. The hourly check still restarts Sentinel at xx:00 or add the SSH user to the docker group and reset the SSH mux sessions: the loop stops.

Example Repository URL

No response

Coolify Version

v4.3.23

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04.4 LTS

Screenshots / Visuals

No response

Additional Information

Workarounds confirmed:

  • Adding the SSH user to the docker group fixes it, even with the default 60 s push interval. Note: existing SSH multiplexed sessions keep the old groups; they must be closed (pkill -u <user> -f 'sshd: <user>') before the fix takes effect.
  • Alternatively, a 30 s push interval makes the first push land before the next check (Sentinel is still restarted hourly).

Started right after upgrading to 4.3.23 (2026-09-19); previous versions worked with the same settings.

Possibly related: #11803 (different trigger, but same effect of StartSentinel resetting the heartbeat and no grace period for the first report).