blob: 9976d342b1f86138dbd33c814a64804663e8d02a [file]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Iggy leader + follower cluster test setup: a real 2-node VSR cluster with
# replica 0 as the initial leader.
# Activated by: ./scripts/run-bdd-tests.sh <sdk> leader_redirection
# ./scripts/run-bdd-tests.sh <sdk> all
#
# Server constraints that shape this file:
# - `--replica-id <N>` is the only CLI arg each node needs; there is no
# `--follower`, and a new container per run makes `--fresh` redundant.
# - root credentials are mandatory once the cluster is enabled and come
# from IGGY_ROOT_USERNAME / IGGY_ROOT_PASSWORD.
# - `cluster.nodes[*].ip` is parsed as a strict IpAddr (no hostnames) and
# cluster listeners bind to that roster IP, so nodes need static IPs and
# healthchecks must ping the roster address rather than loopback.
# - replica-to-replica consensus requires `ports.tcp_replica`.
x-cluster-node: &cluster-node
image: iggy-bdd-server
platform: linux/amd64
build:
context: ..
dockerfile: core/server/Dockerfile
target: runtime-prebuilt
args:
PREBUILT_IGGY_SERVER: ${IGGY_SERVER_PATH:-target/debug/iggy-server}
PREBUILT_IGGY_CLI: ${IGGY_CLI_PATH:-target/debug/iggy}
LIBC: glibc
PROFILE: debug
cap_add:
- SYS_NICE
security_opt:
- seccomp:unconfined
ulimits:
memlock:
soft: -1
hard: -1
x-cluster-topology: &cluster-topology
IGGY_ROOT_USERNAME: iggy
IGGY_ROOT_PASSWORD: iggy
IGGY_CLUSTER_ENABLED: "true"
IGGY_CLUSTER_NAME: test-cluster
IGGY_CLUSTER_NODES_0_NAME: leader-node
IGGY_CLUSTER_NODES_0_IP: 172.28.0.101
IGGY_CLUSTER_NODES_0_REPLICA_ID: "0"
IGGY_CLUSTER_NODES_0_PORTS_TCP: "8091"
IGGY_CLUSTER_NODES_0_PORTS_QUIC: "8081"
IGGY_CLUSTER_NODES_0_PORTS_HTTP: "3001"
IGGY_CLUSTER_NODES_0_PORTS_WEBSOCKET: "8071"
IGGY_CLUSTER_NODES_0_PORTS_TCP_REPLICA: "8191"
IGGY_CLUSTER_NODES_1_NAME: follower-node
IGGY_CLUSTER_NODES_1_IP: 172.28.0.102
IGGY_CLUSTER_NODES_1_REPLICA_ID: "1"
IGGY_CLUSTER_NODES_1_PORTS_TCP: "8092"
IGGY_CLUSTER_NODES_1_PORTS_QUIC: "8082"
IGGY_CLUSTER_NODES_1_PORTS_HTTP: "3002"
IGGY_CLUSTER_NODES_1_PORTS_WEBSOCKET: "8072"
IGGY_CLUSTER_NODES_1_PORTS_TCP_REPLICA: "8192"
# http.enabled with cluster.enabled requires a JWT key every node can
# verify; cluster auth provides it (derived from the shared secret).
# Enabling auth activates follower-to-primary forwarding, so the config
# validator requires ports.http on every roster node.
IGGY_CLUSTER_AUTH_ENABLED: "true"
IGGY_CLUSTER_AUTH_SHARED_SECRET: "bdd-vsr-cluster-shared-secret-0123456789"
x-cluster-bdd-deps: &cluster-bdd-deps
depends_on:
iggy-leader:
condition: service_healthy
iggy-follower:
condition: service_healthy
environment:
- IGGY_TCP_ADDRESS_LEADER=iggy-leader:8091
- IGGY_TCP_ADDRESS_FOLLOWER=iggy-follower:8092
services:
iggy-leader:
<<: *cluster-node
command: [ "--replica-id", "0" ]
healthcheck:
test: [ "CMD", "/usr/local/bin/iggy", "--tcp-server-address", "172.28.0.101:8091", "ping" ]
interval: 5s
timeout: 3s
retries: 30
start_period: 2s
environment:
<<: *cluster-topology
RUST_LOG: info
IGGY_SYSTEM_PATH: local_data_leader
IGGY_TCP_ADDRESS: 0.0.0.0:8091
IGGY_HTTP_ADDRESS: 0.0.0.0:3001
IGGY_QUIC_ADDRESS: 0.0.0.0:8081
IGGY_WEBSOCKET_ADDRESS: 0.0.0.0:8071
networks:
iggy-bdd-network:
ipv4_address: 172.28.0.101
volumes:
- iggy_leader_data:/app/local_data_leader
iggy-follower:
<<: *cluster-node
command: [ "--replica-id", "1" ]
healthcheck:
test: [ "CMD", "/usr/local/bin/iggy", "--tcp-server-address", "172.28.0.102:8092", "ping" ]
interval: 5s
timeout: 3s
retries: 30
start_period: 2s
environment:
<<: *cluster-topology
RUST_LOG: info
IGGY_SYSTEM_PATH: local_data_follower
IGGY_TCP_ADDRESS: 0.0.0.0:8092
IGGY_HTTP_ADDRESS: 0.0.0.0:3002
IGGY_QUIC_ADDRESS: 0.0.0.0:8082
IGGY_WEBSOCKET_ADDRESS: 0.0.0.0:8072
networks:
iggy-bdd-network:
ipv4_address: 172.28.0.102
volumes:
- iggy_follower_data:/app/local_data_follower
rust-bdd:
<<: *cluster-bdd-deps
go-bdd:
<<: *cluster-bdd-deps
csharp-bdd:
<<: *cluster-bdd-deps
java-bdd:
<<: *cluster-bdd-deps
networks:
iggy-bdd-network:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/24
volumes:
iggy_leader_data:
iggy_follower_data: