From fcb44dc026501ca93c1c4df5e6e428151b4d4f9e Mon Sep 17 00:00:00 2001 From: BigXin0109 <1064730540@qq.com> Date: Sat, 20 Aug 2022 17:34:38 +0800 Subject: [PATCH] feat: Only the datasource parameter is exposed (#550) --- docs/docs/user_docs/ops/server-docker.md | 11 +++++++---- hippo4j-server/Dockerfile | 25 +++++++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/docs/docs/user_docs/ops/server-docker.md b/docs/docs/user_docs/ops/server-docker.md index 55c2d2ce..e3e6abd5 100644 --- a/docs/docs/user_docs/ops/server-docker.md +++ b/docs/docs/user_docs/ops/server-docker.md @@ -38,9 +38,12 @@ docker pull hippo4j-server docker run -p 6691:6691 --name hippo4j-server -d hippo4j-server:{指定版本} /** -* 如需自定义 mysql 等配置,可通过 "-e PARAMS" 指定,参数格式 PARAMS="--key=value --key2=value2" -* 配置项参考文件:/hippo4j-server/src/main/resources/application.properties -* 如需自定义 JVM内存参数 等配置,可通过 "-e JAVA_OPTS" 指定,参数格式 JAVA_OPTS="-Xmx512m" +* 暂时只暴露以下参数 +* MYSQL_DATASOURCE_URL、MYSQL_USERNAME、MYSQL_PASSWORD */ -docker run -e PARAMS="--spring.datasource.url=jdbc:mysql://localhost:3306/hippo4j_manager?characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8" -p 6691:6691 --name hippo4j-server -d hippo4j-server:{指定版本} +docker run -p 6691:6691 --name hippo4j-server \ +-e MYSQL_DATASOURCE_URL=127.0.0.1:3306/hippo4j_manager \ +-e MYSQL_USERNAME=root \ +-e MYSQL_PASSWORD=mysql \ +-d hippo4j-server ``` diff --git a/hippo4j-server/Dockerfile b/hippo4j-server/Dockerfile index 8c0ef870..3a215218 100644 --- a/hippo4j-server/Dockerfile +++ b/hippo4j-server/Dockerfile @@ -17,14 +17,29 @@ FROM openjdk:8-jre-slim MAINTAINER lijianxin -ENV PARAMS="" +ENV MYSQL_DATASOURCE_URL="127.0.0.1:3306/hippo4j_manager" \ + MYSQL_USERNAME="root" \ + MYSQL_PASSWORD="root" \ + BASE_DIR="/opt/hippo4j" ENV TZ=PRC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -ADD conf/hippo4j-logback.xml /opt/hippo4j/logback.xml -ADD target/hippo4j-server.jar /opt/hippo4j/hippo4j-server.jar +ADD conf/hippo4j-logback.xml ${BASE_DIR}/logback.xml +ADD target/hippo4j-server.jar ${BASE_DIR}/hippo4j-server.jar -WORKDIR /opt/hippo4j +WORKDIR ${BASE_DIR} -ENTRYPOINT ["sh","-c","java -jar -Dhippo4j.home=/opt/hippo4j $JAVA_OPTS /opt/hippo4j/hippo4j-server.jar --server.tomcat.basedir=/opt/tomcat --logging.config=/opt/hippo4j/logback.xml $PARAMS"] \ No newline at end of file +ENTRYPOINT ["sh","-c","java -jar \ + -Xloggc:${BASE_DIR}/hippo4j_gc.log -verbose:gc -XX:+PrintGCDetails \ + -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation \ + -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M \ + -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASE_DIR}/java_heapdump.hprof \ + -Xms1024m -Xmx1024m -Xmn512m \ + -Dhippo4j.standalone=true -Dhippo4j.home=${BASE_DIR} \ + hippo4j-server.jar \ + --server.max-http-header-size=524288 --server.tomcat.basedir=${BASE_DIR}/tomcat/ \ + --logging.config=${BASE_DIR}/logback.xml \ + --spring.datasource.url=\"jdbc:mysql://$MYSQL_DATASOURCE_URL?characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8\" \ + --spring.datasource.username=$MYSQL_USERNAME --spring.datasource.password=$MYSQL_PASSWORD \ + "] \ No newline at end of file