Files
dev/hanzo-node/compose.yml
T
zeekay 1ea74fdf94 fix(hanzo-node): migrate IAM stack to Hanzo-branded images and PostgreSQL
Replace upstream MySQL, Redis, and Casdoor images with Hanzo equivalents
(ghcr.io/hanzoai/sql, kv, iam) and switch IAM database driver from MySQL
to PostgreSQL for consistency with the production stack.
2026-02-23 17:48:09 -08:00

228 lines
5.6 KiB
YAML

# Hanzo Node - Docker Compose Configuration
# Production-ready deployment with environment-based configuration
services:
hanzo-node:
build:
context: .
dockerfile: Dockerfile
image: hanzoai/hanzo-node:latest
container_name: hanzo-node
restart: unless-stopped
# Environment configuration
environment:
# Node identity (auto-generated if empty)
- HANZO_NODE_ID=${HANZO_NODE_ID:-}
# Network addresses
- HANZO_GRPC_ADDR=0.0.0.0:9090
- HANZO_HTTP_ADDR=0.0.0.0:8080
- HANZO_P2P_ADDR=/ip4/0.0.0.0/tcp/9000
# Data persistence
- HANZO_DATA_DIR=/app/data
# Network configuration
# 43114 = mainnet, 43113 = testnet, 1337 = local
- HANZO_NETWORK_ID=${HANZO_NETWORK_ID:-1337}
# Bootstrap peers (comma-separated multiaddrs)
- HANZO_BOOTSTRAP_PEERS=${HANZO_BOOTSTRAP_PEERS:-}
# Operator wallet address for staking/rewards
- HANZO_OPERATOR=${HANZO_OPERATOR:-}
# MLX acceleration (macOS only, disabled in container)
- HANZO_MLX=false
# Logging
- HANZO_LOG_LEVEL=${HANZO_LOG_LEVEL:-info}
- RUST_LOG=${RUST_LOG:-hanzo_node=info,tonic=info,libp2p=warn}
# IAM Configuration
- HANZO_IAM_ENABLED=${HANZO_IAM_ENABLED:-false}
- HANZO_IAM_ISSUER=${HANZO_IAM_ISSUER:-}
- HANZO_IAM_AUDIENCE=${HANZO_IAM_AUDIENCE:-hanzo-node}
- HANZO_IAM_JWKS_URI=${HANZO_IAM_JWKS_URI:-}
- HANZO_IAM_SECRET=${HANZO_IAM_SECRET:-}
- HANZO_IAM_BASE_URL=${HANZO_IAM_BASE_URL:-http://iam:8000}
# Port mappings
ports:
# RPC/gRPC API - main interface
- "${HANZO_RPC_PORT:-9090}:9090"
# HTTP health check endpoint
- "${HANZO_HTTP_PORT:-8080}:8080"
# P2P networking
- "${HANZO_P2P_PORT:-9000}:9000"
# Persistent storage
volumes:
- hanzo-data:/app/data
- ./config:/app/config:ro
- ./iam:/app/iam:ro
# Health check
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Resource limits
deploy:
resources:
limits:
cpus: "${HANZO_CPU_LIMIT:-4}"
memory: ${HANZO_MEMORY_LIMIT:-4G}
reservations:
cpus: "0.5"
memory: 512M
# Network configuration
networks:
- hanzo-network
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
# Optional: Prometheus metrics exporter
prometheus:
image: prom/prometheus:v2.48.0
container_name: hanzo-prometheus
profiles:
- monitoring
restart: unless-stopped
ports:
- "${PROMETHEUS_PORT:-9091}:9090"
volumes:
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-lifecycle'
networks:
- hanzo-network
depends_on:
hanzo-node:
condition: service_healthy
# Optional: Grafana dashboards
grafana:
image: grafana/grafana:10.2.0
container_name: hanzo-grafana
profiles:
- monitoring
restart: unless-stopped
ports:
- "${GRAFANA_PORT:-3000}:3000"
volumes:
- grafana-data:/var/lib/grafana
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-hanzo}
- GF_USERS_ALLOW_SIGN_UP=false
networks:
- hanzo-network
depends_on:
- prometheus
# IAM Service (Casdoor) - Optional authentication provider
iam-db:
image: ghcr.io/hanzoai/sql:latest
container_name: hanzo-iam-db
profiles:
- iam
restart: unless-stopped
environment:
POSTGRES_USER: hanzo
POSTGRES_PASSWORD: ${IAM_DB_PASSWORD:-hanzo}
POSTGRES_DB: hanzo_iam
ports:
- "${IAM_DB_PORT:-5433}:5432"
volumes:
- iam-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U hanzo -d hanzo_iam"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- hanzo-network
iam-redis:
image: ghcr.io/hanzoai/kv:latest
container_name: hanzo-iam-redis
profiles:
- iam
restart: unless-stopped
ports:
- "${IAM_REDIS_PORT:-6380}:6379"
volumes:
- iam-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- hanzo-network
iam:
image: ghcr.io/hanzoai/iam:latest
container_name: hanzo-iam
profiles:
- iam
restart: unless-stopped
command: ./server --createDatabase=true
ports:
- "${IAM_PORT:-8000}:8000"
depends_on:
iam-db:
condition: service_healthy
iam-redis:
condition: service_healthy
environment:
RUNNING_IN_DOCKER: "true"
volumes:
- ./iam/app.conf:/conf/app.conf:ro
- ./iam/init_data.json:/init_data.json:ro
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8000/api/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
networks:
- hanzo-network
# Named volumes for persistence
volumes:
hanzo-data:
driver: local
prometheus-data:
driver: local
grafana-data:
driver: local
iam-db-data:
driver: local
iam-redis-data:
driver: local
# Network configuration
networks:
hanzo-network:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16