Add isolated read-only spectator monitor for public sharing
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Install the isolated spectator service; public Funnel setup is a separate step."""
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
repo = Path(__file__).resolve().parents[2]
|
||||
python = shutil.which('python3')
|
||||
assert python
|
||||
units = Path.home() / '.config/systemd/user'
|
||||
units.mkdir(parents=True, exist_ok=True)
|
||||
(units / 'azerothai-spectator.service').write_text(f'''[Unit]
|
||||
Description=AzerothAI read-only spectator monitor
|
||||
After=network-online.target azerothai-runtime.service
|
||||
[Service]
|
||||
WorkingDirectory={repo}
|
||||
ExecStart={python} {repo}/scripts/spectator-server.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
NoNewPrivileges=true
|
||||
UMask=0077
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
''')
|
||||
subprocess.run(['systemctl', '--user', 'daemon-reload'], check=True)
|
||||
subprocess.run(['systemctl', '--user', 'enable', '--now', 'azerothai-spectator.service'], check=True)
|
||||
print('Spectator ready on loopback port 8790. Public sharing:')
|
||||
print('sudo tailscale funnel --bg --https=8443 http://127.0.0.1:8790')
|
||||
print('Keep the existing private dashboard on port 443.')
|
||||
Reference in New Issue
Block a user