Skip to content

Commit

Permalink
Merge pull request #145 from 2024-SummerBootcamp-Team/develop
Browse files Browse the repository at this point in the history
Main merge확인바람
  • Loading branch information
drghdtjr authored Jul 29, 2024
2 parents 39bf95d + bcdc9ce commit d6fe527
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import app.config.envSetting # 환경 변수를 가져오기 위한 설정
from fastapi import FastAPI ,Request
from starlette.middleware.cors import CORSMiddleware
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from prometheus_fastapi_instrumentator import Instrumentator
import logging

Expand All @@ -21,7 +21,7 @@
# CORS 설정
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173", "https://brain-washer.net/"], # 모든 도메인에서의 요청을 허용
allow_origins=["http://localhost:5173", "https://brain-washer.net"], # 모든 도메인에서의 요청을 허용
allow_credentials=True,
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"], # 허용할 메서드들 설정
allow_headers=["*"], # 모든 헤더를 허용
Expand Down
2 changes: 1 addition & 1 deletion app/routers/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def read_samples(character_name: str, db: Session = Depends(get_db)):


# 이미지 다운로드 수
@router.post("/download_count/{image_id}", response_model=ResultResponseModel, summary="이미지 다운로드 수",
@router.post("/count/{image_id}", response_model=ResultResponseModel, summary="이미지 다운로드 수",
description="이미지 다운로드 수를 알려줍니다.")
def download_image_count(image_id: int, db: Session = Depends(get_db)):
image = image_service.get_image(db, image_id=image_id)
Expand Down
2 changes: 1 addition & 1 deletion app/routers/voices.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def hard_delete_voice(voice_id: int, db: Session = Depends(get_db)):


#목소리 다운로드 수
@router.post("/download_count/{voice_id}", response_model=ResultResponseModel, summary="목소리 다운로드 수",
@router.post("/count/{voice_id}", response_model=ResultResponseModel, summary="목소리 다운로드 수",
description="목소리 다운로드 수를 알려줍니다")
def download_voice_count(voice_id: int, db: Session = Depends(get_db)):
voice = voice_service.get_voice(db, voice_id=voice_id)
Expand Down
10 changes: 10 additions & 0 deletions docker-compose-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,15 @@ services:
networks:
- teamhnet

nginx-prometheus-exporter:
container_name: nginx-prometheus-exporter
image: nginx/nginx-prometheus-exporter:1.3
environment:
- SCRAPE_URI=http://nginx:9110/metrics
ports:
- "9113:9113"
networks:
- teamhnet

networks:
teamhnet:
2 changes: 1 addition & 1 deletion monitoring/elk/filebeat/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ filebeat.inputs:
output.logstash:
hosts: ["logstash:5044"]

logging.level: error
logging.level: info
2 changes: 1 addition & 1 deletion monitoring/elk/logstash/logstash.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
http.host: "0.0.0.0" # 모든 인터페이스에서 수신 대기
log.level: error # 로그 레벨 설정
log.level: info # 로그 레벨 설정
path.logs: /var/log/logstash #저장할 위치
6 changes: 6 additions & 0 deletions monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ scrape_configs:
static_configs:
- targets: ['cadvisor:8080']


- job_name: 'nginx'
static_configs:
- targets: ['nginx-prometheus-exporter:9113']


13 changes: 13 additions & 0 deletions nginx/configs/nginx-blue.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,17 @@ http {

}

# nginx prometheus exporter를 위한 설정
server {
# 내부적으로 사용하기 위해 9110 포트로 설정
listen 9110;
server_name localhost;

location /metrics {
stub_status on; # stub_status 활성화
allow all; # allow 접근을 허용할 주소 설정
# deny 접근을 허용하지 않을 주소 설정
}
}

}
13 changes: 13 additions & 0 deletions nginx/configs/nginx-green.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,17 @@ http {

}

# nginx prometheus exporter를 위한 설정
server {
# 내부적으로 사용하기 위해 9110 포트로 설정
listen 9110;
server_name localhost;

location /metrics {
stub_status on; # stub_status 활성화
allow all; # allow 접근을 허용할 주소 설정
# deny 접근을 허용하지 않을 주소 설정
}
}

}
13 changes: 13 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,17 @@ http {

}

# nginx prometheus exporter를 위한 설정
server {
# 내부적으로 사용하기 위해 9110 포트로 설정
listen 9110;
server_name localhost;

location /metrics {
stub_status on; # stub_status 활성화
allow all; # allow 접근을 허용할 주소 설정
# deny 접근을 허용하지 않을 주소 설정
}
}

}

0 comments on commit d6fe527

Please sign in to comment.