From 13b878e97a85b270160730ab2c199af59d19add7 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Mon, 1 Jul 2024 17:21:03 +0900 Subject: [PATCH 01/21] =?UTF-8?q?[ci]=20prometheus=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=9C=A0=EC=A7=80=20=EA=B8=B0=EA=B0=84=201?= =?UTF-8?q?=EC=A3=BC=EC=9D=BC=EB=A1=9C=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus 데이터 유지 기간 1주일로 지정 --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index c927b627..3a72da2b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,6 +84,8 @@ services: - "9090:9090" extra_hosts: - "host.docker.internal:host-gateway" + command: + - '--storage.tsdb.retention.time=168h' grafana: image: grafana/grafana From 2c1f915d73ee3addbe81936d88861c96eb7f7e81 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Mon, 1 Jul 2024 19:17:04 +0900 Subject: [PATCH 02/21] =?UTF-8?q?[ci]=20prometheus=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus config 수정 --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3a72da2b..f4c32751 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -85,7 +85,9 @@ services: extra_hosts: - "host.docker.internal:host-gateway" command: + - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.retention.time=168h' + - '--storage.tsdb.path=/prometheus' grafana: image: grafana/grafana From bf36da752aeab5c21cdc8c4c502677836b903236 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 14:30:09 +0900 Subject: [PATCH 03/21] =?UTF-8?q?[ci]=20prometheus=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus config 수정 --- docker-compose.yml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f4c32751..4d34fe2e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -62,7 +62,7 @@ services: - /home/ec2-user/application-prod.yml:/config/application-prod.yml environment: - TZ=Asia/Seoul - - spring.application.name=app3 + - spring.application.name=app1 redis: container_name: redis @@ -85,10 +85,7 @@ services: extra_hosts: - "host.docker.internal:host-gateway" command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.retention.time=168h' - - '--storage.tsdb.path=/prometheus' - + - --storage.tsdb.retention.time=14d grafana: image: grafana/grafana container_name: grafana @@ -111,26 +108,7 @@ services: volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf -# 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: \ No newline at end of file + redis-data: From 26a45ed5fab9253683a83d3e9d2da0f5a7340701 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 14:42:25 +0900 Subject: [PATCH 04/21] =?UTF-8?q?[ci]=20prometheus=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus config 수정 --- docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4d34fe2e..869af4a3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,6 +82,8 @@ services: - prometheus-data:/prometheus ports: - "9090:9090" + networks: + - monitoring extra_hosts: - "host.docker.internal:host-gateway" command: @@ -92,6 +94,8 @@ services: restart: always ports: - "3009:3000" + networks: + - monitoring environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: @@ -105,6 +109,8 @@ services: - "--config.my-cnf=/etc/mysql/my.cnf" ports: - "9104:9104" + networks: + - monitoring volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf From 9df070d98c8d405d87bcbd45b39e5037bd5e1b39 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 14:53:18 +0900 Subject: [PATCH 05/21] =?UTF-8?q?[ci]=20prometheus=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus config 수정 --- docker-compose.yml | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 869af4a3..83f847c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -62,7 +62,7 @@ services: - /home/ec2-user/application-prod.yml:/config/application-prod.yml environment: - TZ=Asia/Seoul - - spring.application.name=app1 + - spring.application.name=app3 redis: container_name: redis @@ -82,20 +82,18 @@ services: - prometheus-data:/prometheus ports: - "9090:9090" - networks: - - monitoring extra_hosts: - "host.docker.internal:host-gateway" command: - - --storage.tsdb.retention.time=14d + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.retention.time=168h' + grafana: image: grafana/grafana container_name: grafana restart: always ports: - "3009:3000" - networks: - - monitoring environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: @@ -109,12 +107,29 @@ services: - "--config.my-cnf=/etc/mysql/my.cnf" ports: - "9104:9104" - networks: - - monitoring volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf +# 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: + redis-data: \ No newline at end of file From 22202b1df383573c1b3f9162e6eae4cb1c727ed2 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 15:02:32 +0900 Subject: [PATCH 06/21] =?UTF-8?q?[ci]=20prometheus=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus config 수정 --- docker-compose.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 83f847c2..292c0eff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,9 +84,6 @@ services: - "9090:9090" extra_hosts: - "host.docker.internal:host-gateway" - command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.retention.time=168h' grafana: image: grafana/grafana @@ -111,24 +108,22 @@ services: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf # loki: -# image: grafana/loki:latest +# image: grafana/loki:2.3.0 # container_name: loki -# restart: always # ports: # - "3100:3100" # volumes: # - ./loki-config.yml:/etc/loki/local-config.yaml +# command: -config.file=/etc/loki/local-config.yaml # # promtail: -# image: grafana/promtail:latest +# image: grafana/promtail:2.3.0 # 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 +# - ./promtail-config.yml:/etc/promtail/promtail-config.yml +# command: -config.file=/etc/promtail/promtail-config.yml + volumes: grafana-storage: prometheus-data: From 88293ab345d77e08daf76460b35b5a0fa5817854 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 15:21:10 +0900 Subject: [PATCH 07/21] =?UTF-8?q?[ci]=20prometheus=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prometheus config 수정 --- docker-compose.yml | 48 ++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 292c0eff..b02717a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,8 @@ services: - app3 - prometheus - grafana + networks: + - server-network app1: image: "yeachan05/application:latest" @@ -32,9 +34,8 @@ services: - redis volumes: - /home/ec2-user/application-prod.yml:/config/application-prod.yml - environment: - - TZ=Asia/Seoul - - spring.application.name=app1 + networks: + - server-network app2: image: "yeachan05/application:latest" @@ -46,9 +47,8 @@ services: - redis volumes: - /home/ec2-user/application-prod.yml:/config/application-prod.yml - environment: - - TZ=Asia/Seoul - - spring.application.name=app2 + networks: + - server-network app3: image: "yeachan05/application:latest" @@ -60,9 +60,8 @@ services: - redis volumes: - /home/ec2-user/application-prod.yml:/config/application-prod.yml - environment: - - TZ=Asia/Seoul - - spring.application.name=app3 + networks: + - server-network redis: container_name: redis @@ -72,6 +71,8 @@ services: - "6379:6379" volumes: - redis-data:/data + networks: + - server-network prometheus: image: prom/prometheus @@ -84,6 +85,8 @@ services: - "9090:9090" extra_hosts: - "host.docker.internal:host-gateway" + networks: + - server-network grafana: image: grafana/grafana @@ -95,6 +98,8 @@ services: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: - grafana-storage:/var/lib/grafana + networks: + - server-network mysqld_exporter: image: quay.io/prometheus/mysqld-exporter @@ -106,25 +111,14 @@ services: - "9104:9104" volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf - -# loki: -# image: grafana/loki:2.3.0 -# container_name: loki -# ports: -# - "3100:3100" -# volumes: -# - ./loki-config.yml:/etc/loki/local-config.yaml -# command: -config.file=/etc/loki/local-config.yaml -# -# promtail: -# image: grafana/promtail:2.3.0 -# container_name: promtail -# volumes: -# - /var/log:/var/log -# - ./promtail-config.yml:/etc/promtail/promtail-config.yml -# command: -config.file=/etc/promtail/promtail-config.yml + networks: + - server-network volumes: grafana-storage: prometheus-data: - redis-data: \ No newline at end of file + redis-data: + +networks: + server-network: + driver: bridge From 741ff59f79f93cfb3a38364ce568e6eb622b3904 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 15:28:19 +0900 Subject: [PATCH 08/21] =?UTF-8?q?[ci]=20docker=20network=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker network 수정 --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index b02717a1..0e9d0fe8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,3 +122,4 @@ volumes: networks: server-network: driver: bridge + external: true \ No newline at end of file From 6cf77d4a41961cfac6246a947aff1063c8570bb5 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 17:10:45 +0900 Subject: [PATCH 09/21] =?UTF-8?q?[ci]=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 스크립트 수정 --- scripts/deploy.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 2f3142e8..acadc9d3 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -11,13 +11,23 @@ touch $START_LOG echo "[$(date +%c)] Docker Compose 실행 시작 - 이미지: $IMAGE_NAME:$IMAGE_TAG" >> $START_LOG -docker-compose -f $DOCKER_COMPOSE_PATH pull -docker-compose -f $DOCKER_COMPOSE_PATH up -d +# 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 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 From 6237bf645f59b14c2c08890c0e8826c9a7059e2c Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 17:44:32 +0900 Subject: [PATCH 10/21] =?UTF-8?q?[ci]=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=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 0e9d0fe8..f4c32751 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 acadc9d3..2f3142e8 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 From 6e69bfa2068ee6af9cae3de301e2191052b0d469 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 18:17:28 +0900 Subject: [PATCH 11/21] =?UTF-8?q?[ci]=20docker=20network=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker network 수정 --- docker-compose.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f4c32751..fc5b4a6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,7 +88,8 @@ services: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.retention.time=168h' - '--storage.tsdb.path=/prometheus' - + networks: + - monitoring grafana: image: grafana/grafana container_name: grafana @@ -99,7 +100,8 @@ services: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: - grafana-storage:/var/lib/grafana - + networks: + - monitoring mysqld_exporter: image: quay.io/prometheus/mysqld-exporter container_name: mysqld-exporter @@ -110,7 +112,8 @@ services: - "9104:9104" volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf - + networks: + - monitoring # loki: # image: grafana/loki:latest # container_name: loki @@ -133,4 +136,8 @@ services: volumes: grafana-storage: prometheus-data: - redis-data: \ No newline at end of file + redis-data: + +networks: + monitoring: + driver: bridge \ No newline at end of file From d0c803dba3d4810a112901da86053ec7c9ccee1a Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 18:45:10 +0900 Subject: [PATCH 12/21] =?UTF-8?q?[ci]=20nginx.conf=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nginx.conf 수정 --- nginx.conf | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/nginx.conf b/nginx.conf index b8f9c3cb..0139107b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -74,29 +74,29 @@ http { ssl_dhparam /etc/ssl/certs/ssl-dhparams.pem; } - server { - listen 9090; - - location / { - proxy_pass http://prometheus:9090; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - } - - server { - listen 3009; - - location / { - proxy_pass http://grafana:3000; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - } +# server { +# listen 9090; +# +# location / { +# proxy_pass http://prometheus:9090; +# proxy_set_header Host $host; +# proxy_set_header X-Real-IP $remote_addr; +# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +# proxy_set_header X-Forwarded-Proto $scheme; +# } +# } +# +# server { +# listen 3009; +# +# location / { +# proxy_pass http://grafana:3000; +# proxy_set_header Host $host; +# proxy_set_header X-Real-IP $remote_addr; +# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +# proxy_set_header X-Forwarded-Proto $scheme; +# } +# } server { if ($host = www.fundina.shop) { From e2662100d5aea7b17bb3b430a736db82718cd65f Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 18:51:19 +0900 Subject: [PATCH 13/21] =?UTF-8?q?[ci]=20nginx.conf=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nginx.conf 수정 --- docker-compose.yml | 3 ++- nginx.conf | 46 +++++++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fc5b4a6a..72312d4f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -87,9 +87,9 @@ services: command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.retention.time=168h' - - '--storage.tsdb.path=/prometheus' networks: - monitoring + grafana: image: grafana/grafana container_name: grafana @@ -102,6 +102,7 @@ services: - grafana-storage:/var/lib/grafana networks: - monitoring + mysqld_exporter: image: quay.io/prometheus/mysqld-exporter container_name: mysqld-exporter diff --git a/nginx.conf b/nginx.conf index 0139107b..b8f9c3cb 100644 --- a/nginx.conf +++ b/nginx.conf @@ -74,29 +74,29 @@ http { ssl_dhparam /etc/ssl/certs/ssl-dhparams.pem; } -# server { -# listen 9090; -# -# location / { -# proxy_pass http://prometheus:9090; -# proxy_set_header Host $host; -# proxy_set_header X-Real-IP $remote_addr; -# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -# proxy_set_header X-Forwarded-Proto $scheme; -# } -# } -# -# server { -# listen 3009; -# -# location / { -# proxy_pass http://grafana:3000; -# proxy_set_header Host $host; -# proxy_set_header X-Real-IP $remote_addr; -# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -# proxy_set_header X-Forwarded-Proto $scheme; -# } -# } + server { + listen 9090; + + location / { + proxy_pass http://prometheus:9090; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } + + server { + listen 3009; + + location / { + proxy_pass http://grafana:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } server { if ($host = www.fundina.shop) { From f675a4e040216c056a8ef77d30aa288da6fdfabd Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Tue, 2 Jul 2024 19:06:14 +0900 Subject: [PATCH 14/21] =?UTF-8?q?[ci]=20nginx.conf=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nginx.conf 수정 --- docker-compose.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 72312d4f..c927b627 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,11 +84,6 @@ services: - "9090:9090" extra_hosts: - "host.docker.internal:host-gateway" - command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.retention.time=168h' - networks: - - monitoring grafana: image: grafana/grafana @@ -100,8 +95,6 @@ services: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: - grafana-storage:/var/lib/grafana - networks: - - monitoring mysqld_exporter: image: quay.io/prometheus/mysqld-exporter @@ -113,8 +106,7 @@ services: - "9104:9104" volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf - networks: - - monitoring + # loki: # image: grafana/loki:latest # container_name: loki @@ -137,8 +129,4 @@ services: volumes: grafana-storage: prometheus-data: - redis-data: - -networks: - monitoring: - driver: bridge \ No newline at end of file + redis-data: \ No newline at end of file From fb812df7074d35f3dcc8e6fb290c36716c8e283a Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Wed, 3 Jul 2024 15:41:28 +0900 Subject: [PATCH 15/21] =?UTF-8?q?[ci]=20grafana=20=EC=84=A4=EC=A0=95=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 grafana 설정 수정 --- docker-compose.yml | 23 ++------------------ loki-config.yml | 53 --------------------------------------------- promtail-config.yml | 27 ----------------------- 3 files changed, 2 insertions(+), 101 deletions(-) delete mode 100644 loki-config.yml delete mode 100644 promtail-config.yml diff --git a/docker-compose.yml b/docker-compose.yml index c927b627..e72adfd7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,12 +89,13 @@ services: image: grafana/grafana container_name: grafana restart: always + user: "$UID:$GID" ports: - "3009:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: - - grafana-storage:/var/lib/grafana + - ./grafana-data:/var/lib/grafana mysqld_exporter: image: quay.io/prometheus/mysqld-exporter @@ -106,26 +107,6 @@ services: - "9104:9104" volumes: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf - -# 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: diff --git a/loki-config.yml b/loki-config.yml deleted file mode 100644 index 04ce72c5..00000000 --- a/loki-config.yml +++ /dev/null @@ -1,53 +0,0 @@ -auth_enabled: false - -server: - http_listen_port: 3100 - log_level: info - -common: - path_prefix: /loki - storage: - filesystem: - chunks_directory: /loki/chunks - rules_directory: /loki/rules - replication_factor: 1 - -schema_config: - configs: - - from: 2022-01-01 - store: boltdb-shipper - object_store: filesystem - schema: v11 - index: - prefix: index_ - period: 24h - -storage_config: - boltdb_shipper: - active_index_directory: /loki/index - shared_store: filesystem - cache_location: /loki/cache - -limits_config: - enforce_metric_name: false - reject_old_samples: true - reject_old_samples_max_age: 168h - -chunk_store_config: - max_look_back_period: 0s - -table_manager: - retention_deletes_enabled: true - retention_period: 168h - -ingester: - lifecycler: - ring: - kvstore: - store: inmemory - replication_factor: 1 - final_sleep: 0s - chunk_idle_period: 15m - chunk_block_size: 262144 - chunk_retain_period: 1m - max_transfer_retries: 0 diff --git a/promtail-config.yml b/promtail-config.yml deleted file mode 100644 index 90420faa..00000000 --- a/promtail-config.yml +++ /dev/null @@ -1,27 +0,0 @@ -server: - http_listen_port: 9080 - -positions: - filename: /tmp/positions.yaml - -clients: - - url: http://loki:3100/loki/api/v1/push - -scrape_configs: - - job_name: system - static_configs: - - targets: - - localhost - labels: - job: varlogs - host: ${HOSTNAME} - __path__: /var/log/*log - - - job_name: applications - static_configs: - - targets: - - localhost - labels: - job: applogs - host: ${HOSTNAME} - __path__: /path/to/your/application/logs/*.log From 238247428b2a7a8c86669b622bc455f0430c4fc1 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Wed, 3 Jul 2024 15:50:34 +0900 Subject: [PATCH 16/21] =?UTF-8?q?[ci]=20grafana=20=EC=84=A4=EC=A0=95=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 grafana 설정 수정 --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e72adfd7..87022289 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,7 +89,6 @@ services: image: grafana/grafana container_name: grafana restart: always - user: "$UID:$GID" ports: - "3009:3000" environment: From 5beabc412adebd2fee7afdf03a5df3d7f2721fed Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Wed, 3 Jul 2024 15:59:53 +0900 Subject: [PATCH 17/21] =?UTF-8?q?[ci]=20grafana=20user=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grafana user 수정 --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 87022289..9e10f278 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,6 +89,7 @@ services: image: grafana/grafana container_name: grafana restart: always + user: ec2-user ports: - "3009:3000" environment: From f4e9b0a2069473fd9c0c25385ac7ad8fbb9105df Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Wed, 3 Jul 2024 16:14:56 +0900 Subject: [PATCH 18/21] =?UTF-8?q?[ci]=20grafana=20user=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grafana user 수정 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9e10f278..8753e3fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,13 +89,13 @@ services: image: grafana/grafana container_name: grafana restart: always - user: ec2-user + user: "1000" ports: - "3009:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: - - ./grafana-data:/var/lib/grafana + - grafana_data:/var/lib/grafana mysqld_exporter: image: quay.io/prometheus/mysqld-exporter From 77927cafd76b4f63eeea5154367b9abdf2bbd035 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Wed, 3 Jul 2024 16:30:53 +0900 Subject: [PATCH 19/21] =?UTF-8?q?[ci]=20docker=20network=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker network 수정 --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8753e3fe..3c218d21 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,5 +109,6 @@ services: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf volumes: grafana-storage: + external: true prometheus-data: redis-data: \ No newline at end of file From eddd386287d16cef85ee5a9aa77a557a86feb4b3 Mon Sep 17 00:00:00 2001 From: YeaChan05 Date: Wed, 3 Jul 2024 16:37:55 +0900 Subject: [PATCH 20/21] =?UTF-8?q?[ci]=20grafana=20volume=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grafana volume 수정 --- docker-compose.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3c218d21..82182959 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,13 +89,13 @@ services: image: grafana/grafana container_name: grafana restart: always - user: "1000" + user: "472" ports: - "3009:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} volumes: - - grafana_data:/var/lib/grafana + - grafana-storage:/var/lib/grafana mysqld_exporter: image: quay.io/prometheus/mysqld-exporter @@ -109,6 +109,5 @@ services: - /home/ec2-user/my.cnf:/etc/mysql/my.cnf volumes: grafana-storage: - external: true prometheus-data: redis-data: \ No newline at end of file From 7391a901df965cbebf7efe6b7f3828afc3d1260b Mon Sep 17 00:00:00 2001 From: Kim Min-Woo <107420002+kmw2378@users.noreply.github.com> Date: Thu, 4 Jul 2024 17:43:02 +0900 Subject: [PATCH 21/21] =?UTF-8?q?[refactor]=20=EB=A9=94=ED=8A=B8=EB=A6=AD?= =?UTF-8?q?=20=EB=A1=9C=EA=B9=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kakaoshare/backend/logging/filter/LoggingFilter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java b/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java index 51469302..a1786d63 100644 --- a/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java +++ b/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java @@ -50,10 +50,10 @@ protected void doFilterInternal(final HttpServletRequest request, final FilterChain filterChain) throws ServletException, IOException { final ContentCachingRequestWrapper cachingRequest = new ContentCachingRequestWrapper(request); final ContentCachingResponseWrapper cachingResponse = new ContentCachingResponseWrapper(response); - final String requestURI = cachingRequest.getRequestURI(); - if (requestURI.contains(METRIC_URL_PREFIX) || requestURI.contains(FAVICON_URL)) { - return; - } + // final String requestURI = cachingRequest.getRequestURI(); + // if (requestURI.contains(METRIC_URL_PREFIX) || requestURI.contains(FAVICON_URL)) { + // return; + // } apiTimer.start(); filterChain.doFilter(cachingRequest, cachingResponse);