Persist runner state across restarts (stop /tmp wipe)#1
Merged
Conversation
The runner stored compose files and .env data in /tmp while the systemd unit ran with PrivateTmp=true, which gives the service a fresh tmpfs on every (re)start. As a result, compose projects and other deploy artifacts were destroyed whenever the runner restarted. - Move compose projects from /tmp to /var/lib/lockethq/compose/<project>, matching the existing persistent convention used by the proxy module. - Set PrivateTmp=false and add StateDirectory=lockethq in the systemd unit so /var/lib/lockethq is created/owned by systemd and never cleared on restart. - "Update runner" now re-pushes the systemd unit and runs daemon-reload before restart, so unit changes reach already-installed servers. - Add a best-effort startup migration that moves any leftover /tmp/lockethq-compose-* projects into the persistent location, with a recursive copy fallback for cross-filesystem (EXDEV) moves. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`cargo check --workspace` compiles the Tauri app crate, whose build script resolves the `binaries/*` resource glob from tauri.conf.json. Those runner binaries are gitignored release artifacts, so in CI the glob matched nothing and the build script failed with "glob pattern binaries/* ... didn't match any files" — CI had been red on main for this reason regardless of the change under test. Build the runner and stage it at app/src-tauri/binaries/ before the check so the bundled resource genuinely exists. This also verifies the runner compiles to a binary as a side effect. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
The runner wrote compose files and
.envdata into/tmpwhile its systemd unit ran withPrivateTmp=true. A private/tmpis a fresh tmpfs on every (re)start, so compose projects and other deploy artifacts were destroyed whenever the runner restarted. This moves all runner-owned state to a persistent location and ensures it survives restarts.Changes
/tmp—compose_upandcompose_up_streamnow write to/var/lib/lockethq/compose/<project>/instead ofstd::env::temp_dir(), matching the existing persistent convention already used by the proxy module (/var/lib/lockethq/traefik).PrivateTmp=true→false, and addedStateDirectory=lockethqso systemd creates/owns/var/lib/lockethqand never clears it on restart.ProtectSystem=fullleaves/varwritable, so no extraReadWritePathsis needed.update_runnerpreviously only swapped the binary and restarted. It now also re-uploads the systemd unit (sameinclude_str!source as a fresh install) and runsdaemon-reloadbeforerestart, so unit changes reach already-installed servers.migrate_legacy_compose_dirs()runs on boot, moving any leftover/tmp/lockethq-compose-*projects into the persistent location. Usesrenamewith a recursive copy + delete fallback (tmpfs → disk failsrenamewithEXDEV). Fully best-effort: errors are logged and skipped so a bad entry never blocks startup.Also verified (no change needed)
Detection of containers not created by LocketHQ already works:
list_containerscalls Docker withall: trueand no label filter, so every container on the host is returned regardless of who created it, and the frontend renders them all.Reviewer notes
PrivateTmp=truerunners already wiped/tmpon restart). The durable fix for everyone is the new unit + new compose location, both delivered by the updated "Update runner" action.mutin docker.rs, unusedarchfield) are pre-existing and unrelated.🤖 Generated with Claude Code