-
Notifications
You must be signed in to change notification settings - Fork 1
[FIX] 현재 develop 기준으로 kafka 구조 최신화 #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
48f8501
141807c
899ef70
ee4990a
92e4f3d
3f219a8
dd14104
c745982
22e997f
140562a
4b8d680
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,100 @@ | ||
| services: | ||
| redis: | ||
| image: redis:7-alpine | ||
| container_name: redis | ||
| ports: | ||
| - "6379:6379" | ||
| restart: unless-stopped | ||
| mem_limit: 128m | ||
| command: redis-server --appendonly yes | ||
| volumes: | ||
| - redis_data:/data | ||
| # 블루 배포 | ||
| app-blue: | ||
| image: ddhi7/ccapp:latest #이미지는 동일 이미지 사용 : (깃허브 플젝 -> ccapp 이미지) | ||
| container_name: ccapp-blue | ||
| ports: | ||
| - "8081:8080" | ||
| env_file: | ||
| - .env | ||
| restart: unless-stopped | ||
| pull_policy: always | ||
| mem_limit: 400m | ||
| healthcheck: | ||
| test: [ "CMD", "curl", "-f", "http://localhost:8080/actuator/health" ] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 40s | ||
| depends_on: | ||
| - redis | ||
| services: | ||
| redis: | ||
| image: redis:7-alpine | ||
| container_name: redis | ||
| ports: | ||
| - "6379:6379" | ||
| restart: unless-stopped | ||
| mem_limit: 128m | ||
| command: redis-server --appendonly yes | ||
| volumes: | ||
| - redis_data:/data | ||
| # 블루 배포 | ||
| app-blue: | ||
| image: ddhi7/ccapp:latest #이미지는 동일 이미지 사용 : (깃허브 플젝 -> ccapp 이미지) | ||
| container_name: ccapp-blue | ||
| ports: | ||
| - "8081:8080" | ||
| env_file: | ||
| - .env | ||
| restart: unless-stopped | ||
| pull_policy: always | ||
| mem_limit: 400m | ||
| healthcheck: | ||
| test: [ "CMD", "curl", "-f", "http://localhost:8080/actuator/health" ] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 40s | ||
| depends_on: | ||
| - redis | ||
| - kafka #추가 | ||
|
|
||
| app-green: | ||
| #그린 배포 | ||
| image: ddhi7/ccapp:latest | ||
| container_name: ccapp-green | ||
| ports: | ||
| - "8082:8080" | ||
| env_file: | ||
| - .env | ||
| restart: unless-stopped | ||
| pull_policy: always | ||
| mem_limit: 400m | ||
| healthcheck: | ||
| test: [ "CMD", "curl", "-f", "http://localhost:8080/actuator/health" ] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 40s | ||
| depends_on: | ||
| - redis | ||
| app-green: | ||
| #그린 배포 | ||
| image: ddhi7/ccapp:latest | ||
| container_name: ccapp-green | ||
| ports: | ||
| - "8082:8080" | ||
| env_file: | ||
| - .env | ||
| restart: unless-stopped | ||
| pull_policy: always | ||
| mem_limit: 400m | ||
| healthcheck: | ||
| test: [ "CMD", "curl", "-f", "http://localhost:8080/actuator/health" ] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 40s | ||
| depends_on: | ||
| - redis | ||
| - kafka | ||
|
|
||
| volumes: | ||
| redis_data: | ||
| driver: local | ||
|
|
||
| kafka: | ||
| image: confluentinc/cp-kafka:latest | ||
| container_name: kafka | ||
| ports: | ||
| - "29092:29092" # 로컬호스트 접속용 | ||
| environment: | ||
| # 필수 KRaft 설정 | ||
| CLUSTER_ID: "hjeeg3q1SoCw7IKoRw-rMQ" | ||
| KAFKA_NODE_ID: 1 | ||
| KAFKA_PROCESS_ROLES: "broker,controller" # 브로커와 컨트롤러 역할 | ||
| KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:9093" # 컨트롤러 지정 | ||
|
|
||
| # 리스너 설정 (CONTROLLER 추가 필수) | ||
| KAFKA_LISTENERS: 'PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093,PLAINTEXT_HOST://0.0.0.0:29092' | ||
| KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092' | ||
| KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT' | ||
| KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' | ||
|
|
||
| # Mac(ARM) 호환 설정 및 성능 최적화 | ||
| _JAVA_OPTIONS: "-XX:UseSVE=0" | ||
| KAFKA_HEAP_OPTS: "-Xms256M -Xmx256M" # JVM 힙 메모리 | ||
| KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
| KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 | ||
| KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | ||
| KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | ||
| volumes: | ||
| - kafka_data:/var/lib/kafka/data # <- Docker 내부 볼륨만 사용 | ||
| restart: unless-stopped | ||
|
|
||
| kafka-ui: | ||
| image: provectuslabs/kafka-ui:latest | ||
| container_name: kafka-ui | ||
| ports: | ||
| - "8085:8080" # 호스트의 브라우저는 8085로 접속 가능 | ||
| environment: | ||
| KAFKA_CLUSTERS_0_NAME: local | ||
| KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092 | ||
| KAFKA_CLUSTERS_0_ZOOKEEPER: "" # KRaft 모드라 Zookeeper 필요 없음 | ||
| depends_on: | ||
| - kafka | ||
| restart: unless-stopped | ||
|
|
||
| volumes: | ||
| redis_data: | ||
| driver: local | ||
| kafka_data: | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,4 +84,7 @@ List<AmateurShow> findHotShows( | |||||||||
| @Query("UPDATE AmateurShow s SET s.status = 'ENDED' " + | ||||||||||
| "WHERE s.status = 'ONGOING' AND s.end < :today") | ||||||||||
| int updateShowsToEnded(@Param("today") LocalDate today); | ||||||||||
|
|
||||||||||
| @Query("SELECT s.hashtag FROM AmateurShow s WHERE s.member.id = :memberId") | ||||||||||
| List<String> findHashtagsByMemberId(@Param("memberId") Long memberId); | ||||||||||
|
Comment on lines
+88
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find and examine the AmateurShow entity class
fd -e java 'AmateurShow\.java' --exclude '*Repository*' --exclude '*test*'Repository: SeeATheater/CC_Backend Length of output: 126 🏁 Script executed: #!/bin/bash
# Search for hashtag field in AmateurShow entity
rg -n 'private.*hashtag|@Column.*hashtag|@NotNull.*hashtag' --type=java -B 2 -A 2Repository: SeeATheater/CC_Backend Length of output: 2781 🏁 Script executed: #!/bin/bash
# Check how findHashtagsByMemberId is used
rg -n 'findHashtagsByMemberId' --type=java -B 3 -A 5Repository: SeeATheater/CC_Backend Length of output: 1738 🏁 Script executed: #!/bin/bash
# Get the full AmateurShow entity class to check field annotations
head -60 src/main/java/cc/backend/amateurShow/entity/AmateurShow.java | tail -20Repository: SeeATheater/CC_Backend Length of output: 406 🏁 Script executed: #!/bin/bash
# Check if there are other usages of findHashtagsByMemberId that might also be affected
rg -n 'findHashtagsByMemberId' --type=java -C 10Repository: SeeATheater/CC_Backend Length of output: 3928 Add null check to prevent NullPointerException in downstream recommendation logic. The Suggested fix- `@Query`("SELECT s.hashtag FROM AmateurShow s WHERE s.member.id = :memberId")
+ `@Query`("SELECT s.hashtag FROM AmateurShow s WHERE s.member.id = :memberId AND s.hashtag IS NOT NULL")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kafka service lacks a healthcheck, making
depends_onunreliable.The app containers (
app-blue,app-green) depend onkafka, but without a healthcheck defined on the kafka service, Docker Compose only waits for the container to start, not for Kafka to be ready. This can cause transient connection failures on application startup.Consider adding a healthcheck and using
depends_onwithcondition: service_healthy:🛠️ Suggested healthcheck for kafka
volumes: - kafka_data:/var/lib/kafka/data restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "kafka-broker-api-versions --bootstrap-server localhost:9092 || exit 1"] + interval: 15s + timeout: 10s + retries: 5 + start_period: 30sThen update the dependents:
🤖 Prompt for AI Agents