Skip to content

Commit

Permalink
[ci] 스크립트 수정
Browse files Browse the repository at this point in the history
스크립트 수정
  • Loading branch information
YeaChan05 committed Jul 2, 2024
1 parent 6cf77d4 commit 6237bf6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
55 changes: 33 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ services:
- app3
- prometheus
- grafana
networks:
- server-network

app1:
image: "yeachan05/application:latest"
Expand All @@ -34,8 +32,9 @@ services:
- redis
volumes:
- /home/ec2-user/application-prod.yml:/config/application-prod.yml
networks:
- server-network
environment:
- TZ=Asia/Seoul
- spring.application.name=app1

app2:
image: "yeachan05/application:latest"
Expand All @@ -47,8 +46,9 @@ services:
- redis
volumes:
- /home/ec2-user/application-prod.yml:/config/application-prod.yml
networks:
- server-network
environment:
- TZ=Asia/Seoul
- spring.application.name=app2

app3:
image: "yeachan05/application:latest"
Expand All @@ -60,8 +60,9 @@ services:
- redis
volumes:
- /home/ec2-user/application-prod.yml:/config/application-prod.yml
networks:
- server-network
environment:
- TZ=Asia/Seoul
- spring.application.name=app3

redis:
container_name: redis
Expand All @@ -71,8 +72,6 @@ services:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- server-network

prometheus:
image: prom/prometheus
Expand All @@ -85,8 +84,10 @@ services:
- "9090:9090"
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- server-network
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.retention.time=168h'
- '--storage.tsdb.path=/prometheus'

grafana:
image: grafana/grafana
Expand All @@ -98,8 +99,6 @@ services:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
volumes:
- grafana-storage:/var/lib/grafana
networks:
- server-network

mysqld_exporter:
image: quay.io/prometheus/mysqld-exporter
Expand All @@ -111,15 +110,27 @@ services:
- "9104:9104"
volumes:
- /home/ec2-user/my.cnf:/etc/mysql/my.cnf
networks:
- server-network

# loki:
# image: grafana/loki:latest
# container_name: loki
# restart: always
# ports:
# - "3100:3100"
# volumes:
# - ./loki-config.yml:/etc/loki/local-config.yaml
#
# promtail:
# image: grafana/promtail:latest
# container_name: promtail
# restart: always
# volumes:
# - /var/log:/var/log
# - ./promtail-config.yml:/etc/promtail/config.yml
# command: -config.file=/etc/promtail/config.yml
# environment:
# - HOSTNAME=promtail
volumes:
grafana-storage:
prometheus-data:
redis-data:

networks:
server-network:
driver: bridge
external: true
redis-data:
14 changes: 2 additions & 12 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,13 @@ touch $START_LOG

echo "[$(date +%c)] Docker Compose 실행 시작 - 이미지: $IMAGE_NAME:$IMAGE_TAG" >> $START_LOG

# docker-compose pull 로그 기록
echo "[$(date +%c)] docker-compose pull 시작" >> $START_LOG
docker-compose -f $DOCKER_COMPOSE_PATH pull >> $START_LOG 2>&1

# docker-compose up 로그 기록
echo "[$(date +%c)] docker-compose up 시작" >> $START_LOG
docker-compose -f $DOCKER_COMPOSE_PATH up -d >> $START_LOG 2>&1
docker-compose -f $DOCKER_COMPOSE_PATH pull
docker-compose -f $DOCKER_COMPOSE_PATH up -d

if [ $? -eq 0 ]; then
echo "[$(date +%c)] Docker Compose로 애플리케이션 시작 성공" >> $START_LOG
else
# shellcheck disable=SC2129
echo "[$(date +%c)] Docker Compose로 애플리케이션 시작 실패" >> $START_LOG
echo "[$(date +%c)] Docker Compose 오류 로그:" >> $START_LOG
docker-compose -f $DOCKER_COMPOSE_PATH logs >> $START_LOG 2>&1
fi

# 전체 로그를 기록
echo "[$(date +%c)] 전체 Docker Compose 로그:" >> $START_LOG
docker-compose -f $DOCKER_COMPOSE_PATH logs >> $START_LOG 2>&1

0 comments on commit 6237bf6

Please sign in to comment.