build: add sentinel topology to dev compose stack
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
2bd3d0a18e
commit
8d1093cd2d
4 files changed
+42
-2
No files matched your search
@@ -2,3 +2,7 @@ UPTIME_DATABASE_URL=postgres://uptime:uptime@localhost:5432/uptime?sslmode=disab
|
||||
UPTIME_REDIS_URL=redis://localhost:6379/0
|
||||
UPTIME_LOG_FORMAT=text
|
||||
UPTIME_CHECKER_REGION=local
|
||||
|
||||
# Sentinel instead of a single redis (docker compose --profile sentinel up -d)
|
||||
# UPTIME_REDIS_SENTINEL_MASTER=uptime
|
||||
# UPTIME_REDIS_SENTINEL_ADDRS=127.0.0.1:26379,127.0.0.1:26380,127.0.0.1:26381
|
||||
@@ -3,7 +3,7 @@ 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-down migrate image
|
||||
.PHONY: generate web build test lint dev-up dev-up-sentinel dev-down migrate image
|
||||
|
||||
generate:
|
||||
sqlc generate
|
||||
@@ -24,8 +24,11 @@ lint:
|
||||
dev-up:
|
||||
docker compose up -d --wait
|
||||
|
||||
dev-up-sentinel:
|
||||
docker compose --profile sentinel up -d --wait
|
||||
|
||||
dev-down:
|
||||
docker compose down
|
||||
docker compose --profile sentinel down
|
||||
|
||||
migrate:
|
||||
go run ./cmd/api migrate up
|
||||
|
||||
@@ -22,5 +22,33 @@ services:
|
||||
interval: 2s
|
||||
retries: 30
|
||||
|
||||
# Sentinel topology for HA testing: docker compose --profile sentinel up -d
|
||||
# Host networking keeps announced addresses reachable from the host.
|
||||
redis-primary:
|
||||
image: redis:8-alpine
|
||||
profiles: [sentinel]
|
||||
network_mode: host
|
||||
command: redis-server --port 6380
|
||||
|
||||
redis-replica:
|
||||
image: redis:8-alpine
|
||||
profiles: [sentinel]
|
||||
network_mode: host
|
||||
command: redis-server --port 6381 --replicaof 127.0.0.1 6380
|
||||
|
||||
sentinel-1: &sentinel
|
||||
image: redis:8-alpine
|
||||
profiles: [sentinel]
|
||||
network_mode: host
|
||||
entrypoint: ["sh", "-c", "cp /cfg/sentinel.conf /tmp/s.conf && exec redis-sentinel /tmp/s.conf --port $$PORT"]
|
||||
environment: {PORT: "26379"}
|
||||
volumes: [./deploy/dev/sentinel.conf:/cfg/sentinel.conf:ro]
|
||||
sentinel-2:
|
||||
<<: *sentinel
|
||||
environment: {PORT: "26380"}
|
||||
sentinel-3:
|
||||
<<: *sentinel
|
||||
environment: {PORT: "26381"}
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
@@ -0,0 +1,5 @@
|
||||
port 26379
|
||||
sentinel resolve-hostnames yes
|
||||
sentinel monitor uptime 127.0.0.1 6380 2
|
||||
sentinel down-after-milliseconds uptime 3000
|
||||
sentinel failover-timeout uptime 10000
|
||||
Reference in new issue
Block a user