Files
christianandClaude Opus 5 c9eef0672c Church Translate, as it runs at the campuses
Live sermon translation into 100+ languages, running entirely on one Mac per
campus: audio in, voice detection, Whisper on the GPU, NLLB-200 in its own
process, and a built-in web server the congregation reads from on their
phones. No audio leaves the building.

This is the source only. What used to sit beside it — 14 GB of speech and
translation models, 8 GB of voice bundles, 6 GB of natural voices, the Electron
caches, and the app data holding the operator PIN and every service transcript
— is machine state and downloaded assets, and stays in the NAS backup where it
belongs. The vendored node, cloudflared and Windows ffmpeg binaries are out too
(533 MB, re-fetched for packaging); the browser-side runtime beside them is
kept, so a checkout still serves the congregation page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 15:41:21 -04:00

59 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
#
# Take the translation server off the NAS.
#
# The app hosts its own server now — each campus runs a self-contained copy —
# so nothing needs to live on the NAS any more.
#
# Stops and removes the container and its image. Deliberately LEAVES
# /volume2/docker/church-translate/data alone: it holds the service transcripts,
# and deleting those is not a decision a cleanup script gets to make.
#
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
NAS_HOST="${NAS_HOST:-10.1.1.5}"; NAS_USER="${NAS_USER:-Christian}"
NAS_PATH="${NAS_PATH:-/volume2/docker/church-translate}"
CRED_FILE="$HOME/.church-translate-deploy"
LEGACY="$HOME/Documents/recurring-checklist-app/build-deploy.sh"
[ -z "${NAS_PASS:-}" ] && [ -r "$CRED_FILE" ] && NAS_PASS="$(head -n1 "$CRED_FILE")"
[ -z "${NAS_PASS:-}" ] && [ -r "$LEGACY" ] && NAS_PASS="$(sed -n "s/^NAS_PASS='\(.*\)'$/\1/p" "$LEGACY" | head -n1)"
if [ -z "${NAS_PASS:-}" ] && [ -t 0 ]; then
printf 'Password for %s@%s: ' "$NAS_USER" "$NAS_HOST"; stty -echo; read -r NAS_PASS; stty echo; printf '\n'
fi
[ -n "${NAS_PASS:-}" ] || { echo "No NAS password available." >&2; exit 1; }
EXP="$(mktemp /tmp/ct-rm.XXXXXX)"
cat > "$EXP" <<'EXPEOF'
#!/usr/bin/expect -f
set timeout 300
log_user 1
set pass $env(CT_PASS)
spawn -noecho bash -c [lindex $argv 0]
expect { -nocase "password:" { send "$pass\r"; exp_continue } eof }
catch wait result
exit [lindex $result 3]
EXPEOF
chmod +x "$EXP"; trap 'rm -f "$EXP" /tmp/ct-rm-remote.sh' EXIT
cat > /tmp/ct-rm-remote.sh <<REMOTEEOF
set -e
cd "$NAS_PATH" 2>/dev/null || { echo "nothing deployed at $NAS_PATH"; exit 0; }
echo "--- stopping ---"
# docker stop + rm rather than 'compose down --rmi': removing the image pulls in
# a layer sweep that can run for many minutes on a NAS, and the container's
# restart policy is 'unless-stopped', so stopping it is what actually keeps it
# down across reboots.
echo "\$REMOTE_PASS" | sudo -S /usr/local/bin/docker stop -t 5 church-translate 2>&1 | tail -2 || true
echo "\$REMOTE_PASS" | sudo -S /usr/local/bin/docker rm church-translate 2>&1 | tail -2 || true
echo "--- remaining containers ---"
echo "\$REMOTE_PASS" | sudo -S /usr/local/bin/docker ps -a --filter name=church-translate --format "{{.Names}} {{.Status}}" || true
echo "--- data left in place ---"
ls -la data/ 2>/dev/null | head -5 || echo "(no data dir)"
REMOTEEOF
echo "==> Removing the translation container from $NAS_HOST"
CT_PASS="$NAS_PASS" expect "$EXP" \
"ssh -o StrictHostKeyChecking=accept-new $NAS_USER@$NAS_HOST 'REMOTE_PASS=\"$NAS_PASS\" bash -s' < /tmp/ct-rm-remote.sh"
echo "==> Done. Transcripts remain in $NAS_PATH/data if you want them."