API roles#

One image serves the HTTP API as up to four roles, so the toolkit, the agent service and monitoring can run as separate processes while clients keep one address.

Role

Serves

all

Every route in one process (default)

toolkit

Core and pack routes, authentication, and forwarding

agent-service

The agent service part’s routes

monitoring

The monitoring part’s routes

Each role also serves liveness and readiness at /v1/health/live and /v1/health/ready. Every role authenticates its own requests.

Select a role#

geonemo-services api --role toolkit --host 0.0.0.0 --port 8000

--role sets GEONEMO_API_ROLE; the variable works as well. A process loads only the parts whose services list includes its role (see Choose the parts).

Forwarding#

When other roles run as their own processes, set GEONEMO_API_SERVICE_ENDPOINTS on the toolkit process to a JSON object that maps a role to its URL:

{"agent-service": "http://agent-service-api:8000",
 "monitoring": "http://monitoring-api:8000"}

The toolkit process then sends a request for another role’s path to that process unchanged and streams the response back, so event streams stay open. Only agent-service and monitoring are valid keys and URLs must be http or https without credentials. A role with no entry is not forwarded, so a single all process needs none. Forwarding applies only to the toolkit role.

The Compose stacks run this split: services-api (toolkit), agent-service-api and monitoring-api, each built from the same image. The toolkit process does not load the agent service part, so it needs no agent-control database login.