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

60 lines
2.4 KiB
Markdown

# 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.
## Edge API gateway
The canonical public route publishes the Debian API directly through the OCI
edge proxy 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 and
is not required for API availability.
The edge gateway applies a per-client rate limit of 10 requests per second
with a burst of 20, forwards the bearer token to Debian, and uses 35-second
proxy read/write timeouts. The Jeannie API remains responsible for bearer
authentication and command allowlisting. Read-only retries are not enabled at
the edge; `POST /v1/execute` is never retried so a command cannot be submitted
twice by a proxy.
The Kubernetes `jeannie-api` route may remain available for internal testing,
but it is not the availability-critical path. Traefik continues to expose
Kubernetes request metrics, while the edge proxy records the canonical API
traffic in its access logs.
The Temporal UI is bound to `127.0.0.1:8233` by default because Debian uses
port 8088 for the provisioning service. Override it during deployment with
`JEANNIE_TEMPORAL_UI_PORT` if needed.
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 canonical gateway, use the API hostname and the OCI edge address.
For a controlled test without changing DNS, use `curl --resolve` with the
edge public IP.