Skip to content

Commit

Permalink
Use different cluster setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hmstepanek committed Jul 21, 2023
1 parent adda701 commit a69426b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
56 changes: 26 additions & 30 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,32 @@ jobs:
timeout-minutes: 30

services:
redis:
image: redis
ports:
- 7000:7000
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis-node-0:
image: docker.io/bitnami/redis-cluster:6.2
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2'
ports:
- 6379:6379
- 8080:6379
- 8081:6379

redis-node-1:
image: docker.io/bitnami/redis-cluster:6.2
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2'

redis-node-2:
image: docker.io/bitnami/redis-cluster:6.2
depends_on:
- redis-node-0
- redis-node-1
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_CLUSTER_REPLICAS=0'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2'
- 'REDIS_CLUSTER_CREATOR=yes'

steps:
- uses: actions/checkout@v3
Expand All @@ -421,26 +437,6 @@ jobs:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --tags origin
# Start the redis cluser (See https://redis.io/docs/management/scaling/#create-a-redis-cluster)
- name: Start the redis cluster
run: |
mkdir cluster-test
mkdir cluster-test/7000 cluster-test/7001 cluster-test/7002 cluster-test/7003 cluster-test/7004 cluster-test/7005
echo $'port 7000\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes' > cluster-test/7000/redis.conf
echo $'port 7001\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes' > cluster-test/7001/redis.conf
echo $'port 7002\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes' > cluster-test/7002/redis.conf
echo $'port 7003\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes' > cluster-test/7003/redis.conf
echo $'port 7004\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes' > cluster-test/7004/redis.conf
echo $'port 7005\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes' > cluster-test/7005/redis.conf
sudo apt install redis-server
redis-server ./cluster-test/7000/redis.conf --daemonize yes
redis-server ./cluster-test/7001/redis.conf --daemonize yes
redis-server ./cluster-test/7002/redis.conf --daemonize yes
redis-server ./cluster-test/7003/redis.conf --daemonize yes
redis-server ./cluster-test/7004/redis.conf --daemonize yes
redis-server ./cluster-test/7005/redis.conf --daemonize yes
redis-cli --cluster create host.docker.internal:7000 host.docker.internal:7001 host.docker.internal:7002 host.docker.internal:7003 host.docker.internal:7004 host.docker.internal:7005 --cluster-replicas 1
- name: Get Environments
id: get-envs
run: |
Expand Down
4 changes: 2 additions & 2 deletions tests/testing_support/db_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ def redis_cluster_settings():

host = "host.docker.internal" if "GITHUB_ACTIONS" in os.environ else "localhost"
instances = 1
base_port = 7000
base_port = 6379

settings = [
{
"host": "localhost",
"host": host,
"port": base_port + instance_num,
}
for instance_num in range(instances)
Expand Down

0 comments on commit a69426b

Please sign in to comment.