Skip to content

DEPLOY - v1.0.2 - #31

Merged
youyeon11 merged 6 commits into
mainfrom
develop
Oct 2, 2025
Merged

DEPLOY - v1.0.2#31
youyeon11 merged 6 commits into
mainfrom
develop

Conversation

@youyeon11

Copy link
Copy Markdown
Contributor

๐Ÿ“Œ ์ž‘์—… ๋ชฉ์ 


๐Ÿ—‚ ์ž‘์—… ์œ ํ˜•

  • ๊ธฐ๋Šฅ ์ถ”๊ฐ€ (Feature)
  • ๋ฒ„๊ทธ ์ˆ˜์ • (Bug Fix)
  • ๋ฆฌํŒฉํ„ฐ๋ง (Refactor)
  • ์„ฑ๋Šฅ ๊ฐœ์„  (Performance)
  • ํ…Œ์ŠคํŠธ ์ถ”๊ฐ€/์ˆ˜์ • (Test)
  • ๋นŒ๋“œ/๋ฐฐํฌ/ํ™˜๊ฒฝ ์„ค์ • (Chore)
  • ๋ฌธ์„œ ์ˆ˜์ • (Docs)

๐Ÿ”จ ์ฃผ์š” ์ž‘์—… ๋‚ด์šฉ

  • ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ์„ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค

๐Ÿ“Ž ๊ด€๋ จ ์ด์Šˆ


@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @youyeon11, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

์ด PR์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ํฌ๊ด„์ ์ธ ๋ชจ๋‹ˆํ„ฐ๋ง ๊ธฐ๋Šฅ์„ ๋„์ž…ํ•˜์—ฌ Prometheus์™€ Grafana๋ฅผ ํ†ตํ•ฉํ•ฉ๋‹ˆ๋‹ค. FastAPI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ณ„์ธกํ•˜์—ฌ ์„ฑ๋Šฅ ๋ฉ”ํŠธ๋ฆญ์„ ๋…ธ์ถœํ•˜๊ณ , ๋ฐฐํฌ ํ”„๋กœ์„ธ์Šค๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋ฉฐ, ๋ชจ๋‹ˆํ„ฐ๋ง ์Šคํƒ์— ํ•„์š”ํ•œ ๊ตฌ์„ฑ ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์‹œ์Šคํ…œ์˜ ๊ฐ€์‹œ์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ณ  ์ž ์žฌ์ ์ธ ๋ฌธ์ œ๋ฅผ ์‚ฌ์ „์— ๊ฐ์ง€ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

Highlights

  • ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ ์ถ”๊ฐ€: ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— Prometheus์™€ Grafana๋ฅผ ํฌํ•จํ•œ ํฌ๊ด„์ ์ธ ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ์ด ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  • FastAPI ๋ฉ”ํŠธ๋ฆญ ๊ณ„์ธก: FastAPI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— prometheus-fastapi-instrumentator ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ /actuator/prometheus ์—”๋“œํฌ์ธํŠธ์— ๋ฉ”ํŠธ๋ฆญ์„ ๋…ธ์ถœํ•˜๋„๋ก ๊ณ„์ธก๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  • ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์—…๋ฐ์ดํŠธ: deploy.sh ์Šคํฌ๋ฆฝํŠธ๊ฐ€ docker-compose.yml ํŒŒ์ผ์„ ๋ช…์‹œ์ ์œผ๋กœ ์ฐธ์กฐํ•˜๋„๋ก ์—…๋ฐ์ดํŠธ๋˜์–ด ์ปจํ…Œ์ด๋„ˆ ํ’€ ๋ฐ ์žฌ๊ตฌ์ถ• ํ”„๋กœ์„ธ์Šค์˜ ๋ช…ํ™•์„ฑ์„ ๋†’์˜€์Šต๋‹ˆ๋‹ค.
  • ์ƒˆ๋กœ์šด ๋ชจ๋‹ˆํ„ฐ๋ง ๊ตฌ์„ฑ ํŒŒ์ผ: Prometheus ๋ฐ Grafana๋ฅผ ์œ„ํ•œ docker-compose.monitoring.yml, Prometheus ๊ฒฝ๊ณ  ๊ทœ์น™์„ ์œ„ํ•œ prometheus-rule.yml, ๊ทธ๋ฆฌ๊ณ  Prometheus ์„œ๋ฒ„ ๊ตฌ์„ฑ์„ ์œ„ํ•œ prometheus.yml ํŒŒ์ผ์ด ์ƒˆ๋กœ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  • ์ข…์†์„ฑ ์—…๋ฐ์ดํŠธ: requirements.txt ํŒŒ์ผ์— prometheus-client์™€ prometheus-fastapi-instrumentator๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/workflow.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with ๐Ÿ‘ and ๐Ÿ‘Ž on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. โ†ฉ

