[#74] docker for applying spring boot to pinpoint-collector

This commit is contained in:
Roy Kim 2020-08-26 09:59:03 +09:00 committed by Roy Kim
parent 6bd53dcd9d
commit e9e8d7bb1a
7 changed files with 57 additions and 70 deletions

21
.env
View File

@ -59,17 +59,18 @@ ALARM_MAIL_DEBUG=false
### Pinpoint-Collector ### Pinpoint-Collector
CLUSTER_ZOOKEEPER_ADDRESS=pinpoint-hbase
HBASE_HOST=pinpoint-hbase
HBASE_PORT=2181
PINPOINT_COLLECTOR_NAME=pinpoint-collector PINPOINT_COLLECTOR_NAME=pinpoint-collector
COLLECTOR_RECEIVER_AGENT_PORT=9991 CLUSTER_ENABLE=true
COLLECTOR_RECEIVER_METADATA_PORT=9991
COLLECTOR_RECEIVER_STAT_PORT=9992 COLLECTOR_LOGGING_LEVEL_ROOT=INFO
COLLECTOR_RECEIVER_SPAN_PORT=9993
#grpc
COLLECTOR_RECEIVER_GRPC_AGENT_PORT=9991
COLLECTOR_RECEIVER_GRPC_STAT_PORT=9992
COLLECTOR_RECEIVER_GRPC_SPAN_PORT=9993
#thrift
COLLECTOR_RECEIVER_BASE_PORT=9994 COLLECTOR_RECEIVER_BASE_PORT=9994
COLLECTOR_RECEIVER_STAT_UDP_PORT=9995 COLLECTOR_RECEIVER_STAT_UDP_PORT=9995
COLLECTOR_RECEIVER_SPAN_UDP_PORT=9996 COLLECTOR_RECEIVER_SPAN_UDP_PORT=9996
@ -77,8 +78,6 @@ COLLECTOR_RECEIVER_SPAN_UDP_PORT=9996
FLINK_CLUSTER_ENABLE=true FLINK_CLUSTER_ENABLE=true
FLINK_CLUSTER_ZOOKEEPER_ADDRESS=pinpoint-hbase FLINK_CLUSTER_ZOOKEEPER_ADDRESS=pinpoint-hbase
COLLECTOR_DEBUG_LEVEL=INFO
### Pinpoint-Agent ### Pinpoint-Agent

View File

@ -133,10 +133,9 @@ services:
- "9995" - "9995"
- "9996" - "9996"
ports: ports:
- "${COLLECTOR_RECEIVER_AGENT_PORT:-9991}:9991/udp" - "${COLLECTOR_RECEIVER_GRPC_AGENT_PORT:-9991}:9991/tcp"
- "${COLLECTOR_RECEIVER_METADATA_PORT:-9991}:9991/tcp" - "${COLLECTOR_RECEIVER_GRPC_STAT_PORT:-9992}:9992/tcp"
- "${COLLECTOR_RECEIVER_STAT_PORT:-9992}:9992/tcp" - "${COLLECTOR_RECEIVER_GRPC_SPAN_PORT:-9993}:9993/tcp"
- "${COLLECTOR_RECEIVER_SPAN_PORT:-9993}:9993/tcp"
- "${COLLECTOR_RECEIVER_BASE_PORT:-9994}:9994" - "${COLLECTOR_RECEIVER_BASE_PORT:-9994}:9994"
- "${COLLECTOR_RECEIVER_STAT_UDP_PORT:-9995}:9995/tcp" - "${COLLECTOR_RECEIVER_STAT_UDP_PORT:-9995}:9995/tcp"
- "${COLLECTOR_RECEIVER_SPAN_UDP_PORT:-9996}:9996/tcp" - "${COLLECTOR_RECEIVER_SPAN_UDP_PORT:-9996}:9996/tcp"
@ -148,13 +147,11 @@ services:
environment: environment:
- JAVA_OPTS="-Dspring.profiles.active=${SPRING_PROFILES}" - JAVA_OPTS="-Dspring.profiles.active=${SPRING_PROFILES}"
- SPRING_PROFILES=${SPRING_PROFILES} - SPRING_PROFILES=${SPRING_PROFILES}
- PINPOINT_ZOOKEEPER_ADDRESS=${PINPOINT_ZOOKEEPER_ADDRESS}
- CLUSTER_ENABLE=${CLUSTER_ENABLE} - CLUSTER_ENABLE=${CLUSTER_ENABLE}
- CLUSTER_ZOOKEEPER_ADDRESS=${CLUSTER_ZOOKEEPER_ADDRESS} - LOGGING_LEVEL_ROOT=${COLLECTOR_LOGGING_LEVEL_ROOT}
- HBASE_HOST=${HBASE_HOST}
- HBASE_PORT=${HBASE_PORT}
- FLINK_CLUSTER_ENABLE=${FLINK_CLUSTER_ENABLE} - FLINK_CLUSTER_ENABLE=${FLINK_CLUSTER_ENABLE}
- FLINK_CLUSTER_ZOOKEEPER_ADDRESS=${FLINK_CLUSTER_ZOOKEEPER_ADDRESS} - FLINK_CLUSTER_ZOOKEEPER_ADDRESS=${FLINK_CLUSTER_ZOOKEEPER_ADDRESS}
- DEBUG_LEVEL=${COLLECTOR_DEBUG_LEVEL}
pinpoint-quickstart: pinpoint-quickstart:
build: build:

View File

@ -3,26 +3,26 @@ SPRING_PROFILES=release
### Pinpoint-Collector ### Pinpoint-Collector
CLUSTER_ENABLE=true
#zookeeper information required
CLUSTER_ZOOKEEPER_ADDRESS=
#hbase information required
HBASE_HOST=
HBASE_PORT=
PINPOINT_COLLECTOR_NAME=pinpoint-collector PINPOINT_COLLECTOR_NAME=pinpoint-collector
COLLECTOR_RECEIVER_AGENT_PORT=9991 #zookeeper information required
COLLECTOR_RECEIVER_METADATA_PORT=9991 PINPOINT_ZOOKEEPER_ADDRESS=
COLLECTOR_RECEIVER_STAT_PORT=9992
COLLECTOR_RECEIVER_SPAN_PORT=9993 CLUSTER_ENABLE=true
COLLECTOR_LOGGING_LEVEL_ROOT=INFO
#grpc
COLLECTOR_RECEIVER_GRPC_AGENT_PORT=9991
COLLECTOR_RECEIVER_GRPC_STAT_PORT=9992
COLLECTOR_RECEIVER_GRPC_SPAN_PORT=9993
#thrift
COLLECTOR_RECEIVER_BASE_PORT=9994 COLLECTOR_RECEIVER_BASE_PORT=9994
COLLECTOR_RECEIVER_STAT_UDP_PORT=9995 COLLECTOR_RECEIVER_STAT_UDP_PORT=9995
COLLECTOR_RECEIVER_SPAN_UDP_PORT=9996 COLLECTOR_RECEIVER_SPAN_UDP_PORT=9996
FLINK_CLUSTER_ENABLE=true FLINK_CLUSTER_ENABLE=true
FLINK_CLUSTER_ZOOKEEPER_ADDRESS=zoo1 FLINK_CLUSTER_ZOOKEEPER_ADDRESS=
COLLECTOR_DEBUG_LEVEL=INFO

View File

@ -1,23 +1,22 @@
FROM tomcat:8-jre8 FROM openjdk:8-jdk-alpine
LABEL maintainer="Roy Kim <roy.kim@navercorp.com>" LABEL maintainer="Roy Kim <roy.kim@navercorp.com>"
ARG PINPOINT_VERSION=${PINPOINT_VERSION:-2.0.4} ARG PINPOINT_VERSION=${PINPOINT_VERSION:-2.0.4}
ARG INSTALL_URL=https://github.com/naver/pinpoint/releases/download/v${PINPOINT_VERSION}/pinpoint-collector-${PINPOINT_VERSION}.war ARG INSTALL_URL=https://github.com/naver/pinpoint/releases/download/v${PINPOINT_VERSION}/pinpoint-collector-boot-${PINPOINT_VERSION}.war
COPY /build/scripts/start-collector.sh /usr/local/bin/ RUN mkdir -p /pinpoint/config \
&& mkdir -p /pinpoint/scripts
RUN chmod a+x /usr/local/bin/start-collector.sh \ COPY /build/config/pinpoint-collector.properties /pinpoint/config/
&& curl -SL ${INSTALL_URL} -o pinpoint-collector.war \ COPY /build/scripts/start-collector.sh /pinpoint/scripts/
&& rm -rf /usr/local/tomcat/webapps \ #temporary line for local test
&& mkdir -p /usr/local/tomcat/webapps \ #COPY /pinpoint-collector-boot-2.1.0-SNAPSHOT.jar /pinpoint/pinpoint-collector-boot.jar
&& unzip pinpoint-collector.war -d /usr/local/tomcat/webapps/ROOT \
&& rm -rf pinpoint-collector.war \
&& sed -i "s/8005/9005/g" /usr/local/tomcat/conf/server.xml \
&& sed -i "s/8080/9080/g" /usr/local/tomcat/conf/server.xml \
&& sed -i "s/8009/9009/g" /usr/local/tomcat/conf/server.xml \
&& sed -i "s/8443/9443/g" /usr/local/tomcat/conf/server.xml
ENTRYPOINT ["/usr/local/bin/start-collector.sh"] RUN chmod a+x /pinpoint/scripts/start-collector.sh \
&& chmod a+x /pinpoint/config/pinpoint-collector.properties \
&& curl -SL ${INSTALL_URL} -o /pinpoint/pinpoint-collector-boot.jar
ENTRYPOINT ["sh", "/pinpoint/scripts/start-collector.sh"]

View File

@ -0,0 +1,8 @@
##########
# another way of setting properties.
# applied priority '.ENV' -> 'pinpoint-collector.properties'
# property should be commented in docker-compose file to use
# ex) PINPOINT_ZOOKEEPER_ADDRESS should be commented in docker-compose to use pinpoint.zookeeper.address below
##########
#
# pinpoint.zookeeper.address=

View File

@ -2,14 +2,4 @@
set -e set -e
set -x set -x
sed -i "/cluster.enable=/ s/=.*/=${CLUSTER_ENABLE}/" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/pinpoint-collector.properties exec java -jar /pinpoint/pinpoint-collector-boot.jar --spring.config.additional-location=/pinpoint/config/pinpoint-web.properties
sed -i "/cluster.zookeeper.address=/ s/=.*/=${CLUSTER_ZOOKEEPER_ADDRESS}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/pinpoint-collector.properties
sed -i "/flink.cluster.enable=/ s/=.*/=${FLINK_CLUSTER_ENABLE}/" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/pinpoint-collector.properties
sed -i "/flink.cluster.zookeeper.address=/ s/=.*/=${FLINK_CLUSTER_ZOOKEEPER_ADDRESS}/" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/pinpoint-collector.properties
sed -i "/hbase.client.host=/ s/=.*/=${HBASE_HOST}/" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/profiles/${SPRING_PROFILES}/hbase-env.properties
sed -i "/hbase.client.port=/ s/=.*/=${HBASE_PORT}/" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/profiles/${SPRING_PROFILES}/hbase-env.properties
sed -i "/level value=/ s/=.*/=\"${DEBUG_LEVEL}\"\/>/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/profiles/${SPRING_PROFILES}/log4j.xml
exec /usr/local/tomcat/bin/catalina.sh run

View File

@ -20,10 +20,9 @@ services:
- "9995" - "9995"
- "9996" - "9996"
ports: ports:
- "${COLLECTOR_RECEIVER_AGENT_PORT:-9991}:9991/udp" - "${COLLECTOR_RECEIVER_GRPC_AGENT_PORT:-9991}:9991/tcp"
- "${COLLECTOR_RECEIVER_METADATA_PORT:-9991}:9991/tcp" - "${COLLECTOR_RECEIVER_GRPC_STAT_PORT:-9992}:9992/tcp"
- "${COLLECTOR_RECEIVER_STAT_PORT:-9992}:9992/tcp" - "${COLLECTOR_RECEIVER_GRPC_SPAN_PORT:-9993}:9993/tcp"
- "${COLLECTOR_RECEIVER_SPAN_PORT:-9993}:9993/tcp"
- "${COLLECTOR_RECEIVER_BASE_PORT:-9994}:9994" - "${COLLECTOR_RECEIVER_BASE_PORT:-9994}:9994"
- "${COLLECTOR_RECEIVER_STAT_UDP_PORT:-9995}:9995/tcp" - "${COLLECTOR_RECEIVER_STAT_UDP_PORT:-9995}:9995/tcp"
- "${COLLECTOR_RECEIVER_SPAN_UDP_PORT:-9996}:9996/tcp" - "${COLLECTOR_RECEIVER_SPAN_UDP_PORT:-9996}:9996/tcp"
@ -31,15 +30,10 @@ services:
- "${COLLECTOR_RECEIVER_SPAN_UDP_PORT:-9996}:9996/udp" - "${COLLECTOR_RECEIVER_SPAN_UDP_PORT:-9996}:9996/udp"
environment: environment:
- JAVA_OPTS="-Dspring.profiles.active=${SPRING_PROFILES}"
- SPRING_PROFILES=${SPRING_PROFILES} - SPRING_PROFILES=${SPRING_PROFILES}
- PINPOINT_ZOOKEEPER_ADDRESS=${PINPOINT_ZOOKEEPER_ADDRESS}
- CLUSTER_ENABLE=${CLUSTER_ENABLE} - CLUSTER_ENABLE=${CLUSTER_ENABLE}
- CLUSTER_ZOOKEEPER_ADDRESS=${CLUSTER_ZOOKEEPER_ADDRESS} - LOGGING_LEVEL_ROOT=${COLLECTOR_LOGGING_LEVEL_ROOT}
- HBASE_HOST=${HBASE_HOST}
- HBASE_PORT=${HBASE_PORT}
- FLINK_CLUSTER_ENABLE=${FLINK_CLUSTER_ENABLE} - FLINK_CLUSTER_ENABLE=${FLINK_CLUSTER_ENABLE}
- FLINK_CLUSTER_ZOOKEEPER_ADDRESS=${FLINK_CLUSTER_ZOOKEEPER_ADDRESS} - FLINK_CLUSTER_ZOOKEEPER_ADDRESS=${FLINK_CLUSTER_ZOOKEEPER_ADDRESS}
- DEBUG_LEVEL=${COLLECTOR_DEBUG_LEVEL}
networks:
pinpoint:
driver: bridge