Skip to content

Commit

Permalink
chore: 스크립트 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
dlrkdus committed Jan 3, 2025
1 parent 83a989f commit 1cf2e77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
command: >
sh -c "
/etc/confluent/docker/run &
sleep 20 && bash /scripts/create-topic.sh
sleep 5 && bash /scripts/create-topic.sh
"
spring-app:
Expand Down
13 changes: 11 additions & 2 deletions scripts/create-topic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
KAFKA_BROKER="kafka:9092"
TOPIC="chat-topic"

kafka-topics.sh --create \
# Kafka가 응답하는지 확인하기 위한 반복문
until docker exec kafka kafka-topics.sh --list --bootstrap-server $KAFKA_BROKER; do
echo "Waiting for Kafka to be ready..."
sleep 5
done

# Kafka가 준비되었으면, 토픽 생성
docker exec kafka kafka-topics.sh --create \
--bootstrap-server $KAFKA_BROKER \
--replication-factor 1 \
--partitions 3 \
--topic $TOPIC
--topic $TOPIC

echo "Topic '$TOPIC' created."

0 comments on commit 1cf2e77

Please sign in to comment.