Stop the ragnar.service via a systemd-run transient unit. Because Ragnar is stopping *itself*, a direct systemctl stop kills the thread before status files and config can be persisted. We use systemd-run so the stop command runs in its own cgroup — completely outside ragnar.service
(delay: int = 1)
| 2843 | # Cache of the last peer poll. The UI reads this rather than triggering a fan-out |
| 2844 | # on every page render — a 10-unit mesh must not cost 10 HTTP round trips per |
| 2845 | # dashboard refresh. |
| 2846 | _mesh_peer_health = {} |
| 2847 | _mesh_last_poll = 0.0 |
| 2848 | # Per-peer set of alert keys already folded into the incident engine. Peers |
| 2849 | # serve a rolling window, so every poll re-sends what we saw last cycle. |
| 2850 | _mesh_alert_seen = {} |
| 2851 | # Per-peer cached security findings (vulns/integrity/watchtower/incidents), |
| 2852 | # refreshed each poll and rendered as the fleet findings view. |
| 2853 | _mesh_peer_findings = {} |
| 2854 | # Live health of the poll LOOP itself, surfaced in the Mesh tab so a stalled or |
| 2855 | # crashing poller is visible in the browser instead of only in the logs. This is |
| 2856 | # the difference between "sees peers but never polls" (a loop problem) and "polls |
| 2857 | # but the peer refuses" (a peer problem) — the UI could not tell them apart. |
| 2858 | _mesh_poll_state = {'loop_started': False, 'last_ok_at': 0.0, |
| 2859 | 'last_error': '', 'last_summary': ''} |
| 2860 | |
| 2861 | # Tailscale-install-from-the-UI state. Installing pulls a vendor script and runs |
| 2862 | # apt, so it takes a minute or two — run it in the background and let the tab |
| 2863 | # poll, exactly like the sensing-backend install. |
| 2864 | MESH_INSTALL_SCRIPT = os.path.join(shared_data.currentdir, 'scripts', 'setup_mesh.sh') |
| 2865 | MESH_INSTALL_LOG = os.path.join(shared_data.currentdir, 'data', 'mesh_install.log') |
| 2866 | _mesh_install_lock = threading.Lock() |
| 2867 | _mesh_installing = False |
| 2868 | |
| 2869 | |
| 2870 | def _run_mesh_install(): |
| 2871 | """Install the Tailscale client in the background, logging to MESH_INSTALL_LOG. |
nothing calls this directly
no test coverage detected