@youyeon11

Copy link
Copy Markdown
Contributor Author

๐Ÿค– Gemini ์ฝ”๋“œ ๋ฆฌ๋ทฐ ๊ฒฐ๊ณผ

1) PR ์˜๋„ ์š”์•ฝ

์ด๋ฒˆ PR์€ ์‹œ์Šคํ…œ์˜ ์•ˆ์ •์„ฑ๊ณผ ๊ด€์ธก ๊ฐ€๋Šฅ์„ฑ(Observability)์„ ๋†’์ด๊ธฐ ์œ„ํ•ด Prometheus์™€ Grafana ๊ธฐ๋ฐ˜์˜ ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ์„ ๋„์ž…ํ•˜๋Š” ๊ฒƒ์„ ๋ชฉํ‘œ๋กœ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด FastAPI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋ฉ”ํŠธ๋ฆญ ์ˆ˜์ง‘ ์—”๋“œํฌ์ธํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ , ๋ชจ๋‹ˆํ„ฐ๋ง ์Šคํƒ์„ Docker Compose๋กœ ์ •์˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, ์ธ์Šคํ„ด์Šค ๋‹ค์šด์ด๋‚˜ API ์ง€์—ฐ๊ณผ ๊ฐ™์€ ์ƒํ™ฉ์— ๋Œ€ํ•œ ๊ฒฝ๊ณ (Alert) ๊ทœ์น™์„ ์„ค์ •ํ•˜์—ฌ ์žฅ์• ์— ์‹ ์†ํ•˜๊ฒŒ ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋ฐ˜์„ ๋งˆ๋ จํ–ˆ์Šต๋‹ˆ๋‹ค.

2) ์ „๋ฐ˜์  ํ‰๊ฐ€ (ํ’ˆ์งˆ/๊ฐ€๋…์„ฑ/ํ…Œ์ŠคํŠธ/์•„ํ‚คํ…์ฒ˜)

  • ์ปจ๋ฒค์…˜: ์ „๋ฐ˜์ ์œผ๋กœ ์ฝ”๋“œ์™€ ์„ค์ • ํŒŒ์ผ๋“ค์ด ๊ฐ ๋„๊ตฌ์˜ ํ‘œ์ค€ ์ปจ๋ฒค์…˜์„ ์ž˜ ๋”ฐ๋ฅด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. Python ์ฝ”๋“œ๋Š” PEP8์„ ์ค€์ˆ˜ํ•˜๋ฉฐ, YAML ์„ค์ •๋„ ๊ตฌ์กฐ์ ์œผ๋กœ ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค.
  • ๋„ค์ด๋ฐ/๋ชจ๋“ˆ ๊ฒฝ๊ณ„: docker-compose.monitoring.yml, prometheus.yml ๋“ฑ ํŒŒ์ผ๋ช…์ด ์—ญํ• ์„ ๋ช…ํ™•ํ•˜๊ฒŒ ๋‚˜ํƒ€๋‚ด์–ด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค. ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋กœ์ง์˜ ๋ถ„๋ฆฌ๋„ ์ž˜ ์ด๋ฃจ์–ด์กŒ์Šต๋‹ˆ๋‹ค.
  • ์˜์กด์„ฑ: ๋ชจ๋‹ˆํ„ฐ๋ง์„ ์œ„ํ•œ ์˜์กด์„ฑ(prometheus-fastapi-instrumentator)์ด requirements.txt์— ๋ช…ํ™•ํžˆ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  • ํ…Œ์ŠคํŠธ ์ „๋žต: ์ธํ”„๋ผ ์„ค์ • ๋ณ€๊ฒฝ์ด ์ฃผ๋œ ๋‚ด์šฉ์ด๋ฏ€๋กœ ์ž๋™ํ™”๋œ ํ…Œ์ŠคํŠธ๋Š” ์—†์ง€๋งŒ, ๋ฐฐํฌ ํ›„ ์‹ค์ œ ๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์‹œ๋ณด๋“œ ๋ฐ ์•Œ๋ฆผ ๊ธฐ๋Šฅ์ด ์ •์ƒ ๋™์ž‘ํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์ˆ˜๋™ ๊ฒ€์ฆ์ด ๋ฐ˜๋“œ์‹œ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

3) ์šฐ์„ ์ˆœ์œ„๋ณ„ ํ”ผ๋“œ๋ฐฑ ๋ชฉ๋ก

