Add launchd agent for auto-start on the Ultra

discgod_server.py now runs as a launchd LaunchAgent (RunAtLoad + KeepAlive) on
:5057 — starts on login/boot, respawns on crash. Documented in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
type-two 2026-06-13 20:25:54 +10:00
parent 1945c19fb3
commit cc0eabe2e0
2 changed files with 71 additions and 2 deletions

View File

@ -66,8 +66,20 @@ It creates the `mp_*` tables and `discgod_seller_watch` in `discogs_full` on
startup (additive — touches nothing existing). `deploy.sh` is only needed if you
ever run the server on a *different* box.
To keep it running across reboots, either add that `nohup` line to your
MONSTERPANEL startup alongside the plice server, or wrap it in a launchd plist.
To keep it running across reboots it's installed as a launchd agent on the Ultra
(`deploy/com.monsterrobot.discgod.plist` → `~/Library/LaunchAgents/`): starts on
login/boot, restarts itself if it crashes, logs to `server/discgod_server.log`.
```bash
cp deploy/com.monsterrobot.discgod.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.monsterrobot.discgod.plist
# status / stop:
launchctl print gui/$(id -u)/com.monsterrobot.discgod
launchctl bootout gui/$(id -u)/com.monsterrobot.discgod
```
(LaunchAgent = runs as the johnking user, needed for local Postgres peer auth. If
you want it up even with nobody logged in, convert to a LaunchDaemon in
`/Library/LaunchDaemons` with `UserName johnking` — needs sudo.)
### 2. Extension (the engine + control panel)
1. `chrome://extensions` → enable Developer mode → **Load unpacked** → pick `discgod/extension`.

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
discgod ingest server — launchd agent for the Ultra (ultra.local).
Runs discgod_server.py on :5057 as the johnking user (required for local
Postgres peer auth to discogs_full), starts at login/boot, and is kept alive
if it ever crashes.
Install:
cp deploy/com.monsterrobot.discgod.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.monsterrobot.discgod.plist
launchctl kickstart -k gui/$(id -u)/com.monsterrobot.discgod
Stop / remove:
launchctl bootout gui/$(id -u)/com.monsterrobot.discgod
Logs: server/discgod_server.log
-->
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.monsterrobot.discgod</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/python3</string>
<string>/Users/johnking/discgod/server/discgod_server.py</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/johnking/discgod/server</string>
<key>EnvironmentVariables</key>
<dict>
<key>DISCGOD_DB</key>
<string>discogs_full</string>
<key>DISCGOD_PORT</key>
<string>5057</string>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ThrottleInterval</key>
<integer>10</integer>
<key>StandardOutPath</key>
<string>/Users/johnking/discgod/server/discgod_server.log</string>
<key>StandardErrorPath</key>
<string>/Users/johnking/discgod/server/discgod_server.log</string>
</dict>
</plist>