docker-redis - local tests

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-10-02 00:27:11 -04:00
parent b7423aebf6
commit 04dec6d91c
14 changed files with 456 additions and 18 deletions

30
redis/entrypoint.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
LOCK_FILE="redis-cluster-init.lock"
# Start Redis server in the background
redis-server /usr/local/etc/redis/redis.conf &
# Wait for Redis server to start
sleep 5
# Initialize the cluster only if the lock file does not exist
if [ ! -f "$LOCK_FILE" ]; then
echo "Initializing Redis Cluster..."
# Run the Redis cluster initialization
yes yes | redis-cli --cluster create \
redis-node-1:6379 \
redis-node-2:6379 \
redis-node-3:6379 \
--cluster-replicas 0
# Create the lock file after initialization
touch "$LOCK_FILE"
echo "Cluster initialization complete. Lock file created."
else
echo "Cluster has already been initialized. Skipping initialization."
fi
# Keep the container running
tail -f /dev/null