Expand description
In-container ingest relay (ADR-100 section 4).
A cog always posts its vectors to 127.0.0.1:80/api/v1/store/ingest
(the address is compiled into the released binaries). Inside a
container, or an Apple container VM, that loopback is the container’s
own, so nothing answers unless something listens there. When the host
contract names an ingest upstream (the node’s ingest bridge as the
container sees it, e.g. the VM gateway), the adapter builds the image
with a small relay as the entrypoint:
- the relay binds
127.0.0.1:80while still root (the only reason the container starts as root, with every capability dropped exceptNET_BIND_SERVICE,SETUIDandSETGID); - it forks the cog, which drops to
nobodyand setsno_new_privsbeforeexec, so the cog runs with no capabilities and cannot regain any through a setuid binary (Applecontainerhas no--security-opt no-new-privileges, so the relay sets it itself); - it drops to
nobody(andno_new_privs) itself and forwards each connection, byte for byte, to the upstream (bounded connections, bytes and time); - it forwards SIGTERM / SIGINT to the cog and exits with the cog’s status.
The relay is a Python script, so a relay image needs python3 in the
operator-pinned base; the build checks for it and fails loudly.
Constants§
- COG_
INGEST_ ADDR - The fixed address every cog posts its ingest to.
- RELAY_
CAPS - Capabilities a relay container keeps (all others are dropped).
- RELAY_
FILE - Build-context file name of the relay script.
- RELAY_
PATH - Where the relay script lives in the image.
- RELAY_
SCRIPT - The relay script (see the module docs).
Functions§
- dockerfile
- Dockerfile for a cog image fronted by the ingest relay.
- relay_
upstream - The upstream the relay forwards to, if the image needs a relay.