From 4e68645ccb7d6664c19beaac2e079a9f7948e216 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Thu, 27 Oct 2022 12:33:29 +0800 Subject: [PATCH] docker packaging issues fixed --- docs/docs/user_docs/ops/server-docker.md | 1 + hippo4j-server/hippo4j-bootstrap/Dockerfile | 1 + .../hippo4j-bootstrap/conf/application-h2.properties | 9 +++++++++ .../hippo4j-bootstrap/conf/application.properties | 10 ++++++++-- hippo4j-server/hippo4j-bootstrap/docker-startup.sh | 3 ++- 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 hippo4j-server/hippo4j-bootstrap/conf/application-h2.properties diff --git a/docs/docs/user_docs/ops/server-docker.md b/docs/docs/user_docs/ops/server-docker.md index d0a738ce..141c597a 100644 --- a/docs/docs/user_docs/ops/server-docker.md +++ b/docs/docs/user_docs/ops/server-docker.md @@ -16,6 +16,7 @@ docker run -d -p 6691:6691 --name hippo4j-server hippo4j/hippo4j-server ```shell docker run -d -p 6691:6691 --name hippo4j-server \ +-e DATASOURCE_MODE=mysql \ -e DATASOURCE_HOST=xxx.xxx.xxx.xxx \ -e DATASOURCE_PORT=3306 \ -e DATASOURCE_DB=hippo4j_manager \ diff --git a/hippo4j-server/hippo4j-bootstrap/Dockerfile b/hippo4j-server/hippo4j-bootstrap/Dockerfile index 0bfee974..bb14f76c 100644 --- a/hippo4j-server/hippo4j-bootstrap/Dockerfile +++ b/hippo4j-server/hippo4j-bootstrap/Dockerfile @@ -30,6 +30,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ADD conf/hippo4j-logback.xml ${BASE_DIR}/conf/hippo4j-logback.xml ADD conf/application.properties ${BASE_DIR}/conf/application.properties +ADD conf/application-h2.properties ${BASE_DIR}/conf/application-h2.properties ADD target/hippo4j-server.jar ${BASE_DIR}/hippo4j-server.jar ADD docker-startup.sh ${BASE_DIR}/docker-startup.sh diff --git a/hippo4j-server/hippo4j-bootstrap/conf/application-h2.properties b/hippo4j-server/hippo4j-bootstrap/conf/application-h2.properties new file mode 100644 index 00000000..b4bdea1c --- /dev/null +++ b/hippo4j-server/hippo4j-bootstrap/conf/application-h2.properties @@ -0,0 +1,9 @@ +### Data source customization section +hippo4j.database.dialect=h2 +hippo4j.database.init_enable=true +hippo4j.database.init_script=sql-script/h2/hippo4j_manager.sql + +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.url=jdbc:h2:file:{your storage address}/h2_hippo4j_test_file;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL; +spring.datasource.username=sa +spring.datasource.password=sa diff --git a/hippo4j-server/hippo4j-bootstrap/conf/application.properties b/hippo4j-server/hippo4j-bootstrap/conf/application.properties index d9557188..448a682c 100644 --- a/hippo4j-server/hippo4j-bootstrap/conf/application.properties +++ b/hippo4j-server/hippo4j-bootstrap/conf/application.properties @@ -4,6 +4,7 @@ ### Server Startup Port server.port=6691 +spring.profiles.active=mysql ### Server Tomcat server.tomcat.accesslog.enabled=true @@ -23,17 +24,22 @@ hippo4j.core.clean-history-data-enable=true ### Whether to enable authentication. hippo4j.core.auth.enabled=true +### Initialize the database dialect class. +hippo4j.database.dialect=mysql +hippo4j.database.init_enable=false +hippo4j.database.init_script=sql-script/mysql/hippo4j_manager.sql + ### Use netty to report thread pool monitoring data. The default is http. # hippo4j.core.monitor.report-type=netty #*************** Config Module Related Configurations ***************# -### Data source customization section +### Default database +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/hippo4j_manager?characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 spring.datasource.username=root spring.datasource.password=root ### Hikari Datasource -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.hikari.pool-name=Hikari spring.datasource.hikari.connectionTimeout=30000 spring.datasource.hikari.idleTimeout=30000 diff --git a/hippo4j-server/hippo4j-bootstrap/docker-startup.sh b/hippo4j-server/hippo4j-bootstrap/docker-startup.sh index 8b03f1e6..ccbda789 100644 --- a/hippo4j-server/hippo4j-bootstrap/docker-startup.sh +++ b/hippo4j-server/hippo4j-bootstrap/docker-startup.sh @@ -19,7 +19,8 @@ JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288" JAVA_OPT="${JAVA_OPT} --server.tomcat.basedir=${BASE_DIR}/bin" if [[ "${DATASOURCE_MODE}" == "mysql" ]]; then - JAVA_OPT="${JAVA_OPT} --spring.datasource.url=\"jdbc:mysql://${DATASOURCE_HOST}:${DATASOURCE_PORT}/${DATASOURCE_DB}?characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8\" " + JAVA_OPT="${JAVA_OPT} --spring.profiles.active=mysql --hippo4j.database.init_enable=false " + JAVA_OPT="${JAVA_OPT} --spring.datasource.url=jdbc:mysql://${DATASOURCE_HOST}:${DATASOURCE_PORT}/${DATASOURCE_DB}?characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 " JAVA_OPT="${JAVA_OPT} --spring.datasource.username=${DATASOURCE_USERNAME} --spring.datasource.password=${DATASOURCE_PASSWORD} " elif [[ "${DATASOURCE_MODE}" == "h2" ]]; then JAVA_OPT="${JAVA_OPT} --spring.profiles.active=h2 --spring.datasource.url=jdbc:h2:file:${BASE_DIR}/h2_hippo4j;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL"