Create standalone monitoring container that subscribes to all CHORUS pub/sub topics and logs traffic in real-time for debugging and observability. Features: - Subscribes to chorus-bzzz, chorus-hmmm, chorus-context topics - Logs all messages with timestamps and sender information - Pretty-printed JSON output with topic-specific emojis - Minimal resource usage (256MB RAM, 0.5 CPU) - Read-only monitoring (doesn't publish messages) Files: - hmmm-monitor/main.go: Main monitoring application - hmmm-monitor/Dockerfile: Multi-stage build for minimal image - hmmm-monitor/docker-compose.yml: Swarm deployment config - hmmm-monitor/README.md: Usage documentation This tool helps debug council formation, task execution, and agent coordination by providing visibility into all HMMM/Bzzz traffic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
42 lines
866 B
Docker
42 lines
866 B
Docker
FROM golang:1.22-alpine AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git ca-certificates
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum* ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download || true
|
|
|
|
# Copy source code
|
|
COPY main.go ./
|
|
|
|
# Build the binary
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hmmm-monitor main.go
|
|
|
|
# Final stage - minimal image
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy binary from builder
|
|
COPY --from=builder /app/hmmm-monitor .
|
|
|
|
# Run as non-root user
|
|
RUN addgroup -g 1000 monitor && \
|
|
adduser -D -u 1000 -G monitor monitor && \
|
|
chown -R monitor:monitor /app
|
|
|
|
USER monitor
|
|
|
|
# Set metadata
|
|
LABEL maintainer="CHORUS Ecosystem" \
|
|
description="HMMM Traffic Monitor - Real-time libp2p message monitoring for CHORUS"
|
|
|
|
ENTRYPOINT ["./hmmm-monitor"]
|