diff --git a/podman-standalone.sh b/podman-standalone.sh index 4e1b35b..2ebf51e 100755 --- a/podman-standalone.sh +++ b/podman-standalone.sh @@ -75,8 +75,7 @@ TZ=America/Los_Angeles # ── Turnstone container ─────────────────────────────────────────────────────── # Image is built locally — no registry auto-update label. -# To update: sudo podman build -t localhost/turnstone:latest /opt/turnstone -# sudo podman restart turnstone +# Run this script after every `git pull` to rebuild and redeploy. # # /opt is mounted read-only so all service logs under /opt/*/config/logs/ are # accessible without per-service mounts. Add new sources to patterns/sources.yaml @@ -84,6 +83,11 @@ TZ=America/Los_Angeles # # Must be run as root (sudo bash podman-standalone.sh) — rootful Podman only. # + +# Build image from current source (bakes app/ code into the image) +echo "Building Turnstone image..." +podman build -t localhost/turnstone:latest "${REPO_DIR}" + # Remove existing container if present (safe re-run) podman rm -f turnstone 2>/dev/null || true @@ -111,16 +115,24 @@ echo "" echo "Turnstone is starting up." echo " UI: http://localhost:8534/turnstone/" echo "" + +# Regenerate systemd unit so it references the freshly-built image. +# The --new flag means systemd re-creates the container on each start +# rather than binding to a specific container ID. +if [ -d /etc/systemd/system ]; then + echo "Regenerating systemd unit..." + podman generate systemd --new --name turnstone \ + | tee /etc/systemd/system/turnstone.service > /dev/null + systemctl daemon-reload + systemctl enable turnstone.service 2>/dev/null || true + echo " systemd unit updated — run: sudo systemctl restart turnstone.service" + echo "" +fi + echo "Check container health with:" echo " sudo podman ps" echo " sudo podman logs turnstone" echo "" -echo "To register as a systemd service:" -echo " sudo podman generate systemd --new --name turnstone \\" -echo " | sudo tee /etc/systemd/system/turnstone.service" -echo " sudo systemctl daemon-reload" -echo " sudo systemctl enable --now turnstone" -echo "" echo "To ingest all sources now:" echo " sudo podman exec turnstone python scripts/ingest_corpus.py \\" echo " --sources /patterns/sources.yaml --db /data/turnstone.db"