Files
stpweb/quartz/entrypoint.sh
T
adamfandClaude Opus 5 64df70e5d2 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]>
2026-09-16 15:57:48 +01:00

43 lines
2.0 KiB
Bash

#!/bin/sh
# =============================================================================
# quartz entrypoint — render the config, then build-and-serve the notes site.
#
# WHAT IT DOES
# Quartz turns the Obsidian vault into a static site. Its config is a
# TypeScript file that has to know the public base URL, which is only known
# at runtime, so quartz.config.ts is generated from a template on each start.
#
# THE envsubst ALLOW-LIST
# Only ${DOMAIN} is substituted. This matters more here than elsewhere: the
# template is TypeScript and full of `${...}` -shaped syntax and dollar signs
# that must NOT be touched. Restricting envsubst to a single name guarantees
# it can only ever rewrite the one intended line (baseUrl).
#
# WHY build --serve RATHER THAN A STATIC BUILD
# --serve leaves Quartz running as an HTTP server AND watching the content
# directory, so editing a note in Obsidian on the host re-renders the site
# live with no container restart. The vault is bind-mounted READ-ONLY
# (docker-compose.yml), so Quartz can watch it but never write to it.
# The trade-off is that this is a long-running Node process on a Pi rather
# than pre-built static files nginx could serve for free.
#
# ACCESS CONTROL
# None here — Quartz is wide open on its port inside app-network. The site is
# private because nginx gates /notes/ behind an `auth_request` admin check
# before proxying. Never publish this container's port to the host.
#
# ENV VARS
# DOMAIN required; becomes baseUrl "www.<DOMAIN>/notes"
# QUARTZ_PORT optional, defaults to 8080; must match the QUARTZ_PORT nginx
# builds its upstream from, or /notes/ 502s.
#
# `exec` so the Node process becomes PID 1 and receives docker's signals.
# =============================================================================
set -e
envsubst '${DOMAIN}' \
</quartz/quartz.config.ts.template \
>/quartz/quartz.config.ts
exec npx quartz build --serve --port "${QUARTZ_PORT:-8080}"