Subscribes to devices/+/telemetry, validates payloads, buffers writes into ClickHouse (flush on size or interval), and emits a per-reading event on RabbitMQ for rule-engine-service to consume later. Adds the initial Postgres and ClickHouse schema migrations, a Dockerfile, and wires the service into docker-compose. Verified end-to-end via docker compose + mosquitto_pub: row lands in ClickHouse and the event reaches the telemetry.new_reading queue. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
13 lines
336 B
Docker
13 lines
336 B
Docker
FROM golang:1.25-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -o /out/ingest-service ./cmd/ingest-service
|
|
|
|
FROM alpine:3.20
|
|
RUN adduser -D -u 10001 app
|
|
COPY --from=build /out/ingest-service /usr/local/bin/ingest-service
|
|
USER app
|
|
ENTRYPOINT ["/usr/local/bin/ingest-service"]
|