[P2] ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ด์‹์„ฑ ๋ฐ ์œ ์ง€๋ณด์ˆ˜์„ฑ ์ €ํ•˜

  • ํŒŒ์ผ/์œ„์น˜: deployment/docker-compose.monitoring.yml:6, deployment/docker-compose.monitoring.yml:23, .github/workflows/workflow.yml:48

  • ๊ทผ๊ฑฐ(์™œ ๋ฌธ์ œ์ธ์ง€): docker-compose.monitoring.yml ํŒŒ์ผ ๋‚ด ๋ณผ๋ฅจ ๊ฒฝ๋กœ๊ฐ€ /home/ubuntu/... ์™€ ๊ฐ™์ด ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋กœ ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ํŠน์ • ์‚ฌ์šฉ์ž(ubuntu)์™€ ํŠน์ • ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ(dearbelly)์— ๊ฐ•ํ•˜๊ฒŒ ์˜์กดํ•˜๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค. GitHub Actions ์›Œํฌํ”Œ๋กœ์šฐ์˜ target ๊ฒฝ๋กœ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค.

  • ์˜ํ–ฅ(๋ฒ„๊ทธ/๋ณด์•ˆ/์„ฑ๋Šฅ/์œ ์ง€๋ณด์ˆ˜ ๋“ฑ):

    • ์œ ์ง€๋ณด์ˆ˜์„ฑ: ํ–ฅํ›„ ์„œ๋ฒ„ ํ™˜๊ฒฝ(์˜ˆ: ์‚ฌ์šฉ์ž ์ด๋ฆ„ ๋ณ€๊ฒฝ, ํ”„๋กœ์ ํŠธ ๊ฒฝ๋กœ ๋ณ€๊ฒฝ)์ด ๋ฐ”๋€” ๊ฒฝ์šฐ, ์—ฌ๋Ÿฌ ์„ค์ • ํŒŒ์ผ์„ ์ฐพ์•„ ์ง์ ‘ ์ˆ˜์ •ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ๋ฒˆ๊ฑฐ๋กญ๊ณ  ์‹ค์ˆ˜๋ฅผ ์œ ๋ฐœํ•˜๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค.
    • ์ด์‹์„ฑ: ๋‹ค๋ฅธ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋กœ์ปฌ ํ™˜๊ฒฝ์—์„œ ํ…Œ์ŠคํŠธํ•˜๊ฑฐ๋‚˜, ๋‹ค๋ฅธ ์„œ๋ฒ„์— ๋™์ผํ•œ ๊ตฌ์„ฑ์„ ๋ฐฐํฌํ•˜๊ธฐ ์–ด๋ ต๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
  • ์ œ์•ˆ(๊ตฌ์ฒด์  ์กฐ์น˜, ๋Œ€์•ˆ, ์ฐธ๊ณ  ๋งํฌ๋Š” ์„ ํƒ):

    1. Docker Named Volumes ์‚ฌ์šฉ: ๋ฐ์ดํ„ฐ ์ €์žฅ ๋ณผ๋ฅจ(prometheus/volume, grafana/volume)์€ Docker๊ฐ€ ๊ด€๋ฆฌํ•˜๋Š” Named Volume์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ์ ๊ทน ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ˜ธ์ŠคํŠธ ๊ฒฝ๋กœ ์˜์กด์„ฑ์ด ์‚ฌ๋ผ์ง‘๋‹ˆ๋‹ค.
    2. ์„ค์ • ํŒŒ์ผ์€ ์ƒ๋Œ€ ๊ฒฝ๋กœ ์‚ฌ์šฉ: prometheus.yml๊ณผ ๊ฐ™์€ ์„ค์ • ํŒŒ์ผ์€ docker-compose ํŒŒ์ผ ์œ„์น˜ ๊ธฐ์ค€์œผ๋กœ ์ƒ๋Œ€ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
    3. GitHub Actions ๊ฒฝ๋กœ๋Š” Secret/Variable ์‚ฌ์šฉ: ๋ฐฐํฌ ๊ฒฝ๋กœ๋Š” GitHub Actions์˜ Secret์ด๋‚˜ Variable๋กœ ๊ด€๋ฆฌํ•˜๋ฉด ์œ ์—ฐ์„ฑ์ด ํฌ๊ฒŒ ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.

    ์ˆ˜์ • ์ œ์•ˆ (docker-compose.monitoring.yml):

    services:
      prometheus:
        user: ${PROMETHEUS_USER}
        image: prom/prometheus:latest
        container_name: prometheus
        volumes:
    -     - /home/ubuntu/dearbelly/deployment/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    -     - /home/ubuntu/prometheus/volume:/prometheus/data
    +     - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
    +     - prometheus-data:/prometheus/data
        ports:
          - 9090:9090
        # ... (์ดํ•˜ ์ƒ๋žต)
    
      grafana:
        user: ${GRAFANA_USER}
        image: grafana/grafana:latest
        container_name: grafana
        ports:
          - 3000:3000
        volumes:
    -     - /home/ubuntu/grafana/volume:/var/lib/grafana
    +     - grafana-data:/var/lib/grafana
        restart: always
        networks:
          - mynetwork
    
    networks:
      mynetwork:
        driver: bridge
    
    +volumes:
    +  prometheus-data:
    +  grafana-data:

