76 lines
3.5 KiB
Markdown
76 lines
3.5 KiB
Markdown
# Jeannie Remote API
|
|
|
|
The private remote-execution API exposes the public Jeannie command surface.
|
|
The local Jeannie remote client submits a 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
|
|
|
|
`GET /v1/commands` returns the complete remotely enabled command list. Internal
|
|
`__up-task` and recursive `remote` dispatch are excluded. This API therefore
|
|
has the same authority as the bearer token and should remain private; commands
|
|
such as `nuke`, `rebuild-cluster`, and `stop-cluster` are available remotely.
|
|
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.
|
|
|
|
`cluster-runtime check` and `cluster-transition k3s-to-native [--yes]` are
|
|
allowlisted as well. The transition runs on Debian, archives the accidental
|
|
laptop K3s state, prepares verified registry storage on the declared ARM host,
|
|
and then deploys cluster/platform/apps. It preserves the old data and refuses
|
|
identity mismatches. Redeploy the API binary after updating its allowlist.
|
|
|
|
The authenticated `GET /metrics` endpoint exposes Prometheus-compatible HTTP
|
|
request counters, request duration totals, and authentication-failure counts.
|
|
It is served by the Debian API process, so metrics remain available while
|
|
Kubernetes is stopped; Prometheus may scrape it when the cluster is healthy.
|
|
Run the platform pipeline with `JEANNIE_SERVER_TOKEN` set to enable the
|
|
authenticated `jeannie-api` scrape job in kube-prometheus-stack.
|
|
|
|
## 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 2 requests per second with
|
|
no burst, 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.
|