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

This commit is contained in:
Roy Kim 2020-08-26 08:51:56 +09:00 committed by Roy Kim
parent d835497b06
commit 6bd53dcd9d
7 changed files with 110 additions and 138 deletions

54
.env
View File

@ -1,11 +1,13 @@
PINPOINT_VERSION=2.0.4
SPRING_PROFILES=release
#zookeeper information required
PINPOINT_ZOOKEEPER_ADDRESS=pinpoint-hbase
### Pinpoint-Hbase
PINPOINT_HBASE_NAME=pinpoint-hbase
#config for hbase in external docker
EXTERNAL_HBASE_PORT=2180
EXTERNAL_HBASE_PORT=2181
### Pinpoint-mysql
MYSQL_ROOT_PASSWORD=root123
@ -17,49 +19,51 @@ MYSQL_DATABASE=pinpoint
PINPOINT_WEB_NAME=pinpoint-web
WEB_PAGE_PORT=8079
SERVER_PORT=8079
WEB_LOGGING_LEVEL_ROOT=INFO
CLUSTER_ENABLE=true
#CLUSTER_WEB_TCP_PORT=9997
CLUSTER_ZOOKEEPER_ADDRESS=zoo1
ADMIN_PASSWORD=admin
ANALYTICS=true
HBASE_HOST=pinpoint-hbase
HBASE_PORT=2181
WEB_DEBUG_LEVEL=INFO
#analytics
CONFIG_SENDUSAGE=true
#flink server information required if used
BATCH_ENABLE=false
BATCH_SERVER_IP=127.0.0.1
BATCH_FLINK_SERVER=pinpoint-flink-jobmanager
CONFIG_SHOW_APPLICATIONSTAT=true
#mysql information required
JDBC_DRIVER=com.mysql.jdbc.Driver
#mysql information required if used
JDBC_DRIVERCLASSNAME=com.mysql.jdbc.Driver
JDBC_URL=jdbc:mysql://pinpoint-mysql:3306/pinpoint?characterEncoding=UTF-8
JDBC_USERNAME=admin
JDBC_PASSWORD=admin
#mail server information required
MAIL_SERVER_URL=smtp.gmail.com
MAIL_SERVER_PORT=587
MAIL_SERVER_USERNAME=username
MAIL_SERVER_PASSWORD=password
MAIL_SENDER_ADDRESS=pinpoint_operator@pinpoint.com
MAIL_TRANSPORT_PROTOCOL=smtp
MAIL_SMTP_PORT=25
MAIL_SMTP_AUTH=false
MAIL_SMTP_STARTTLS_ENABLE=false
MAIL_SMTP_STARTTLS_REQUIRED=false
MAIL_DEBUG=false
#mail server information required if used
ALARM_MAIL_SERVER_URL=smtp.gmail.com
ALARM_MAIL_SERVER_PORT=587
ALARM_MAIL_SERVER_USERNAME=username
ALARM_MAIL_SERVER_PASSWORD=password
ALARM_MAIL_SENDER_ADDRESS=pinpoint_operator@pinpoint.com
ALARM_MAIL_TRANSPORT_PROTOCOL=smtp
ALARM_MAIL_SMTP_PORT=25
ALARM_MAIL_SMTP_AUTH=false
ALARM_MAIL_SMTP_STARTTLS_ENABLE=false
ALARM_MAIL_SMTP_STARTTLS_REQUIRED=false
ALARM_MAIL_DEBUG=false
### Pinpoint-Collector
CLUSTER_ZOOKEEPER_ADDRESS=pinpoint-hbase
HBASE_HOST=pinpoint-hbase
HBASE_PORT=2181
PINPOINT_COLLECTOR_NAME=pinpoint-collector
COLLECTOR_RECEIVER_AGENT_PORT=9991
@ -71,7 +75,7 @@ COLLECTOR_RECEIVER_STAT_UDP_PORT=9995
COLLECTOR_RECEIVER_SPAN_UDP_PORT=9996
FLINK_CLUSTER_ENABLE=true
FLINK_CLUSTER_ZOOKEEPER_ADDRESS=zoo1
FLINK_CLUSTER_ZOOKEEPER_ADDRESS=pinpoint-hbase
COLLECTOR_DEBUG_LEVEL=INFO

View File