[P2] ๋ชจ๋‹ˆํ„ฐ๋ง ์Šคํƒ ๋ฐฐํฌ ์ž๋™ํ™” ๋ˆ„๋ฝ

  • ํŒŒ์ผ/์œ„์น˜: deployment/deploy.sh

  • ๊ทผ๊ฑฐ(์™œ ๋ฌธ์ œ์ธ์ง€): deploy.sh ์Šคํฌ๋ฆฝํŠธ๋Š” docker-compose.yml ํŒŒ์ผ์„ ์‚ฌ์šฉํ•˜์—ฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜(app-blue/app-green)๋งŒ ๋ฐฐํฌํ•˜๋„๋ก ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ๋กœ ์ถ”๊ฐ€๋œ docker-compose.monitoring.yml ํŒŒ์ผ์˜ ์„œ๋น„์Šค(Prometheus, Grafana)๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๋กœ์ง์ด ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

  • ์˜ํ–ฅ(๋ฒ„๊ทธ/๋ณด์•ˆ/์„ฑ๋Šฅ/์œ ์ง€๋ณด์ˆ˜ ๋“ฑ):

    • ๋ฐฐํฌ ๋ถˆ์™„์ „์„ฑ: ํ˜„์žฌ ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•ด๋„ ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ์€ ์‹คํ–‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋งค๋ฒˆ ์ˆ˜๋™์œผ๋กœ docker compose -f docker-compose.monitoring.yml up -d ์™€ ๊ฐ™์€ ๋ช…๋ น์„ ์‹คํ–‰ํ•ด์•ผ ํ•˜๋ฏ€๋กœ, ๋ฐฐํฌ ๊ณผ์ •์ด ๋ฒˆ๊ฑฐ๋กญ๊ณ  ์‹ค์ˆ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ œ์•ˆ(๊ตฌ์ฒด์  ์กฐ์น˜, ๋Œ€์•ˆ, ์ฐธ๊ณ  ๋งํฌ๋Š” ์„ ํƒ):
    ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๋ชจ๋‹ˆํ„ฐ๋ง ์Šคํƒ์˜ ์‹คํ–‰๋„ ์ฑ…์ž„์ง€๋„๋ก ์ˆ˜์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, deploy.sh ์ƒ๋‹จ์— ๋ชจ๋‹ˆํ„ฐ๋ง ์„œ๋น„์Šค๋ฅผ ์‹คํ–‰(๋˜๋Š” ์—…๋ฐ์ดํŠธ)ํ•˜๋Š” ๊ตฌ๋ฌธ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ˆ˜์ • ์ œ์•ˆ (deploy.sh):

    #!/bin/bash
    
    +echo "Starting monitoring services..."
    +docker compose -f docker-compose.monitoring.yml up -d
    +
     EXIST_BLUE=$(docker compose -f docker-compose.yml ps -q app-blue)
     # ... (์ดํ•˜ ๊ธฐ์กด ์Šคํฌ๋ฆฝํŠธ)

    ๋˜๋Š”, ํ•˜๋‚˜์˜ ์Šคํฌ๋ฆฝํŠธ๋กœ ์—ฌ๋Ÿฌ compose ํŒŒ์ผ์„ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ๋ณต์žกํ•˜๋‹ค๋ฉด, ๋ณ„๋„์˜ deploy-monitoring.sh ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ฌธ์„œํ™”ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

[P3] ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ •์— ๋Œ€ํ•œ ์„ค๋ช… ๋ถ€์กฑ

  • ํŒŒ์ผ/์œ„์น˜: deployment/docker-compose.monitoring.yml:3, deployment/docker-compose.monitoring.yml:19, deployment/prometheus.yml:18 ๋“ฑ

  • ๊ทผ๊ฑฐ(์™œ ๋ฌธ์ œ์ธ์ง€): docker-compose.monitoring.yml ๊ณผ prometheus.yml์—์„œ ${PROMETHEUS_USER}, ${GRAFANA_USER}, ${REMOTE_HOST} ์™€ ๊ฐ™์€ ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด ๋ณ€์ˆ˜๋“ค์ด ์–ด๋””์„œ ์–ด๋–ป๊ฒŒ ์„ค์ •๋˜์–ด์•ผ ํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์„ค๋ช…(์˜ˆ: .env ํŒŒ์ผ ํ•„์š”์„ฑ)์ด PR ๋ณธ๋ฌธ์ด๋‚˜ ์ฝ”๋“œ ๋‚ด ์ฃผ์„์— ์—†์Šต๋‹ˆ๋‹ค.

  • ์˜ํ–ฅ(๋ฒ„๊ทธ/๋ณด์•ˆ/์„ฑ๋Šฅ/์œ ์ง€๋ณด์ˆ˜ ๋“ฑ):

    • ์‹คํ–‰ ์˜ค๋ฅ˜: ํ•ด๋‹น ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์—†์ด ์‹คํ–‰ํ•˜๋ฉด ์„œ๋น„์Šค๊ฐ€ ๊ถŒํ•œ ๋ฌธ์ œ๋กœ ์‹œ์ž‘์— ์‹คํŒจํ•˜๊ฑฐ๋‚˜, ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ ๋Œ€์ƒ์„ ์Šคํฌ๋žฉํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • ํ˜‘์—… ๋น„ํšจ์œจ: ๋‹ค๋ฅธ ํŒ€์›์ด ์ด ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒˆ๋กœ ์„ค์ •ํ•  ๋•Œ, ์–ด๋–ค ํ™˜๊ฒฝ ๋ณ€์ˆ˜๊ฐ€ ํ•„์š”ํ•œ์ง€ ๋ชฐ๋ผ ์‹œ๊ฐ„์„ ๋‚ญ๋น„ํ•˜๊ฑฐ๋‚˜ ์„ค์ •์— ์‹คํŒจํ•  ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์Šต๋‹ˆ๋‹ค.
  • ์ œ์•ˆ(๊ตฌ์ฒด์  ์กฐ์น˜, ๋Œ€์•ˆ, ์ฐธ๊ณ  ๋งํฌ๋Š” ์„ ํƒ):
    ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์— .env.example ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ํ•„์š”ํ•œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ๋ชฉ๋ก๊ณผ ๊ทธ ์—ญํ• ์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”. ์ด๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ๊ฐœ๋ฐœ์ž๋“ค์ด ์†์‰ฝ๊ฒŒ ๋กœ์ปฌ ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    .env.example ํŒŒ์ผ ์˜ˆ์‹œ:

    # docker-compose.monitoring.yml: Prometheus & Grafana services user ID/group ID
    # Example: 1000:1000 or ubuntu user's id
    PROMETHEUS_USER=1000:1000
    GRAFANA_USER=472:472
    
    # prometheus.yml: Host IP for Prometheus to scrape itself and node-exporter
    REMOTE_HOST=127.0.0.1
    

[P3] API ๋ฉ”ํŠธ๋ฆญ ์ˆ˜์ง‘ ์ฃผ๊ธฐ ๊ณผ๋‹ค

  • ํŒŒ์ผ/์œ„์น˜: deployment/prometheus.yml:28, deployment/prometheus.yml:32

  • ๊ทผ๊ฑฐ(์™œ ๋ฌธ์ œ์ธ์ง€): FastAPI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ฉ”ํŠธ๋ฆญ์„ ์ˆ˜์ง‘ํ•˜๋Š” scrape_interval์ด 1m(1๋ถ„)์œผ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์˜ํ–ฅ(๋ฒ„๊ทธ/๋ณด์•ˆ/์„ฑ๋Šฅ/์œ ์ง€๋ณด์ˆ˜ ๋“ฑ):

    • ์žฅ์•  ๊ฐ์ง€ ์ง€์—ฐ: ํŠธ๋ž˜ํ”ฝ ๊ธ‰์ฆ์ด๋‚˜ ์‘๋‹ต ์‹œ๊ฐ„ ์ง€์—ฐ๊ณผ ๊ฐ™์€ ์ˆœ๊ฐ„์ ์ธ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ, ์ด๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๋ฐ ์ตœ๋Œ€ 1๋ถ„์ด ์†Œ์š”๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์žฅ์•  ๋Œ€์‘์˜ ๊ณจ๋“ ํƒ€์ž„์„ ๋†“์น˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ œ์•ˆ(๊ตฌ์ฒด์  ์กฐ์น˜, ๋Œ€์•ˆ, ์ฐธ๊ณ  ๋งํฌ๋Š” ์„ ํƒ):
    ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฉ”ํŠธ๋ฆญ ์ˆ˜์ง‘ ์ฃผ๊ธฐ๋ฅผ ์ผ๋ฐ˜์ ์ธ ์ˆ˜์ค€์ธ 15s ๋˜๋Š” 30s๋กœ ์ค„์ด๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์‹œ์Šคํ…œ ์ƒํƒœ ๋ณ€ํ™”๋ฅผ ๋” ๋น ๋ฅด๊ฒŒ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ˆ˜์ • ์ œ์•ˆ (prometheus.yml):

    # ...
      - job_name: 'fastapi-actuator-blue'
        metrics_path: '/actuator/prometheus'
    -   scrape_interval: 1m
    +   scrape_interval: 15s
        static_configs:
          - targets: [ 'app-blue:8000' ]
      - job_name: 'fastapi-actuator-green'
        metrics_path: '/actuator/prometheus'
    -   scrape_interval: 1m
    +   scrape_interval: 15s
        static_configs:
          - targets: [ 'app-green:8001' ]

