Skip to content

redis-unstable cluster docker #1889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.cluster
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RUN chmod +x /create_cluster.sh

EXPOSE 16379 16380 16381 16382 16383 16384

CMD [ "/create_cluster.sh"]
CMD /create_cluster.sh 16379 16384
9 changes: 9 additions & 0 deletions docker/base/Dockerfile.unstable_cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# produces redisfab/redis-py-cluster:6.2.6
FROM redisfab/redis-py:unstable-bionic

COPY create_cluster.sh /create_cluster.sh
RUN chmod +x /create_cluster.sh

EXPOSE 6372 6373 6374 6375 6376 6377

CMD /create_cluster.sh 6372 6377
6 changes: 4 additions & 2 deletions docker/base/create_cluster.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#! /bin/bash
mkdir -p /nodes
touch /nodes/nodemap
for PORT in $(seq 16379 16384); do
START_NODE=$1
END_NODE=$2
for PORT in `seq ${START_NODE} ${END_NODE}`; do
mkdir -p /nodes/$PORT
if [[ -e /redis.conf ]]; then
cp /redis.conf /nodes/$PORT/redis.conf
Expand All @@ -22,5 +24,5 @@ EOF
fi
echo 127.0.0.1:$PORT >> /nodes/nodemap
done
echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g 16379 16384) --cluster-replicas 1
echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g ${START_NODE} ${END_NODE}) --cluster-replicas 1
tail -f /redis.log
4 changes: 4 additions & 0 deletions docker/unstable_cluster/redis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Redis Cluster config file will be shared across all nodes.
# Do not change the following configurations that are already set:
# port, cluster-enabled, daemonize, logfile, dir
protected-mode no
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(sock
volumes =
bind:rw:{toxinidir}/docker/unstable/redis.conf:/redis.conf

[docker:unstable_cluster]
name = unstable_cluster
image = redisfab/redis-py-cluster:unstable-bionic
ports =
6372:6372/tcp
6373:6373/tcp
6374:6374/tcp
6375:6375/tcp
6376:6376/tcp
6377:6377/tcp
healtcheck_cmd = python -c "import socket;print(True) if all([0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',port)) for port in range(6372,6377)]) else False"
volumes =
bind:rw:{toxinidir}/docker/cluster/redis.conf:/redis.conf

[docker:sentinel_1]
name = sentinel_1
Expand Down Expand Up @@ -118,6 +131,7 @@ deps =
-r {toxinidir}/dev_requirements.txt
docker =
unstable
unstable_cluster
master
replica
sentinel_1
Expand Down