Document codebase: comments, per-area READMEs, deployment guide
Readability pass across all four areas of the stack. Comments explain why rather than what, concentrated at the points where behaviour is non-obvious: concurrency, caching, auth, scraping and nginx templating. Backend: doc comments on every exported declaration across handlers, services, models and resolvers. Resolver commentary lives inside function bodies so gqlgen does not strip it on regeneration; schema files use # comments rather than description blocks so introspection output is unchanged. Extracted the duplicated auth-cookie blocks into helpers. Frontend: header comments on every component, store and view, including STATUS: notes marking which of the parallel/legacy views are still live. Documented the non-reactive animation-state pattern, the homeData hub and the WebSocket stale-socket guard. Removed a few dead imports and named the reconnect-backoff and poll-interval constants. Python: module and function docstrings covering the Travelodge scraping contract, the deadline threading, the two-executor concurrency and the NDJSON streaming protocol. Infra: header blocks on every compose file, nginx template, Dockerfile and entrypoint, covering the config selection, envsubst allow-lists, rate-limit semantics and volume persistence. Hoisted the duplicated envsubst variable list in nginx/entrypoint.sh. New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example, backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which stated a 24h access token where main.go sets 7 days. No behaviour change. go build/vet, vite build, py_compile and docker compose config all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -1,4 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# gitea-runner/download.sh — fetch the act_runner binary for this machine.
|
||||
#
|
||||
# WHAT IT DOES
|
||||
# Downloads the correct act_runner release asset for the host CPU and drops
|
||||
# it next to this script as ./act_runner (gitignored — a binary, not source).
|
||||
#
|
||||
# WHY IT IS A SCRIPT AND NOT A CONTAINER
|
||||
# The runner executes the deploy workflow, which itself runs
|
||||
# `docker compose up -d --build` against this stack. Running it inside the
|
||||
# stack would mean a container restarting its own parent mid-job. So the
|
||||
# runner lives OUTSIDE docker, directly on the Pi, and is the one moving part
|
||||
# of this repo that docker compose does not manage.
|
||||
#
|
||||
# ARCHITECTURE SELECTION (the Raspberry Pi bit)
|
||||
# uname -m decides the asset. aarch64 is the 64-bit Pi OS case and is what
|
||||
# this deployment actually uses; armv7l covers a 32-bit Pi OS install and
|
||||
# x86_64 covers running the same script on a dev laptop. An unknown arch is a
|
||||
# hard error rather than a silent wrong download.
|
||||
#
|
||||
# VERSION is pinned so a runner upgrade is an explicit commit, never a surprise
|
||||
# on a re-run. Bump it here, delete ./act_runner, and re-run to upgrade.
|
||||
#
|
||||
# SCRIPT_DIR is resolved so the binary always lands beside the script even when
|
||||
# invoked from another directory.
|
||||
#
|
||||
# USAGE: bash gitea-runner/download.sh (run.sh calls it automatically if the
|
||||
# binary is missing)
|
||||
# =============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="0.2.11"
|
||||
|
||||
+47
-1
@@ -1,5 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# =============================================================================
|
||||
# gitea-runner/run.sh — register (once) and then run the Gitea Actions runner.
|
||||
#
|
||||
# WHAT IT DOES
|
||||
# 1. Downloads the act_runner binary if it is not already present.
|
||||
# 2. Blocks until Gitea answers on http://localhost:3000.
|
||||
# 3. Registers with Gitea the first time only.
|
||||
# 4. execs the runner daemon in the foreground.
|
||||
#
|
||||
# WHEN IT RUNS
|
||||
# On the Pi, outside docker, as a long-lived process (systemd unit or nohup).
|
||||
# It must be started from THIS directory: the script uses relative paths
|
||||
# (./act_runner, .runner) and `act_runner daemon` looks for .runner in the
|
||||
# current working directory.
|
||||
#
|
||||
# WHY IT WAITS FOR PORT 3000
|
||||
# On a Pi reboot this process and the docker stack race. Registering or
|
||||
# starting the daemon against a Gitea that is not up yet fails permanently
|
||||
# rather than retrying, so the loop polls (forever, by design — there is no
|
||||
# sensible timeout when the answer is "wait longer") until Gitea responds.
|
||||
# It targets localhost:3000, the port docker-compose.yml publishes directly,
|
||||
# NOT the public /gitea/ path through nginx — so the runner keeps working
|
||||
# even while TLS or nginx is broken.
|
||||
#
|
||||
# THE REGISTRATION TOKEN (one-shot, and easy to get wrong)
|
||||
# GITEA_RUNNER_REGISTRATION_TOKEN comes from ./.env and is generated in the
|
||||
# Gitea web UI (Site Administration -> Actions -> Runners -> Create new
|
||||
# runner). It is a single-use enrolment token, NOT a lasting credential:
|
||||
# registration exchanges it for a permanent runner identity written to the
|
||||
# .runner file (gitignored — that file IS the real credential).
|
||||
#
|
||||
# The `if [ ! -f .runner ]` guard is what makes this idempotent. Once .runner
|
||||
# exists the token is never used again and may safely be stale in .env. To
|
||||
# re-register a runner you must delete .runner AND mint a FRESH token in the
|
||||
# UI — reusing the old one will fail.
|
||||
#
|
||||
# --labels self-hosted must match `runs-on: self-hosted` in
|
||||
# .gitea/workflows/*.yaml, or jobs queue forever with no runner picking them up.
|
||||
#
|
||||
# ENV VARS
|
||||
# GITEA_RUNNER_REGISTRATION_TOKEN required for first registration only
|
||||
# GITEA_RUNNER_NAME optional, defaults to "pi-runner"
|
||||
# (this script does not source .env itself — export them or use an
|
||||
# EnvironmentFile in the systemd unit)
|
||||
#
|
||||
# Diagnostics go to stderr so stdout stays clean for the daemon's own output.
|
||||
# =============================================================================
|
||||
if [ ! -f ./act_runner ]; then
|
||||
echo "act_runner binary not found. Downloading..." >&2
|
||||
bash "$(dirname "$0")/download.sh"
|
||||
|
||||
Reference in New Issue
Block a user