@ -74,40 +74,39 @@ services:
- pinpoint-mysql
restart: always
expose:
- "8080"
- "${SERVER_PORT:-8080}"
- "9997"
ports:
- "9997:9997"
- "${WEB_PAGE_PORT:-8080}:8080"
- "${SERVER_PORT:-8080}:${SERVER_PORT:-8080}"
environment:
- JAVA_OPTS="-Dspring.profiles.active=${SPRING_PROFILES},batch"
- SERVER_PORT=${SERVER_PORT}
- SPRING_PROFILES=${SPRING_PROFILES}
- PINPOINT_ZOOKEEPER_ADDRESS=${PINPOINT_ZOOKEEPER_ADDRESS}
- CLUSTER_ENABLE=${CLUSTER_ENABLE}
- CLUSTER_ZOOKEEPER_ADDRESS=${CLUSTER_ZOOKEEPER_ADDRESS}
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
- ANALYTICS=${ANALYTICS}
- HBASE_HOST=${HBASE_HOST}
- HBASE_PORT=${HBASE_PORT}
- DEBUG_LEVEL=${WEB_DEBUG_LEVEL}
- CONFIG_SENDUSAGE=${CONFIG_SENDUSAGE}
- LOGGING_LEVEL_ROOT=${WEB_LOGGING_LEVEL_ROOT}
- CONFIG_SHOW_APPLICATIONSTAT=${CONFIG_SHOW_APPLICATIONSTAT}
- BATCH_ENABLE=${BATCH_ENABLE}
- BATCH_SERVER_IP=${BATCH_SERVER_IP}
- BATCH_FLINK_SERVER=${BATCH_FLINK_SERVER}
- JDBC_DRIVER=${JDBC_DRIVER}
- JDBC_DRIVERCLASSNAME=${JDBC_DRIVERCLASSNAME}
- JDBC_URL=${JDBC_URL}
- JDBC_USERNAME=${JDBC_USERNAME}
- JDBC_PASSWORD=${JDBC_PASSWORD}
- MAIL_SERVER_URL=${MAIL_SERVER_URL}
- MAIL_SERVER_PORT=${MAIL_SERVER_PORT}
- MAIL_SERVER_USERNAME=${MAIL_SERVER_USERNAME}
- MAIL_SERVER_PASSWORD=${MAIL_SERVER_PASSWORD}
- MAIL_SENDER_ADDRESS=${MAIL_SENDER_ADDRESS}
- MAIL_TRANSPORT_PROTOCOL=${MAIL_TRANSPORT_PROTOCOL}
- MAIL_SMTP_PORT=${MAIL_SMTP_PORT}
- MAIL_SMTP_AUTH=${MAIL_SMTP_AUTH}
- MAIL_SMTP_STARTTLS_ENABLE=${MAIL_SMTP_STARTTLS_ENABLE}
- MAIL_SMTP_STARTTLS_REQUIRED=${MAIL_SMTP_STARTTLS_REQUIRED}
- MAIL_DEBUG=${MAIL_DEBUG}
- ALARM_MAIL_SERVER_URL=${ALARM_MAIL_SERVER_URL}
- ALARM_MAIL_SERVER_PORT=${ALARM_MAIL_SERVER_PORT}
- ALARM_MAIL_SERVER_USERNAME=${ALARM_MAIL_SERVER_USERNAME}
- ALARM_MAIL_SERVER_PASSWORD=${ALARM_MAIL_SERVER_PASSWORD}
- ALARM_MAIL_SENDER_ADDRESS=${ALARM_MAIL_SENDER_ADDRESS}
- ALARM_MAIL_TRANSPORT_PROTOCOL=${ALARM_MAIL_TRANSPORT_PROTOCOL}
- ALARM_MAIL_SMTP_PORT=${ALARM_MAIL_SMTP_PORT}
- ALARM_MAIL_SMTP_AUTH=${ALARM_MAIL_SMTP_AUTH}
- ALARM_MAIL_SMTP_STARTTLS_ENABLE=${ALARM_MAIL_SMTP_STARTTLS_ENABLE}
- ALARM_MAIL_SMTP_STARTTLS_REQUIRED=${ALARM_MAIL_SMTP_STARTTLS_REQUIRED}
- ALARM_MAIL_DEBUG=${ALARM_MAIL_DEBUG}
links:
- "pinpoint-mysql:pinpoint-mysql"
networks:

View File

