Skip to content

chore: scrub local machine details; fix unsafe deploy/setup.sh - #14

Merged
msitarzewski merged 2 commits into
mainfrom
chore/scrub-local-details-and-fix-deploy-tooling
Sep 12, 2026
Merged

chore: scrub local machine details; fix unsafe deploy/setup.sh#14
msitarzewski merged 2 commits into
mainfrom
chore/scrub-local-details-and-fix-deploy-tooling

Conversation

@msitarzewski

Copy link
Copy Markdown
Owner

Two related cleanups for a public repo: remove operator-specific details, and fix the production setup script that carried them.

1. Absolute developer paths in docs

Eight lines across docs/testing/stability-test-execution-guide.md and four memory-bank/tasks/2025-10/ docs hardcoded an absolute home-directory path embedding a username. Replaced with the ~/ form — which is what a reader should be typing anyway. Documentation only.

2. deploy/setup.sh appended to a shared Caddyfile

The script did:

sudo cat "$INSTALL_DIR/deploy/Caddyfile" >> /etc/caddy/Caddyfile

Two problems. The >> redirect runs in the caller's shell, not under sudo, so on a root-owned Caddyfile it fails outright. And where it does succeed, it mutates a config shared with every other site on the host — on a multi-tenant box a bad append takes down neighbors, not just this app.

It now writes a discrete /etc/caddy/sites/<domain>.caddy. If that directory does not exist, it prints the block and touches nothing.

3. The operator's hostname was hardcoded in four files

DOMAIN is now required input. deploy/Caddyfile is an annotated studio.example.com example, ICECAST_HOSTNAME reads ${PUBLIC_DOMAIN}, and the sample manifest points at example.com.

4. Pre-existing break in docker-compose.prod.yml

It referenced ICECAST_ADMIN_PASS and ICECAST_RELAY_PASS. Neither name exists in .env.example or the root docker-compose.yml, so two of the three :? guards hard-failed for anyone following the documented production path:

error: ICECAST_ADMIN_PASS: Set ICECAST_ADMIN_PASS

Aligned to the canonical ICECAST_*_PASSWORD names used everywhere else. All four variables now resolve against .env.example.

Other setup.sh hardening

  • preflight: node >= 18, docker compose v2, caddy, git
  • npm install --production -> npm ci --omit=dev
  • refuses to fast-forward a checkout with local modifications
  • will not overwrite an existing station-manifest.json
  • warns that the sample ships CHANGE_ME TURN credentials rather than installing them silently
  • waits for /health instead of assuming the service started

Also

deploy.sh is gitignored. An operator-local deploy script hardcodes host names, paths and ports specific to one person's infrastructure; it is not a common process for other users and does not belong in a public repo.

Testing

No runtime code changed — nothing under server/ or web/ is touched, so no redeploy is needed once this lands.

  • bash -n deploy/setup.sh clean
  • station-manifest.production.json parses as JSON
  • docker-compose.prod.yml parses as YAML, and all four ${VAR} references resolve against .env.example
  • repo scan clean for absolute developer paths, machine names, and private IPs

Git history still contains a since-removed hostname and a private LAN address from older commits. Deliberately not rewriting history — it would break every existing clone and fork for a hostname and an RFC1918 address that mean nothing outside that LAN.

🤖 Generated with Claude Code

msitarzewski and others added 2 commits September 12, 2026 11:25
Eight lines across the testing guide and four 2025-10 task docs hardcoded an
absolute home-directory path that embedded a developer's username. Replaced
with the ~/ form, which is what a reader should be typing anyway.

No behavior change; documentation only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…the domain

setup.sh appended deploy/Caddyfile onto /etc/caddy/Caddyfile. That is both
broken and unsafe: the >> redirect runs in the caller's shell rather than
under sudo, so it fails outright on a root-owned Caddyfile, and where it does
succeed it edits a config shared with every other site on the host. It now
writes a discrete /etc/caddy/sites/<domain>.caddy, and when that directory
does not exist it prints the block and touches nothing.

The operator's own hostname was hardcoded in four places. DOMAIN is now
required input; the Caddy file is an annotated example; ICECAST_HOSTNAME
reads ${PUBLIC_DOMAIN}; the sample manifest points at example.com.

Also in setup.sh: preflight checks for node>=18, docker compose v2, caddy and
git; npm install --production -> npm ci --omit=dev; refuse to fast-forward a
checkout with local modifications; do not overwrite an existing
station-manifest.json; warn that the sample ships CHANGE_ME TURN credentials;
wait for /health rather than assuming the service came up.

Fixes a pre-existing break in docker-compose.prod.yml, which referenced
ICECAST_ADMIN_PASS and ICECAST_RELAY_PASS. Neither name exists in
.env.example or the root compose file, so two of the three `:?` guards
hard-failed for anyone following the documented production path. Aligned to
the canonical ICECAST_*_PASSWORD names; all four variables now resolve.

deploy.sh is gitignored: an operator-local deploy script hardcodes host
names, paths and ports specific to one person's infrastructure and does not
belong in a public repo.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@msitarzewski
msitarzewski merged commit e700622 into main Sep 12, 2026
4 of 6 checks passed
@msitarzewski
msitarzewski deleted the chore/scrub-local-details-and-fix-deploy-tooling branch September 12, 2026 16:34
msitarzewski added a commit that referenced this pull request Sep 12, 2026
…ubmodule steps

Three latent breakages found sweeping the repo.

setup.sh could never run. PR #14 changed it to `npm ci`, but package-lock.json
is gitignored (.gitignore:6) and no lockfile is tracked, so a fresh clone died
immediately:

    npm error code EUSAGE
    npm error The `npm ci` command can only install with an existing
    package-lock.json

Reverted to `npm install --omit=dev`, which works either way. Worth deciding
separately whether this repo should commit its lockfiles — an application
normally should, for reproducible installs; ignoring them is a library
convention.

Four env vars the server reads were undocumented in .env.example: PORT,
ALLOWED_ORIGINS, ICECAST_MOUNT, ICECAST_USER. The consequential one is
ALLOWED_ORIGINS — when unset or empty EVERY origin is permitted
(server/server.js:53), which is fine for local development and wrong for a
public deployment. All four now documented with their real defaults.

Docs still instructed `git submodule update --init` for whisper.cpp. PR #13
untracked that gitlink, so the command silently does nothing and leaves users
with no whisper.cpp and no error. Corrected across the memory bank to point at
./setup-ai.sh. The 2026-05 task log keeps the old wording on purpose — it is a
record of what was true then, not instructions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant