Files

199 lines
5.0 KiB
YAML

version: '3.8'
# Distributed Ruvector Cluster Test Environment
# Simulates a 5-node cluster with Raft consensus, multi-master replication, and auto-sharding
services:
# Raft Node 1 (Initial Leader)
raft-node-1:
build:
context: ../../../
dockerfile: tests/integration/distributed/Dockerfile
container_name: ruvector-raft-1
hostname: raft-node-1
environment:
- NODE_ID=raft-node-1
- NODE_ROLE=leader
- RAFT_PORT=7000
- CLUSTER_PORT=8000
- REPLICATION_PORT=9000
- CLUSTER_MEMBERS=raft-node-1,raft-node-2,raft-node-3,raft-node-4,raft-node-5
- SHARD_COUNT=64
- REPLICATION_FACTOR=3
- ELECTION_TIMEOUT_MIN=150
- ELECTION_TIMEOUT_MAX=300
- HEARTBEAT_INTERVAL=50
- RUST_LOG=info
ports:
- "17000:7000"
- "18000:8000"
- "19000:9000"
networks:
ruvector-cluster:
ipv4_address: 172.28.0.10
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 3
# Raft Node 2
raft-node-2:
build:
context: ../../../
dockerfile: tests/integration/distributed/Dockerfile
container_name: ruvector-raft-2
hostname: raft-node-2
environment:
- NODE_ID=raft-node-2
- NODE_ROLE=follower
- RAFT_PORT=7000
- CLUSTER_PORT=8000
- REPLICATION_PORT=9000
- CLUSTER_MEMBERS=raft-node-1,raft-node-2,raft-node-3,raft-node-4,raft-node-5
- SHARD_COUNT=64
- REPLICATION_FACTOR=3
- RUST_LOG=info
ports:
- "17001:7000"
- "18001:8000"
- "19001:9000"
networks:
ruvector-cluster:
ipv4_address: 172.28.0.11
depends_on:
- raft-node-1
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 3
# Raft Node 3
raft-node-3:
build:
context: ../../../
dockerfile: tests/integration/distributed/Dockerfile
container_name: ruvector-raft-3
hostname: raft-node-3
environment:
- NODE_ID=raft-node-3
- NODE_ROLE=follower
- RAFT_PORT=7000
- CLUSTER_PORT=8000
- REPLICATION_PORT=9000
- CLUSTER_MEMBERS=raft-node-1,raft-node-2,raft-node-3,raft-node-4,raft-node-5
- SHARD_COUNT=64
- REPLICATION_FACTOR=3
- RUST_LOG=info
ports:
- "17002:7000"
- "18002:8000"
- "19002:9000"
networks:
ruvector-cluster:
ipv4_address: 172.28.0.12
depends_on:
- raft-node-1
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 3
# Raft Node 4
raft-node-4:
build:
context: ../../../
dockerfile: tests/integration/distributed/Dockerfile
container_name: ruvector-raft-4
hostname: raft-node-4
environment:
- NODE_ID=raft-node-4
- NODE_ROLE=follower
- RAFT_PORT=7000
- CLUSTER_PORT=8000
- REPLICATION_PORT=9000
- CLUSTER_MEMBERS=raft-node-1,raft-node-2,raft-node-3,raft-node-4,raft-node-5
- SHARD_COUNT=64
- REPLICATION_FACTOR=3
- RUST_LOG=info
ports:
- "17003:7000"
- "18003:8000"
- "19003:9000"
networks:
ruvector-cluster:
ipv4_address: 172.28.0.13
depends_on:
- raft-node-1
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 3
# Raft Node 5
raft-node-5:
build:
context: ../../../
dockerfile: tests/integration/distributed/Dockerfile
container_name: ruvector-raft-5
hostname: raft-node-5
environment:
- NODE_ID=raft-node-5
- NODE_ROLE=follower
- RAFT_PORT=7000
- CLUSTER_PORT=8000
- REPLICATION_PORT=9000
- CLUSTER_MEMBERS=raft-node-1,raft-node-2,raft-node-3,raft-node-4,raft-node-5
- SHARD_COUNT=64
- REPLICATION_FACTOR=3
- RUST_LOG=info
ports:
- "17004:7000"
- "18004:8000"
- "19004:9000"
networks:
ruvector-cluster:
ipv4_address: 172.28.0.14
depends_on:
- raft-node-1
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 3
# Test Runner Container
test-runner:
build:
context: ../../../
dockerfile: tests/integration/distributed/Dockerfile.test
container_name: ruvector-test-runner
environment:
- CLUSTER_NODES=raft-node-1:8000,raft-node-2:8000,raft-node-3:8000,raft-node-4:8000,raft-node-5:8000
- TEST_ITERATIONS=10000
- RUST_LOG=info
networks:
ruvector-cluster:
ipv4_address: 172.28.0.100
depends_on:
- raft-node-1
- raft-node-2
- raft-node-3
- raft-node-4
- raft-node-5
command: ["cargo", "test", "-p", "ruvector-raft", "-p", "ruvector-cluster", "-p", "ruvector-replication", "--", "--nocapture"]
networks:
ruvector-cluster:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
volumes:
cargo-cache:
target-cache: