Skip to content

[Fix] Upstash Redis TLS 연결 문제 해결#212

Merged
gaeunee2 merged 2 commits into
devfrom
fix/211-upstash-redis-tls-connection
May 19, 2026
Merged

[Fix] Upstash Redis TLS 연결 문제 해결#212
gaeunee2 merged 2 commits into
devfrom
fix/211-upstash-redis-tls-connection

Conversation

@gaeunee2
Copy link
Copy Markdown
Collaborator

@gaeunee2 gaeunee2 commented May 19, 2026

📌 관련 이슈

🏷️ PR 타입

  • ✨ 기능 추가 (Feature)
  • 🐛 버그 수정 (Bug Fix)
  • ♻️ 리팩토링 (Refactoring)
  • 📝 문서 수정 (Documentation)
  • 🎨 스타일 변경 (Style)
  • ✅ 테스트 추가 (Test)

📝 작업 내용

Upstash Redis TLS 연결 실패 문제 해결
prod 환경에서 Upstash Redis 연결 시 Connection closed prematurely at RedisHandshakeHandler 오류 발생하던 문제를 해결했습니다.

주요 수정사항:

  • RedisConfig에서 application.yaml의 SSL/비밀번호 설정을 제대로 읽도록 수정
  • Upstash 호환을 위한 ProtocolVersion.RESP2 명시적 설정
  • JDK SSL 프로바이더 사용 및 Keep-alive 활성화
  • 자동 재연결 및 적절한 타임아웃 설정
  • prod 프로파일의 bundle.implicit: true 설정 제거

기술적 세부사항:

  • LettuceClientConfiguration으로 SSL 옵션 명시적 구성
  • ClientOptions에 RESP2 프로토콜 버전 설정
  • SslOptions에 JDK SSL 프로바이더 적용
  • SocketOptions에 연결 타임아웃 및 Keep-alive 설정

📸 스크린샷

컴파일 성공 확인: ./gradlew compileJava 통과
2개 파일 수정: RedisConfig.java, application.yaml

✅ 체크리스트

  • 코드 리뷰를 받을 준비가 완료되었습니다
  • 컴파일 테스트를 통과했습니다
  • 관련 이슈와 연결했습니다
  • 코드 스타일 가이드를 준수했습니다
  • 셀프 리뷰를 완료했습니다

📎 기타 참고사항

  • local 프로파일 호환성 확인됨 (SSL 비활성화)
  • 기존 Redis 사용처(AuthService, EmbeddingJobPublisher) 모두 정상 동작 예상
  • Flyway 마이그레이션이나 기타 기능에는 영향 없음
  • redis-cli로는 연결되지만 Lettuce만 실패하던 TLS handshake 문제 해결

Summary by CodeRabbit

Release Notes

  • Chores
    • Redis 데이터베이스 연결에 비밀번호 기반 인증 지원 추가
    • 프로덕션 환경에서 Redis 연결의 SSL 암호화 통신 활성화
    • 프로덕션 API 엔드포인트의 기본값 설정 추가

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@gaeunee2 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 50 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bec10150-e1ab-4089-966b-8c3879b208c1

📥 Commits

Reviewing files that changed from the base of the PR and between a9faa8a and 8b5231c.

📒 Files selected for processing (1)
  • src/main/java/com/proovy/global/config/RedisConfig.java
📝 Walkthrough

Walkthrough

RedisConfig의 Redis 연결 설정이 비밀번호 주입과 Lettuce 클라이언트의 TLS/SSL 옵션으로 확장되었습니다. 프로덕션 프로필에서 Redis SSL을 활성화하고 API 기본 URL을 설정합니다.

Changes

Redis TLS/SSL 지원

