mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
211 lines
5.1 KiB
YAML
211 lines
5.1 KiB
YAML
version: '3.9'
|
|
|
|
services:
|
|
# DEX Backend - Single Node with K=1 Consensus
|
|
dex-node:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: 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
|
|
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: 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
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/v2"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: lux-dex-db
|
|
environment:
|
|
- POSTGRES_DB=luxdex
|
|
- POSTGRES_USER=dexuser
|
|
- POSTGRES_PASSWORD=dexpass123
|
|
- POSTGRES_MAX_CONNECTIONS=200
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
- ./backend/migrations:/docker-entrypoint-initdb.d
|
|
networks:
|
|
- dex-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U dexuser -d luxdex"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# Redis Cache
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: lux-dex-redis
|
|
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis-data:/data
|
|
networks:
|
|
- dex-network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
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: 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
|
|
|
|
volumes:
|
|
dex-data:
|
|
driver: local
|
|
postgres-data:
|
|
driver: local
|
|
redis-data:
|
|
driver: local
|
|
prometheus-data:
|
|
driver: local
|
|
grafana-data:
|
|
driver: local
|
|
nginx-cache:
|
|
driver: local |