You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/06/15 02:48:32 UTC

[incubator-linkis] branch dev-1.2.0 updated: [Feat][Deploy] add graceful upgrade script (#2284)

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.2.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.2.0 by this push:
     new 174caf974 [Feat][Deploy] add graceful upgrade script (#2284)
174caf974 is described below

commit 174caf974bd7505ed6e6bf10143915aaf680e18a
Author: legendtkl <ta...@gmail.com>
AuthorDate: Wed Jun 15 10:48:27 2022 +0800

    [Feat][Deploy] add graceful upgrade script (#2284)
---
 .../assembly-combined/sbin/graceful-upgrade.sh     | 103 +++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh b/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh
new file mode 100755
index 000000000..19e13c2b9
--- /dev/null
+++ b/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh
@@ -0,0 +1,103 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+function print_usage(){
+  echo "Usage: graceful-upgrade [serverName] [ip]"
+  echo " serverName            The service name [ps-publicservice,cg-linkismanager,ps-cs,cg-engineconnmanager,cg-entrance,cg-engineplugin,ps-data-source-manager,ps-metadatamanager] of the operation"
+  echo " ip                    The service instance's ip"
+  echo "Most commands print help when invoked w/o parameters."
+}
+
+function startApp(){
+  echo "<-------------------------------->"
+  echo "Begin to start $SERVER_NAME"
+  SERVER_START_CMD="sh $LINKIS_HOME/sbin/linkis-daemon.sh restart $SERVER_NAME"
+  if test -z "$SERVER_IP"
+  then
+    SERVER_IP=$local_host
+  fi
+
+  executeCMD $SERVER_IP "$SERVER_START_CMD"
+
+  isSuccess "End to start $SERVER_NAME"
+  echo "<-------------------------------->"
+  sleep 3
+}
+
+function getPort(){
+  case $SERVER_NAME in
+    "ps-publicservice")
+      export SERVER_PORT=$PUBLICSERVICE_PORT
+      ;;
+    "cg-linkismanager")
+      export SERVER_PORT=$MANAGER_PORT
+      ;;
+    "ps-cs")
+      export SERVER_PORT=$CS_PORT
+      ;;
+    "cg-engineconnmanager")
+      export SERVER_PORT=$ENGINECONNMANAGER_PORT
+      ;;
+    "cg-entrance")
+      export SERVER_PORT=$ENTRANCE_PORT
+      ;;
+    "cg-engineplugin")
+      export SERVER_PORT=$ENGINECONN_PLUGIN_SERVER_PORT
+      ;;
+    "ps-data-source-manager")
+      export SERVER_PORT=$DATASOURCE_MANAGER_PORT
+      ;;
+    "ps-metadatamanager")
+      export SERVER_PORT=$METADATA_MANAGER_PORT
+      ;;
+  esac
+}
+
+if [ $# != 2 ]; then
+  print_usage
+  exit 2
+fi
+
+source /etc/profile
+source ~/.bash_profile
+
+cd `dirname $0`
+cd ..
+INSTALL_HOME=`pwd`
+
+# set LINKIS_HOME
+if [ "$LINKIS_HOME" = "" ]; then
+  export LINKIS_HOME=$INSTALL_HOME
+fi
+echo $LINKIS_HOME
+
+if [ "$LINKIS_CONF_DIR" = "" ]; then
+  export LINKIS_CONF_DIR=$LINKIS_HOME/conf
+fi
+source $LINKIS_CONF_DIR/linkis-env.sh
+
+export SERVER_NAME=$1
+startApp
+
+IP=$2
+getPort
+echo $SERVER_PORT
+
+offlineUrl=$IP:$SERVER_PORT/api/rest_j/v1/offline
+echo "Begin to offline $SERVER_NAME with curl $offlineUrl"
+curl $offlineUrl
+
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org