feat(admin): module skeleton, config and two database connections

Adds the admin module: env config with fail-fast validation, two MongoDB
connections (its own vantage_admin database plus a narrow path into the
control plane), the boot sequence and the image.

Config refuses to start without a signing key, and both Mongo URIs must
name their database inline -- admin talks to two databases, so a bare
MONGO_DB would be ambiguous about which.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
mrhid6
2026-07-25 18:58:44 +01:00
co-authored by Claude Opus 5
parent c4f1684304
commit 64eac6dbc7
8 changed files with 332 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# Context is the repository root; admin depends on the shared module.
FROM golang:1.26-alpine AS builder
WORKDIR /src
COPY shared/go.mod shared/go.sum ./shared/
COPY admin/go.mod admin/go.sum ./admin/
RUN cd admin && go mod download
COPY shared/ ./shared/
COPY admin/ ./admin/
RUN cd admin && CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/admin ./cmd
RUN cd admin && CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/adminctl ./cmd/adminctl
FROM alpine:3.20 AS runner
RUN apk add --no-cache ca-certificates && \
addgroup --system --gid 1001 admin && \
adduser --system --uid 1001 --ingroup admin admin
COPY --from=builder /out/admin /usr/local/bin/admin
COPY --from=builder /out/adminctl /usr/local/bin/adminctl
USER admin
EXPOSE 8083
ENV PORT=8083
CMD ["/usr/local/bin/admin"]