Add social feed, cooperative parties, guild goals, and operations recovery
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Install current-user runtime recovery and telemetry. Enable lingering for boot startup."""
|
||||
from pathlib import Path
|
||||
import shutil,subprocess
|
||||
repo=Path(__file__).resolve().parents[2]
|
||||
units=Path.home()/'.config/systemd/user';units.mkdir(parents=True,exist_ok=True)
|
||||
node=shutil.which('node');python=shutil.which('python3');assert node and python
|
||||
(units/'azerothai-runtime.service').write_text(f'''[Unit]
|
||||
Description=AzerothAI web runtime
|
||||
After=network-online.target
|
||||
[Service]
|
||||
WorkingDirectory={repo}
|
||||
ExecStart={node} {repo}/scripts/start-local-runtime.mjs --lan
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
''')
|
||||
(units/'azerothai-operations.service').write_text(f'''[Unit]
|
||||
Description=AzerothAI telemetry and transport retention
|
||||
After=azerothai-runtime.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
WorkingDirectory={repo}
|
||||
ExecStart=/usr/bin/sg docker -c "{python} {repo}/scripts/operations-agent.py"
|
||||
TimeoutStartSec=50
|
||||
''')
|
||||
(units/'azerothai-operations.timer').write_text('''[Unit]
|
||||
Description=AzerothAI one-minute health sampling
|
||||
[Timer]
|
||||
OnBootSec=90
|
||||
OnUnitActiveSec=60
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
''')
|
||||
subprocess.run(['systemctl','--user','daemon-reload'],check=True)
|
||||
# Runtime is enabled but started separately after handing over its existing process.
|
||||
subprocess.run(['systemctl','--user','enable','azerothai-runtime.service','azerothai-operations.timer'],check=True)
|
||||
subprocess.run(['systemctl','--user','start','azerothai-operations.timer'],check=True)
|
||||
print('User services installed. Start the runtime after stopping its previous unmanaged process.')
|
||||
Reference in New Issue
Block a user