[P4] ๋ถˆํ•„์š”ํ•œ ์˜์กด์„ฑ ํฌํ•จ

  • ํŒŒ์ผ/์œ„์น˜: requirements.txt:14

  • ๊ทผ๊ฑฐ(์™œ ๋ฌธ์ œ์ธ์ง€): logging ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ requirements.txt์— ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. logging์€ Python์˜ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ, ๋ณ„๋„๋กœ ์„ค์น˜ํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.

  • ์˜ํ–ฅ(๋ฒ„๊ทธ/๋ณด์•ˆ/์„ฑ๋Šฅ/์œ ์ง€๋ณด์ˆ˜ ๋“ฑ):

    • ๊ฐ€๋…์„ฑ/์œ ์ง€๋ณด์ˆ˜์„ฑ: pip ์„ค์น˜ ์‹œ ๋ฌด์‹œ๋˜๋ฏ€๋กœ ๊ธฐ๋Šฅ์  ๋ฌธ์ œ๋Š” ์—†์ง€๋งŒ, ๋ถˆํ•„์š”ํ•œ ํ•ญ๋ชฉ์ด ํฌํ•จ๋˜์–ด ์žˆ์–ด ์˜์กด์„ฑ ๋ชฉ๋ก์„ ํ˜ผ๋ž€์Šค๋Ÿฝ๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
  • ์ œ์•ˆ(๊ตฌ์ฒด์  ์กฐ์น˜, ๋Œ€์•ˆ, ์ฐธ๊ณ  ๋งํฌ๋Š” ์„ ํƒ):
    requirements.txt ํŒŒ์ผ์—์„œ logging ๋ผ์ธ์„ ์‚ญ์ œํ•˜์—ฌ ์˜์กด์„ฑ ๋ชฉ๋ก์„ ๊น”๋”ํ•˜๊ฒŒ ์œ ์ง€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

    ์ˆ˜์ • ์ œ์•ˆ (requirements.txt):

    - logging
    prometheus-client==0.19.0
    prometheus-fastapi-instrumentator==6.1.0

[P5] ๋ฉ”ํŠธ๋ฆญ ์ดˆ๊ธฐํ™” ๋กœ์ง ๋ถ„๋ฆฌ ์ œ์•ˆ

  • ํŒŒ์ผ/์œ„์น˜: app/main.py:14-15

  • ๊ทผ๊ฑฐ(์™œ ๋ฌธ์ œ์ธ์ง€): Prometheus Instrumentator๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ์ ์šฉํ•˜๋Š” ์ฝ”๋“œ๊ฐ€ main.py์˜ ์ตœ์ƒ์œ„ ๋ ˆ๋ฒจ์— ์ง์ ‘ ์ž‘์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์˜ํ–ฅ(๋ฒ„๊ทธ/๋ณด์•ˆ/์„ฑ๋Šฅ/์œ ์ง€๋ณด์ˆ˜ ๋“ฑ):

    • ๊ฐ€๋…์„ฑ: ํ˜„์žฌ๋Š” ์ฝ”๋“œ๊ฐ€ ์งง์•„ ๋ฌธ์ œ๊ฐ€ ์—†์ง€๋งŒ, ํ–ฅํ›„ ๋ฏธ๋“ค์›จ์–ด๋‚˜ ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ ๋“ฑ ์•ฑ ์ดˆ๊ธฐํ™” ๋กœ์ง์ด ๋ณต์žกํ•ด์ง€๋ฉด main.py ํŒŒ์ผ์˜ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ œ์•ˆ(๊ตฌ์ฒด์  ์กฐ์น˜, ๋Œ€์•ˆ, ์ฐธ๊ณ  ๋งํฌ๋Š” ์„ ํƒ):
    ์•ฑ์˜ ํŠน์ • ๊ธฐ๋Šฅ์„ ์„ค์ •ํ•˜๋Š” ๋กœ์ง์€ ๋ณ„๋„์˜ ํ•จ์ˆ˜๋กœ ๋ถ„๋ฆฌํ•˜๋ฉด ๊ตฌ์กฐ๊ฐ€ ๋” ๋ช…ํ™•ํ•ด์ง‘๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด setup_monitoring ๊ฐ™์€ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ˆ˜์ • ์ œ์•ˆ (app/main.py):

    from fastapi import FastAPI
    from app.core.lifespan import lifespan
    from app.api.endpoints import predictions
    from app.core.logging_config import setup_logging
    from prometheus_fastapi_instrumentator import Instrumentator
    
    def setup_monitoring(app: FastAPI):
        """Sets up the Prometheus instrumentator."""
        instrumentator = Instrumentator().instrument(app)
        instrumentator.expose(app, include_in_schema=False, endpoint="/actuator/prometheus")
    
    setup_logging()
    app = FastAPI(
        title="My App",
        description="FastAPI App",
        version="1.0.0",
        lifespan=lifespan
    )
    
    setup_monitoring(app)
    app.include_router(predictions.router, prefix="/api/v1", tags=["Prediction"])
    
    @app.get("/health")
    # ...

