feat: split worker into separate binary (cmd/worker)
Kafka consumers and WorkerPool are moved out of the server process into a dedicated worker binary. Server now handles HTTP + SSE only; worker handles Kafka consumption and AI processing. - cmd/worker/main.go + init.go: new binary with minimal config (DATABASE_URL, OPENAI_API_KEY, KAFKA_BROKERS) - cmd/server: remove WorkerPool, paidConsumer, freeConsumer - Dockerfile: builds both server and worker binaries - docker-compose.yml: add worker service - Makefile: add run-worker and docker-logs-worker targets - README.md: document worker startup and env vars Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
.PHONY: run test test-integration lint migrate-up migrate-down migrate-create migrate-status docker-up docker-down docker-logs
|
||||
.PHONY: run run-worker test test-integration lint migrate-up migrate-down migrate-create migrate-status docker-up docker-down docker-logs docker-logs-worker
|
||||
|
||||
ifneq (,$(wildcard .env))
|
||||
include .env
|
||||
@@ -9,6 +9,9 @@ endif
|
||||
run:
|
||||
go run ./cmd/server
|
||||
|
||||
run-worker:
|
||||
go run ./cmd/worker
|
||||
|
||||
# Tests
|
||||
test:
|
||||
go test ./... -v -race -count=1
|
||||
@@ -43,3 +46,6 @@ docker-down:
|
||||
|
||||
docker-logs:
|
||||
docker compose logs -f app
|
||||
|
||||
docker-logs-worker:
|
||||
docker compose logs -f worker
|
||||
|
||||
Reference in New Issue
Block a user