Docker-Compose: Redis Cluster
version: '3'
x-environment-redis:
&default-redis-env
ALLOW_EMPTY_PASSWORD: 'yes'
REDIS_NODES: '127.0.0.1:10000 127.0.0.1:10001 127.0.0.1:10002 127.0.0.1:10003 127.0.0.1:10004 127.0.0.1:10005'
services:
redis-node-1:
image: public.ecr.aws/bitnami/redis-cluster:7.2
restart: always
network_mode: host
environment:
<<: *default-redis-env
REDIS_PORT_NUMBER: 10001
redis-node-2:
image: public.ecr.aws/bitnami/redis-cluster:7.2
restart: always
network_mode: host
environment:
<<: *default-redis-env
REDIS_PORT_NUMBER: 10002
redis-node-3:
image: public.ecr.aws/bitnami/redis-cluster:7.2
restart: always
network_mode: host
environment:
<<: *default-redis-env
REDIS_PORT_NUMBER: 10003
redis-node-4:
image: public.ecr.aws/bitnami/redis-cluster:7.2
restart: always
network_mode: host
environment:
<<: *default-redis-env
REDIS_PORT_NUMBER: 10004
redis-node-5:
image: public.ecr.aws/bitnami/redis-cluster:7.2
restart: always
network_mode: host
environment:
<<: *default-redis-env
REDIS_PORT_NUMBER: 10005
redis-cluster:
image: public.ecr.aws/bitnami/redis-cluster:7.2
restart: always
network_mode: host
depends_on:
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
- redis-node-5
environment:
<<: *default-redis-env
REDIS_PORT_NUMBER: 10000
REDIS_CLUSTER_REPLICAS: 1
REDIS_CLUSTER_CREATOR: 'yes'
NAS Update Containers Script
docker/
├─ update.sh
├─ project1/
│ ├─ docker-compose.yml
├─ project2/
│ ├─ docker-compose.yml
│ ├─ .DISABLED
#!/bin/bash
root_path="/volume1/docker"
###########################################
# UPDATE ALL PROJECTS
###########################################
# Use a for loop to iterate through folders in the directory
for folder in $root_path/*; do
cd $root_path
# Check if the item is a directory
if [ -d "$folder" ]; then
if [ -e "$folder/docker-compose.yml" ]; then
echo "Docker project found in $folder"
if [ -e "$folder/.DISABLED" ]; then
echo "Project $folder was disabled. Skip."
else
echo "Project $folder enabled."
cd $folder
docker-compose pull
docker-compose up -d
fi
else
echo "Docker project not found in $folder"
fi
fi
done
###########################################
# CLEAN DOCKER IMAGES
###########################################
docker system prune --volumes -f
docker image prune -a -f