From 000a59ed5f0d511b720ae79a0e3a7cf514ef1eb1 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 01:25:53 +0900 Subject: [PATCH] =?UTF-8?q?fix(redis):=20Redis=208=20=EA=B5=AC=EC=84=B1=20?= =?UTF-8?q?lane=EC=9D=B4=20search=20=EB=AA=A8=EB=93=88=EC=9D=84=20?= =?UTF-8?q?=EC=8B=A3=EA=B3=A0=20admin=EC=9D=B4=20FT.INFO=EB=A5=BC=20?= =?UTF-8?q?=EB=B0=9B=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: nightly의 redis-topology 8.2 standalone·sentinel·cluster가 run 63에서 RedisTopologyContractTest 「admin 계정이 ADMIN_ONLY 진단을 모두 쓸 수 있다」로 실패한다. 7.2·7.4는 통과한다. 원인은 둘이다. - 명령 정책 catalog는 search 모듈의 FT.INFO를 8.0부터 ADMIN_ONLY로 둔다. fixture ACL의 admin 줄에는 그 권한이 없다(standalone: 거부). - sentinel·cluster lane은 entrypoint를 덮어써 `redis-server`를 바로 실행한다. Redis 8 이미지의 docker-entrypoint.sh가 모듈을 싣는데 그것을 건너뛰어 FT.INFO 자체가 없다(「있어야 할 서버에 없다」). desktop에서 확인: Redis 7.2·7.4는 ACL 규칙 `+ft.info`가 있으면 시작을 거부하고, 8.2는 모듈을 실었을 때만 받는다. cluster 모드에서도 search 모듈은 실리고 FT.INFO가 생긴다. 고른 방법: - sentinel·cluster 데이터 노드가 `exec docker-entrypoint.sh redis-server`로 standalone처럼 이미지 entrypoint를 거친다. 서버도 root가 아니라 이미지의 redis 사용자로 돈다. - 네 구성의 ACL 마운트 원본을 `REDIS_ACL_DIR`로 바꿀 수 있게 한다(기본값은 지금 폴더). redis-topology.sh가 8 이상에서만 커밋한 ACL 파일에서 admin 줄 끝에 `+ft.info`를 더한 사본을 build/ 아래 만들어 쓴다. 실행마다 원본에서 만들어 어긋날 수 없다. ACL README에 이 예외를 적는다. 버린 대안: 버전별 ACL 파일을 하나 더 커밋하기. README가 금하는 두 번째 사본이다. catalog에서 FT.INFO를 빼기. SDK가 문서로 지원한다고 한 진단이다. 위험·한계: entrypoint를 거치며 7.x에서도 서버 사용자가 redis로 바뀐다. /tmp의 nodes.conf와 읽기 전용 ACL 마운트는 그 사용자도 읽고 쓸 수 있다. 검증: runner redis-topology 11칸(nightly 수동 실행, 이 PR 본문에 적는다). --- compose/redis/acl/README.md | 7 +++++++ scripts/ci/redis-topology.sh | 19 +++++++++++++++++++ .../redis-sdk/compose/cluster/compose.yml | 8 ++++++-- .../redis-sdk/compose/sentinel/compose.yml | 8 ++++++-- .../redis-sdk/compose/standalone/compose.yml | 2 +- .../redis-sdk/compose/tls/compose.yml | 2 +- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/compose/redis/acl/README.md b/compose/redis/acl/README.md index 19be08f8..87e3b1d2 100644 --- a/compose/redis/acl/README.md +++ b/compose/redis/acl/README.md @@ -56,6 +56,13 @@ Redis ACL 파일은 완전한 `user` 줄만 받는다. 주석도, 줄 이어 쓰 모두 이 폴더를 읽기 전용으로 마운트한다. 복사본을 두지 않는다. 이 줄들의 두 번째 사본은 비밀번호나 key 패턴이 따로 어긋날 두 번째 자리다. +예외 하나: Redis 8 이상의 구성 lane은 `scripts/ci/redis-topology.sh`가 이 파일에서 만든 사본을 마운트한다. +admin 줄 끝에 `+ft.info` 하나만 더한다. Redis 8에 들어 있는 search 모듈의 `FT.INFO`를 명령 정책 catalog가 +8.0부터 admin 진단(`ADMIN_ONLY`)으로 두기 때문이다. Redis 7은 자기에게 없는 명령을 부르는 ACL 규칙이 있으면 +시작하지 않으므로, 이 파일 자체에는 그 줄을 넣을 수 없다. 사본은 실행할 때마다 이 파일에서 다시 만들어 어긋날 +수 없고, 커밋하지 않는다(`build/` 아래). Redis 8에 같은 admin 계정을 두는 배포는 자기 ACL 파일에 +`+ft.info`를 더한다. + Compose lane은 애플리케이션을 `ca-skeleton-application`과 `ca-skeleton-application-advanced`로 연결한다. 연결은 `secret://@environment/` 참조를 거치고, 그 변수가 위 fixture 비밀번호를 가진다. 여기의 모든 계정이 `~prod:*`로 묶여 있어서, lane은 Redis namespace 환경을 `prod`로 두고 돈다. diff --git a/scripts/ci/redis-topology.sh b/scripts/ci/redis-topology.sh index d8f212bb..94aa747b 100755 --- a/scripts/ci/redis-topology.sh +++ b/scripts/ci/redis-topology.sh @@ -35,6 +35,25 @@ case "${topology}" in *) echo "redis-topology: unknown topology ${topology}" >&2; exit 2 ;; esac +# Redis 8 ships the search module, and the command catalog makes its FT.INFO an admin diagnostic +# from 8.0 (ADMIN_ONLY). The committed fixture ACL cannot grant it: one file serves every version, +# and Redis 7 refuses to start on a rule that names a command it does not have. On 8 and later the +# lane mounts a copy whose admin line also grants +ft.info, made here from that one file so the two +# cannot drift (compose/redis/acl/README.md). +if [ "${version%%.*}" -ge 8 ]; then + acl_dir="${PWD}/src/adapter/outbound/redis-sdk/build/redis-topology-acl" + rm -rf "${acl_dir}" + mkdir -p "${acl_dir}" + sed '/^user ca-skeleton-admin-readonly /s/$/ +ft.info/' compose/redis/acl/lane-fixture-accounts.acl \ + > "${acl_dir}/lane-fixture-accounts.acl" + grep -q '^user ca-skeleton-admin-readonly .* +ft\.info$' "${acl_dir}/lane-fixture-accounts.acl" \ + || { echo "redis-topology: the admin line of the fixture ACL was not found" >&2; exit 1; } + # Read by the image's redis user, which is not the user that made the copy. + chmod 0755 "${acl_dir}" + chmod 0644 "${acl_dir}/lane-fixture-accounts.acl" + export REDIS_ACL_DIR="${acl_dir}" +fi + REDIS_VERSION=${version} "${compose[@]}" up -d --wait # Inside a CI job container the Docker daemon's ports are on the daemon host, not on localhost, and diff --git a/src/adapter/outbound/redis-sdk/compose/cluster/compose.yml b/src/adapter/outbound/redis-sdk/compose/cluster/compose.yml index 3439d338..d2e8585a 100644 --- a/src/adapter/outbound/redis-sdk/compose/cluster/compose.yml +++ b/src/adapter/outbound/redis-sdk/compose/cluster/compose.yml @@ -25,12 +25,16 @@ x-node: &node image: "redis:${REDIS_VERSION:-7.4}" network_mode: host volumes: - - ../../../../../../compose/redis/acl:/etc/redis/acl:ro + - ${REDIS_ACL_DIR:-../../../../../../compose/redis/acl}:/etc/redis/acl:ro + # Through the image's own entrypoint, as the standalone lane is: on Redis 8 that is what loads + # the bundled modules (search, JSON, time series, probabilistic), and without them a topology lane + # would test a different server from the standalone one (FT.INFO absent, 2026-11-09 run 63). It + # also runs the server as the image's redis user instead of root. entrypoint: - /bin/sh - -c - | - exec redis-server \ + exec docker-entrypoint.sh redis-server \ --port $$NODE_PORT \ --cluster-enabled yes \ --cluster-config-file /tmp/nodes.conf \ diff --git a/src/adapter/outbound/redis-sdk/compose/sentinel/compose.yml b/src/adapter/outbound/redis-sdk/compose/sentinel/compose.yml index db059a38..2ba205c8 100644 --- a/src/adapter/outbound/redis-sdk/compose/sentinel/compose.yml +++ b/src/adapter/outbound/redis-sdk/compose/sentinel/compose.yml @@ -29,7 +29,11 @@ x-data-node: &data-node image: "redis:${REDIS_VERSION:-7.4}" network_mode: host volumes: - - ../../../../../../compose/redis/acl:/etc/redis/acl:ro + - ${REDIS_ACL_DIR:-../../../../../../compose/redis/acl}:/etc/redis/acl:ro + # Through the image's own entrypoint, as the standalone lane is: on Redis 8 that is what loads + # the bundled modules (search, JSON, time series, probabilistic), and without them a topology lane + # would test a different server from the standalone one (FT.INFO absent, 2026-11-09 run 63). It + # also runs the server as the image's redis user instead of root. entrypoint: - /bin/sh - -c @@ -42,7 +46,7 @@ x-data-node: &data-node # into an explicit NOREPLICAS refusal the caller can see and act on. Any deployment where an # acknowledgement is supposed to mean something has to set these. - | - exec redis-server \ + exec docker-entrypoint.sh redis-server \ --port $$NODE_PORT \ $$REPLICA_OF \ --appendonly no \ diff --git a/src/adapter/outbound/redis-sdk/compose/standalone/compose.yml b/src/adapter/outbound/redis-sdk/compose/standalone/compose.yml index 5d983bbc..d3882261 100644 --- a/src/adapter/outbound/redis-sdk/compose/standalone/compose.yml +++ b/src/adapter/outbound/redis-sdk/compose/standalone/compose.yml @@ -16,7 +16,7 @@ services: - --aclfile - /etc/redis/acl/lane-fixture-accounts.acl volumes: - - ../../../../../../compose/redis/acl:/etc/redis/acl:ro + - ${REDIS_ACL_DIR:-../../../../../../compose/redis/acl}:/etc/redis/acl:ro ports: - "${REDIS_PORT:-6379}:6379" healthcheck: diff --git a/src/adapter/outbound/redis-sdk/compose/tls/compose.yml b/src/adapter/outbound/redis-sdk/compose/tls/compose.yml index a679849f..48cc99d7 100644 --- a/src/adapter/outbound/redis-sdk/compose/tls/compose.yml +++ b/src/adapter/outbound/redis-sdk/compose/tls/compose.yml @@ -38,7 +38,7 @@ services: certs: condition: service_completed_successfully volumes: - - ../../../../../../compose/redis/acl:/etc/redis/acl:ro + - ${REDIS_ACL_DIR:-../../../../../../compose/redis/acl}:/etc/redis/acl:ro - tls:/tls:ro command: - redis-server