# tracker-web LaunchAgent (keep-alive on :3003)

Auto-starts the fleet **web tracker** (`tracker-web`) on login and restarts it on
crash/reboot, so `http://localhost:3003` stays up without a babysitter. Mirrors
the `agent-queue/launchd/` pattern in `learning_ai_devops_tools`.

## Files

- `tracker-web-boot.sh` — boot entrypoint: repairs `PATH`, loads `JWT_SECRET` (+
  co.) from `../../services/platform-service/.env` and optional
  `~/.tracker-web.env` overrides, points the app at the local platform-service
  (`PLATFORM_API_URL`, default `http://localhost:4003`), then `exec pnpm dev`.
- `install.sh` — renders `~/Library/LaunchAgents/com.bytelyst.tracker-web.plist`
  (`RunAtLoad` + unconditional `KeepAlive` so it restarts on any exit, incl. a
  clean SIGTERM, + a 10s crash-loop throttle), frees `:3003` if something else is
  on it, then bootstraps + kickstarts it.

## Use

```bash
bash launchd/install.sh             # install + start
bash launchd/install.sh --uninstall # stop + remove

tail -f ~/Library/Logs/tracker-web/tracker-web.out.log   # logs
launchctl print gui/$(id -u)/com.bytelyst.tracker-web | sed -n '1,20p'  # status
```

## Notes

- **Prereqs:** the platform-service backend on `:4003` (see
  `learning_ai_devops_tools/scripts/deploy-gigafactory.sh`) and `pnpm` on `PATH`.
- **Don't double-manage the port:** while this LaunchAgent owns `:3003`, do not
  also run `deploy-gigafactory.sh --with-tracker` / `--tracker-only` — they would
  clash on `:3003`. Use one or the other.
- **Per-machine overrides:** drop env in `~/.tracker-web.env` (not tracked) to
  override `PLATFORM_API_URL`, `DEFAULT_PRODUCT_ID`, etc.
- macOS only (LaunchAgents). On Linux use a `systemd --user` unit.
