Repository navigation
Updates: a server can keep itself on the newest commit - #30
Open
TeleporterGuy wants to merge 1 commit into
Open
TeleporterGuy wants to merge 1 commit into
TeleporterGuy wants to merge 1 commit into
Conversation
deploy/auto-update.sh runs the "Upgrading" steps (backup, pull, build, up -d) when the tracked branch has moved, then waits for the server to log that it is listening. A failed build leaves the running containers alone. A server that does not come up is put back on the images it ran before (kept under a :before-update tag), and that commit is skipped until the branch moves past it. --install writes a systemd service and nightly timer that run as the checkout's owner; --uninstall removes them. Co-Authored-By: Claude Opus 5.5 <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
A server install had no way to update itself. Someone had to SSH in and run the four "Upgrading" commands by hand. This adds an opt-in nightly auto-update for servers, as a counterpart to the desktop self-update (#19).
deploy/auto-update.sh: one run is the documented upgrade (backup,git pull,docker compose build,up -d), plus the checks a person would make by eye:listening onwithin 180s, or stops right after: it retags the images it ran before (saved as:before-updatebefore building), so going back is a restart, not a rebuild..auto-update-failedand skipped until the branch moves past it. A broken commit onmaincosts one restart, not one every night.flocklets only one through, so a manual run can't race the timer.--install/--uninstallwrite and remove a systemd service plus timer: nightly at 04:00 with a 30-minute random delay, andPersistent=trueso a VM that was off catches up. The service runs as the checkout's owner, not root. Someone who isn't a Linux expert only needssudo /opt/stem/deploy/auto-update.sh --install..env:STEM_BACKUP_DIR,STEM_KEEP_BACKUPS,STEM_UPDATE_TIMEOUT.main(), which is called on the last line, so bash has read the entire file beforegit pullcan replace it.docs/running-on-a-server.md, plus a 0.7.2 (Unreleased) release-notes entry..gitignorenow covers the defaultbackups/, the lock file and the failed-commit marker.Testing
All runs were against a real Tailscale server install (Ubuntu 24.04, systemd 255, Docker Compose v2) at
/opt/stem:up to dateand exits 0.build <sha>in the server log matches the new commit, exits 0 in about 15s with cached layers.StartedAt.STEM_UPDATE_TIMEOUT=1): rolled back to the previous images and commit, the server came back on the old build, exit 1. The next run printedskipping <sha>: it did not come up last timeand exited 0. Removing the marker let the update go through.exportrefuses to overwrite and the run stopped safely). Archive names now include seconds.--install: the unit files it writes, generated into a temp dir, passsystemd-analyze verify. Not tested: an actual install on a host, because the test server needs a sudo password. That's worth onesudo … --installplussystemctl start stem-auto-update.serviceafter merge.bash -nis clean.🤖 Generated with Claude Code