feat(configure): auto-restart the always-on service after a self-upgrade#257
Merged
Conversation
Non-engineer operators run mureo as an always-on service and don't know how to restart it, so the post-upgrade "restart mureo configure" prompt left them stuck on the old version. Now, when (and only when) the daemon runs under an auto-start supervisor, a successful one-click upgrade restarts it automatically on the new code; a plain interactive `mureo configure` keeps the manual prompt. How: - `mureo service install` stamps MUREO_MANAGED_SERVICE=1 into the launchd plist (EnvironmentVariables) and the systemd unit (Environment=). NOT on Windows — Task Scheduler doesn't relaunch a clean exit, so that path stays manual. - `mureo.web.service.is_managed_service()` reads the marker. - `_post_upgrade` returns `restarting` in the JSON envelope and, when managed, schedules a graceful `request_stop()` then an `os._exit(0)` backstop after the response flushes; launchd KeepAlive / systemd Restart=always relaunch on the new code. (is_managed_service is imported lazily to avoid an import cycle.) - dashboard.js: on `restarting`, shows "Restarting…", polls /api/ping and reloads once the daemon has clearly restarted (version changed OR a down→up transition — robust for plugin-only upgrades), with a 60s manual fallback. The version check and "Update all" continue to cover mureo plus every installed mureo-* plugin (agency, bridges).
This was referenced Jun 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Non-engineer operators run mureo as an always-on service and don't know how to restart it, so the post-upgrade "restart
mureo configure" prompt left them stuck on the old version. This auto-restarts the daemon after a successful one-click upgrade — but only when it runs under an auto-start supervisor. A plain interactivemureo configure(terminal user) keeps the manual prompt, as requested.How
mureo service installstampsMUREO_MANAGED_SERVICE=1into the launchd plist (EnvironmentVariables) and the systemd unit (Environment=). Not on Windows — Task Scheduler doesn't relaunch a task that exits cleanly, so that path stays manual (verified by a test).mureo.web.service.is_managed_service()reads the marker._post_upgradeaddsrestartingto the/api/upgradeenvelope and, when managed, schedules a gracefulwizard.request_stop()then anos._exit(0)backstop after the response flushes. launchdKeepAlive/ systemdRestart=always(already configured) relaunch the daemon on the new code.is_managed_serviceis imported lazily to avoid a handlers→service→server→handlers cycle.restarting,dashboard.jsshows "Restarting…", pollsGET /api/ping, andlocation.reload()s once the daemon has clearly restarted — the reported version changed OR a down→up transition was seen (robust for plugin-only upgrades where the mureo version is unchanged). 60s manual fallback.The version check and "Update all" continue to cover mureo plus every installed
mureo-*plugin (agency, bridges).Test plan
is_managed_serviceenv mapping (strict== "1"), Windows has no marker,restartingflag (managed True+restart scheduled / unmanaged False+not), and the_restart_runneros._exitpath (incl. exit even whenrequest_stopraises) — exercised withtime.sleep/os._exitpatched so the suite never exits.node --checkon dashboard.js; i18n.json valid.restarting:true→ "Restarting…" → version change detected → auto-reload to a fresh page; no console errors.mureo service installonce to gain the marker (idempotent).