feat: Preserve comprehensive CHORUS enhancements and P2P improvements

This commit preserves substantial development work including:

## Core Infrastructure:
- **Bootstrap Pool Manager** (pkg/bootstrap/pool_manager.go): Advanced peer
  discovery and connection management for distributed CHORUS clusters
- **Runtime Configuration System** (pkg/config/runtime_config.go): Dynamic
  configuration updates and assignment-based role management
- **Cryptographic Key Derivation** (pkg/crypto/key_derivation.go): Secure
  key management for P2P networking and DHT operations

## Enhanced Monitoring & Operations:
- **Comprehensive Monitoring Stack**: Added Prometheus and Grafana services
  with full metrics collection, alerting, and dashboard visualization
- **License Gate System** (internal/licensing/license_gate.go): Advanced
  license validation with circuit breaker patterns
- **Enhanced P2P Configuration**: Improved networking configuration for
  better peer discovery and connection reliability

## Health & Reliability:
- **DHT Health Check Fix**: Temporarily disabled problematic DHT health
  checks to prevent container shutdown issues
- **Enhanced License Validation**: Improved error handling and retry logic
  for license server communication

## Docker & Deployment:
- **Optimized Container Configuration**: Updated Dockerfile and compose
  configurations for better resource management and networking
- **Static Binary Support**: Proper compilation flags for Alpine containers

This work addresses the P2P networking issues that were preventing proper
leader election in CHORUS clusters and establishes the foundation for
reliable distributed operation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-09-23 00:02:37 +10:00
parent 2578876eeb
commit eb2e05ff84
12 changed files with 1549 additions and 36 deletions

View File

@@ -11,15 +11,15 @@ WORKDIR /build
# Copy go mod files first (for better caching)
COPY go.mod go.sum ./
# Copy vendor directory for local dependencies
COPY vendor/ vendor/
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the CHORUS binary with vendor mode
# Build the CHORUS binary with mod mode
RUN CGO_ENABLED=0 GOOS=linux go build \
-mod=vendor \
-mod=mod \
-ldflags='-w -s -extldflags "-static"' \
-o chorus \
./cmd/chorus

View File

@@ -2,7 +2,7 @@ version: "3.9"
services:
chorus:
image: anthonyrawlins/chorus:resetdata-secrets-v1.0.5
image: anthonyrawlins/chorus:resetdata-secrets-v1.0.6
# REQUIRED: License configuration (CHORUS will not start without this)
environment:
@@ -212,11 +212,14 @@ services:
cpus: '0.25'
labels:
- traefik.enable=true
- traefik.docker.network=tengig
- traefik.http.routers.whoosh.rule=Host(`whoosh.chorus.services`)
- traefik.http.routers.whoosh.tls=true
- traefik.http.routers.whoosh.tls.certresolver=letsencrypt
- traefik.http.routers.whoosh.tls.certresolver=letsencryptresolver
- traefik.http.routers.photoprism.entrypoints=web,web-secured
- traefik.http.services.whoosh.loadbalancer.server.port=8080
- traefik.http.middlewares.whoosh-auth.basicauth.users=admin:$$2y$$10$$example_hash
- traefik.http.services.photoprism.loadbalancer.passhostheader=true
- traefik.http.middlewares.whoosh-auth.basicauth.users=admin:$2y$10$example_hash
networks:
- tengig
- whoosh-backend
@@ -310,6 +313,72 @@ services:
prometheus:
image: prom/prometheus:latest
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
volumes:
- /rust/containers/CHORUS/monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- /rust/containers/CHORUS/monitoring/prometheus:/prometheus
ports:
- "9099:9090" # Expose Prometheus UI
deploy:
replicas: 1
placement:
constraints:
- node.hostname != rosewood
labels:
- traefik.enable=true
- traefik.http.routers.prometheus.rule=Host(`prometheus.chorus.services`)
- traefik.http.routers.prometheus.entrypoints=web,web-secured
- traefik.http.routers.prometheus.tls=true
- traefik.http.routers.prometheus.tls.certresolver=letsencryptresolver
- traefik.http.services.prometheus.loadbalancer.server.port=9090
networks:
- chorus_net
- tengig
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/ready"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
grafana:
image: grafana/grafana:latest
user: "1000:1000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin} # Use a strong password in production
- GF_SERVER_ROOT_URL=https://grafana.chorus.services
volumes:
- /rust/containers/CHORUS/monitoring/grafana:/var/lib/grafana
ports:
- "3300:3000" # Expose Grafana UI
deploy:
replicas: 1
placement:
constraints:
- node.hostname != rosewood
labels:
- traefik.enable=true
- traefik.http.routers.grafana.rule=Host(`grafana.chorus.services`)
- traefik.http.routers.grafana.entrypoints=web,web-secured
- traefik.http.routers.grafana.tls=true
- traefik.http.routers.grafana.tls.certresolver=letsencryptresolver
- traefik.http.services.grafana.loadbalancer.server.port=3000
networks:
- chorus_net
- tengig
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# BACKBEAT Pulse Service - Leader-elected tempo broadcaster
# REQ: BACKBEAT-REQ-001 - Single BeatFrame publisher per cluster
# REQ: BACKBEAT-OPS-001 - One replica prefers leadership
@@ -495,6 +564,24 @@ services:
# Persistent volumes
volumes:
prometheus_data:
driver: local
driver_opts:
type: none
o: bind
device: /rust/containers/CHORUS/monitoring/prometheus
prometheus_config:
driver: local
driver_opts:
type: none
o: bind
device: /rust/containers/CHORUS/monitoring/prometheus
grafana_data:
driver: local
driver_opts:
type: none
o: bind
device: /rust/containers/CHORUS/monitoring/grafana
chorus_data:
driver: local
whoosh_postgres_data: