You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2021/08/08 03:06:49 UTC
[incubator-inlong] branch master updated:
[INLONG-1423][InLong-Manager] modify the docker image of the inlong-manager
module (#1426)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 87febbb [INLONG-1423][InLong-Manager] modify the docker image of the inlong-manager module (#1426)
87febbb is described below
commit 87febbbce0202952bcf926f925642398f002839d
Author: healchow <he...@gmail.com>
AuthorDate: Sun Aug 8 11:06:42 2021 +0800
[INLONG-1423][InLong-Manager] modify the docker image of the inlong-manager module (#1426)
Co-authored-by: healzhou <he...@tencent.com>
---
inlong-manager/manager-docker/Dockerfile | 15 ++++++++++++++
inlong-manager/manager-docker/README.md | 15 ++++++++++++--
inlong-manager/manager-docker/manager-docker.sh | 23 ++++++++++++++++++++--
inlong-manager/manager-docker/pom.xml | 2 +-
inlong-manager/manager-web/bin/startup.sh | 11 +++++++----
.../src/main/resources/application-dev.properties | 2 +-
.../src/main/resources/application-prod.properties | 2 +-
.../src/main/resources/application-test.properties | 2 +-
8 files changed, 60 insertions(+), 12 deletions(-)
diff --git a/inlong-manager/manager-docker/Dockerfile b/inlong-manager/manager-docker/Dockerfile
index 930c4cf..74fce37 100644
--- a/inlong-manager/manager-docker/Dockerfile
+++ b/inlong-manager/manager-docker/Dockerfile
@@ -18,7 +18,22 @@
#
FROM openjdk:8-jdk-alpine
EXPOSE 8083
+
+# profile and env virables
+ENV ACTIVE_PROFILE=dev
+# Note: '/' and '&' symbles need to be escaped with the '\'
+ENV JDBC_URL='jdbc:mysql:\/\/127.0.0.1:3306\/apache_inlong_manager?useSSL=false\&allowPublicKeyRetrieval=true\&characterEncoding=UTF-8\&nullCatalogMeansCurrent=true\&serverTimezone=GMT%2b8'
+ENV USERNAME=root
+ENV PASSWORD=123456
+ENV TUBE_MANAGER=http://127.0.0.1:8081
+ENV TUBE_MASTER=127.0.0.1:8000,127.0.0.1:8010
+ENV TUBE_CLUSTER_ID=1
+ENV ZK_URL=127.0.0.1:2181
+ENV ZK_ROOT=inlong_hive
+ENV SORT_APP_NAME=inlong_hive
+
WORKDIR /opt/inlong-manager
+
# add tarball from manager output
ARG MANAGER_TARBALL
ADD ${MANAGER_TARBALL} /opt/inlong-manager
diff --git a/inlong-manager/manager-docker/README.md b/inlong-manager/manager-docker/README.md
index 2dbca3c..9b3aa41 100644
--- a/inlong-manager/manager-docker/README.md
+++ b/inlong-manager/manager-docker/README.md
@@ -9,9 +9,20 @@ docker pull inlong/manager-web:latest
```
### Start Container
-
+~~~~
```
-docker run -d --name manager-web -p 8083:8083 inlong/manager-web
+docker run -d --name manager-web -p 8083:8083 \
+-e ACTIVE_PROFILE=prod \
+-e JDBC_URL='jdbc:mysql:\/\/127.0.0.1:3306\/apache_inlong_manager?serverTimezone=GMT%2b8\&useSSL=false\&allowPublicKeyRetrieval=true\&characterEncoding=UTF-8\&nullCatalogMeansCurrent=true' \
+-e USERNAME=xxxxxx \
+-e PASSWORD=xxxxxx \
+-e TUBE_MANAGER=http://127.0.0.1:8081 \
+-e TUBE_MASTER=127.0.0.1:8000,127.0.0.1:8010 \
+-e TUBE_CLUSTER_ID=1 \
+-e ZK_URL=127.0.0.1:2181 \
+-e ZK_ROOT=inlong_hive \
+-e SORT_APP_NAME=inlong_hive \
+inlong/manager-web:latest
```
### Add A Job
diff --git a/inlong-manager/manager-docker/manager-docker.sh b/inlong-manager/manager-docker/manager-docker.sh
index 16ba1ef..a84565f 100644
--- a/inlong-manager/manager-docker/manager-docker.sh
+++ b/inlong-manager/manager-docker/manager-docker.sh
@@ -21,8 +21,27 @@ file_path=$(
pwd
)
-# start
-sh "${file_path}"/bin/startup.sh
+if [ -f "${ACTIVE_PROFILE}" ]; then
+ "${ACTIVE_PROFILE}" = dev
+fi
+conf_file="${file_path}"/conf/application-"${ACTIVE_PROFILE}".properties
+
+# replace the configuration
+sed -i "s/datasource.jdbc\-url=.*$/datasource.jdbc\-url=${JDBC_URL}/g" "${conf_file}"
+sed -i "s/datasource.username=.*$/datasource.username=${USERNAME}/g" "${conf_file}"
+sed -i "s/datasource.password=.*$/datasource.password=${PASSWORD}/g" "${conf_file}"
+
+sed -i "s/cluster.tube.manager=.*$/cluster.tube.manager\=${TUBE_MANAGER}/g" "${conf_file}"
+sed -i "s/cluster.tube.master=.*$/cluster.tube.master\=${TUBE_MASTER}/g" "${conf_file}"
+sed -i "s/cluster.tube.clusterId=.*$/cluster.tube.clusterId=${TUBE_CLUSTER_ID}/g" "${conf_file}"
+sed -i "s/cluster.zk.url=.*$/cluster.zk.url=${ZK_URL}/g" "${conf_file}"
+sed -i "s/cluster.zk.root=.*$/cluster.zk.root=${ZK_ROOT}/g" "${conf_file}"
+sed -i "s/sort.appName=.*$/sort.appName=${SORT_APP_NAME}/g" "${conf_file}"
+
+# startup the application
+JAVA_OPTS="-Dspring.profiles.active=${ACTIVE_PROFILE}"
+
+sh "${file_path}"/bin/startup.sh "${JAVA_OPTS}"
sleep 3
# keep alive
tail -F "${file_path}"/log/manager-web.log
diff --git a/inlong-manager/manager-docker/pom.xml b/inlong-manager/manager-docker/pom.xml
index 714afd5..dffd8ca 100644
--- a/inlong-manager/manager-docker/pom.xml
+++ b/inlong-manager/manager-docker/pom.xml
@@ -74,7 +74,7 @@
</execution>
</executions>
<configuration>
- <repository>${docker.organization}/manager</repository>
+ <repository>${docker.organization}/manager-web</repository>
<pullNewerImage>false</pullNewerImage>
<tag>${project.version}</tag>
<buildArgs>
diff --git a/inlong-manager/manager-web/bin/startup.sh b/inlong-manager/manager-web/bin/startup.sh
index b58ced2..759d5ca 100755
--- a/inlong-manager/manager-web/bin/startup.sh
+++ b/inlong-manager/manager-web/bin/startup.sh
@@ -94,13 +94,16 @@ echo "" >${LOG_FILE}
# JVM Configuration
JAVA_OPT="-server -Xms4g -Xmx4g -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:-OmitStackTraceInFastThrow "
-#gc options
+# outside param
+JAVA_OPT="${JAVA_OPT} $1"
+
+# GC options
JAVA_OPT="${JAVA_OPT} -XX:+IgnoreUnrecognizedVMOptions -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${LOG_DIR}/gc.log"
-#jmx metrics
-#JAVA_OPT="${JAVA_OPT} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8011 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
+# JMX metrics
+#JAVA_OPT="${JAVA_OPT} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8011 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
-#remote debugger
+# Remote debugger
#JAVA_OPT="${JAVA_OPT} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8081"
#=======================================================
diff --git a/inlong-manager/manager-web/src/main/resources/application-dev.properties b/inlong-manager/manager-web/src/main/resources/application-dev.properties
index cf6473c..3e707f5 100644
--- a/inlong-manager/manager-web/src/main/resources/application-dev.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-dev.properties
@@ -21,7 +21,7 @@
logging.level.root=INFO
logging.level.org.apache.inlong.manager=debug
-spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?serverTimezone=GMT%2b8&useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
+spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8
spring.datasource.username=xxxxxx
spring.datasource.password=xxxxxx
diff --git a/inlong-manager/manager-web/src/main/resources/application-prod.properties b/inlong-manager/manager-web/src/main/resources/application-prod.properties
index c619b71..a01a09f 100644
--- a/inlong-manager/manager-web/src/main/resources/application-prod.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-prod.properties
@@ -20,7 +20,7 @@
# Log level
logging.level.root=INFO
-spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?serverTimezone=GMT%2b8&useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
+spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8
spring.datasource.username=xxxxxx
spring.datasource.password=xxxxxx
diff --git a/inlong-manager/manager-web/src/main/resources/application-test.properties b/inlong-manager/manager-web/src/main/resources/application-test.properties
index cf6473c..3e707f5 100644
--- a/inlong-manager/manager-web/src/main/resources/application-test.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-test.properties
@@ -21,7 +21,7 @@
logging.level.root=INFO
logging.level.org.apache.inlong.manager=debug
-spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?serverTimezone=GMT%2b8&useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
+spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8
spring.datasource.username=xxxxxx
spring.datasource.password=xxxxxx