diff --git a/.env b/.env
index 8954fca..07d7d4f 100644
--- a/.env
+++ b/.env
@@ -6,6 +6,11 @@ PINPOINT_HBASE_NAME=pinpoint-hbase
#config for hbase in external docker
EXTERNAL_HBASE_PORT=2180
+### Pinpoint-mysql
+MYSQL_ROOT_PASSWORD=root123
+MYSQL_USER=admin
+MYSQL_PASSWORD=admin
+MYSQL_DATABASE=pinpoint
### Pinpoint-Web
@@ -32,6 +37,21 @@ BATCH_FLINK_SERVER=pinpoint-flink-jobmanager
CONFIG_SHOW_APPLICATIONSTAT=true
+JDBC_DRIVER=com.mysql.jdbc.Driver
+JDBC_URL=jdbc:mysql://pinpoint-mysql:3306/pinpoint?characterEncoding=UTF-8
+JDBC_USERNAME=admin
+JDBC_PASSWORD=admin
+MAIL_HOST=stmp.test.com
+MAIL_PORT=123
+MAIL_USERNAME=user
+MAIL_PASSWORD=pass
+MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL=smtp
+MAIL_PROPERTIES_MAIL_SMTP_AUTH=true
+MAIL_PROPERTIES_MAIL_SMTP_PORT=587
+MAIL_PROPERTIES_MAIL_SMTP_FROM=test@example.com
+MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE=true
+MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED=true
+MAIL_PROPERTIES_MAIL_DEBUG=false
### Pinpoint-Collector
@@ -71,4 +91,4 @@ FLINK_WEB_PORT=8081
### Pinpoint-quickstart
-APP_PORT=8000
\ No newline at end of file
+APP_PORT=8000
diff --git a/Readme.md b/Readme.md
index c1e7b27..bb1f9e1 100644
--- a/Readme.md
+++ b/Readme.md
@@ -42,13 +42,22 @@ This will install and run all services required to run all features in Pinpoint
- Pinpoint-Flink
- Pinpoint-Zookeeper
- Pinpoint-Hbase
- - Pinpoint-QuickStart(a sample application)
+ - Pinpoint-QuickStart(a sample application)
+ - Pinpoint-Mysql
This may take several minutes to download all necessary images.
You can replace `QuickStart` application part with your application to start monitoring.
- check [`Testing QuickStart application`](#testing-quickstart-application) for a quick demo of pinpoint
- check [`Monitoring YOUR Application`](#monitoring-your-application) part for further details
+### Mysql (optional)
+
+The Pinpoint-Mysql server is running on port 13306 and contains the data structure used to register users, groups, and alerts to be sent.
+
+To send email alerts, you must make BATCH_ENABLE=true and change the other mail-related environment variables (MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_PROPERTIES_MAIL_SMTP_FROM, ...) to the Pinpoint-Web server in *.env* file.
+
+For more information see [Setting Alarm](http://naver.github.io/pinpoint/alarm.html) in Pinpoint documentation.
+
### Flink configuration (optional)
After all containers are started and ready to go. There is one more thing to do to use all existing features in Pinpoint.
diff --git a/docker-compose.yml b/docker-compose.yml
index c7dc35c..c194a3c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -35,6 +35,30 @@ services:
- "16030:16030"
restart: always
+ pinpoint-mysql:
+ build:
+ context: ./pinpoint-mysql/
+ dockerfile: Dockerfile
+ args:
+ - PINPOINT_VERSION=${PINPOINT_VERSION}
+
+ container_name: pinpoint-mysql
+ restart: always
+ image: pinpointdocker/pinpoint-mysql:${PINPOINT_VERSION}
+ hostname: pinpoint-mysql
+ ports:
+ - "13306:3306"
+ environment:
+ - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
+ - MYSQL_USER=${MYSQL_USER}
+ - MYSQL_PASSWORD=${MYSQL_PASSWORD}
+ - MYSQL_DATABASE=${MYSQL_DATABASE}
+
+ volumes:
+ - mysql_data:/var/lib/mysql
+ networks:
+ - pinpoint
+
pinpoint-web:
build:
context: ./pinpoint-web/
@@ -47,6 +71,7 @@ services:
depends_on:
- pinpoint-hbase
+ - pinpoint-mysql
restart: always
expose:
- "8080"
@@ -66,6 +91,23 @@ services:
- BATCH_ENABLE=${BATCH_ENABLE}
- BATCH_SERVER_IP=${BATCH_SERVER_IP}
- BATCH_FLINK_SERVER=${BATCH_FLINK_SERVER}
+ - JDBC_DRIVER=${JDBC_DRIVER}
+ - JDBC_URL=${JDBC_URL}
+ - JDBC_USERNAME=${JDBC_USERNAME}
+ - JDBC_PASSWORD=${JDBC_PASSWORD}
+ - MAIL_HOST=${MAIL_HOST}
+ - MAIL_PORT=${MAIL_PORT}
+ - MAIL_USERNAME=${MAIL_USERNAME}
+ - MAIL_PASSWORD=${MAIL_PASSWORD}
+ - MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL=${MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL}
+ - MAIL_PROPERTIES_MAIL_SMTP_AUTH=${MAIL_PROPERTIES_MAIL_SMTP_AUTH}
+ - MAIL_PROPERTIES_MAIL_SMTP_PORT=${MAIL_PROPERTIES_MAIL_SMTP_PORT}
+ - MAIL_PROPERTIES_MAIL_SMTP_FROM=${MAIL_PROPERTIES_MAIL_SMTP_FROM}
+ - MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE=${MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE}
+ - MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED=${MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED}
+ - MAIL_PROPERTIES_MAIL_DEBUG=${MAIL_PROPERTIES_MAIL_DEBUG}
+ links:
+ - "pinpoint-mysql:pinpoint-mysql"
networks:
- pinpoint
@@ -215,6 +257,7 @@ services:
volumes:
data-volume:
+ mysql_data:
networks:
pinpoint:
diff --git a/pinpoint-mysql/.env b/pinpoint-mysql/.env
new file mode 100644
index 0000000..f54d43d
--- /dev/null
+++ b/pinpoint-mysql/.env
@@ -0,0 +1 @@
+PINPOINT_VERSION=1.8.0
\ No newline at end of file
diff --git a/pinpoint-mysql/Dockerfile b/pinpoint-mysql/Dockerfile
new file mode 100644
index 0000000..3d8f87f
--- /dev/null
+++ b/pinpoint-mysql/Dockerfile
@@ -0,0 +1,11 @@
+FROM mysql:5.7
+
+ARG PINPOINT_VERSION=${PINPOINT_VERSION:-1.8.0}
+
+RUN apt update \
+ && apt-get install -y --no-install-recommends ca-certificates wget \
+ && wget -O /docker-entrypoint-initdb.d/CreateTableStatement-mysql.sql "https://raw.githubusercontent.com/naver/pinpoint/$PINPOINT_VERSION/web/src/main/resources/sql/CreateTableStatement-mysql.sql" \
+ && wget -O /docker-entrypoint-initdb.d/SpringBatchJobRepositorySchema-mysql.sql "https://raw.githubusercontent.com/naver/pinpoint/$PINPOINT_VERSION/web/src/main/resources/sql/SpringBatchJobRepositorySchema-mysql.sql" \
+ && sed -i '/^--/d' /docker-entrypoint-initdb.d/CreateTableStatement-mysql.sql \
+ && sed -i '/^--/d' /docker-entrypoint-initdb.d/SpringBatchJobRepositorySchema-mysql.sql \
+ && apt-get purge -y --auto-remove ca-certificates wget
diff --git a/pinpoint-web/.env b/pinpoint-web/.env
index 5f766ac..ff33195 100644
--- a/pinpoint-web/.env
+++ b/pinpoint-web/.env
@@ -26,3 +26,22 @@ BATCH_SERVER_IP=127.0.0.127
BATCH_FLINK_SERVER=pinpoint-flink-jobmanager
CONFIG_SHOW_APPLICATIONSTAT=true
+
+#mysql information required
+JDBC_DRIVER=com.mysql.jdbc.Driver
+JDBC_URL=jdbc:mysql://pinpoint-mysql:3306/pinpoint?characterEncoding=UTF-8
+JDBC_USERNAME=
+JDBC_PASSWORD=
+
+#mail server information required
+MAIL_HOST=
+MAIL_PORT=
+MAIL_USERNAME=
+MAIL_PASSWORD=
+MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL=
+MAIL_PROPERTIES_MAIL_SMTP_AUTH=
+MAIL_PROPERTIES_MAIL_SMTP_PORT=
+MAIL_PROPERTIES_MAIL_SMTP_FROM=
+MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE=
+MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED=
+MAIL_PROPERTIES_MAIL_DEBUG=
\ No newline at end of file
diff --git a/pinpoint-web/Dockerfile b/pinpoint-web/Dockerfile
index e51d805..e295197 100644
--- a/pinpoint-web/Dockerfile
+++ b/pinpoint-web/Dockerfile
@@ -6,12 +6,16 @@ ARG PINPOINT_VERSION=${PINPOINT_VERSION:-1.8.0}
ARG INSTALL_URL=https://github.com/naver/pinpoint/releases/download/${PINPOINT_VERSION}/pinpoint-web-${PINPOINT_VERSION}.war
COPY /build/scripts/start-web.sh /usr/local/bin/
+COPY /build/mail.zip /assets/mail.zip
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
+ && rm -rf pinpoint-web.war \
+ && curl -SL https://maven.java.net/content/repositories/releases/com/sun/mail/javax.mail/1.5.2/javax.mail-1.5.2.jar -o /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/javax.mail-1.5.2.jar \
+ && unzip /assets/mail.zip -d /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/ \
+ && rm -rf /assets/mail.zip
ENTRYPOINT ["/usr/local/bin/start-web.sh"]
diff --git a/pinpoint-web/build/mail.zip b/pinpoint-web/build/mail.zip
new file mode 100644
index 0000000..851516b
Binary files /dev/null and b/pinpoint-web/build/mail.zip differ
diff --git a/pinpoint-web/build/scripts/start-web.sh b/pinpoint-web/build/scripts/start-web.sh
index 9a36905..39f9a15 100644
--- a/pinpoint-web/build/scripts/start-web.sh
+++ b/pinpoint-web/build/scripts/start-web.sh
@@ -18,5 +18,68 @@ sed -i "/batch.flink.server=/ s/=.*/=${BATCH_FLINK_SERVER}/" /usr/local/tomcat/w
sed -i "/level value=/ s/=.*/=\"${DEBUG_LEVEL}\"\/>/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/log4j.xml
+WEB_INF_CLASSES_DIR=/usr/local/tomcat/webapps/ROOT/WEB-INF/classes
+APPLICATION_CONTEXT_WEB_FILE=${WEB_INF_CLASSES_DIR}/applicationContext-web.xml
+APPLICATION_CONTEXT_MAIL_FILE=${WEB_INF_CLASSES_DIR}/applicationContext-mail.xml
+
+echo -e "
+jdbc.driverClassName=${JDBC_DRIVER:-com.mysql.jdbc.Driver}
+jdbc.url=${JDBC_URL:-jdbc:mysql://localhost:13306/pinpoint?characterEncoding=UTF-8}
+jdbc.username=${JDBC_USERNAME:-admin}
+jdbc.password=${JDBC_PASSWORD:-admin}
+" > ${WEB_INF_CLASSES_DIR}/jdbc.properties
+
+sed -i '/classpath:applicationContext-mail.xml/d' ${APPLICATION_CONTEXT_WEB_FILE}
+if [ "$MAIL_HOST" != "" ]; then
+ sed -i 's/<\/beans>/ \
+<\/beans>/' ${APPLICATION_CONTEXT_WEB_FILE}
+
+ sed -i "/name=\"host\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ sed -i "/name=\"port\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ sed -i "/name=\"username\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ sed -i "/name=\"password\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+
+ if [ "$MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL" != "" ]; then
+ sed -i "/prop key=\"mail.transport.protocol\"/c\ ${MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.transport.protocol\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+
+ if [ "$MAIL_PROPERTIES_MAIL_SMTP_PORT" != "" ]; then
+ sed -i "/prop key=\"mail.smtp.port\"/c\ ${MAIL_PROPERTIES_MAIL_SMTP_PORT}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.smtp.port\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+
+ if [ "$MAIL_PROPERTIES_MAIL_SMTP_AUTH" != "" ]; then
+ sed -i "/prop key=\"mail.smtp.auth\"/c\ ${MAIL_PROPERTIES_MAIL_SMTP_AUTH}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.smtp.auth\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+
+ if [ "$MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE" != "" ]; then
+ sed -i "/prop key=\"mail.smtp.starttls.enable\"/c\ ${MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.smtp.starttls.enable\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+
+ if [ "$MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED" != "" ]; then
+ sed -i "/prop key=\"mail.smtp.starttls.required\"/c\ ${MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.smtp.starttls.required\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+
+ if [ "$MAIL_PROPERTIES_MAIL_DEBUG" != "" ]; then
+ sed -i "/prop key=\"mail.debug\"/c\ ${MAIL_PROPERTIES_MAIL_DEBUG}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.debug\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+
+ if [ "$MAIL_PROPERTIES_MAIL_SMTP_FROM" != "" ]; then
+ sed -i "/prop key=\"mail.smtp.from\"/c\ ${MAIL_PROPERTIES_MAIL_SMTP_FROM}" ${APPLICATION_CONTEXT_MAIL_FILE}
+ else
+ sed -i "/prop key=\"mail.smtp.from\"/c\ " ${APPLICATION_CONTEXT_MAIL_FILE}
+ fi
+fi
exec /usr/local/tomcat/bin/catalina.sh run
diff --git a/pinpoint-web/docker-compose.yml b/pinpoint-web/docker-compose.yml
index 4db45e3..d23b185 100644
--- a/pinpoint-web/docker-compose.yml
+++ b/pinpoint-web/docker-compose.yml
@@ -30,4 +30,19 @@ services:
- BATCH_ENABLE=${BATCH_ENABLE}
- BATCH_SERVER_IP=${BATCH_SERVER_IP}
- BATCH_FLINK_SERVER=${BATCH_FLINK_SERVER}
+ - JDBC_DRIVER=${JDBC_DRIVER}
+ - JDBC_URL=${JDBC_URL}
+ - JDBC_USERNAME=${JDBC_USERNAME}
+ - JDBC_PASSWORD=${JDBC_PASSWORD}
+ - MAIL_HOST=${MAIL_HOST}
+ - MAIL_PORT=${MAIL_PORT}
+ - MAIL_USERNAME=${MAIL_USERNAME}
+ - MAIL_PASSWORD=${MAIL_PASSWORD}
+ - MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL=${MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL}
+ - MAIL_PROPERTIES_MAIL_SMTP_AUTH=${MAIL_PROPERTIES_MAIL_SMTP_AUTH}
+ - MAIL_PROPERTIES_MAIL_SMTP_PORT=${MAIL_PROPERTIES_MAIL_SMTP_PORT}
+ - MAIL_PROPERTIES_MAIL_SMTP_FROM=${MAIL_PROPERTIES_MAIL_SMTP_FROM}
+ - MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE=${MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE}
+ - MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED=${MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED}
+ - MAIL_PROPERTIES_MAIL_DEBUG=${MAIL_PROPERTIES_MAIL_DEBUG}