mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
189 lines
4.7 KiB
YAML
189 lines
4.7 KiB
YAML
services:
|
|
# DEX Backend - Single Node with K=1 Consensus
|
|
dex-node:
|
|
build:
|
|
context: ../backend
|
|
dockerfile: ../docker/backend/Dockerfile
|
|
container_name: lux-dex-node
|
|
hostname: dex-node-1
|
|
environment:
|
|
- NODE_ID=node-1
|
|
- NODE_PORT=5000
|
|
- HTTP_PORT=8080
|
|
- WS_PORT=8081
|
|
- CONSENSUS_K=1 # Single node consensus
|
|
- CONSENSUS_N=1 # Total nodes = 1
|
|
- ENGINE_TYPE=hybrid
|
|
- TEST_MODE=true
|
|
- ENABLE_PERPS=true
|
|
- ENABLE_VAULTS=true
|
|
- ENABLE_LENDING=true
|
|
- LOG_LEVEL=info
|
|
- METRICS_ENABLED=true
|
|
- METRICS_PORT=9090
|
|
ports:
|
|
- "8080:8080" # HTTP API
|
|
- "8081:8081" # WebSocket
|
|
- "5000:5000" # P2P/Consensus
|
|
- "9090:9090" # Metrics
|
|
volumes:
|
|
- dex-data:/data
|
|
- ../backend/config:/config
|
|
networks:
|
|
- dex-network
|
|
- lux-monitoring
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# UI Frontend
|
|
dex-ui:
|
|
build:
|
|
context: ../ui
|
|
dockerfile: ../docker/ui/Dockerfile
|
|
args:
|
|
- NEXT_PUBLIC_WS_URL=ws://localhost:8081
|
|
- NEXT_PUBLIC_API_URL=http://localhost:8080
|
|
container_name: lux-dex-ui
|
|
environment:
|
|
- NODE_ENV=production
|
|
- NEXT_PUBLIC_WS_URL=ws://localhost:8081
|
|
- NEXT_PUBLIC_API_URL=http://localhost:8080
|
|
- NEXT_PUBLIC_BASE_PATH=/v2
|
|
ports:
|
|
- "3000:3000" # Next.js server
|
|
depends_on:
|
|
dex-node:
|
|
condition: service_healthy
|
|
networks:
|
|
- dex-network
|
|
- lux-monitoring
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/v2"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# NATS Message Bus for inter-node communication
|
|
nats:
|
|
image: nats:2.10-alpine
|
|
container_name: lux-dex-nats
|
|
command: "-p 4222 -m 8222 --cluster_name LX_DEX"
|
|
ports:
|
|
- "4222:4222" # Client connections
|
|
- "8222:8222" # HTTP monitoring
|
|
networks:
|
|
- dex-network
|
|
- lux-monitoring
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8222/healthz"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# Prometheus Metrics
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: lux-dex-prometheus
|
|
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'
|
|
ports:
|
|
- "9091:9090"
|
|
volumes:
|
|
- ../monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
|
|
- prometheus-data:/prometheus
|
|
networks:
|
|
- dex-network
|
|
depends_on:
|
|
- dex-node
|
|
restart: unless-stopped
|
|
|
|
# Grafana Dashboard
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
container_name: lux-dex-grafana
|
|
environment:
|
|
- GF_SECURITY_ADMIN_USER=admin
|
|
- GF_SECURITY_ADMIN_PASSWORD=admin123
|
|
- GF_INSTALL_PLUGINS=grafana-clock-panel
|
|
ports:
|
|
- "3001:3000"
|
|
volumes:
|
|
- ../monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards
|
|
- ../monitoring/grafana/datasources:/etc/grafana/provisioning/datasources
|
|
- grafana-data:/var/lib/grafana
|
|
networks:
|
|
- dex-network
|
|
depends_on:
|
|
- prometheus
|
|
restart: unless-stopped
|
|
|
|
# Nginx Reverse Proxy
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: lux-dex-nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ../nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ../nginx/ssl:/etc/nginx/ssl:ro
|
|
- nginx-cache:/var/cache/nginx
|
|
networks:
|
|
- dex-network
|
|
depends_on:
|
|
- dex-ui
|
|
- dex-node
|
|
restart: unless-stopped
|
|
|
|
# Test Runner (Optional - for automated testing)
|
|
test-runner:
|
|
build:
|
|
context: ../ui
|
|
dockerfile: ../docker/ui/Dockerfile.test
|
|
container_name: lux-dex-tests
|
|
environment:
|
|
- PLAYWRIGHT_BASE_URL=http://dex-ui:3000
|
|
- API_URL=http://dex-node:8080
|
|
- WS_URL=ws://dex-node:8081
|
|
volumes:
|
|
- ../ui/test-results:/app/test-results
|
|
- ../ui/playwright-report:/app/playwright-report
|
|
networks:
|
|
- dex-network
|
|
depends_on:
|
|
- dex-ui
|
|
- dex-node
|
|
profiles:
|
|
- test
|
|
command: npm run test:e2e
|
|
|
|
networks:
|
|
dex-network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.25.0.0/16
|
|
|
|
# Connect to Lux monitoring network if available
|
|
lux-monitoring:
|
|
external: true
|
|
name: monitoring_lux-monitoring
|
|
|
|
volumes:
|
|
dex-data:
|
|
driver: local
|
|
prometheus-data:
|
|
driver: local
|
|
grafana-data:
|
|
driver: local
|
|
nginx-cache:
|
|
driver: local |