From 33b209392550b9d14952b52a5c5cc17c2f207484 Mon Sep 17 00:00:00 2001 From: chaogefeng <673120261@163.com> Date: Fri, 13 Dec 2019 17:14:46 +0800 Subject: [PATCH 1/2] Automated Installation Enhance close #37 --- bin/checkEnv.sh | 42 +++++++++++ bin/install.sh | 70 ++++++++++++++----- bin/start-all.sh | 48 +++++++++++++ conf/config.sh | 8 +-- db/azkaban.sql | 3 + db/dss_dml.sql | 4 +- db/qualitis.sql | 3 + .../bin/start-dss-flow-execution-entrance.sh | 50 ++++++++----- dss-server/bin/start-dss-server.sh | 40 ++++++----- .../bin/start-linkis-appjoint-entrance.sh | 43 ++++++------ .../bin/stop-linkis-appjoint-entrance.sh | 2 +- 11 files changed, 233 insertions(+), 80 deletions(-) create mode 100644 bin/checkEnv.sh create mode 100644 db/azkaban.sql create mode 100644 db/qualitis.sql diff --git a/bin/checkEnv.sh b/bin/checkEnv.sh new file mode 100644 index 0000000000..c377c05ea2 --- /dev/null +++ b/bin/checkEnv.sh @@ -0,0 +1,42 @@ +# +# Copyright 2019 WeBank +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#!/bin/sh +say() { + printf 'check command fail \n %s\n' "$1" +} + +err() { + say "$1" >&2 + exit 1 +} + +check_cmd() { + command -v "$1" > /dev/null 2>&1 +} + +need_cmd() { + if ! check_cmd "$1"; then + err "need '$1' (command not found)" + fi +} +echo "<-----start to check used cmd---->" +need_cmd yum +need_cmd java +need_cmd mysql +need_cmd unzip +need_cmd expect +need_cmd telnet +echo "<-----end to check used cmd------>" diff --git a/bin/install.sh b/bin/install.sh index 825448a859..70adc5a341 100644 --- a/bin/install.sh +++ b/bin/install.sh @@ -1,3 +1,18 @@ +# +# Copyright 2019 WeBank +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# #!/bin/sh #Actively load user env source ~/.bash_profile @@ -38,6 +53,11 @@ else fi } + +#check env +sh ${workDir}/bin/checkEnv.sh +isSuccess "check env" + function checkJava(){ java -version isSuccess "execute java --version" @@ -158,38 +178,55 @@ fi ##init db if [[ '2' = "$MYSQL_INSTALL_MODE" ]];then mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/dss_ddl.sql" - isSuccess "source linkis_ddl.sql" - LOCAL_IP="`ifconfig | grep 'inet' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}'`" + isSuccess "source dss_ddl.sql" + LOCAL_IP="`hostname -i`" if [ $GATEWAY_INSTALL_IP == "127.0.0.1" ];then echo "GATEWAY_INSTALL_IP is equals 127.0.0.1 ,we will change it to ip address" GATEWAY_INSTALL_IP_2=$LOCAL_IP else GATEWAY_INSTALL_IP_2=$GATEWAY_INSTALL_IP fi - echo $GATEWAY_INSTALL_IP_2 + #echo $GATEWAY_INSTALL_IP_2 sed -i "s/GATEWAY_INSTALL_IP_2/$GATEWAY_INSTALL_IP_2/g" ${workDir}/db/dss_dml.sql sed -i "s/GATEWAY_PORT/$GATEWAY_PORT/g" ${workDir}/db/dss_dml.sql - if [ $AZKABAN_ADRESS_IP == "127.0.0.1" ];then - echo "AZKABAN_ADRESS_IP is equals 127.0.0.1 ,we will change it to ip address" - AZKABAN_ADRESS_IP_2=$LOCAL_IP - else - AZKABAN_ADRESS_IP_2=$AZKABAN_ADRESS_IP - fi - echo $AZKABAN_ADRESS_IP_2 - sed -i "s/AZKABAN_ADRESS_IP_2/$AZKABAN_ADRESS_IP_2/g" ${workDir}/db/dss_dml.sql - sed -i "s/AZKABAN_ADRESS_PORT/$AZKABAN_ADRESS_PORT/g" ${workDir}/db/dss_dml.sql if [ $VISUALIS_NGINX_IP == "127.0.0.1" ]||[ $VISUALIS_NGINX_IP == "0.0.0.0" ];then echo "VISUALIS_NGINX_IP is equals $VISUALIS_NGINX_IP ,we will change it to ip address" VISUALIS_NGINX_IP_2=$LOCAL_IP else VISUALIS_NGINX_IP_2=$VISUALIS_NGINX_IP fi - echo $VISUALIS_NGINX_IP_2 + #echo $VISUALIS_NGINX_IP_2 sed -i "s/VISUALIS_NGINX_IP_2/$VISUALIS_NGINX_IP_2/g" ${workDir}/db/dss_dml.sql sed -i "s/VISUALIS_NGINX_PORT/$VISUALIS_NGINX_PORT/g" ${workDir}/db/dss_dml.sql mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/dss_dml.sql" - isSuccess "source linkis_dml.sql" - echo "Rebuild the table" + isSuccess "source dss_dml.sql" + if [[ '2' = "$INSTALL_MODE" ]];then + echo "start to update azkaban and qualitis table info " + #azkaban + if [ $AZKABAN_ADRESS_IP == "127.0.0.1" ];then + echo "AZKABAN_ADRESS_IP is equals 127.0.0.1 ,we will change it to ip address" + AZKABAN_ADRESS_IP_2=$LOCAL_IP + else + AZKABAN_ADRESS_IP_2=$AZKABAN_ADRESS_IP + fi + echo $AZKABAN_ADRESS_IP_2 + sed -i "s/AZKABAN_ADRESS_IP_2/$AZKABAN_ADRESS_IP_2/g" ${workDir}/db/azkaban.sql + sed -i "s/AZKABAN_ADRESS_PORT/$AZKABAN_ADRESS_PORT/g" ${workDir}/db/azkaban.sql + mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/azkaban.sql" + isSuccess "source azkaban.sql" + #qualitis + if [ $QUALITIS_ADRESS_IP == "127.0.0.1" ];then + echo "QUALITIS_ADRESS_IP is equals 127.0.0.1 ,we will change it to ip address" + QUALITIS_ADRESS_IP_2=$LOCAL_IP + else + QUALITIS_ADRESS_IP_2=$QUALITIS_ADRESS_IP + fi + echo $QUALITIS_ADRESS_IP_2 + sed -i "s/QUALITIS_ADRESS_IP_2/$QUALITIS_ADRESS_IP_2/g" ${workDir}/db/qualitis.sql + sed -i "s/QUALITIS_ADRESS_PORT/$QUALITIS_ADRESS_PORT/g" ${workDir}/db/qualitis.sql + mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/qualitis.sql" + isSuccess "source qualitis.sql" + fi fi ##env check @@ -304,8 +341,7 @@ isSuccess "install ${APPJOINTNAME}.zip" } ##function end -## -ver Install +##dss-Server install PACKAGE_DIR=dss/dss-server SERVERNAME=dss-server SERVER_IP=$DSS_SERVER_INSTALL_IP diff --git a/bin/start-all.sh b/bin/start-all.sh index abc0e64ed9..df229abc82 100644 --- a/bin/start-all.sh +++ b/bin/start-all.sh @@ -76,6 +76,16 @@ sleep 15 #for Eureka register SERVER_NAME=dss-server SERVER_IP=$DSS_SERVER_INSTALL_IP startApp +#MICRO_SERVICE_NAME=dss-server +#MICRO_SERVICE_IP=$DSS_SERVER_INSTALL_IP +#MICRO_SERVICE_PORT=$DSS_SERVER_PORT +#sh $workDir/check.sh $MICRO_SERVICE_NAME $MICRO_SERVICE_IP $MICRO_SERVICE_PORT +#state=`echo -e "\n" | telnet $MICRO_SERVICE_IP $MICRO_SERVICE_PORT 2>/dev/null | grep Connected | wc -l` +#if [ $state -eq 0 ]; then +# echo "" +# echo "ERROR " $MICRO_SERVICE_NAME "is a critical service and must be guaranteed to be started !!!" +# exit 1 +#fi #dss-flow-execution-entrance SERVER_NAME=dss-flow-execution-entrance @@ -91,3 +101,41 @@ SERVER_NAME=visualis-server SERVER_IP=$VISUALIS_SERVER_INSTALL_IP startApp + +echo "Start to check all dss microservice" + +#check dss-server +MICRO_SERVICE_NAME=dss-server +MICRO_SERVICE_IP=$DSS_SERVER_INSTALL_IP +MICRO_SERVICE_PORT=$DSS_SERVER_PORT +sh $workDir/checkMicro.sh $MICRO_SERVICE_NAME $MICRO_SERVICE_IP $MICRO_SERVICE_PORT +state=`echo -e "\n" | telnet $MICRO_SERVICE_IP $MICRO_SERVICE_PORT 2>/dev/null | grep Connected | wc -l` +isSuccess "$MICRO_SERVICE_NAME start" + + +#check dss-flow-execution-entrance +MICRO_SERVICE_NAME=dss-flow-execution-entrance +MICRO_SERVICE_IP=$FLOW_EXECUTION_INSTALL_IP +MICRO_SERVICE_PORT=$FLOW_EXECUTION_PORT +sh $workDir/checkMicro.sh $MICRO_SERVICE_NAME $MICRO_SERVICE_IP $MICRO_SERVICE_PORT +state=`echo -e "\n" | telnet $MICRO_SERVICE_IP $MICRO_SERVICE_PORT 2>/dev/null | grep Connected | wc -l` +isSuccess "$MICRO_SERVICE_NAME start" + +#check linkis-appjoint-entrance +MICRO_SERVICE_NAME=linkis-appjoint-entrance +MICRO_SERVICE_IP=$APPJOINT_ENTRANCE_INSTALL_IP +MICRO_SERVICE_PORT=$APPJOINT_ENTRANCE_PORT +sh $workDir/checkMicro.sh $MICRO_SERVICE_NAME $MICRO_SERVICE_IP $MICRO_SERVICE_PORT +state=`echo -e "\n" | telnet $MICRO_SERVICE_IP $MICRO_SERVICE_PORT 2>/dev/null | grep Connected | wc -l` +isSuccess "$MICRO_SERVICE_NAME start" + + +#check visualis-server +sleep 10 #for visualis-server +MICRO_SERVICE_NAME=visualis-server +MICRO_SERVICE_IP=$VISUALIS_SERVER_INSTALL_IP +MICRO_SERVICE_PORT=$VISUALIS_SERVER_PORT +sh $workDir/checkMicro.sh $MICRO_SERVICE_NAME $MICRO_SERVICE_IP $MICRO_SERVICE_PORT +state=`echo -e "\n" | telnet $MICRO_SERVICE_IP $MICRO_SERVICE_PORT 2>/dev/null | grep Connected | wc -l` +isSuccess "$MICRO_SERVICE_NAME start" + diff --git a/conf/config.sh b/conf/config.sh index b5a00f706b..895c2c02c4 100644 --- a/conf/config.sh +++ b/conf/config.sh @@ -15,7 +15,7 @@ WORKSPACE_USER_ROOT_PATH=file:///tmp/linkis/ RESULT_SET_ROOT_PATH=hdfs:///tmp/linkis ### 1、DataCheck APPJOINT,This service is used to provide DataCheck capability. -HIVE_META_URL=jdbc:mysql://127.0.0.1:3306/linkis?characterEncoding=UTF-8 +HIVE_META_URL=jdbc:mysql://127.0.0.1:3306/hivemeta?characterEncoding=UTF-8 HIVE_META_USER=xxx HIVE_META_PASSWORD=xxx @@ -50,16 +50,16 @@ GATEWAY_PORT=9001 ### SSH Port SSH_PORT=22 -#for azkaban +#Used to store the azkaban project transformed by DSS WDS_SCHEDULER_PATH=file:///appcom/tmp/wds/scheduler ###The IP address and port are written into the database here, so be sure to plan ahead ## visualis-server VISUALIS_SERVER_INSTALL_IP=127.0.0.1 VISUALIS_SERVER_PORT=9007 -### visualis nginx acess ip +### visualis nginx acess ip,keep consistent with DSS front end VISUALIS_NGINX_IP=0.0.0.0 -VISUALIS_NGINX_PORT=9009 +VISUALIS_NGINX_PORT=8088 ### Eventchecker APPJOINT ### This service is used to provide Eventchecker capability. it's config in db.sh same as dss-server. diff --git a/db/azkaban.sql b/db/azkaban.sql new file mode 100644 index 0000000000..489ded7bb1 --- /dev/null +++ b/db/azkaban.sql @@ -0,0 +1,3 @@ +INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'schedulis', NULL, '0', '1', NULL, '0', NULL, NULL, '1', NULL, NULL); +UPDATE `dss_application` SET url = 'http://AZKABAN_ADRESS_IP_2:AZKABAN_ADRESS_PORT', project_url = 'http://AZKABAN_ADRESS_IP_2:AZKABAN_ADRESS_PORT/manager?project=${projectName}',homepage_url = 'http://AZKABAN_ADRESS_IP_2:AZKABAN_ADRESS_PORT/homepage' WHERE `name` in + ('schedulis'); diff --git a/db/dss_dml.sql b/db/dss_dml.sql index 3ee9fca202..27146dedc4 100644 --- a/db/dss_dml.sql +++ b/db/dss_dml.sql @@ -1,6 +1,5 @@ INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'linkis', null, '0', '1', NULL, '0', '/home', NULL, '0', '/home', NULL); INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'visualis', null, '0', '1', NULL, '0', NULL, NULL, '1', NULL, NULL); -INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'schedulis', NULL, '0', '1', NULL, '0', NULL, NULL, '1', NULL, NULL); INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'workflow', null, '0', '1', NULL, '0', '/workflow', NULL, '0', '/project', NULL); INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'console', null, '0', '1', NULL, '0', '/console', NULL, '0', '/console', NULL); @@ -30,7 +29,6 @@ INSERT INTO `dss_flow_taxonomy` (`id`, `name`, `description`, `creator_id`, `cre UPDATE `dss_application` SET url = 'http://GATEWAY_INSTALL_IP_2:GATEWAY_PORT' WHERE `name` in('linkis','workflow'); UPDATE `dss_application` SET url = 'http://VISUALIS_NGINX_IP_2:VISUALIS_NGINX_PORT' WHERE `name` in('visualis'); UPDATE `dss_application` SET project_url = 'http://VISUALIS_NGINX_IP_2:VISUALIS_NGINX_PORT/dss/visualis/#/project/${projectId}',homepage_url = 'http://VISUALIS_NGINX_IP_2:VISUALIS_NGINX_PORT/dss/visualis/#/projects' WHERE `name` in('visualis'); -UPDATE `dss_application` SET url = 'http://AZKABAN_ADRESS_IP_2:AZKABAN_ADRESS_PORT', project_url = 'http://AZKABAN_ADRESS_IP_2:AZKABAN_ADRESS_PORT/manager?project=${projectName}',homepage_url = 'http://AZKABAN_ADRESS_IP_2:AZKABAN_ADRESS_PORT/homepage' WHERE `name` in('schedulis'); UPDATE `dss_workflow_node` SET jump_url = 'http://VISUALIS_NGINX_IP_2:VISUALIS_NGINX_PORT/dss/visualis/#/project/${projectId}/display/${nodeId}' where node_type = 'linkis.appjoint.visualis.display'; UPDATE `dss_workflow_node` SET jump_url = 'http://VISUALIS_NGINX_IP_2:VISUALIS_NGINX_PORT/dss/visualis/#/project/${projectId}/portal/${nodeId}/portalName/${nodeName}' where node_type = 'linkis.appjoint.visualis.dashboard'; @@ -59,4 +57,4 @@ insert into `linkis_config_key_tree` VALUES(NULL,@key_id2,@tree_id1); insert into `linkis_config_key_tree` VALUES(NULL,@key_id3,@tree_id1); insert into `linkis_config_key_tree` VALUES(NULL,@key_id4,@tree_id1); insert into `linkis_config_key_tree` VALUES(NULL,@key_id5,@tree_id1); -insert into `linkis_config_key_tree` VALUES(NULL,@key_id6,@tree_id2); \ No newline at end of file +insert into `linkis_config_key_tree` VALUES(NULL,@key_id6,@tree_id2); diff --git a/db/qualitis.sql b/db/qualitis.sql new file mode 100644 index 0000000000..04fb15cfb2 --- /dev/null +++ b/db/qualitis.sql @@ -0,0 +1,3 @@ +INSERT INTO `dss_application` (`id`, `name`, `url`, `is_user_need_init`, `level`, `user_init_url`, `exists_project_service`, `project_url`, `enhance_json`, `if_iframe`, `homepage_url`, `redirect_url`) VALUES (NULL, 'qualitis', 'http://QUALITIS_ADRESS_IP_2:QUALITIS_ADRESS_PORT', '0', '1', NULL, '1', 'http://QUALITIS_ADRESS_IP_2:QUALITIS_ADRESS_PORT/#/projects/list?id=${projectId}&flow=true', NULL, '1', 'http://QUALITIS_ADRESS_IP_2:QUALITIS_ADRESS_PORT/#/dashboard', 'http://QUALITIS_ADRESS_IP_2:QUALITIS_ADRESS_PORT/qualitis/api/v1/redirect'); +SELECT @qualitis_appid:=id from dss_application WHERE `name` = 'qualitis'; +INSERT INTO `dss_workflow_node` (`id`, `icon`, `node_type`, `application_id`, `submit_to_scheduler`, `enable_copy`, `should_creation_before_node`, `support_jump`, `jump_url`) VALUES (NULL, NULL, 'linkis.appjoint.qualitis', @qualitis_appid, NULL, '1', '0', '1', 'http://QUALITIS_ADRESS_IP_2:QUALITIS_ADRESS_PORT/#/addGroupTechniqueRule?tableType=1&id=${projectId}&ruleGroupId=${ruleGroupId}&nodeId=${nodeId}'); \ No newline at end of file diff --git a/dss-flow-execution-entrance/bin/start-dss-flow-execution-entrance.sh b/dss-flow-execution-entrance/bin/start-dss-flow-execution-entrance.sh index 5ce15dc90f..9bd4a006cb 100644 --- a/dss-flow-execution-entrance/bin/start-dss-flow-execution-entrance.sh +++ b/dss-flow-execution-entrance/bin/start-dss-flow-execution-entrance.sh @@ -1,33 +1,49 @@ #!/bin/bash - cd `dirname $0` cd .. HOME=`pwd` -export DWS_ENGINE_MANAGER_HOME=$HOME -export DWS_ENGINE_MANAGER_PID=$HOME/bin/linkis.pid +export SERVER_PID=$HOME/bin/linkis.pid +export SERVER_LOG_PATH=$HOME/logs +export SERVER_CLASS=com.webank.wedatasphere.linkis.DataWorkCloudApplication -if [[ -f "${DWS_ENGINE_MANAGER_PID}" ]]; then - pid=$(cat ${DWS_ENGINE_MANAGER_PID}) - if kill -0 ${pid} >/dev/null 2>&1; then - echo "FlowExecution Entrance is already running." - return 0; - fi +if test -z "$SERVER_HEAP_SIZE" +then + export SERVER_HEAP_SIZE="512M" fi -export DWS_ENGINE_MANAGER_LOG_PATH=$HOME/logs -export DWS_ENGINE_MANAGER_HEAP_SIZE="1G" -export DWS_ENGINE_MANAGER_JAVA_OPTS="-Xms$DWS_ENGINE_MANAGER_HEAP_SIZE -Xmx$DWS_ENGINE_MANAGER_HEAP_SIZE -XX:+UseG1GC -XX:MaxPermSize=500m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=11730" +if test -z "$SERVER_JAVA_OPTS" +then + export SERVER_JAVA_OPTS=" -Xmx$SERVER_HEAP_SIZE -XX:+UseG1GC -Xloggc:$HOME/logs/linkis-gc.log" +fi -echo $HOME/lib/ +if [[ -f "${SERVER_PID}" ]]; then + pid=$(cat ${SERVER_PID}) + if kill -0 ${pid} >/dev/null 2>&1; then + echo "Server is already running." + exit 1 + fi +fi -nohup java $DWS_ENGINE_MANAGER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* com.webank.wedatasphere.linkis.DataWorkCloudApplication 2>&1 > $DWS_ENGINE_MANAGER_LOG_PATH/linkis.out & +nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out & pid=$! if [[ -z "${pid}" ]]; then - echo "FlowExecution Entrance start failed!" + echo "server $SERVER_NAME start failed!" exit 1 else - echo "FlowExecution Entrance start succeeded!" - echo $pid > $DWS_ENGINE_MANAGER_PID + echo "server $SERVER_NAME start succeeded!" + echo $pid > $SERVER_PID sleep 1 fi + + + + + + + + + + + + diff --git a/dss-server/bin/start-dss-server.sh b/dss-server/bin/start-dss-server.sh index e53e44a167..518cd8da17 100644 --- a/dss-server/bin/start-dss-server.sh +++ b/dss-server/bin/start-dss-server.sh @@ -1,33 +1,39 @@ #!/bin/bash - cd `dirname $0` cd .. HOME=`pwd` -export DWS_ENGINE_MANAGER_HOME=$HOME -export DWS_ENGINE_MANAGER_PID=$HOME/bin/linkis.pid +export SERVER_PID=$HOME/bin/linkis.pid +export SERVER_LOG_PATH=$HOME/logs +export SERVER_CLASS=com.webank.wedatasphere.dss.DSSSpringApplication + +if test -z "$SERVER_HEAP_SIZE" +then + export SERVER_HEAP_SIZE="512M" +fi + +if test -z "$SERVER_JAVA_OPTS" +then + export SERVER_JAVA_OPTS=" -Xmx$SERVER_HEAP_SIZE -XX:+UseG1GC -Xloggc:$HOME/logs/linkis-gc.log" +fi -if [[ -f "${DWS_ENGINE_MANAGER_PID}" ]]; then - pid=$(cat ${DWS_ENGINE_MANAGER_PID}) +if [[ -f "${SERVER_PID}" ]]; then + pid=$(cat ${SERVER_PID}) if kill -0 ${pid} >/dev/null 2>&1; then - echo "DSS SERVER is already running." - return 0; + echo "Server is already running." + exit 1 fi fi -export DWS_ENGINE_MANAGER_LOG_PATH=$HOME/logs -export DWS_ENGINE_MANAGER_HEAP_SIZE="1G" -export DWS_ENGINE_MANAGER_JAVA_OPTS="-Xms$DWS_ENGINE_MANAGER_HEAP_SIZE -Xmx$DWS_ENGINE_MANAGER_HEAP_SIZE -XX:+UseG1GC -XX:MaxPermSize=500m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=11729" - -nohup java $DWS_ENGINE_MANAGER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* com.webank.wedatasphere.dss.DSSSpringApplication 2>&1 > $DWS_ENGINE_MANAGER_LOG_PATH/linkis.out & +nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out & pid=$! if [[ -z "${pid}" ]]; then - echo "DSS SERVER start failed!" - sleep 1 + echo "server $SERVER_NAME start failed!" exit 1 else - echo "DSS SERVER start succeeded!" - echo $pid > $DWS_ENGINE_MANAGER_PID + echo "server $SERVER_NAME start succeeded!" + echo $pid > $SERVER_PID sleep 1 fi -exit 1 + + diff --git a/plugins/linkis/linkis-appjoint-entrance/bin/start-linkis-appjoint-entrance.sh b/plugins/linkis/linkis-appjoint-entrance/bin/start-linkis-appjoint-entrance.sh index 0128a4d1cd..4436def35d 100644 --- a/plugins/linkis/linkis-appjoint-entrance/bin/start-linkis-appjoint-entrance.sh +++ b/plugins/linkis/linkis-appjoint-entrance/bin/start-linkis-appjoint-entrance.sh @@ -1,36 +1,37 @@ #!/bin/bash - cd `dirname $0` cd .. -HOE=`pwd` - export DWS_ENTRANCE_HOE=$HOE +HOME=`pwd` -export DWS_ENTRANCE_PID=$HOE/bin/linkis-appjoint-entrance.pid +export SERVER_PID=$HOME/bin/linkis.pid +export SERVER_LOG_PATH=$HOME/logs +export SERVER_CLASS=com.webank.wedatasphere.linkis.DataWorkCloudApplication -if [[ -f "${DWS_ENTRANCE_PID}" ]]; then - pid=$(cat ${DWS_ENTRANCE_PID}) - if kill -0 ${pid} >/dev/null 2>&1; then - echo "Entrance is already running." - return 0; - fi +if test -z "$SERVER_HEAP_SIZE" +then + export SERVER_HEAP_SIZE="512M" fi -export DWS_ENTRANCE_LOG_PATH=$HOE/logs -export DWS_ENTRANCE_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=19959" -export DWS_ENTRANCE_HEAP_SIZE="2G" -export DWS_ENTRANCE_JAVA_OPTS="-Xms$DWS_ENTRANCE_HEAP_SIZE -Xmx$DWS_ENTRANCE_HEAP_SIZE -XX:+UseG1GC -XX:MaxPermSize=500m $DWS_ENTRANCE_DEBUG" - -cmd="nohup java $DWS_ENTRANCE_JAVA_OPTS -cp $HOE/conf:$HOE/lib/* com.webank.wedatasphere.linkis.DataWorkCloudApplication 2>&1 > $DWS_ENTRANCE_LOG_PATH/linkis.out &" -#echo "CMD IS $cmd" +if test -z "$SERVER_JAVA_OPTS" +then + export SERVER_JAVA_OPTS=" -Xmx$SERVER_HEAP_SIZE -XX:+UseG1GC -Xloggc:$HOME/logs/linkis-gc.log" +fi +if [[ -f "${SERVER_PID}" ]]; then + pid=$(cat ${SERVER_PID}) + if kill -0 ${pid} >/dev/null 2>&1; then + echo "Server is already running." + exit 1 + fi +fi -nohup java $DWS_ENTRANCE_JAVA_OPTS -cp $HOE/conf:$HOE/lib/* com.webank.wedatasphere.linkis.DataWorkCloudApplication 2>&1 > $DWS_ENTRANCE_LOG_PATH/linkis.out & +nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out & pid=$! if [[ -z "${pid}" ]]; then - echo "AppJoint Entrance start failed!" + echo "server $SERVER_NAME start failed!" exit 1 else - echo "AppJoint Entrance start succeeded!" - echo $pid > $DWS_ENTRANCE_PID + echo "server $SERVER_NAME start succeeded!" + echo $pid > $SERVER_PID sleep 1 fi diff --git a/plugins/linkis/linkis-appjoint-entrance/bin/stop-linkis-appjoint-entrance.sh b/plugins/linkis/linkis-appjoint-entrance/bin/stop-linkis-appjoint-entrance.sh index f3aad1635d..7d47032507 100644 --- a/plugins/linkis/linkis-appjoint-entrance/bin/stop-linkis-appjoint-entrance.sh +++ b/plugins/linkis/linkis-appjoint-entrance/bin/stop-linkis-appjoint-entrance.sh @@ -4,7 +4,7 @@ cd `dirname $0` cd .. HOE=`pwd` -export DWS_ENTRANCE_PID=$HOE/bin/linkis-appjoint-entrance.pid +export DWS_ENTRANCE_PID=$HOE/bin/linkis.pid function wait_for_DWS_ENGINE_MANAGER_to_die() { local pid From 94c3586c8488d46940b9323fc47fc5c49057604e Mon Sep 17 00:00:00 2001 From: chaogefeng <673120261@163.com> Date: Fri, 13 Dec 2019 17:33:17 +0800 Subject: [PATCH 2/2] Automated Installation Enhance close #37 --- bin/checkEnv.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/checkEnv.sh b/bin/checkEnv.sh index c377c05ea2..dffcb77189 100644 --- a/bin/checkEnv.sh +++ b/bin/checkEnv.sh @@ -29,14 +29,18 @@ check_cmd() { need_cmd() { if ! check_cmd "$1"; then - err "need '$1' (command not found)" + err "need '$1' (your linux command not found)" fi } -echo "<-----start to check used cmd---->" +echo "<-----start to check linux cmd:yum java mysql unzip expect telnet sed tar---->" need_cmd yum need_cmd java need_cmd mysql need_cmd unzip need_cmd expect need_cmd telnet -echo "<-----end to check used cmd------>" +need_cmd sed +need_cmd tar +need_cmd source +need_cmd hostname +echo "<-----end to check linux cmd:yum java mysql unzip expect telnet sed tar------>"