-
pinpoint 설치하기카테고리 없음 2023. 11. 12. 17:23
오픈소스 APM 중 하나인 pinpoint를 docker compose를 통해 설치하는 과정을 정리.
GCP VM 두개을 활용하여 Agent 서버와 Collector 서버로 구분
- Pinpoint Collector, Pinpoint Web etc..
- Web Application(Java Application)과 Pinpoint Agent
1. Collector Server
docker-compose.yml 파일 내 pinpoint-agent와 pinpoint-quickstart 두 가지를 제거하고 docker compose 실행
git clone https://github.com/pinpoint-apm/pinpoint-docker.git cd pinpoint-docker //docker-compose.yml에서 pinpoint-agent, pinpoint-quickstart 제거 docker compose up -d
docker-compose.yml에서 삭제할 부분
더보기# docker-compose.yml pinpoint-agent: build: context: ./pinpoint-agent/ dockerfile: Dockerfile args: - PINPOINT_VERSION=${PINPOINT_VERSION} container_name: "${PINPOINT_AGENT_NAME}" image: "pinpointdocker/pinpoint-agent:${PINPOINT_VERSION}" restart: unless-stopped networks: - pinpoint volumes: - data-volume:/pinpoint-agent environment: - SPRING_PROFILES=${SPRING_PROFILES} .... depends_on: - pinpoint-collector ... pinpoint-quickstart: build: context: ./pinpoint-quickstart/ dockerfile: Dockerfile container_name: "pinpoint-quickstart" image: "pinpointdocker/pinpoint-quickstart" ports: - "${APP_PORT:-8085}:8080" volumes: - data-volume:/pinpoint-agent environment: JAVA_OPTS: "-javaagent:/pinpoint-agent/pinpoint-bootstrap-${PINPOINT_VERSION}.jar -Dpinpoint.agentId=${AGENT_ID} -Dpinpoint.applicationName=${APP_NAME} -Dpinpoint.profiler.profiles.active=${SPRING_PROFILES}" networks: - pinpoint depends_on: - pinpoint-agent
2. Agent Server
docker compose에서 환경변수를 정의하는 파일인 .env를 다음과 같이 수정
환경변수 명 설명 SPRING_PROFILES Pinpoint 환경 구분, Debug Level이나 Sampling 등을 개별적으로 관리할 수 있다. COLLECTOR_IP Pinpoint Collector Server IP AGENT_ID Web Application의 고유한 이름 APP_NAME Web Application이 Pinpoint Web에서 보여지는 이름 .env
더보기# .env PINPOINT_VERSION=2.5.2 SPRING_PROFILES=release #pinpoint profile local|release ### Pinpoint-Agent PINPOINT_AGENT_NAME=pinpoint-agent COLLECTOR_IP=34.64.XXX.XX # Collector Server IP PROFILER_TRANSPORT_AGENT_COLLECTOR_PORT=9991 PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT=9991 PROFILER_TRANSPORT_STAT_COLLECTOR_PORT=9992 PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=9993 COLLECTOR_TCP_PORT=9994 COLLECTOR_STAT_PORT=9995 COLLECTOR_SPAN_PORT=9996 # Sampling Configurations PROFILER_SAMPLING_TYPE=COUNTING PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=1 PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=100 PROFILER_SAMPLING_NEW_THROUGHPUT=0 PROFILER_SAMPLING_CONTINUE_THROUGHPUT=0 AGENT_ID=board # Application Unique ID APP_NAME=board # Application Name For View AGENT_DEBUG_LEVEL=INFO ### Board APP_PORT=8081
docker-compose.yml 에서는 Web Application과 Pinpoint-Agent를 service로 선언
docker volume을 Application과 Agent가 공유하는 구조
docker-compose.yml
더보기# docker-compose.yml services: board: container_name: "board" image: "ghcr.io/sukkyun2/sbb" restart: always ports: - "${APP_PORT:-8081}:8080" volumes: - data-volume:/pinpoint-agent environment: JAVA_OPTS: "-javaagent:/pinpoint-agent/pinpoint-bootstrap-${PINPOINT_VERSION}.jar -Dpinpoint.agentId=${AGENT_ID} -Dpinpoint.applicationName=${APP_NAME} -Dpinpoint.profiler.profiles.active=${SPRING_PROFILES}" networks: - pinpoint depends_on: - pinpoint-agent pinpoint-agent: container_name: "${PINPOINT_AGENT_NAME}" image: "pinpointdocker/pinpoint-agent:${PINPOINT_VERSION}" restart: unless-stopped networks: - pinpoint volumes: - data-volume:/pinpoint-agent environment: - COLLECTOR_IP=${COLLECTOR_IP} - COLLECTOR_TCP_PORT=${COLLECTOR_TCP_PORT} - COLLECTOR_STAT_PORT=${COLLECTOR_STAT_PORT} - COLLECTOR_SPAN_PORT=${COLLECTOR_SPAN_PORT} - PROFILER_SAMPLING_TYPE=${PROFILER_SAMPLING_TYPE} - PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=${PROFILER_SAMPLING_COUNTING_SAMPLING_RATE} - PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=${PROFILER_SAMPLING_PERCENT_SAMPLING_RATE} - PROFILER_SAMPLING_NEW_THROUGHPUT=${PROFILER_SAMPLING_NEW_THROUGHPUT} - PROFILER_SAMPLING_CONTINUE_THROUGHPUT=${PROFILER_SAMPLING_CONTINUE_THROUGHPUT} - DEBUG_LEVEL=${AGENT_DEBUG_LEVEL} volumes: data-volume: networks: pinpoint: driver: bridge
# 방화벽 설정
- Agent Servcer에서 Collector Server로 로그 전송
- 외부에서 Pinpoint Web을 접속
두 가지 측면에서 방화벽을 설정해줘야 한다.
Collector Server의 Inbound Port 설정을 8080, 9991 ~ 9996까지 열어주면 설정 완료!