์ „๋ฐ˜์ ์œผ๋กœ ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ์„ ๋„์ž…ํ•˜์—ฌ ์‹œ์Šคํ…œ์˜ ์•ˆ์ •์„ฑ๊ณผ ๊ด€์ธก ๊ฐ€๋Šฅ์„ฑ์„ ํฌ๊ฒŒ ๋†’์ด๋Š” ์ค‘์š”ํ•œ PR์ด๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๋ช‡ ๊ฐ€์ง€ ์ œ์•ˆ ์‚ฌํ•ญ์„ ๋ฐ˜์˜ํ•˜๋ฉด ๋” ๊ฒฌ๊ณ ํ•˜๊ณ  ์œ ์ง€๋ณด์ˆ˜ํ•˜๊ธฐ ์ข‹์€ ๊ตฌ์กฐ๊ฐ€ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค! ๐Ÿ‘

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

์ด PR์€ Prometheus์™€ Grafana๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋‹ˆํ„ฐ๋ง ํ™˜๊ฒฝ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ๋ชฉํ‘œ๋กœ ํ•ฉ๋‹ˆ๋‹ค. FastAPI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋ฉ”ํŠธ๋ฆญ ์—”๋“œํฌ์ธํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ , ๋ชจ๋‹ˆํ„ฐ๋ง ์Šคํƒ์„ ์œ„ํ•œ Docker Compose ์„ค์ • ๋ฐ Prometheus ์„ค์ • ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ „๋ฐ˜์ ์œผ๋กœ ์ข‹์€ ๋ฐฉํ–ฅ์ด์ง€๋งŒ, Docker ๋„คํŠธ์›Œํ‚น ์„ค์ • ์˜ค๋ฅ˜๋กœ ์ธํ•ด ๋ชจ๋‹ˆํ„ฐ๋ง์ด ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, Docker ์ด๋ฏธ์ง€ ํƒœ๊ทธ์™€ ๋ณผ๋ฅจ ์„ค์ •์— ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์— ์ž์„ธํ•œ ๋ฆฌ๋ทฐ ์˜๊ฒฌ์„ ๋‚จ๊ฒผ์Šต๋‹ˆ๋‹ค.

Comment thread deployment/prometheus.yml
Comment on lines +25 to +34
- job_name: 'fastapi-actuator-blue'
metrics_path: '/actuator/prometheus'
scrape_interval: 1m
static_configs:
- targets: [ 'app-blue:8000' ]
- job_name: 'fastapi-actuator-green'
metrics_path: '/actuator/prometheus'
scrape_interval: 1m
static_configs:
- targets: [ 'app-green:8001' ] No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

fastapi-actuator-blue์™€ fastapi-actuator-green job์ด app-blue:8000, app-green:8001์„ ํƒ€๊ฒŸ์œผ๋กœ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ docker-compose.monitoring.yml๊ณผ docker-compose.yml์ด ๋ณ„๋„์˜ ํŒŒ์ผ๋กœ ๊ด€๋ฆฌ๋˜๊ณ  ์žˆ์–ด, Prometheus ์ปจํ…Œ์ด๋„ˆ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ปจํ…Œ์ด๋„ˆ๋“ค์ด ์„œ๋กœ ๋‹ค๋ฅธ Docker ๋„คํŠธ์›Œํฌ์— ์†ํ•˜๊ฒŒ ๋  ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์Šต๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ Prometheus๊ฐ€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ฉ”ํŠธ๋ฆญ์„ ์ˆ˜์ง‘ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋™์ผํ•œ Docker ๋„คํŠธ์›Œํฌ์— ์žˆ๋„๋ก docker-compose.yml๊ณผ docker-compose.monitoring.yml์˜ ๋„คํŠธ์›Œํฌ ์„ค์ •์„ ๋งž์ถฐ์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ๊ณตํ†ต ์™ธ๋ถ€ ๋„คํŠธ์›Œํฌ(external network)๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

