[daemon] add optional backend bridge for future socket API service#110
Merged
Conversation
The forthcoming C++ droidspaces-socketd daemon needs a narrow private control path into the existing privileged Droidspaces daemon. Keep the native Droidspaces build unchanged by default and compile that bridge only when ENABLE_SOCKETD_BACKEND=1 is requested. This keeps the current static-musl runtime layout intact for existing users while reserving an explicit opt-in build path for the Portainer/Podman compatibility work.
Introduce the first native-C seam for the future C++ droidspaces-socketd daemon. The bridge is intentionally: * private, using a separate Linux abstract AF_UNIX socket; * opt-in, compiled only with DS_ENABLE_SOCKETD_BACKEND; * C-only, keeping C++ out of the existing runtime; * tiny, with a versioned framed protocol and root/same-UID peer gate; * dormant with respect to the existing CLI/app daemon protocol. The initial bridge implements only protocol-level PING and CAPABILITIES requests. Container listing, inspection, and lifecycle RPCs can be added on this stable framing without changing the public Docker-compatible API daemon.
Prep for WebUI compat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This introduces the first native-side foundation for a future external
droidspaces-socketdservice. Provided that this PR is accepted, the development of the endpoint for the following purpose will commence.The intended long-term goal is to allow Droidspaces to expose a
Podman-style Docker Engine API compatibility service, suitable for tools
such as Portainer, without pulling HTTP/JSON/C++ concerns into the existing
native runtime.
This PR does not implement the public Docker-compatible API yet.
Instead, it adds a small, opt-in, private backend bridge inside the existing
privileged Droidspaces daemon that a future C++ socket daemon can use.
Motivation
Droidspaces already has the correct privileged execution context for
container lifecycle and inspection operations:
Rather than duplicating that logic in a new public-facing service, the planned
architecture is:
This keeps the current native runtime focused and avoids leaking C++ or
public API-server concerns into the existing C codebase.
What this PR adds
1. Optional build gate
A new build flag is introduced:
The bridge is disabled by default, so normal Droidspaces builds remain unchanged.
Example:
builds the existing runtime as before.
builds the runtime with the private socketd backend bridge enabled.
2. Private backend socket bridge
When enabled, the existing Droidspaces daemon starts a small helper process
that listens on a private abstract Unix socket:
This is not the future public Portainer-facing socket. It is an internal
control path intended only for the future
droidspaces-socketdprocess.3. Versioned framed protocol
The new files:
define a small request/response protocol with:
The protocol header is written to be safely usable from both C and C++, so the
future external daemon can share it without introducing C++ into the native
runtime.
4. Initial backend operations
This PR implements only the protocol bootstrap operations:
PINGCAPABILITIESContainer-oriented operations are reserved in the protocol for follow-up work:
INFOLIST_CONTAINERSINSPECT_CONTAINERSTART_CONTAINERSTOP_CONTAINERRESTART_CONTAINERThese currently return
UNSUPPORTED.5. Basic local peer restriction
The backend socket currently accepts only:
This is intentionally conservative because the bridge is a privileged local
control interface.