mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
259 lines
5.8 KiB
YAML
259 lines
5.8 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Infrastructure Services
|
|
nats:
|
|
image: nats:2.10-alpine
|
|
container_name: bridge-nats
|
|
ports:
|
|
- "4222:4222"
|
|
- "8222:8222"
|
|
command: "-js -m 8222 --store_dir /data"
|
|
volumes:
|
|
- nats-data:/data
|
|
networks:
|
|
- bridge-network
|
|
healthcheck:
|
|
test: ["CMD", "nc", "-z", "localhost", "4222"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
consul:
|
|
image: consul:1.17
|
|
container_name: bridge-consul
|
|
ports:
|
|
- "8500:8500"
|
|
- "8600:8600/udp"
|
|
command: "agent -server -bootstrap-expect=1 -ui -client=0.0.0.0"
|
|
volumes:
|
|
- consul-data:/consul/data
|
|
networks:
|
|
- bridge-network
|
|
environment:
|
|
- CONSUL_BIND_INTERFACE=eth0
|
|
healthcheck:
|
|
test: ["CMD", "consul", "members"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# MPC Nodes (3 nodes for 2-of-3 threshold)
|
|
mpc-node-0:
|
|
image: luxfi/lux-mpc:latest
|
|
container_name: bridge-mpc-0
|
|
environment:
|
|
- NODE_ID=mpc-node-0
|
|
- NATS_URL=nats://nats:4222
|
|
- CONSUL_URL=http://consul:8500
|
|
- DB_PATH=/data/mpc
|
|
- HTTP_PORT=8080
|
|
- GRPC_PORT=9090
|
|
- LOG_LEVEL=debug
|
|
- KEY_PREFIX=bridge/mpc
|
|
- THRESHOLD=2
|
|
- TOTAL_NODES=3
|
|
volumes:
|
|
- mpc-data-0:/data
|
|
ports:
|
|
- "8080:8080"
|
|
- "9090:9090"
|
|
networks:
|
|
- bridge-network
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
consul:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
mpc-node-1:
|
|
image: luxfi/lux-mpc:latest
|
|
container_name: bridge-mpc-1
|
|
environment:
|
|
- NODE_ID=mpc-node-1
|
|
- NATS_URL=nats://nats:4222
|
|
- CONSUL_URL=http://consul:8500
|
|
- DB_PATH=/data/mpc
|
|
- HTTP_PORT=8080
|
|
- GRPC_PORT=9090
|
|
- LOG_LEVEL=debug
|
|
- KEY_PREFIX=bridge/mpc
|
|
- THRESHOLD=2
|
|
- TOTAL_NODES=3
|
|
volumes:
|
|
- mpc-data-1:/data
|
|
ports:
|
|
- "8081:8080"
|
|
- "9091:9090"
|
|
networks:
|
|
- bridge-network
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
consul:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
mpc-node-2:
|
|
image: luxfi/lux-mpc:latest
|
|
container_name: bridge-mpc-2
|
|
environment:
|
|
- NODE_ID=mpc-node-2
|
|
- NATS_URL=nats://nats:4222
|
|
- CONSUL_URL=http://consul:8500
|
|
- DB_PATH=/data/mpc
|
|
- HTTP_PORT=8080
|
|
- GRPC_PORT=9090
|
|
- LOG_LEVEL=debug
|
|
- KEY_PREFIX=bridge/mpc
|
|
- THRESHOLD=2
|
|
- TOTAL_NODES=3
|
|
volumes:
|
|
- mpc-data-2:/data
|
|
ports:
|
|
- "8082:8080"
|
|
- "9092:9090"
|
|
networks:
|
|
- bridge-network
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
consul:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
# Bridge Server with integrated MPC
|
|
bridge-server:
|
|
build:
|
|
context: ./app/server
|
|
dockerfile: Dockerfile
|
|
container_name: bridge-server
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3000
|
|
- DATABASE_URL=postgresql://bridge:bridge@postgres:5432/bridge
|
|
- NATS_URL=nats://nats:4222
|
|
- CONSUL_URL=http://consul:8500
|
|
- NODE_ID=bridge-server-0
|
|
- MPC_THRESHOLD=2
|
|
- MPC_TOTAL_NODES=3
|
|
- MPC_KEY_PREFIX=bridge/mpc
|
|
ports:
|
|
- "3000:3000"
|
|
networks:
|
|
- bridge-network
|
|
depends_on:
|
|
- postgres
|
|
- nats
|
|
- consul
|
|
- mpc-node-0
|
|
- mpc-node-1
|
|
- mpc-node-2
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
volumes:
|
|
- ./app/server:/app
|
|
- /app/node_modules
|
|
|
|
# Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: bridge-postgres
|
|
environment:
|
|
- POSTGRES_USER=bridge
|
|
- POSTGRES_PASSWORD=bridge
|
|
- POSTGRES_DB=bridge
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- bridge-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U bridge"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# Bridge UI
|
|
bridge-ui:
|
|
build:
|
|
context: ./app/ui
|
|
dockerfile: Dockerfile
|
|
container_name: bridge-ui
|
|
environment:
|
|
- NEXT_PUBLIC_API_URL=http://localhost:3000
|
|
- NEXT_PUBLIC_CHAIN_ENV=mainnet
|
|
ports:
|
|
- "3001:3000"
|
|
networks:
|
|
- bridge-network
|
|
depends_on:
|
|
- bridge-server
|
|
volumes:
|
|
- ./app/ui:/app
|
|
- /app/node_modules
|
|
- /app/.next
|
|
|
|
# Monitoring
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: bridge-prometheus
|
|
volumes:
|
|
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
|
|
- prometheus-data:/prometheus
|
|
ports:
|
|
- "9093:9090"
|
|
networks:
|
|
- bridge-network
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
container_name: bridge-grafana
|
|
ports:
|
|
- "3002:3000"
|
|
networks:
|
|
- bridge-network
|
|
environment:
|
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
|
- GF_USERS_ALLOW_SIGN_UP=false
|
|
volumes:
|
|
- grafana-data:/var/lib/grafana
|
|
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards
|
|
- ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources
|
|
|
|
volumes:
|
|
nats-data:
|
|
consul-data:
|
|
mpc-data-0:
|
|
mpc-data-1:
|
|
mpc-data-2:
|
|
postgres-data:
|
|
prometheus-data:
|
|
grafana-data:
|
|
|
|
networks:
|
|
bridge-network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.20.0.0/16 |