services:
prometheus:
user: ${PROMETHEUS_USER}
image: prom/prometheus:latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

prom/prometheus:latest์™€ ๊ฐ™์ด :latest ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„œ ์˜ˆ๊ธฐ์น˜ ์•Š์€ ๋ฒ„์ „ ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•œ ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•ˆ์ •์ ์ธ ์šด์˜์„ ์œ„ํ•ด ํŠน์ • ๋ฒ„์ „(์˜ˆ: v2.51.2)์„ ๋ช…์‹œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

    image: prom/prometheus:v2.51.2


grafana:
user: ${GRAFANA_USER}
image: grafana/grafana:latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

grafana/grafana:latest์™€ ๊ฐ™์ด :latest ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„œ ์˜ˆ๊ธฐ์น˜ ์•Š์€ ๋ฒ„์ „ ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•œ ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•ˆ์ •์ ์ธ ์šด์˜์„ ์œ„ํ•ด ํŠน์ • ๋ฒ„์ „(์˜ˆ: 11.0.0)์„ ๋ช…์‹œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

    image: grafana/grafana:11.0.0

Comment thread deployment/prometheus.yml
Comment on lines +22 to +24
- job_name: 'node'
static_configs:
- targets: ['${REMOTE_HOST}:9090']

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

node job์˜ targets๊ฐ€ Prometheus ์ž์‹ ์„ ๊ฐ€๋ฆฌํ‚ค๋Š” '${REMOTE_HOST}:9090'์œผ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. node๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๋ณด์•„ Node Exporter ๋ฉ”ํŠธ๋ฆญ์„ ์ˆ˜์ง‘ํ•˜๋ ค๋Š” ์˜๋„๋กœ ๋ณด์ด์ง€๋งŒ, ํฌํŠธ๊ฐ€ ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค. Node Exporter๋Š” ๋ณดํ†ต 9100 ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ Node Exporter๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์ด job์€ ๋ถˆํ•„์š”ํ•˜๊ฒŒ Prometheus ๋ฉ”ํŠธ๋ฆญ์„ ์ค‘๋ณต ์ˆ˜์ง‘ํ•˜๋ฏ€๋กœ ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

  - job_name: 'node'
    static_configs:
      - targets: ['${REMOTE_HOST}:9100']

Comment on lines +7 to +8
- /home/ubuntu/dearbelly/deployment/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- /home/ubuntu/prometheus/volume:/prometheus/data

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Prometheus ๋ณผ๋ฅจ ๊ฒฝ๋กœ๊ฐ€ /home/ubuntu/...์™€ ๊ฐ™์ด ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋กœ ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์–ด ๋‹ค๋ฅธ ํ™˜๊ฒฝ์—์„œ์˜ ์žฌ์‚ฌ์šฉ์„ฑ ๋ฐ ์ด์‹์„ฑ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. ์„ค์ • ํŒŒ์ผ์€ ์ƒ๋Œ€ ๊ฒฝ๋กœ (./prometheus.yml)๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ๋ฐ์ดํ„ฐ ๋ณผ๋ฅจ์€ Docker์˜ named volume์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ผ ํ•˜๋‹จ์— volumes ์„น์…˜์„ ์ถ”๊ฐ€ํ•˜์—ฌ prometheus-data named volume์„ ์ •์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus-data:/prometheus/data

ports:
- 3000:3000
volumes:
- /home/ubuntu/grafana/volume:/var/lib/grafana

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Grafana ๋ฐ์ดํ„ฐ ๋ณผ๋ฅจ ๊ฒฝ๋กœ๊ฐ€ /home/ubuntu/grafana/volume์™€ ๊ฐ™์ด ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋กœ ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์–ด ์ด์‹์„ฑ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. Docker์˜ named volume์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ผ ํ•˜๋‹จ์— volumes ์„น์…˜์„ ์ถ”๊ฐ€ํ•˜์—ฌ grafana-data named volume์„ ์ •์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

      - grafana-data:/var/lib/grafana

@youyeon11
youyeon11 merged commit 797f3b9 into main Oct 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant