feat(go-services): tracker-go Phase 0/1 — /live + /trails read parity
Parallel Go reimplementation of the dereth-tracker read side, deployed loopback-only (:8770) and reading the dereth TimescaleDB read-only. The live Python stack is untouched (added via a compose override, not by editing the tracked docker-compose.yml). - Phase 0 scaffold: stdlib net/http server (Go 1.22+ method+path routing), /health + /api-version, multi-stage distroless Docker build, and go-services/docker-compose.go.yml override (loopback :8770). - Phase 1: pgx v5 pool forced into read-only transactions, a 5s /live + /trails cache loop using the exact main.py:837 SQL, and Python-isoformat timestamps so output matches FastAPI's jsonable_encoder. - compare/compare_live.py: parity harness vs the live Python service. Uses the server-stamped received_at to prove same-row full-field equality and to make the online-set diff boundary-aware. Verified on live traffic (73 players): identical online set + 23-key schema, identity/type parity for all, every same-row pair matches on every field, and diff-row pairs differ only by the ~6s two-cache refresh skew. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b8fd449d62
commit
1af47520c0
7 changed files with 691 additions and 0 deletions
40
go-services/docker-compose.go.yml
Normal file
40
go-services/docker-compose.go.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Compose OVERRIDE that adds the Go services alongside the live Python stack.
|
||||
# It only ADDS containers; it never modifies the tracked docker-compose.yml or
|
||||
# any running Python service.
|
||||
#
|
||||
# Invoke from the repo root so the Compose project name resolves to
|
||||
# "mosswartoverlord" (same as the live stack) and the new container joins the
|
||||
# existing default network — letting it reach the `db` service by name:
|
||||
#
|
||||
# cd /home/erik/MosswartOverlord
|
||||
# export BUILD_VERSION="$(date -u +%Y.%-m.%-d.%H%M)-$(git rev-parse --short HEAD)"
|
||||
# docker compose -f docker-compose.yml -f go-services/docker-compose.go.yml \
|
||||
# build dereth-tracker-go
|
||||
# docker compose -f docker-compose.yml -f go-services/docker-compose.go.yml \
|
||||
# up -d --no-deps dereth-tracker-go
|
||||
#
|
||||
# --no-deps keeps Compose from touching the already-running `db` (and anything
|
||||
# else). The service is loopback-bound (127.0.0.1:8770); external reach is only
|
||||
# ever via the host nginx `location /go/` block (added separately).
|
||||
services:
|
||||
dereth-tracker-go:
|
||||
build:
|
||||
context: ./go-services/tracker-go
|
||||
args:
|
||||
BUILD_VERSION: ${BUILD_VERSION:-dev}
|
||||
container_name: dereth-tracker-go
|
||||
ports:
|
||||
- "127.0.0.1:8770:8770"
|
||||
environment:
|
||||
PORT: "8770"
|
||||
# Read-only use of the same dereth TimescaleDB the Python tracker writes.
|
||||
DATABASE_URL: "postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/dereth"
|
||||
LOG_LEVEL: "INFO"
|
||||
depends_on:
|
||||
- db
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
Loading…
Add table
Add a link
Reference in a new issue