diff --git a/.github/actions/ci-prepare/action.yml b/.github/actions/ci-prepare/action.yml index 3978c1cad..b92618117 100644 --- a/.github/actions/ci-prepare/action.yml +++ b/.github/actions/ci-prepare/action.yml @@ -14,7 +14,7 @@ runs: run: | docker network create imi-ci-service-network --subnet 172.10.12.0/24 docker compose -f ./.github/service/redis-cluster/docker-compose.yml up -d - docker compose -f ./.github/docker-compose.yml up -d ${{ inputs.env }} redis-new + docker compose -f ./.github/docker-compose.yml up -d ${{ inputs.env }} docker exec ${{ inputs.env }} php -v docker exec ${{ inputs.env }} php -m docker exec ${{ inputs.env }} php --ri redis diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml index ee1a0d77e..71921c254 100644 --- a/.github/docker-compose.yml +++ b/.github/docker-compose.yml @@ -40,28 +40,30 @@ services: volumes: - "${GITHUB_WORKSPACE}:/imi:rw" - redis: - image: redis:6-alpine - container_name: redis - depends_on: - - shared-tmp - command: redis-server /etc/redis.conf - volumes: - - ./redis.conf:/etc/redis.conf - - /run/shared:/run/shared - ports: - - 6379:6379 +# redis: +# image: redis:6-alpine +# container_name: redis +# depends_on: +# - shared-tmp +# command: redis-server /etc/redis.conf +# volumes: +# - ./redis.conf:/etc/redis.conf +# - /run/shared:/run/shared +# ports: +# - 6379:6379 - redis-new: + redis: image: bitnami/redis:7.2 - container_name: redis-new + container_name: redis depends_on: - shared-tmp volumes: - "${GITHUB_WORKSPACE}/.github/service/redis-tls/certs:/opt/bitnami/redis/certs" + - "${GITHUB_WORKSPACE}/.github/service/redis-tls/redis-overrides.conf:/opt/bitnami/redis/redis-overrides.conf" - /run/shared:/run/shared environment: - REDIS_PORT_NUMBER: 6377 + REDIS_OVERRIDES_FILE: "/opt/bitnami/redis/redis-overrides.conf" + REDIS_PORT_NUMBER: 6379 REDIS_PASSWORD: "l83aa26" REDIS_TLS_ENABLED: "true" REDIS_TLS_PORT_NUMBER: 6443 @@ -71,13 +73,18 @@ services: REDIS_TLS_CA_FILE: "/opt/bitnami/redis/certs/ca.crt" REDIS_TLS_AUTH_CLIENTS: "yes" healthcheck: - test: ["CMD-SHELL", "redis-cli -h 127.0.0.1 -p 6377 -a l83aa26 INFO | grep 'redis_version'"] + test: ["CMD-SHELL", "redis-cli -h 127.0.0.1 -p $${REDIS_PORT_NUMBER:-6379} -a $${REDIS_PASSWORD} INFO | grep 'redis_version'"] interval: 3s timeout: 60s retries: 30 ports: - - "6377:6377" + - "6379:6379" - "6443:6443" + networks: + proxies: + aliases: + - redis + ipv4_address: 172.10.12.111 rabbitmq: container_name: rabbitmq @@ -124,13 +131,13 @@ services: - shared-tmp - mysql - redis - - redis-new - rabbitmq - kafka1 - postgres environment: MYSQL_SERVER_HOST: mysql REDIS_SERVER_HOST: ${REDIS_SERVER_HOST} + REDIS_SERVER_PASSWORD: ${REDIS_SERVER_PASSWORD:-l83aa26} PGSQL_SERVER_HOST: postgres MYSQL_SERVER_PASSWORD: "" AMQP_SERVER_HOST: "rabbitmq" @@ -140,7 +147,7 @@ services: REDIS_SERVER_CLUSTER_SEEDS: "172.10.12.2:6379,172.10.12.3:6379,172.10.12.4:6379,172.10.12.5:6379,172.10.12.6:6379,172.10.12.7:6379" REDIS_SERVER_TLS_CLUSTER_SEEDS: "172.10.12.2:6443,172.10.12.3:6443,172.10.12.4:6443,172.10.12.5:6443,172.10.12.6:6443,172.10.12.7:6443" REDIS_SERVER_UNIX_SOCK: "/run/shared/redis.sock" - REDIS_SERVER_TLS_HOST: "redis-new" + REDIS_SERVER_TLS_HOST: "redis" REDIS_SERVER_TLS_PORT: "6443" REDIS_SERVER_TLS_PASSWORD: "l83aa26" REDIS_SERVER_TLS_CA_FILE: "/imi/.github/service/redis-tls/certs/ca.crt" @@ -162,13 +169,13 @@ services: - shared-tmp - mysql - redis - - redis-new - rabbitmq - kafka1 - postgres environment: MYSQL_SERVER_HOST: mysql REDIS_SERVER_HOST: ${REDIS_SERVER_HOST} + REDIS_SERVER_PASSWORD: ${REDIS_SERVER_PASSWORD:-l83aa26} PGSQL_SERVER_HOST: postgres MYSQL_SERVER_PASSWORD: "" AMQP_SERVER_HOST: "rabbitmq" @@ -178,7 +185,7 @@ services: REDIS_SERVER_CLUSTER_SEEDS: "172.10.12.2:6379,172.10.12.3:6379,172.10.12.4:6379,172.10.12.5:6379,172.10.12.6:6379,172.10.12.7:6379" REDIS_SERVER_TLS_CLUSTER_SEEDS: "172.10.12.2:6443,172.10.12.3:6443,172.10.12.4:6443,172.10.12.5:6443,172.10.12.6:6443,172.10.12.7:6443" REDIS_SERVER_UNIX_SOCK: "/run/shared/redis.sock" - REDIS_SERVER_TLS_HOST: "redis-new" + REDIS_SERVER_TLS_HOST: "redis" REDIS_SERVER_TLS_PORT: "6443" REDIS_SERVER_TLS_PASSWORD: "l83aa26" REDIS_SERVER_TLS_CA_FILE: "/imi/.github/service/redis-tls/certs/ca.crt" diff --git a/.github/service/redis-tls/redis-overrides.conf b/.github/service/redis-tls/redis-overrides.conf new file mode 100644 index 000000000..d3f0f7abe --- /dev/null +++ b/.github/service/redis-tls/redis-overrides.conf @@ -0,0 +1,2 @@ +unixsocket /run/shared/redis.sock +unixsocketperm 777 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d584a87c..49fef11d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,13 +61,13 @@ jobs: run: | docker ps docker logs shared-tmp || true - docker logs redis-new || true + docker logs redis || true docker exec ${ENV_SERVICE} bash -c "ls -lha /run/shared" echo ">>> redis-cluster-node-0" docker exec ${ENV_SERVICE} bash -c "echo -e 'auth l83aa26\r\ninfo server' | nc redis-cluster-node-0-1 6379 -w 1" docker exec ${ENV_SERVICE} bash -c "echo -e 'auth l83aa26\r\ncluster info\r\ncluster nodes' | nc redis-cluster-node-0-1 6379 -w 1" - echo ">>> redis-new" - docker exec ${ENV_SERVICE} bash -c "echo -e 'auth l83aa26\r\ninfo server' | nc redis-new 6377 -w 1" + echo ">>> redis" + docker exec ${ENV_SERVICE} bash -c "echo -e 'auth l83aa26\r\ninfo server' | nc redis 6379 -w 1" - name: Test if: ${{ env.test_prepared && always() }} run: docker exec ${ENV_SERVICE} composer test @@ -152,7 +152,7 @@ jobs: sudo apt update && sudo apt install -y rsync netcat-openbsd tree docker network create imi-ci-service-network --subnet 172.10.12.0/24 docker compose -f ./.github/service/redis-cluster/docker-compose.yml up -d - docker compose -f ./.github/docker-compose.yml up -d mysql postgres redis redis-new rabbitmq kafka1 + docker compose -f ./.github/docker-compose.yml up -d mysql postgres redis 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 }} @@ -199,10 +199,7 @@ jobs: find /run/shared -name *.sock tree -alfugh /run/shared echo ">>> redis" - echo -e 'info server' | nc 127.0.0.1 6379 -w 1 - echo ">>> =====" - echo ">>> redis-new" - echo -e 'auth l83aa26\r\ninfo server' | nc 127.0.0.1 6377 -w 1 + echo -e 'auth l83aa26\r\ninfo server' | nc 127.0.0.1 6379 -w 1 echo ">>> =====" docker compose -f ./.github/service/redis-cluster/docker-compose.yml logs echo ">>> redis-cluster" @@ -212,6 +209,7 @@ jobs: - name: Test if: ${{ env.test_prepared && always() }} env: + REDIS_SERVER_PASSWORD: "l83aa26" REDIS_SERVER_CLUSTER_PASSWORD: "l83aa26" REDIS_SERVER_CLUSTER_SEEDS: "172.10.12.2:6379,172.10.12.3:6379,172.10.12.4:6379,172.10.12.5:6379,172.10.12.6:6379,172.10.12.7:6379" run: composer test @@ -224,6 +222,7 @@ jobs: - name: Test redis if: ${{ env.test_prepared && always() }} env: + REDIS_SERVER_PASSWORD: "l83aa26" REDIS_SERVER_CLUSTER_PASSWORD: "l83aa26" REDIS_SERVER_CLUSTER_SEEDS: "172.10.12.2:6379,172.10.12.3:6379,172.10.12.4:6379,172.10.12.5:6379,172.10.12.6:6379,172.10.12.7:6379" REDIS_SERVER_TLS_CLUSTER_SEEDS: "172.10.12.2:6443,172.10.12.3:6443,172.10.12.4:6443,172.10.12.5:6443,172.10.12.6:6443,172.10.12.7:6443" @@ -237,6 +236,8 @@ jobs: run: composer test-redis - name: Test swoole if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-swoole - name: Test workerman if: ${{ env.test_prepared && always() }} @@ -249,21 +250,33 @@ jobs: run: composer test-jwt - name: Test queue if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-queue - name: Test amqp if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-amqp - name: Test kafka if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-kafka - name: Test grpc if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-grpc - name: Test snowflake if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-snowflake - name: Test mqtt if: ${{ env.test_prepared && always() }} + env: + REDIS_SERVER_PASSWORD: "l83aa26" run: composer test-mqtt - name: Test smarty if: ${{ env.test_prepared && always() }}