diff --git a/deploy/user/socialmag-dash.service.in b/deploy/user/socialmag-dash.service.in index a2e7ba6..ac59e90 100644 --- a/deploy/user/socialmag-dash.service.in +++ b/deploy/user/socialmag-dash.service.in @@ -4,14 +4,20 @@ After=network.target [Service] Type=simple -# Serves the repo directory itself, so the page is at -# http://127.0.0.1:8321/dashboard.html — refresher writes dashboard.json in -# here too, both resolved off the package's own __file__. -WorkingDirectory=@REPO@ +# WorkingDirectory is deliberately NOT the repo. `-m http.server` puts the +# working directory first on sys.path, and the repo ships selectors.py — so +# serving the repo by sitting in it makes socketserver import ours instead of +# the stdlib's and the unit crash-loops on +# "module 'selectors' has no attribute 'SelectSelector'". +# --directory serves the files without standing in them. +WorkingDirectory=/ +# The page is at http://127.0.0.1:8321/dashboard.html — refresher writes +# dashboard.json into the same directory, both resolved off the package's own +# __file__. # No --bind: the page is reachable from the LAN, not only from this box. # openbridge stays loopback-only, so a LAN viewer just falls back to opening a # new tab — progressive enhancement, and the page is never worse than it was. -ExecStart=@VENV@/bin/python -m http.server 8321 +ExecStart=@VENV@/bin/python -m http.server 8321 --directory @REPO@ Restart=on-failure RestartSec=5 diff --git a/install.sh b/install.sh index 4303570..df84a5a 100755 --- a/install.sh +++ b/install.sh @@ -120,10 +120,11 @@ if [[ -z "$USER_BUS" ]]; then warn " systemctl status user@$(id -u).service # start here" fi fi - warn "until then, run the three by hand from $REPO:" + warn "until then, run the three by hand (from anywhere EXCEPT $REPO):" warn " $VENV/bin/socialmag-openbridge &" - warn " $VENV/bin/python -m http.server 8321 &" + warn " $VENV/bin/python -m http.server 8321 --directory $REPO &" warn " $VENV/bin/socialmag-refresh # one pass, whenever you want it" + warn " (-m from inside the repo imports its selectors.py over the stdlib's)" else mkdir -p "$UNIT_DIR" for src in "$REPO"/deploy/user/*.in; do