mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-08 17:42:56 +01:00
27 lines
634 B
Bash
Executable file
27 lines
634 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Approach references https://docs.docker.com/config/containers/multi-service_container/#use-a-wrapper-script
|
|
# This script starts 3 Redis server process in the background and syncs them after a short wait.
|
|
|
|
start_redis_server() {
|
|
redis-server --port $1\
|
|
--cluster-enabled yes \
|
|
--cluster-node-timeout 5000 \
|
|
--bind 0.0.0.0 \
|
|
--cluster-config-file "$2" &
|
|
}
|
|
|
|
IP=$(hostname -I)
|
|
IP=${IP%% *}
|
|
|
|
start_redis_server 7001 nodes-1.conf
|
|
start_redis_server 7002 nodes-2.conf
|
|
start_redis_server 7003 nodes-3.conf
|
|
|
|
sleep 3
|
|
|
|
redis-cli --cluster create "$IP:7001" "$IP:7002" "$IP:7003" --cluster-yes
|
|
|
|
wait -n
|
|
|
|
exit $?
|