#!/bin/bash -x SESSION=etcd-cluster DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ulimit -n unlimited tmux new-session -d -s $SESSION mkdir test-cluster peer_args= if [ -n "${DISCOVERY_URL}" ]; then peer_args="-discovery ${DISCOVERY_URL}" fi # Setup a window for tailing log files tmux new-window -t $SESSION:1 -n 'peers' tmux split-window -h tmux select-pane -t 0 tmux send-keys "${DIR}/../bin/etcd -peer-addr 127.0.0.1:7001 -addr 127.0.0.1:4001 -data-dir test-cluster/peer1 -name peer1 ${peer_args}" C-m if [ -z "${peer_args}" ]; then peer_args="-peers 127.0.0.1:7001" fi for i in 2 3; do tmux select-pane -t 0 tmux split-window -v tmux send-keys "sleep 2; ${DIR}/../bin/etcd -cors='*' -peer-addr 127.0.0.1:700${i} -addr 127.0.0.1:400${i} -data-dir test-cluster/peer${i} -name peer${i} ${peer_args}" C-m done tmux new-window -t $SESSION:2 -n 'proxy' tmux split-window -h tmux select-pane -t 0 tmux send-keys "curl -XPUT -H \"Content-Type: application/json\" -d '{\"activeSize\":3, \"removeDelay\":30}' http://127.0.0.1:7001/v2/admin/config" C-m for i in 4 5 6; do tmux select-pane -t 0 tmux split-window -v tmux send-keys "sleep 5; ${DIR}/../bin/etcd -cors='*' -peer-addr 127.0.0.1:700${i} -addr 127.0.0.1:400${i} -data-dir test-cluster/peer${i} -name peer${i} ${peer_args}" C-m done # Attach to session tmux attach-session -t $SESSION