Governed substrate for autonomous agents: scoped identity (passports), audited actions, MCP workspace. Infra IPs and secrets redacted for public release. |
||
|---|---|---|
| .. | ||
| moonraker-tunnel.service | ||
| README.md | ||
3D Printer reverse-tunnel — recovery after server migration
The CRM reaches the printer's Moonraker API at http://localhost:7125
(backend/services/agent-tools/printer-tools.js). That port is fed by a
reverse SSH tunnel initiated from the MKS Pi — the printer dials out to the
CRM box and forwards its local Moonraker. The CRM box cannot reach the printer
directly, so the tunnel always starts on the printer side.
Slicing uses the prusa-slicer CLI on the CRM box (profile:
backend/services/agent-tools/printer/slicer-profile.ini).
What broke
The CRM migrated to v881099.hosted-by-vdsina.com / <PROD_IP>.
The MKS Pi's autossh still dials the old (dead) address, so 7125 is empty and
every printer_* MCP tool returns fetch failed.
Server side — DONE (this box)
prusa-slicer2.7.2 installed; headless slice verified against our profile.- Locked-down ingress user
printercreated. Itsauthorized_keysis restricted to reverse-forward oflocalhost:7125only — no shell, no other ports (restrict,port-forwarding,permitlisten="localhost:7125",command=...). - Keypair
mkspi_tunnelgenerated at/home/printer/.ssh/. Validated end-to-end with a stub Moonraker.
Printer side — TODO (run on the MKS Pi)
- Install autossh:
sudo apt-get install -y autossh - Drop the private key (provided separately — never committed) at
/home/pi/.ssh/mkspi_tunnel,chmod 600. - Install the unit and start it:
sudo cp moonraker-tunnel.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now moonraker-tunnel - If the MKS Pi user is not
pi, editUser=and the key path in the unit.
Verify (on the CRM box, after the printer is up)
ss -tlnp | grep 7125 # tunnel bound
curl -s http://localhost:7125/printer/info # Moonraker answers
Then printer_status MCP tool should return live state.
Future migrations
Change ONLY the IP in moonraker-tunnel.service ExecStart and restart the
unit on the MKS Pi. Server-side ingress + slicer survive untouched.