- test.yml: runs on any push or PR (branches: main)
- go build, go vet, gofmt check, go test
- Fast feedback on PRs without pushing images
- build.yml: runs only on push to main
- Builds and pushes Docker image to registry
- No longer triggered by PRs or feature branches
- Removes 'needs: test' dependency (separate workflows now)
This ensures the :latest Docker image is only updated after
code is merged to main, not from unvalidated PR branches.
CI (blocker):
- Replace container: golang:1.27-alpine with actions/setup-go@v5
(runner couldn't pull from Docker Hub, job failed in ~1s)
- Use go-version-file: go.mod to auto-sync Go version
Code nits:
- Return proper 413 for oversized bodies using errors.As with http.MaxBytesError
(was: always 400 'Invalid form data' when MaxBytesReader triggered)
- Apply same 413 handling to /remove endpoint
- Add maxIPLimiterEntries=10000 cap to ipLimiter.get()
Evicts idle entries when full, returns zero-rate limiter if still full
(was: unbounded map growth between 10-min cleanup intervals)
All checks pass: go build, go vet, gofmt -l clean
Blockers fixed:
- Docker: create /app/data with tbin ownership, use named volume in docker-compose
(was: bind mount broke non-root user, MkdirAll failed on startup)
- Remove /metrics from main HTTP mux (was: exposed publicly even when --metrics-addr empty)
- Implement per-IP rate limiting with ipLimiter (map + cleanup goroutine)
(was: single global limiter, docs said per-IP but wasn't)
- Fix Prometheus label cardinality: use fixed endpoint labels instead of r.URL.Path
(was: unbounded memory growth from unique paths as labels)
Non-blocking fixes:
- Remove redundant purgeRunning atomic.Bool (keep only purgeMu.TryLock)
- Remove dead code: getClientIP (replaced by getRemoteIP), unreachable health case
in handleHTTP, _ = host in TCP limiter
- Fix MaxBytesReader/413: use r.ParseForm() to detect body-too-large errors properly
- Track TCP handlers and async operations with sync.WaitGroup for graceful shutdown
- CI: add test job with go build, vet, gofmt check, go test before Docker build
- CI: bump actions/checkout to v4, add PR trigger
- docker-compose: use named volume tbin-data instead of bind mount
- Dockerfile: pin tbin user to UID 1000, add VOLUME /app/data
- README: document non-root user, named volume, per-IP rate limiting
All checks pass: go build, go vet, gofmt -l