Skip to content

Commit

Permalink
Update: 测试
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Mar 10, 2024
1 parent b591a0b commit 211d577
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 4 deletions.
135 changes: 135 additions & 0 deletions .github/service/redis-cluster/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
version: '2'
services:
redis-node-0:
image: bitnami/redis-cluster:7.2
volumes:
- "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs"
depends_on:
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
- redis-node-5
environment:
REDIS_PORT_NUMBER: 6379
REDIS_PASSWORD: l83aa26
REDISCLI_AUTH: l83aa26
REDIS_CLUSTER_REPLICAS: 1
REDIS_CLUSTER_CREATOR: yes
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
REDIS_TLS_ENABLED: "true"
REDIS_TLS_PORT_NUMBER: 6443
REDIS_TLS_CERT_FILE: "/opt/bitnami/redis/certs/redis.crt"
REDIS_TLS_KEY_FILE: "/opt/bitnami/redis/certs/redis.key"
REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt"
REDIS_TLS_DH_PARAMS_FILE: "/opt/bitnami/redis/certs/redis.dh"
REDIS_TLS_AUTH_CLIENTS: "yes"
healthcheck:
test: ["CMD-SHELL", "redis-cli -h 127.0.0.1 -p $${REDIS_PORT_NUMBER:-6379} -a $${REDIS_PASSWORD} CLUSTER INFO | grep 'cluster_state:ok'"]
interval: 3s
timeout: 60s
retries: 30
networks:
default:
ipv4_address: 172.10.1.2

redis-node-1:
image: bitnami/redis-cluster:7.2
volumes:
- "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs"
environment:
REDIS_PORT_NUMBER: 6379
REDIS_PASSWORD: l83aa26
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
REDIS_TLS_ENABLED: "true"
REDIS_TLS_PORT_NUMBER: 6443
REDIS_TLS_CERT_FILE: "/opt/bitnami/redis/certs/redis.crt"
REDIS_TLS_KEY_FILE: "/opt/bitnami/redis/certs/redis.key"
REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt"
REDIS_TLS_DH_PARAMS_FILE: "/opt/bitnami/redis/certs/redis.dh"
REDIS_TLS_AUTH_CLIENTS: "yes"
networks:
default:
ipv4_address: 172.10.1.3

redis-node-2:
image: bitnami/redis-cluster:7.2
volumes:
- "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs"
environment:
REDIS_PORT_NUMBER: 6379
REDIS_PASSWORD: l83aa26
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
REDIS_TLS_ENABLED: "true"
REDIS_TLS_PORT_NUMBER: 6443
REDIS_TLS_CERT_FILE: "/opt/bitnami/redis/certs/redis.crt"
REDIS_TLS_KEY_FILE: "/opt/bitnami/redis/certs/redis.key"
REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt"
REDIS_TLS_DH_PARAMS_FILE: "/opt/bitnami/redis/certs/redis.dh"
REDIS_TLS_AUTH_CLIENTS: "yes"
networks:
default:
ipv4_address: 172.10.1.4

redis-node-3:
image: bitnami/redis-cluster:7.2
volumes:
- "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs"
environment:
REDIS_PORT_NUMBER: 6379
REDIS_PASSWORD: l83aa26
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
REDIS_TLS_ENABLED: "true"
REDIS_TLS_PORT_NUMBER: 6443
REDIS_TLS_CERT_FILE: "/opt/bitnami/redis/certs/redis.crt"
REDIS_TLS_KEY_FILE: "/opt/bitnami/redis/certs/redis.key"
REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt"
REDIS_TLS_DH_PARAMS_FILE: "/opt/bitnami/redis/certs/redis.dh"
REDIS_TLS_AUTH_CLIENTS: "yes"
networks:
default:
ipv4_address: 172.10.1.5

