Files
bodyshop/redis/entrypoint.sh
Dave Richer ddb0990645 docker-redis - local tests
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-10-02 00:50:40 -04:00

21 lines
481 B
Bash

#!/bin/sh
# Start Redis server in the background
redis-server /usr/local/etc/redis/redis.conf &
# Wait for Redis server to start
sleep 5
# Only initialize the cluster from one node to prevent race conditions
if [ "$HOSTNAME" = "redis-node-1" ]; then
echo "Initializing Redis Cluster..."
yes yes | redis-cli --cluster create \
redis-node-1:6379 \
redis-node-2:6379 \
redis-node-3:6379 \
--cluster-replicas 0
fi
# Keep the container running
tail -f /dev/null