계층 / 파일 요약
Redis 클라이언트 설정 인프라
src/main/java/com/proovy/global/config/RedisConfig.java
Lettuce의 ClientOptions, SocketOptions, SslOptions, ProtocolVersion 타입을 임포트하고, spring.data.redis.passwordspring.data.redis.ssl.enabled 플래그를 설정 필드로 추가합니다.
Redis 연결 팩토리 SSL/TLS 구현
src/main/java/com/proovy/global/config/RedisConfig.java
redisConnectionFactory() 메서드가 비밀번호를 RedisStandaloneConfiguration에 설정하고, SSL 활성화 시 LettuceClientConfiguration 빌더를 통해 RESP2 프로토콜, JDK SSL 프로바이더, 소켓 connectTimeout/keepAlive, 자동 재연결, shutdownTimeout을 포함한 ClientOptions를 구성하여 LettuceConnectionFactory에 전달합니다.
프로덕션 Redis SSL 및 API 설정
src/main/resources/application.yaml
프로덕션 프로필에서 spring.data.redis.ssl.enabled: true를 명시하고, proovy.api.public-base-urlhttps://api.proovy.ai.kr 기본값을 설정하며, 불필요한 bundle.implicit: true 설정을 제거합니다.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 Upstash Redis 문제 해결 토끼의 노래

TLS 악수가 실패했던 날,
Lettuce 클라이언트는 울고 있었지,
SSL 옵션 정해주고 RESP2 명시하니,
이제 Redis와 춤을 춘다네! 🔐✨
안녕 프로덕션, 연결 성공!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 주요 변경사항인 'Upstash Redis TLS 연결 문제 해결'을 명확하게 요약하고 있으며, 파일 목록이나 불필요한 정보 없이 간결하게 표현되어 있습니다.
Linked Issues check ✅ Passed PR의 변경사항은 #211의 모든 주요 목표를 충족합니다: RedisConfig에서 SSL/비밀번호 설정 적용, RESP2 프로토콜 명시 설정, JDK SSL 프로바이더 사용, local 프로파일 호환성 유지, TLS handshake 문제 해결을 위한 ClientOptions/SslOptions/SocketOptions 구성.
Out of Scope Changes check ✅ Passed 변경사항은 Redis 연결 설정(RedisConfig.java, application.yaml)으로만 제한되어 있으며, #211의 제약사항인 Flyway, 기존 기능 변경 없이 Redis 설정 범위 내에서만 수정되었습니다.
Description check ✅ Passed PR 설명이 대부분 완전하며, 관련 이슈, PR 타입, 작업 내용, 체크리스트가 적절히 작성되었습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/211-upstash-redis-tls-connection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gaeunee2 gaeunee2 changed the title fix: Upstash Redis TLS 연결 문제 해결 [Fix] Upstash Redis TLS 연결 문제 해결 May 19, 2026
@gaeunee2 gaeunee2 self-assigned this May 19, 2026
@gaeunee2 gaeunee2 added bug Something isn't working infra labels May 19, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/com/proovy/global/config/RedisConfig.java`:
- Around line 32-47: In RedisConfig.redisConnectionFactory currently the
password field is allowed to be empty and the code only sets config.setPassword
when password is non-blank; change this so that when sslEnabled
(spring.data.redis.ssl.enabled) is true and password is null/blank you fail
fast: detect blank password (password == null || password.trim().isEmpty()) and
throw a clear IllegalStateException (or similar) from redisConnectionFactory
indicating TLS is enabled but spring.data.redis.password is missing, otherwise
continue to set config.setPassword(password) as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 36699e4f-8b49-468f-9545-abf5fa89b88a

📥 Commits

Reviewing files that changed from the base of the PR and between 66ec491 and a9faa8a.

📒 Files selected for processing (2)
  • src/main/java/com/proovy/global/config/RedisConfig.java
  • src/main/resources/application.yaml
💤 Files with no reviewable changes (1)
  • src/main/resources/application.yaml

Comment thread src/main/java/com/proovy/global/config/RedisConfig.java
@gaeunee2 gaeunee2 requested a review from haein45 May 19, 2026 01:04
Copy link
Copy Markdown
Collaborator

@haein45 haein45 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제 해결하신부분 확인했습니다!

@gaeunee2 gaeunee2 merged commit 92a7aae into dev May 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] Upstash Redis TLS 연결 실패 문제 해결

2 participants