From 6237bf645f59b14c2c08890c0e8826c9a7059e2c Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 17:44:32 +0900 Subject: [PATCH] =?UTF-8?q?[ci]=20=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 스크립트 수정 --- docker-compose.yml | 55 +++++++++++++++++++++++++++------------------- scripts/deploy.sh | 14 ++---------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0e9d0fe8b..f4c327517 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,8 +21,6 @@ services: - app3 - prometheus - grafana - networks: - - server-network app1: image: "yeachan05/application:latest" @@ -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" @@ -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" @@ -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 @@ -71,8 +72,6 @@ services: - "6379:6379" volumes: - redis-data:/data - networks: - - server-network prometheus: image: prom/prometheus @@ -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 @@ -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 @@ -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 \ No newline at end of file + redis-data: \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh index acadc9d35..2f3142e83 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -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