Skip to content

Commit

Permalink
📝docs : Zookeeper, Kafka 환경 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DDonghyeo committed May 23, 2024
1 parent 85c82d5 commit 22e601f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,19 @@ services:
volumes:
- /home/ec2-user/logs/noti-service:/logs


zookeeper:
image: wurstmeister/zookeeper:latest
container_name: zookeeper
ports:
- "2181:2181"
-
kafka:
image: wurstmeister/kafka:latest
container_name: kafka
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
18 changes: 18 additions & 0 deletions script/common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 현재 실행중인 도커 컨테이너중 단어가 포함 컨테이너를 검색
RUNNING_EUREKA=$(docker ps | grep eureka)
RUNNING_CONFIG=$(docker ps | grep config)
RUNNING_ZOOKEEPER=$(docker ps | grep zookeeper)
RUNNING_KAFKA=$(docker ps | grep kafka)

# Eureka 검색
if [ -z "$RUNNING_EUREKA" ]; then
Expand All @@ -18,4 +20,20 @@ if [ -z "$RUNNING_CONFIG" ]; then
sleep 5 #Config 실행 5초 대기
else
echo "Config Service is already running"
fi

# Zookeeper 검색
if [ -z "$RUNNING_ZOOKEEPER" ]; then
echo "Starting Zookeeper ..."
docker compose -f /home/docker-compose.yml up -d zookeeper
else
echo "Zookeeper is already running"
fi

# Kafka 검색
if [ -z "$RUNNING_ZOOKEEPER" ]; then
echo "Starting Kafka ..."
docker compose -f /home/docker-compose.yml up -d kafka
else
echo "Kafka is already running"
fi

0 comments on commit 22e601f

Please sign in to comment.