Add backend with buffered zstd-compressed report storage

Introduce the Go backend (netwatch-server) with an HTTP API that
accepts telemetry reports and persists them as zstd-compressed JSONL
files. Reports are buffered in memory and flushed to disk when the
buffer reaches 10 MiB or every 60 seconds.
This commit is contained in:
2026-02-27 12:14:34 +07:00
parent 4ad98d578b
commit b57afeddbd
23 changed files with 1250 additions and 0 deletions

22
backend/Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
# golang:1.24-alpine (2026-02-26)
FROM golang:1.24-alpine@sha256:8bee1901f1e530bfb4a7850aa7a479d17ae3a18beb6e09064ed54cfd245b7191 AS builder
RUN apk add --no-cache git make gcc musl-dev
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make check
RUN make build
# alpine:3.21 (2026-02-26)
FROM alpine:3.21@sha256:c3f8e73fdb79deaebaa2037150150191b9dcbfba68b4a46d70103204c53f4709
RUN apk add --no-cache ca-certificates
COPY --from=builder /src/netwatch-server /usr/local/bin/netwatch-server
COPY --from=builder /src /src
EXPOSE 8080
ENTRYPOINT ["netwatch-server"]