my-homelab-configs/docs/jeannie-remote-api.md

2.0 KiB

Jeannie Remote API

Phase 1 adds a private remote-execution API. The local Jeannie remote client submits a read-only command to a Jeannie API running on Debian. The Debian process executes the existing Jeannie entrypoint; command logic is not duplicated in the API.

Run locally

Start the server from the Debian checkout:

JEANNIE_SERVER_ADDR=127.0.0.1:8787
JEANNIE_SERVER_TOKEN='replace-with-a-secret'
JEANNIE_SERVER_REPO_ROOT=/path/to/my-homelab-configs
./scripts/jeannie-server

From a client with network access:

JEANNIE_REMOTE_URL=http://debian:8787
JEANNIE_REMOTE_TOKEN='replace-with-a-secret'
./jeannie remote status

The initial allowlist contains read-only commands only. Execution state is stored in memory and command output is returned through GET /v1/executions/{id}. It is not a public edge service and does not accept arbitrary shell commands.

Kubernetes API gateway

The jeannie-api Argo application publishes the Debian API through Traefik at api.lab2025.duckdns.org. The backend remains the Debian host at 192.168.100.73:8787; Kubernetes does not run a second Jeannie server.

The gateway applies the existing bearer-token authentication, a rate limit of 10 requests per second with a burst of 20, and backend timeouts of 3 seconds for dialing, 30 seconds for response headers, and 60 seconds for idle connections. Read-only routes may be retried once; POST /v1/execute is not retried so a command cannot be submitted twice by the gateway.

Traefik exposes JSON access logs and Prometheus request metrics. Prometheus scrapes the Traefik metrics endpoint as the traefik job, with entrypoint and service labels enabled.

For a LAN test after the edge/DNS certificate is available, use the host's LAN address or a local DNS override. Direct backend testing remains:

curl -H 'Authorization: Bearer replace-with-a-secret' \
  http://192.168.100.73:8787/v1/health

Through the API gateway, use the API hostname and the Traefik load-balancer address from the cluster network.