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]>
42 lines
2.0 KiB
Docker
42 lines
2.0 KiB
Docker
# =============================================================================
|
|
# Radio image — liquidsoap base with icecast2 added on top.
|
|
#
|
|
# BASE CHOICE: savonet/liquidsoap:v2.3.2, pinned. Liquidsoap is by far the
|
|
# harder of the two to install (OCaml toolchain, many audio codecs), so the
|
|
# image starts from the official liquidsoap build and adds icecast2 from apt,
|
|
# rather than the other way round. Both daemons then run in one container so
|
|
# liquidsoap can reach icecast on localhost — see icecast2/entrypoint.sh.
|
|
#
|
|
# PACKAGES
|
|
# icecast2 the streaming server itself
|
|
# gettext provides `envsubst` for rendering the two config templates
|
|
# media-types the /etc/mime.types database; without it icecast serves the
|
|
# stream and its status pages with wrong content types
|
|
#
|
|
# THE USER SWITCH: apt needs root, so the image switches to root, installs,
|
|
# creates an unprivileged `radio` user, chowns everything the two daemons will
|
|
# need to write (icecast config, its logs, the music dir, the liquidsoap config
|
|
# dir) and then drops back to `radio` for the rest. Neither daemon runs as
|
|
# root, which is also why icecast.xml sets <chroot>0</chroot> — an unprivileged
|
|
# process cannot chroot anyway.
|
|
#
|
|
# The chown of /music matters even though it is mounted read-only at runtime:
|
|
# the mount inherits ownership from the host, and the directory must exist
|
|
# before the mount lands.
|
|
#
|
|
# The apt install is Debian-based and multi-arch; no platform pin needed on the Pi.
|
|
# =============================================================================
|
|
FROM savonet/liquidsoap:v2.3.2
|
|
USER root
|
|
RUN apt-get update \
|
|
&& apt-get install --yes icecast2 gettext media-types \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
RUN useradd radio
|
|
RUN mkdir -p /music /etc/liquidsoap
|
|
RUN chown -R radio:radio /etc/icecast2 /var/log/icecast2 /music /etc/liquidsoap
|
|
USER radio
|
|
COPY icecast.xml.template /etc/icecast2/icecast.xml.template
|
|
COPY stream.liq.template /etc/liquidsoap/stream.liq.template
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
ENTRYPOINT [ "/entrypoint.sh" ]
|