Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions docker/prod/api/docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
GOOGLE_CLIENT_SECRET_PROD: ${GOOGLE_CLIENT_SECRET_PROD}
WIDGET_SECRET_KEY_PROD: ${WIDGET_SECRET_KEY_PROD}
networks:
- prod-kokomen-net
- api-net

nginx:
image: nginx:1.28.0
Expand All @@ -40,7 +40,7 @@ services:
environment:
TZ: Asia/Seoul
networks:
- prod-kokomen-net
- api-net

node:
image: prom/node-exporter
Expand All @@ -56,19 +56,7 @@ services:
environment:
TZ: Asia/Seoul
networks:
- prod-kokomen-net

kokomen-redis:
image: valkey/valkey:8.0.1
container_name: kokomen-redis
ports:
- 6379:6379
volumes:
- kokomen-redis-data:/data
environment:
TZ: Asia/Seoul
networks:
- prod-kokomen-net
- api-net

promtail:
image: grafana/promtail
Expand All @@ -85,13 +73,11 @@ services:
TZ: Asia/Seoul
HOSTNAME: ${HOSTNAME}
networks:
- prod-kokomen-net
- api-net

volumes:
promtail-tmp:
kokomen-redis-data:

networks:
prod-kokomen-net:
external: true
api-net:
driver: bridge
2 changes: 1 addition & 1 deletion docker/prod/api/promtail/promtail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ positions:
filename: /tmp/positions.yaml

clients:
- url: http://loki:3100/loki/api/v1/push
- url: http://10.0.1.196:3100/loki/api/v1/push
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

Loki 서버의 주소를 하드코딩된 IP(10.0.1.196)로 변경하셨습니다. 이는 인프라 환경 변화에 취약하며 유지보수성을 떨어뜨립니다. docker-compose-prod.yml에서 promtail 서비스에 -config.expand-env=true 옵션이 활성화되어 있으므로, 환경 변수를 사용하여 주소를 관리하는 것을 권장합니다.

  - url: http://${LOKI_HOST}:3100/loki/api/v1/push

Comment on lines 7 to +8
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

하드코딩된 IP 주소는 유지보수에 취약합니다.

Loki 서버의 IP가 변경되면 이 설정 파일을 수동으로 업데이트해야 합니다. 환경 변수를 사용하면 인프라 변경 시 더 유연하게 대응할 수 있습니다.

♻️ 환경 변수 사용 제안
 clients:
-  - url: http://10.0.1.196:3100/loki/api/v1/push
+  - url: http://${LOKI_HOST}:3100/loki/api/v1/push

docker-compose-prod.yml의 promtail 서비스에 환경 변수 추가:

environment:
  TZ: Asia/Seoul
  HOSTNAME: ${HOSTNAME}
  LOKI_HOST: ${LOKI_HOST}  # 또는 직접 IP 지정
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker/prod/api/promtail/promtail.yaml` around lines 7 - 8, The clients URL
is hardcoded to http://10.0.1.196:3100/loki/api/v1/push; change it to use an
environment variable (e.g., LOKI_HOST) so the Loki host/IP is not baked into
promtail.yaml. Update the promtail.yaml clients entry to build the URL from the
env var (e.g., use ${LOKI_HOST} with the same port and path) and ensure the
docker-compose-prod.yml promtail service defines the LOKI_HOST env var (or
passes it through) so the container can resolve the target dynamically.


scrape_configs:
- job_name: kokomen-app-prod
Expand Down
Loading