@ -5,44 +5,41 @@ SPRING_PROFILES=release
PINPOINT_WEB_NAME=pinpoint-web
WEB_PAGE_PORT=8079
SERVER_PORT=8079
#zookeeper information required
PINPOINT_ZOOKEEPER_ADDRESS=
WEB_LOGGING_LEVEL_ROOT=INFO
CLUSTER_ENABLE=true
#zookeeper information required
CLUSTER_ZOOKEEPER_ADDRESS=
ADMIN_PASSWORD=admin
ANALYTICS=true
#hbase information required
HBASE_HOST=
HBASE_PORT=
WEB_DEBUG_LEVEL=INFO
#analytics
CONFIG_SENDUSAGE=true
#flink server information required if used
BATCH_ENABLE=true
BATCH_ENABLE=false
BATCH_SERVER_IP=127.0.0.1
BATCH_FLINK_SERVER=pinpoint-flink-jobmanager
CONFIG_SHOW_APPLICATIONSTAT=true
#mysql information required
JDBC_DRIVER=com.mysql.jdbc.Driver
#mysql information required if used
JDBC_DRIVERCLASSNAME=com.mysql.jdbc.Driver
JDBC_URL=jdbc:mysql://pinpoint-mysql:3306/pinpoint?characterEncoding=UTF-8
JDBC_USERNAME=admin
JDBC_PASSWORD=admin
#mail server information required
MAIL_SERVER_URL=smtp.gmail.com
MAIL_SERVER_PORT=587
MAIL_SERVER_USERNAME=username
MAIL_SERVER_PASSWORD=password
MAIL_SENDER_ADDRESS=pinpoint_operator@pinpoint.com
MAIL_TRANSPORT_PROTOCOL=smtp
MAIL_SMTP_PORT=25
MAIL_SMTP_AUTH=false
MAIL_SMTP_STARTTLS_ENABLE=false
MAIL_SMTP_STARTTLS_REQUIRED=false
MAIL_DEBUG=false
#mail server information required if used
ALARM_MAIL_SERVER_URL=smtp.gmail.com
ALARM_MAIL_SERVER_PORT=587
ALARM_MAIL_SERVER_USERNAME=username
ALARM_MAIL_SERVER_PASSWORD=password
ALARM_MAIL_SENDER_ADDRESS=pinpoint_operator@pinpoint.com
ALARM_MAIL_TRANSPORT_PROTOCOL=smtp
ALARM_MAIL_SMTP_PORT=25
ALARM_MAIL_SMTP_AUTH=false
ALARM_MAIL_SMTP_STARTTLS_ENABLE=false
ALARM_MAIL_SMTP_STARTTLS_REQUIRED=false
ALARM_MAIL_DEBUG=false

View File

@ -1,17 +1,21 @@
FROM tomcat:8-jre8
FROM openjdk:8-jdk-alpine
LABEL maintainer="Roy Kim <roy.kim@navercorp.com>"
ARG PINPOINT_VERSION=${PINPOINT_VERSION:-2.0.4}
ARG INSTALL_URL=https://github.com/naver/pinpoint/releases/download/v${PINPOINT_VERSION}/pinpoint-web-${PINPOINT_VERSION}.war
ARG INSTALL_URL=https://github.com/naver/pinpoint/releases/download/v${PINPOINT_VERSION}/pinpoint-web-boot-${PINPOINT_VERSION}.jar
COPY /build/scripts/start-web.sh /usr/local/bin/
RUN mkdir -p /pinpoint/config \
&& mkdir -p /pinpoint/scripts
RUN chmod a+x /usr/local/bin/start-web.sh \
&& curl -SL ${INSTALL_URL} -o pinpoint-web.war \
&& rm -rf /usr/local/tomcat/webapps \
&& mkdir -p /usr/local/tomcat/webapps \
&& unzip pinpoint-web.war -d /usr/local/tomcat/webapps/ROOT \
&& rm -rf pinpoint-web.war
COPY /build/config/pinpoint-web.properties /pinpoint/config/
COPY /build/scripts/start-web.sh /pinpoint/scripts/
#temporary line for local test
#COPY /pinpoint-web-boot-2.1.0-SNAPSHOT.jar /pinpoint/pinpoint-web-boot.jar
ENTRYPOINT ["/usr/local/bin/start-web.sh"]
RUN chmod a+x /pinpoint/scripts/start-web.sh \
&& chmod a+x /pinpoint/config/pinpoint-web.properties \
&& curl -SL ${INSTALL_URL} -o /pinpoint/pinpoint-web-boot.jar
#entry point to start-web.sh for future use.
ENTRYPOINT ["sh", "/pinpoint/scripts/start-web.sh"]

View File

@ -0,0 +1,8 @@
##########
# another way of setting properties.
# applied priority '.ENV' -> 'pinpoint-web.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,43 +2,4 @@
set -e
set -x
WEB_INF_CLASSES_DIR=/usr/local/tomcat/webapps/ROOT/WEB-INF/classes
APPLICATION_WEB_PROPERTIES=${WEB_INF_CLASSES_DIR}/pinpoint-web.properties
APPLICATION_HBASE_PROPERTIES=${WEB_INF_CLASSES_DIR}/profiles/${SPRING_PROFILES}/hbase-env.properties
APPLICATION_BATCH_PROPERTIES=${WEB_INF_CLASSES_DIR}/batch.properties
APPLICATION_JDBC_PROPERTIES=${WEB_INF_CLASSES_DIR}/jdbc.properties
sed -i "/cluster.enable=/ s/=.*/=${CLUSTER_ENABLE}/" ${APPLICATION_WEB_PROPERTIES}
#sed -i "/cluster.zookeeper.address=/ s/=.*/=${CLUSTER_ZOOKEEPER_ADDRESS}/g" ${APPLICATION_WEB_PROPERTIES}
#sed -i "/cluster.web.tcp.port=/ s/=.*/=${CLUSTER_WEB_TCP_PORT}/" ${APPLICATION_WEB_PROPERTIES}
sed -i "/admin.password=/ s/=.*/=${ADMIN_PASSWORD}/" ${APPLICATION_WEB_PROPERTIES}
sed -i "/config.sendUsage=/ s/=.*/=${ANALYTICS}/" ${APPLICATION_WEB_PROPERTIES}
sed -i "/config.show.applicationStat=/ s/=.*/=${CONFIG_SHOW_APPLICATIONSTAT}/" ${APPLICATION_WEB_PROPERTIES}
sed -i "/hbase.client.host=/ s/=.*/=${HBASE_HOST}/" ${APPLICATION_HBASE_PROPERTIES}
sed -i "/hbase.client.port=/ s/=.*/=${HBASE_PORT}/" ${APPLICATION_HBASE_PROPERTIES}
sed -i "/batch.enable=/ s/=.*/=${BATCH_ENABLE}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/batch.server.ip=/ s/=.*/=${BATCH_SERVER_IP}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/batch.flink.server=/ s/=.*/=${BATCH_FLINK_SERVER}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/level value=/ s/=.*/=\"${DEBUG_LEVEL}\"\/>/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/profiles/${SPRING_PROFILES}/log4j.xml
sed -i "/jdbc.driverClassName=/ s/=.*/=${JDBC_DRIVER:-com.mysql.jdbc.Driver}/" ${APPLICATION_JDBC_PROPERTIES}
sed -i "/jdbc.url=/ s/=.*/=${JDBC_URL//\//\\/}/" ${APPLICATION_JDBC_PROPERTIES}
sed -i "/jdbc.username=/ s/=.*/=${JDBC_USERNAME:-admin}/" ${APPLICATION_JDBC_PROPERTIES}
sed -i "/jdbc.password=/ s/=.*/=${JDBC_PASSWORD:-admin}/" ${APPLICATION_JDBC_PROPERTIES}
sed -i "/alarm.mail.server.url=/ s/=.*/=${MAIL_SERVER_URL}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.server.port=/ s/=.*/=${MAIL_SERVER_PORT:-587}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.server.username=/ s/=.*/=${MAIL_SERVER_USERNAME}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.server.password=/ s/=.*/=${MAIL_SERVER_PASSWORD}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.sender.address=/ s/=.*/=${MAIL_SENDER_ADDRESS:-pinpoint_operator@pinpoint.com}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.transport.protocol=/ s/=.*/=${MAIL_TRANSPORT_PROTOCOL:-smtp}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.smtp.port=/ s/=.*/=${MAIL_SMTP_PORT:-587}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.smtp.auth=/ s/=.*/=${MAIL_SMTP_AUTH:-false}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.smtp.starttls.enable=/ s/=.*/=${MAIL_SMTP_STARTTLS_ENABLE:-false}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.smtp.starttls.required=/ s/=.*/=${MAIL_SMTP_STARTTLS_REQUIRED:-false}/" ${APPLICATION_BATCH_PROPERTIES}
sed -i "/alarm.mail.debug=/ s/=.*/=${MAIL_DEBUG:-false}/" ${APPLICATION_BATCH_PROPERTIES}
exec /usr/local/tomcat/bin/catalina.sh run
exec java -jar /pinpoint/pinpoint-web-boot.jar --spring.config.additional-location=/pinpoint/config/pinpoint-web.properties

View File

@ -13,37 +13,36 @@ services:
restart: always
expose:
- "8080"
- "${SERVER_PORT:-8080}"
- "9997"
ports:
- "9997:9997"
- "${WEB_PAGE_PORT:-8080}:8080"
- "${SERVER_PORT:-8080}:${SERVER_PORT:-8080}"
environment:
- JAVA_OPTS="-Dspring.profiles.active=${SPRING_PROFILES},batch"
- SERVER_PORT=${SERVER_PORT}
- SPRING_PROFILES=${SPRING_PROFILES}
- PINPOINT_ZOOKEEPER_ADDRESS=${PINPOINT_ZOOKEEPER_ADDRESS}
- CLUSTER_ENABLE=${CLUSTER_ENABLE}
- CLUSTER_ZOOKEEPER_ADDRESS=${CLUSTER_ZOOKEEPER_ADDRESS}
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
- ANALYTICS=${ANALYTICS}
- HBASE_HOST=${HBASE_HOST}
- HBASE_PORT=${HBASE_PORT}
- DEBUG_LEVEL=${WEB_DEBUG_LEVEL}
- CONFIG_SENDUSAGE=${CONFIG_SENDUSAGE}
- LOGGING_LEVEL_ROOT=${WEB_LOGGING_LEVEL_ROOT}
- CONFIG_SHOW_APPLICATIONSTAT=${CONFIG_SHOW_APPLICATIONSTAT}
- BATCH_ENABLE=${BATCH_ENABLE}
- BATCH_SERVER_IP=${BATCH_SERVER_IP}
- BATCH_FLINK_SERVER=${BATCH_FLINK_SERVER}
- JDBC_DRIVER=${JDBC_DRIVER}
- JDBC_DRIVERCLASSNAME=${JDBC_DRIVERCLASSNAME}
- JDBC_URL=${JDBC_URL}
- JDBC_USERNAME=${JDBC_USERNAME}
- JDBC_PASSWORD=${JDBC_PASSWORD}
- MAIL_SERVER_URL=${MAIL_SERVER_URL}
- MAIL_SERVER_PORT=${MAIL_SERVER_PORT}
- MAIL_SERVER_USERNAME=${MAIL_SERVER_USERNAME}
- MAIL_SERVER_PASSWORD=${MAIL_SERVER_PASSWORD}
- MAIL_SENDER_ADDRESS=${MAIL_SENDER_ADDRESS}
- MAIL_TRANSPORT_PROTOCOL=${MAIL_TRANSPORT_PROTOCOL}
- MAIL_SMTP_PORT=${MAIL_SMTP_PORT}
- MAIL_SMTP_AUTH=${MAIL_SMTP_AUTH}
- MAIL_SMTP_STARTTLS_ENABLE=${MAIL_SMTP_STARTTLS_ENABLE}
- MAIL_SMTP_STARTTLS_REQUIRED=${MAIL_SMTP_STARTTLS_REQUIRED}
- MAIL_DEBUG=${MAIL_DEBUG}
- ALARM_MAIL_SERVER_URL=${ALARM_MAIL_SERVER_URL}
- ALARM_MAIL_SERVER_PORT=${ALARM_MAIL_SERVER_PORT}
- ALARM_MAIL_SERVER_USERNAME=${ALARM_MAIL_SERVER_USERNAME}
- ALARM_MAIL_SERVER_PASSWORD=${ALARM_MAIL_SERVER_PASSWORD}
- ALARM_MAIL_SENDER_ADDRESS=${ALARM_MAIL_SENDER_ADDRESS}
- ALARM_MAIL_TRANSPORT_PROTOCOL=${ALARM_MAIL_TRANSPORT_PROTOCOL}
- ALARM_MAIL_SMTP_PORT=${ALARM_MAIL_SMTP_PORT}
- ALARM_MAIL_SMTP_AUTH=${ALARM_MAIL_SMTP_AUTH}
- ALARM_MAIL_SMTP_STARTTLS_ENABLE=${ALARM_MAIL_SMTP_STARTTLS_ENABLE}
- ALARM_MAIL_SMTP_STARTTLS_REQUIRED=${ALARM_MAIL_SMTP_STARTTLS_REQUIRED}
- ALARM_MAIL_DEBUG=${ALARM_MAIL_DEBUG}