Files
matrix/now-playing/install.sh
T
jared 3a0a4e15a8
Lint / Shell (shellcheck) (push) Successful in 10s
Lint / JS (eslint) (push) Successful in 7s
Lint / No Hookshot webhook IDs in README (push) Successful in 6s
Lint / No secrets in webhook configs (push) Successful in 6s
Lint / Landing page is rendered (matrix (push) Successful in 7s
Lint / Python (ruff) (push) Successful in 11s
Lint / Python deps (pip-audit) (push) Successful in 36s
Lint / Secret scan (gitleaks) (push) Successful in 5s
now-playing: Navidrome "Listening to" service for Lotus Chat (cinny #491) (#68)
2026-11-16 23:51:07 -05:00

38 lines
1.6 KiB
Bash

#!/bin/bash
# Install or update the now-playing service (cinny #491) on LXC 151.
# Run with this repo's main branch pulled to /opt/matrix-config:
# bash /opt/matrix-config/now-playing/install.sh
# First install: put the Navidrome login in /etc/lotus-now-playing/env first
# (NAVIDROME_USER=lotus-nowplaying / NAVIDROME_PASSWORD=...), mode 640 root:lotus-now-playing.
# Optional /etc/lotus-now-playing/users.json maps Matrix IDs whose SSO link has no
# email to their SSO username, e.g. {"@bigmanjeff:matrix.lotusguild.org": "jeff"}.
# Neither file is kept in this (public) repo. Safe to re-run.
set -euo pipefail
REPO=/opt/matrix-config
CONF=/etc/lotus-now-playing
id lotus-now-playing >/dev/null 2>&1 ||
useradd --system --no-create-home --home-dir /var/lib/lotus-now-playing --shell /usr/sbin/nologin lotus-now-playing
install -d -m750 -o root -g lotus-now-playing "$CONF"
install -D -m644 "$REPO/now-playing/lotus_now_playing.py" /opt/lotus-now-playing/lotus_now_playing.py
if [ ! -f "$CONF/env" ]; then
echo "missing $CONF/env (NAVIDROME_USER / NAVIDROME_PASSWORD); create it and re-run" >&2
exit 1
fi
chown root:lotus-now-playing "$CONF/env"
chmod 640 "$CONF/env"
if [ -f "$CONF/users.json" ]; then
chown root:lotus-now-playing "$CONF/users.json"
chmod 640 "$CONF/users.json"
fi
install -m644 "$REPO/systemd/lotus-now-playing.service" /etc/systemd/system/lotus-now-playing.service
systemctl daemon-reload
systemctl enable lotus-now-playing >/dev/null
systemctl restart lotus-now-playing
sleep 2
systemctl --no-pager --lines=5 status lotus-now-playing
curl -fsS http://127.0.0.1:8072/healthz && echo " (healthy)"