Add restart.sh for routine server changes - #13
Merged
Conversation
bootstrap-server.sh is written for a host that has never run the stack: it checks DNS, the public IP and the token before starting anything. Those answer "can this host ever work", and re-running them to pick up one new repo in JQ_REPOS is both slow and misleading about what is being verified. restart.sh is the everyday path. It brings the stack up with both compose files - naming only the server file would leave Caddy unmanaged, holding 80 and 443 - and re-runs the preflight at the end, because the setting that changes most often is the fleet, and the fleet is what can turn a safe board unsafe. It also waits for the collector to start serving :9109 before the preflight runs. The collector publishes metrics only once its first GitHub refresh has finished, which takes ~17s for a fleet of nine, so bootstrap-server.sh can report "collector exported no repos" on a stack that is merely still starting - a failure that reads as a safety problem but is a race. Co-Authored-By: Claude Opus 5 (1M context) <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.
Adds
scripts/restart.sh— the everyday counterpart tobootstrap-server.sh.Why
bootstrap-server.shis written for a host that has never run the stack: it checks DNS, the public IP and the GitHub token before starting anything. Re-running all that to pick up one new repo inJQ_REPOSis slow, and it reports on questions that were settled the first time.What it does differently
docker-compose.server.ymlleaves Caddy unmanaged, and a laterdownwould strand it holding 80 and 443.up -d --build, not--force-recreate. Compose recreates only the containers whose image or environment actually differs, so a.envedit restarts the collector while Grafana and Caddy keep serving.:9109only once that refresh finishes (~17s for a fleet of nine), andcheck-public-safe.shreads that endpoint to see which repos are exported. Run it too early and it reportscollector exported no repos— a failure that reads as a safety problem but is a race. This was hit on a live server today.It deliberately does not
git pull— a script that silently moves you to new code is not a restart. The README documentsgit pull && ./scripts/restart.shfor that.Testing
Syntax-checked with
bash -n; not exercised against a live server, as this checkout has no host. Theexec -T collectorprobe is the part most likely to need adjustment in practice.🤖 Generated with Claude Code