ZT_CONTROLLER=1 on a box with libpq present but unconfigured compiles clean and silently falls back, so a successful build proves nothing. This adds the embedded controller as a buildable artifact and the check that would have caught that failure. ZT_CONTROLLER_NO_SQL=1 gates the SQL block and the smeeclient cargo target, leaving the ZT_CONTROLLER=1 path byte-identical when unset. Dropping it removes the arch-pinned ext/*/install/ubuntu22.04 prebuilts and the rust toolchain from the build, so any Debian base works. Dockerfile.controller builds that target into a 142MB runtime image. Three defects surfaced while proving it, all logged in SPEC B8/B9: - .dockerignore was inert twice over. Its patterns ran as a post-COPY RUN printf, which the daemon has already used by then, and bare *.o matches the root only under Docker's filepath.Match, so all 121 stale objects were copied and linked against the image's glibc 2.36. Now **/*.o, which is the known stale-object hazard from AGENTS.md. - The gate asserted nm -C found nothing inside a runtime image with no nm. sh: nm: not found made the pipeline fail, ! inverted it to a pass, and the check went green on a missing tool. Uses grep -qaE instead. - The container ran with -p, so every API call returned 401: OneService gates on loopback source at OneService.cpp:1859 unless allowManagementFrom widens it, and a DNAT'd port arrives from the bridge gateway. The gate uses --network host, and the docs now say so. Verified: gate passes against the image and in --local, driving network create, member authorize, member list and the on-disk write. Identity and controller.d survive container replacement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
1.9 KiB
Docker
61 lines
1.9 KiB
Docker
# vim: ft=dockerfile
|
|
#
|
|
# BackOne controller image: embedded controller on FileDB.
|
|
#
|
|
# ZT_CONTROLLER_NO_SQL=1 keeps PostgreSQL, Redis and the Rust smeeclient client
|
|
# out of the build entirely, so no libpq-dev, no cargo toolchain and no
|
|
# ext/*/install/ubuntu22.04/$(EXT_ARCH) prebuilts are needed -- any Debian base
|
|
# works. See SPEC.md V21/V22.
|
|
|
|
FROM debian:bookworm-slim AS builder
|
|
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
clang \
|
|
make \
|
|
libssl-dev \
|
|
pkg-config \
|
|
libminiupnpc-dev \
|
|
ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /src
|
|
COPY . .
|
|
|
|
RUN make -j"$(nproc)" ZT_CONTROLLER=1 ZT_CONTROLLER_NO_SQL=1 one
|
|
|
|
# V21: prove at build time that nothing from the SQL backends got in.
|
|
RUN ! nm -C backone | grep -qiE 'pqxx|PostgreSQL::|sw::redis|smeeclient'
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
# libminiupnpc is a hard runtime dependency (ldd backone -> libminiupnpc.so.21);
|
|
# openssl is required by the gate script's curl usage in CI images and left in
|
|
# for operators debugging the control plane. No libpq5, no rust.
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
libminiupnpc17 \
|
|
iproute2 \
|
|
curl && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /src/backone /usr/sbin/backone
|
|
RUN ln -sf /usr/sbin/backone /usr/sbin/backone-cli && \
|
|
ln -sf /usr/sbin/backone /usr/sbin/backone-idtool
|
|
|
|
ENV ZEROTIER_HOME=/var/lib/backone \
|
|
ZT_PID_FILE=backone.pid \
|
|
ZT_PORT_FILE=backone.port \
|
|
ZT_DAEMON=/usr/sbin/backone \
|
|
ZT_CLI=backone-cli
|
|
|
|
# identity.secret + controller.d live here: replacing the container must not
|
|
# change the node address or lose network state.
|
|
VOLUME ["/var/lib/backone"]
|
|
|
|
EXPOSE 9993
|
|
|
|
# -U skips the root check so the container need not run as uid 0, matching the
|
|
# spec's "no privilege drop". The daemon runs in the foreground as PID 1.
|
|
CMD ["/usr/sbin/backone", "-U", "-p9993"] |