Only cmd/api connects to Postgres and Redis. Agents authenticate with tokens created by 'api agent create' and use /agent/v1: checkers long poll for jobs, which doubles as heartbeat, and report results in batches. Organizations manage monitors through /api/v1/org/monitors. BREAKING CHANGE: cmd/checker and cmd/statuspage no longer read UPTIME_DATABASE_URL or UPTIME_REDIS_*; they need UPTIME_API_URL and UPTIME_AGENT_TOKEN. UPTIME_CHECKER_REGION is replaced by the region bound to the agent token. Closes #10 Closes #11 Closes #12 Closes #13 Closes #49 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
39 lines
1010 B
Makefile
39 lines
1010 B
Makefile
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
|
|
PKG := git.zb-server.de/ZB-Server/uptimesebi
|
|
LDFLAGS := -s -w -X $(PKG)/internal/buildinfo.Version=$(VERSION) -X $(PKG)/internal/buildinfo.Commit=$(COMMIT)
|
|
|
|
.PHONY: generate web build test lint dev-up dev-up-sentinel dev-down migrate image
|
|
|
|
generate:
|
|
sqlc generate
|
|
go tool templ generate
|
|
|
|
web:
|
|
npm run build
|
|
|
|
build: generate web
|
|
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/ ./cmd/...
|
|
|
|
test:
|
|
# Integration tests share one Postgres and Redis database, so packages run one at a time.
|
|
go test -p 1 ./...
|
|
|
|
lint:
|
|
golangci-lint run
|
|
|
|
dev-up:
|
|
docker compose up -d --wait
|
|
|
|
dev-up-sentinel:
|
|
docker compose --profile sentinel up -d --wait
|
|
|
|
dev-down:
|
|
docker compose --profile sentinel down
|
|
|
|
migrate:
|
|
go run ./cmd/api migrate up
|
|
|
|
image:
|
|
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) -t uptimesebi:$(VERSION) .
|