Files
2026-05-14 02:27:26 +01:00

2.9 KiB

Development

Local Tunnel Smoke Test

This first vertical slice proxies Moonraker HTTP requests. Moonraker WebSocket proxying is the next protocol increment.

If Docker is available, run the whole smoke-test stack with:

$env:KA_VERSION = .\scripts\version.ps1
docker compose up --build

The development image copies the repo into the container and builds the binaries. Re-run with --build after source changes.

If you want the containers to carry a git-derived build version, keep KA_VERSION set before rebuilding. Otherwise the build falls back to dev.

Then request Moonraker through the server:

Invoke-RestMethod http://127.0.0.1:8080/p/test/moonraker/printer/info

If Go is installed locally, run the three processes manually.

Run the three processes in separate terminals:

go run ./cmd/mock-moonraker -listen :7125
go run ./cmd/server -listen :8080 -agent-token dev-token
go run ./cmd/agent -config configs/agent.example.json

Then request Moonraker through the server:

Invoke-RestMethod http://127.0.0.1:8080/p/test/moonraker/printer/info

The response should come from the mock Moonraker process through the outbound agent tunnel.

Check the latest heartbeat received by the server:

Invoke-RestMethod http://127.0.0.1:8080/api/printers/test/health

The response includes whether the agent is connected and whether Moonraker was reachable during the agent's last heartbeat.

Fetch combined printer detail data:

Invoke-RestMethod http://127.0.0.1:8080/api/printers/test

The response combines connection health, heartbeat data, and Moonraker /printer/info output for the printer detail page.

The Docker smoke-test config also exposes a mock camera:

Invoke-WebRequest http://127.0.0.1:8080/p/test/camera/default/snapshot

The stream endpoint is long-lived:

curl.exe --cookie "ka_session=<session-cookie>" http://127.0.0.1:8080/p/test/camera/default/stream

Live Printer Smoke Test

When a real printer agent is connected to the server, run the live smoke test against the published server port:

make test-live-printer

That check logs in, verifies the live printer heartbeat, confirms /p/{printer_id}/moonraker/printer/info, and optionally exercises the proxied UI when the live agent reports one.

Cross-Compile Agent

For a rooted printer, first check the target architecture over SSH:

uname -m
cat /proc/cpuinfo

Common builds:

$env:CGO_ENABLED = "0"; $env:GOOS = "linux"; $env:GOARCH = "arm64"; go build -o dist/klipperanywhere-agent-linux-arm64 ./cmd/agent
$env:CGO_ENABLED = "0"; $env:GOOS = "linux"; $env:GOARCH = "arm"; $env:GOARM = "7"; go build -o dist/klipperanywhere-agent-linux-armv7 ./cmd/agent
$env:CGO_ENABLED = "0"; $env:GOOS = "linux"; $env:GOARCH = "mipsle"; go build -o dist/klipperanywhere-agent-linux-mipsle ./cmd/agent