redis-node-4:
image: bitnami/redis-cluster:7.2
volumes:
- "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs"
environment:
REDIS_PORT_NUMBER: 6379
REDIS_PASSWORD: l83aa26
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
REDIS_TLS_ENABLED: "true"
REDIS_TLS_PORT_NUMBER: 6443
REDIS_TLS_CERT_FILE: "/opt/bitnami/redis/certs/redis.crt"
REDIS_TLS_KEY_FILE: "/opt/bitnami/redis/certs/redis.key"
REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt"
REDIS_TLS_DH_PARAMS_FILE: "/opt/bitnami/redis/certs/redis.dh"
REDIS_TLS_AUTH_CLIENTS: "yes"
networks:
default:
ipv4_address: 172.10.1.6

redis-node-5:
image: bitnami/redis-cluster:7.2
volumes:
- "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs"
environment:
REDIS_PORT_NUMBER: 6379
REDIS_PASSWORD: l83aa26
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
REDIS_TLS_ENABLED: "true"
REDIS_TLS_PORT_NUMBER: 6443
REDIS_TLS_CERT_FILE: "/opt/bitnami/redis/certs/redis.crt"
REDIS_TLS_KEY_FILE: "/opt/bitnami/redis/certs/redis.key"
REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt"
REDIS_TLS_DH_PARAMS_FILE: "/opt/bitnami/redis/certs/redis.dh"
REDIS_TLS_AUTH_CLIENTS: "yes"
networks:
default:
ipv4_address: 172.10.1.7

networks:
default:
ipam:
config:
- subnet: 172.10.1.0/24
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ jobs:
shell: bash
run: |
sudo apt update && sudo apt install -y rsync netcat-openbsd tree
docker-compose -f ./.github/docker-compose.yml up -d redis-cluster-node-0 mysql postgres redis redis-new rabbitmq kafka1
docker compose -f ./.github/service/redis-cluster/docker-compose.yml up -d
docker compose -f ./.github/docker-compose.yml up -d redis-cluster-node-0 mysql postgres redis redis-new rabbitmq kafka1
echo "127.0.0.1 kafka1" | sudo tee -a /etc/hosts
- name: Setup swoole-cli
run: .github/script/install-swoole-cli.sh ${{ matrix.swoole-cli }}
Expand Down Expand Up @@ -202,21 +203,25 @@ jobs:
echo ">>> ====="
docker logs redis-cluster-node-0
docker logs redis-cluster-node-1
docker logs redis-cluster-node-2
echo ">>> ====="
docker exec redis-cluster-node-0 cat /bitnami/redis/data/nodes.conf
docker exec redis-cluster-node-1 cat /bitnami/redis/data/nodes.conf
docker exec redis-cluster-node-2 cat /bitnami/redis/data/nodes.conf
echo ">>> redis-cluster"
echo -e 'auth l83aa26\r\ninfo server' | nc 127.0.0.1 6479 -w 1
echo -e 'auth l83aa26\r\ncluster info\r\ncluster nodes' | nc 127.0.0.1 6479 -w 1
echo ">>> redis-new"
echo -e 'auth l83aa26\r\ninfo server' | nc 127.0.0.1 6377 -w 1
echo ">>> ====="
docker compose -f ./.github/service/redis-cluster/docker-compose.yml logs
echo ">>> redis-cluster"
echo -e 'auth l83aa26\r\ninfo server' | nc 172.10.1.2 6379 -w 1
echo -e 'auth l83aa26\r\ncluster info\r\ncluster nodes' | nc 172.10.1.2 6379 -w 1
- name: Test
if: ${{ env.test_prepared && always() }}
run: composer test
- name: Test redis
if: ${{ env.test_prepared && always() }}
#if: ${{ env.test_prepared && always() }}
if: false
env:
REDIS_SERVER_CLUSTER_PASSWORD: "l83aa26"
REDIS_SERVER_CLUSTER_SEEDS: "127.0.0.1:6479,127.0.0.1:6480,127.0.0.1:6481,127.0.0.1:6482,127.0.0.1:6483,127.0.0.1:6484"
Expand Down

0 comments on commit 211d577

Please sign in to comment.