ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject [1/2] ambari git commit: AMBARI-22647. Rafactor: Package Log Search and Log Feeder into jars + cleanup start scripts (oleewere)
Date Mon, 18 Dec 2017 15:31:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f9ad13d0a -> 562795c4d


http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
new file mode 100755
index 0000000..128617c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
@@ -0,0 +1,274 @@
+#!/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.
+
+JVM="java"
+
+if [ -x $JAVA_HOME/bin/java ]; then
+  JVM=$JAVA_HOME/bin/java
+fi
+
+if [ "$LOGSEARCH_JAVA_MEM" = "" ]; then
+    LOGSEARCH_JAVA_MEM="-Xmx1g"
+fi
+
+readlinkf(){
+  # get real path on mac OSX
+  perl -MCwd -e 'print Cwd::abs_path shift' "$1";
+}
+
+if [ "$(uname -s)" = 'Linux' ]; then
+  SCRIPT_DIR="`dirname "$(readlink -f "$0")"`"
+else
+  SCRIPT_DIR="`dirname "$(readlinkf "$0")"`"
+fi
+
+LOGSEARCH_ROOT_DIR="`dirname \"$SCRIPT_DIR\"`"
+LOGSEARCH_LIBS_DIR="$LOGSEARCH_ROOT_DIR/libs"
+LOGSEARCH_WEBAPP_DIR="$LOGSEARCH_ROOT_DIR/webapp"
+
+if [ "$LOGSEARCH_CONF_DIR" = "" ]; then
+  if [ -d "$LOGSEARCH_ROOT_DIR/conf" ]; then
+    LOGSEARCH_CONF_DIR="$LOGSEARCH_ROOT_DIR/conf"
+  fi
+fi
+
+if [ -f "$LOGSEARCH_CONF_DIR/logsearch-env.sh" ]; then
+  source $LOGSEARCH_CONF_DIR/logsearch-env.sh
+fi
+
+if [ ! -z "$LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE" ]; then
+  source $LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE
+fi
+
+if [ -z "$LOGSEARCH_PID_FILE" ]; then
+  LOGSEARCH_PID_DIR=$HOME
+  export LOGSEARCH_PID_FILE=$LOGSEARCH_PID_DIR/logsearch.pid
+fi
+
+if [ -z "$LOG_FILE" ]; then
+  export LOG_FILE="logsearch.log"
+fi
+
+LOGSEARCH_GC_LOGFILE="logsearch_gc.log"
+
+if [ -z "$LOG_PATH" ]; then
+  LOG_FILE="$HOME/$LOG_FILE"
+  LOGSEARCH_GC_LOGFILE="$HOME/$LOGSEARCH_GC_LOGFILE"
+else
+  LOG_PATH_WITHOUT_SLASH=${LOG_PATH%/}
+  LOG_FILE="$LOG_PATH_WITHOUT_SLASH/$LOG_FILE"
+  LOGSEARCH_GC_LOGFILE="$LOG_PATH_WITHOUT_SLASH/$LOGSEARCH_GC_LOGFILE"
+fi
+
+LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH_GC_LOGFILE"
+
+function print_usage() {
+  cat << EOF
+
+   Usage: [<command>] [<arguments with flags>]
+
+   commands:
+     start                         Start Log Search
+     stop                          Stop Log Search
+     status                        Check Log Search status (pid file)
+     help                          Print usage
+
+
+   start command arguments:
+     -d, --debug                   Start java process in debug mode
+     -f, --foreground              Start java process in foreground
+
+EOF
+}
+
+function spinner() {
+  local pid=$1
+  local delay=0.5
+  local spinstr='|/-\'
+  while [ "$(ps aux | awk '{print $2}' | grep -w $pid)" ]; do
+      local temp=${spinstr#?}
+      printf " [%c]  " "$spinstr"
+      local spinstr=$temp${spinstr%"$temp"}
+      sleep $delay
+      printf "\b\b\b\b\b\b"
+  done
+  printf "    \b\b\b\b"
+}
+
+function status() {
+  echo "Checking Log Search status ..."
+  if [ -f "$LOGSEARCH_PID_FILE" ]; then
+    LOGSEARCH_PID=`cat "$LOGSEARCH_PID_FILE"`
+  else
+    echo "Log Search pid not exists. (probably the process is not running)"
+    exit 1
+  fi
+
+  if ps -p $LOGSEARCH_PID > /dev/null
+   then
+   echo "Log Search process is running. (pid: $LOGSEARCH_PID)"
+   exit 0
+  else
+   echo "Log Search process is not running."
+   exit 1
+  fi
+}
+
+function start() {
+  (status);
+  exit_status=$(echo $?)
+  if [ "$exit_status" = "0" ]; then
+    echo "Skipping start process."
+    exit 0
+  fi
+
+  FG="false"
+  LOGSEARCH_DEBUG_SUSPEND=${LOGSEARCH_DEBUG_SUSPEND:-n}
+  LOGSEARCH_DEBUG_PORT=${LOGSEARCH_DEBUG_PORT:-"5005"}
+
+  if [ "$LOGSEARCH_DEBUG" = "true" ]; then
+    LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGSEARCH_DEBUG_PORT,server=y,suspend=$LOGSEARCH_DEBUG_SUSPEND "
+  fi
+
+  if [ "$LOGSEARCH_SSL" = "true" ]; then
+    LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Djavax.net.ssl.keyStore=$LOGSEARCH_KEYSTORE_LOCATION -Djavax.net.ssl.keyStoreType=$LOGSEARCH_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$LOGSEARCH_TRUSTSTORE_LOCATION -Djavax.net.ssl.trustStoreType=$LOGSEARCH_TRUSTSTORE_TYPE"
+  fi
+
+  if [ "$LOGSEARCH_JMX" = "true" ]; then
+   LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=2099"
+  fi
+
+  if [ $# -gt 0 ]; then
+    while true; do
+      case "$1" in
+          -f|--foreground)
+              FG="true"
+              shift
+          ;;
+          -d|--debug)
+              if [ "$LOGSEARCH_DEBUG" != "true" ]; then
+                LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGSEARCH_DEBUG_PORT,server=y,suspend=$LOGSEARCH_DEBUG_SUSPEND "
+              fi
+              shift
+          ;;
+          *)
+              if [ "${1:0:2}" == "-D" ]; then
+                # pass thru any opts that begin with -D (java system props)
+                LOGSEARCH_JAVA_OPTS+=("$1")
+                echo "$LOGSEARCH_JAVA_OPTS"
+                shift
+              else
+                if [ "$1" != "" ]; then
+                  print_usage
+                  exit 1
+                else
+                  break
+                fi
+              fi
+          ;;
+      esac
+    done
+  fi
+
+  if [ $FG == "true" ]; then
+    echo "Starting Log Search... (foreground) pid_file=$LOGSEARCH_PID_FILE"
+    echo "Run command $JVM -cp '$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*' $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch"
+    $JVM -cp "$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch
+  else
+   echo "Starting Log Search... Output file=$LOG_FILE pid_file=$LOGSEARCH_PID_FILE"
+   echo "Run command nohup $JVM -cp '$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*' $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch"
+   nohup $JVM -cp "$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch > $LOG_FILE 2>&1 &
+  fi
+}
+
+function stop() {
+  LOGSEARCH_STOP_WAIT=3
+  if [ -f "$LOGSEARCH_PID_FILE" ]; then
+    LOGSEARCH_PID=`cat "$LOGSEARCH_PID_FILE"`
+  fi
+
+  if [ "$LOGSEARCH_PID" != "" ]; then
+    echo -e "Sending stop command to Log Search... Checking PID: $LOGSEARCH_PID."
+    kill $LOGSEARCH_PID
+      (loops=0
+      while true
+      do
+        CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGSEARCH_PID | sort -r | tr -d ' '`
+        if [ "$CHECK_PID" != "" ]; then
+          slept=$((loops * 2))
+          if [ $slept -lt $LOGSEARCH_STOP_WAIT ]; then
+            sleep 2
+            loops=$[$loops+1]
+          else
+            exit # subshell!
+          fi
+        else
+          exit # subshell!
+        fi
+      done) &
+    spinner $!
+    rm -f "$LOGSEARCH_PID_FILE"
+  else
+    echo -e "No Log Search process found to stop."
+    exit 0
+  fi
+
+  CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGSEARCH_PID | sort -r | tr -d ' '`
+  if [ "$CHECK_PID" != "" ]; then
+    echo -e "Log Search process $LOGSEARCH_PID is still running; forcefully killing it now."
+    kill -9 $LOGSEARCH_PID
+    echo "Killed process $LOGSEARCH_PID"
+    rm -f "$LOGSEARCH_PID_FILE"
+    sleep 1
+  else
+    echo "Log Search is stopped."
+  fi
+
+  CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGSEARCH_PID | sort -r | tr -d ' '`
+  if [ "$CHECK_PID" != "" ]; then
+    echo "ERROR: Failed to kill Log Search Java process $LOGSEARCH_PID ... script fails."
+    exit 1
+  fi
+}
+
+if [ $# -gt 0 ]; then
+    SCRIPT_CMD="$1"
+    shift
+else
+   print_usage
+   exit 1
+fi
+
+case $SCRIPT_CMD in
+  start)
+    start ${1+"$@"}
+  ;;
+  stop)
+    stop
+  ;;
+  status)
+    status
+  ;;
+  help)
+    print_usage
+    exit 0
+  ;;
+  *)
+    print_usage
+    exit 1
+  ;;
+
+esac
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
deleted file mode 100755
index 241b32f..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/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.
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-if [ ! -z "$LOGSEARCH_INCLUDE" ]; then
-   source $LOGSEARCH_INCLUDE
-fi
-
-if [ ! -z "$LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE" ]; then
-   source $LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE
-fi
-
-JAVA=java
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
-fi
-
-if [ "$LOGSEARCH_JAVA_MEM" = "" ]; then
-    LOGSEARCH_JAVA_MEM="-Xmx1g"
-fi
-
-if [ "$LOGFILE" = "" ]; then
-    LOGFILE="/var/log/logsearch/logsearch.out"
-    touch $LOGFILE 2> /dev/null
-    if [ $? -ne 0 ]; then
-	LOGFILE=/tmp/${USER}_logsearch.out
-    fi
-fi
-
-
-#Temporarily enabling JMX so we can monitor the memory and CPU utilization of the process
-#JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=3098"
-
-LOGSEARCH_DEBUG_SUSPEND=${LOGSEARCH_DEBUG_SUSPEND:-n}
-if [ "$LOGSEARCH_DEBUG" = "true" ] && [ ! -z "$LOGSEARCH_DEBUG_PORT" ]; then
-  LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGSEARCH_DEBUG_PORT,server=y,suspend=$LOGSEARCH_DEBUG_SUSPEND "
-fi
-
-if [ "$LOGSEARCH_SSL" = "true" ]; then
-  LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Djavax.net.ssl.keyStore=$LOGSEARCH_KEYSTORE_LOCATION -Djavax.net.ssl.keyStoreType=$LOGSEARCH_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$LOGSEARCH_TRUSTSTORE_LOCATION -Djavax.net.ssl.trustStoreType=$LOGSEARCH_TRUSTSTORE_TYPE"
-fi
-
-if [ "$PID_FILE" = "" ]; then
-    LOGSEARCH_PID_DIR=$HOME
-    PID_FILE=$LOGSEARCH_PID_DIR/logsearch-search-$USER.pid
-fi
-
-if [ -f ${PID_FILE} ]; then
-    PID=`cat ${PID_FILE}`
-    if kill -0 $PID 2>/dev/null; then
-	echo "logsearch already running (${PID}) killing..."
-	kill $PID 2>/dev/null
-	sleep 5
-	if kill -0 $PID 2>/dev/null; then
-	    echo "logsearch still running. Will kill process forcefully in another 10 seconds..."
-	    sleep 10
-	    kill -9 $PID 2>/dev/null
-	    sleep 2
-	fi
-    fi
-
-    if kill -0 $PID 2>/dev/null; then
-	echo "ERROR: Even after all efforts to stop logsearch, it is still running. pid=$PID. Please manually kill the service and try again."
-	exit 1
-    fi
-fi
-
-if [ -z "$LOGSEARCH_CONF_DIR" ]; then
-  LOGSEARCH_CONF_DIR="/etc/logsearch/conf"
-  if [ ! -d $LOGSEARCH_CONF_DIR ]; then
-      if [ -d $script_dir/classes ]; then
-	  LOGSEARCH_CONF_DIR=$script_dir/classes
-      fi
-  fi
-  echo "LOGSEARCH_CONF_DIR not found. Use default: $LOGSEARCH_CONF_DIR"
-fi
-
-LOGSEARCH_GC_LOGFILE=`dirname $LOGFILE`/logsearch_gc.log
-LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH_GC_LOGFILE"
-
-echo "Starting logsearch. Output file=$LOGFILE pid_file=$PID_FILE"
-#LOGSEARCH_CLI_CLASSPATH=
-#set -x
-nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $* > $LOGFILE 2>&1 &

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh
deleted file mode 100755
index 3612f08..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/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.
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-if [ "$PID_FILE" = "" ]; then
-    LOGSEARCH_PID_DIR=$HOME
-    PID_FILE=$LOGSEARCH_PID_DIR/logsearch-search-$USER.pid
-fi
-
-if [ -f ${PID_FILE} ]; then
-    PID=`cat ${PID_FILE}`
-    if kill -0 $PID 2>/dev/null; then
-	echo "logsearch running with process id (${PID}). Killing..."
-	kill $PID 2>/dev/null
-	sleep 5
-	if kill -0 $PID 2>/dev/null; then
-	    echo "logsearch still running. Will kill process forcefully in another 10 seconds..."
-	    sleep 10
-	    kill -9 $PID 2>/dev/null
-	    sleep 2
-	fi
-    fi
-
-    if kill -0 $PID 2>/dev/null; then
-	echo "ERROR: Even after all efforts to stop logsearch, it is still running. pid=$PID. Please manually kill the service and try again."
-	exit 1
-    fi
-fi
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/Dockerfile b/ambari-logsearch/docker/Dockerfile
index e79f61b..8bfcae3 100644
--- a/ambari-logsearch/docker/Dockerfile
+++ b/ambari-logsearch/docker/Dockerfile
@@ -64,11 +64,9 @@ RUN chmod -R 777 /root/test-config
 RUN chmod +x /root/start.sh
 
 ENV SOLR_CONFIG_LOCATION /root/config/solr
-ENV LOGSEARCH_CONFIG_LOCATION /root/config/logsearch
-ENV LOGFEEDER_CONFIG_LOCATION /root/config/logfeeder
+ENV LOGSEARCH_CONF_DIR /root/config/logsearch
+ENV LOGFEEDER_CONF_DIR /root/config/logfeeder
 ENV SOLR_INCLUDE /root/config/solr/solr-env.sh
-ENV LOGSEARCH_INCLUDE /root/config/logsearch/logsearch-env.sh
-ENV LOGFEEDER_INCLUDE /root/config/logfeeder/logfeeder-env.sh
 
 RUN mkdir -p /var/run/ambari-logsearch-solr /var/log/ambari-logsearch-solr /var/run/ambari-infra-solr-client \
   /var/log/ambari-infra-solr-client /root/logsearch_solr_index/data \

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/all.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/all.yml b/ambari-logsearch/docker/all.yml
index 369db39..a5afb9a 100644
--- a/ambari-logsearch/docker/all.yml
+++ b/ambari-logsearch/docker/all.yml
@@ -35,6 +35,4 @@ services:
           - $MAVEN_REPOSITORY_LOCATION:/root/.m2
           - $AMBARI_LOCATION:/root/ambari
           - $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
-          - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
-          - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
-          - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes/org:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/org
\ No newline at end of file
+          - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/bin/start.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/bin/start.sh b/ambari-logsearch/docker/bin/start.sh
index bea06de..f2acf9b 100644
--- a/ambari-logsearch/docker/bin/start.sh
+++ b/ambari-logsearch/docker/bin/start.sh
@@ -49,6 +49,7 @@ function create_logsearch_configs() {
   mkdir /root/config/logsearch
   cp /root/test-config/logsearch/log4j.xml /root/config/logsearch/
   cp /root/test-config/logsearch/logsearch-env.sh /root/config/logsearch/
+  cp $LOGSEARCH_SERVER_PATH/conf/user_pass.json /root/config/logsearch/user_pass.json
   if [ $LOGSEARCH_HTTPS_ENABLED == 'true' ]
   then
     cp /root/test-config/logsearch/logsearch-https.properties /root/config/logsearch/logsearch.properties
@@ -87,7 +88,7 @@ function generate_keys() {
   fi
 }
 
-function start_solr() {
+function start_solr_d() {
   echo "Starting Solr..."
   /root/solr-$SOLR_VERSION/bin/solr start -cloud -s /root/logsearch_solr_index/data -verbose -force
   touch /var/log/ambari-logsearch-solr/solr.log
@@ -102,16 +103,25 @@ function start_solr() {
 }
 
 function start_logsearch() {
-  $LOGSEARCH_SERVER_PATH/run.sh
+  $LOGSEARCH_SERVER_PATH/bin/logsearch.sh start -f
+}
+
+function start_logsearch_d() {
+  $LOGSEARCH_SERVER_PATH/bin/logsearch.sh start
   touch /var/log/ambari-logsearch-portal/logsearch-app.log
 }
 
 function start_logfeeder() {
-  $LOGFEEDER_PATH/run.sh
+  $LOGFEEDER_PATH/bin/logfeeder.sh start -f
+}
+
+
+function start_logfeeder_d() {
+  $LOGFEEDER_PATH/bin/logfeeder.sh start
   touch /var/log/ambari-logsearch-logfeeder/logsearch-logfeeder.log
 }
 
-function start_selenium_server() {
+function start_selenium_server_d() {
   nohup java -jar /root/selenium-server-standalone.jar > /var/log/selenium-test.log &
 }
 
@@ -141,7 +151,7 @@ function main() {
       echo "Start Solr only.."
       export COMPONENT_LOG="solr"
       generate_keys
-      start_solr
+      start_solr_d
       log
      ;;
     "logfeeder")
@@ -150,7 +160,6 @@ function main() {
       export COMPONENT_LOG="logfeeder"
       generate_keys
       start_logfeeder
-      log
      ;;
     "logsearch")
       create_logsearch_configs
@@ -158,15 +167,14 @@ function main() {
       export COMPONENT_LOG="logsearch"
       generate_keys
       start_logsearch
-      log
      ;;
      *)
       create_configs
       generate_keys
-      start_selenium_server
-      start_solr
-      start_logfeeder
-      start_logsearch
+      start_selenium_server_d
+      start_solr_d
+      start_logfeeder_d
+      start_logsearch_d
       log
      ;;
   esac

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/docker-compose.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/docker-compose.yml b/ambari-logsearch/docker/docker-compose.yml
index 725af36..e865ec3 100644
--- a/ambari-logsearch/docker/docker-compose.yml
+++ b/ambari-logsearch/docker/docker-compose.yml
@@ -64,7 +64,6 @@ services:
       - $AMBARI_LOCATION:/root/ambari
       - $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
       - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
-      - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes/org:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/org
   logfeeder:
     image: ambari-logsearch:v1.0
     restart: always
@@ -83,7 +82,6 @@ services:
       - $AMBARI_LOCATION:/root/ambari
       - $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
       - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
-      - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
 networks:
    logsearch-network:
       driver: bridge

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/logsearch-logfeeder.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-logfeeder.yml b/ambari-logsearch/docker/logsearch-logfeeder.yml
index 4d48501..75d4391 100644
--- a/ambari-logsearch/docker/logsearch-logfeeder.yml
+++ b/ambari-logsearch/docker/logsearch-logfeeder.yml
@@ -29,7 +29,6 @@ services:
           - $AMBARI_LOCATION:/root/ambari
           - $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
           - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
-          - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
 networks:
      logsearch-network:
         driver: bridge
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/logsearch-server.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-server.yml b/ambari-logsearch/docker/logsearch-server.yml
index 6a0d71e..00c08a2 100644
--- a/ambari-logsearch/docker/logsearch-server.yml
+++ b/ambari-logsearch/docker/logsearch-server.yml
@@ -29,7 +29,6 @@ services:
           - $AMBARI_LOCATION:/root/ambari
           - $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
           - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
-          - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes/org:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/org
 networks:
      logsearch-network:
         driver: bridge
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
index 5beb093..a57b1f1 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
@@ -21,10 +21,11 @@ export LOGFEEDER_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/t
 export LOGFEEDER_CONF_DIR=/root/config/logfeeder
 
 #Logfile e.g. /var/log/logfeeder.log
-export LOGFILE=/var/log/ambari-logsearch-logfeeder/logfeeder.out
+export LOG_PATH=/var/log/ambari-logsearch-logfeeder
+export LOG_FILE=logfeeder.out
 
 #pid file e.g. /var/run/logfeeder.pid
-export PID_FILE=/var/run/ambari-logsearch-logfeeder/logfeeder.pid
+export LOGFEEDER_PID_FILE=/var/run/ambari-logsearch-logfeeder/logfeeder.pid
 
 export JAVA_HOME=/usr/java/default
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
index 1ae57bb..028cb9f 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
@@ -16,7 +16,7 @@
 cluster.name=cl1
 logfeeder.checkpoint.folder=/root/checkpoints
 logfeeder.metrics.collector.hosts=
-logfeeder.config.dir=/root/test-config/logfeeder/shipper-conf/
+logfeeder.config.dir=/root/config/logfeeder/shipper-conf/
 logfeeder.config.files=shipper-conf/global.config.json,\
   shipper-conf/output.config.json
 logfeeder.log.filter.enable=true

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
index 80f9c4c..2a2efd8 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
@@ -20,9 +20,10 @@ export LOGSEARCH_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-server/targ
 
 export LOGSEARCH_CONF_DIR=/root/config/logsearch
 
-export LOGFILE=/var/log/ambari-logsearch-portal/logsearch-app.log
+export LOG_PATH=/var/log/ambari-logsearch-portal
+export LOG_FILE=logsearch-app.log
 
-export PID_FILE=/var/run/ambari-logsearch-portal/logsearch.pid
+export LOGSEARCH_PID_FILE=/var/run/ambari-logsearch-portal/logsearch.pid
 
 export JAVA_HOME=/usr/java/default
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
index 5e7853d..6b59ac8 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
@@ -36,8 +36,8 @@ logsearch.solr.collection.history=history
 logsearch.solr.history.config.name=history
 logsearch.collection.history.replication.factor=1
 
-logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
-logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
+logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
+logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
 
 # Metrics
 logsearch.solr.metrics.collector.hosts=

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
index 5bde17c..22edf76 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
@@ -31,8 +31,8 @@ logsearch.audit.logs.split.interval.mins=15
 logsearch.collection.audit.logs.numshards=3
 logsearch.collection.audit.logs.replication.factor=2
 
-logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
-logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
+logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
+logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
 
 # History logs
 logsearch.solr.collection.history=history

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
index e308479..4afd7b6 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
@@ -160,6 +160,6 @@
       <property-file-name>logfeeder-env.sh.j2</property-file-name>
       <property-file-type>text</property-file-type>
     </value-attributes>
-    <on-ambari-upgrade add="true"/>
+    <on-ambari-upgrade add="true" update="true"/>
   </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
index a38f961..b43aaa6 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
@@ -29,7 +29,7 @@
   </property>
   <property>
     <name>logfeeder.checkpoint.folder</name>
-    <value>/etc/ambari-logsearch-logfeeder/conf/checkpoints</value>
+    <value>/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints</value>
     <description>Checkpoint folder for Log Feeder</description>
     <display-name>Log Feeder checkpoint dir</display-name>
     <value-attributes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
index 5c263db..cfc3504 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
@@ -107,7 +107,7 @@
   </property>
   <property>
     <name>logsearch_truststore_location</name>
-    <value>/etc/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
+    <value>/usr/lib/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
     <display-name>Log Search trust store location</display-name>
     <description>Location of the trust store file.</description>
     <on-ambari-upgrade add="true"/>
@@ -133,7 +133,7 @@
   </property>
   <property>
     <name>logsearch_keystore_location</name>
-    <value>/etc/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
+    <value>/usr/lib/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
     <display-name>Log Search key store location</display-name>
     <description>Location of the key store file.</description>
     <on-ambari-upgrade add="true"/>
@@ -183,6 +183,6 @@
       <property-file-name>logsearch-env.sh.j2</property-file-name>
       <property-file-type>text</property-file-type>
     </value-attributes>
-    <on-ambari-upgrade add="true"/>
+    <on-ambari-upgrade add="true" update="true"/>
   </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
index fbc29c8..2f6c13c 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
@@ -23,7 +23,6 @@ from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.libraries.script.script import Script
 from setup_logfeeder import setup_logfeeder
-from logsearch_common import kill_process
 
 class LogFeeder(Script):
   def install(self, env):
@@ -43,15 +42,15 @@ class LogFeeder(Script):
     env.set_params(params)
     self.configure(env)
 
-    Execute((format('{logfeeder_dir}/run.sh'),),
-            environment={'LOGFEEDER_INCLUDE': format('{logsearch_logfeeder_conf}/logfeeder-env.sh')},
+    Execute((format('{logfeeder_dir}/bin/logfeeder.sh start'),),
             sudo=True)
 
   def stop(self, env, upgrade_type=None):
     import params
     env.set_params(params)
 
-    kill_process(params.logfeeder_pid_file, getpass.getuser(), params.logfeeder_log_dir)
+    Execute((format('{logfeeder_dir}/bin/logfeeder.sh stop'),),
+            sudo=True)
 
   def status(self, env):
     import status_params

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
index 4410712..a276357 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
@@ -22,7 +22,6 @@ from resource_management.libraries.functions.check_process_status import check_p
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.script.script import Script
 from setup_logsearch import setup_logsearch
-from logsearch_common import kill_process
 
 class LogSearch(Script):
   def install(self, env):
@@ -41,8 +40,7 @@ class LogSearch(Script):
     env.set_params(params)
     self.configure(env)
 
-    Execute(format("{logsearch_dir}/run.sh"),
-            environment={'LOGSEARCH_INCLUDE': format('{logsearch_server_conf}/logsearch-env.sh')},
+    Execute(format("{logsearch_dir}/bin/logsearch.sh start"),
             user=params.logsearch_user
             )
 
@@ -50,7 +48,9 @@ class LogSearch(Script):
     import params
     env.set_params(params)
 
-    kill_process(params.logsearch_pid_file, params.logsearch_user, params.logsearch_log_dir)
+    Execute(format("{logsearch_dir}/bin/logsearch.sh stop"),
+            user=params.logsearch_user
+            )
 
   def status(self, env):
     import status_params

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py
deleted file mode 100644
index c4e0c16..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py
+++ /dev/null
@@ -1,54 +0,0 @@
-"""
-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.
-
-"""
-
-from resource_management.core.resources.system import Execute, File
-from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions.get_user_call_output import get_user_call_output
-from resource_management.libraries.functions.show_logs import show_logs
-
-def kill_process(pid_file, user, log_dir):
-  import params
-  """
-  Kill the process by pid file, then check the process is running or not. If the process is still running after the kill
-  command, it will try to kill with -9 option (hard kill)
-  """
-  pid = get_user_call_output(format("cat {pid_file}"), user=user, is_checked_call=False)[1]
-  process_id_exists_command = format("ls {pid_file} >/dev/null 2>&1 && ps -p {pid} >/dev/null 2>&1")
-
-  kill_cmd = format("{sudo} kill {pid}")
-  Execute(kill_cmd,
-          not_if=format("! ({process_id_exists_command})"))
-  wait_time = 5
-
-  hard_kill_cmd = format("{sudo} kill -9 {pid}")
-  Execute(hard_kill_cmd,
-          not_if=format("! ({process_id_exists_command}) || ( sleep {wait_time} && ! ({process_id_exists_command}) )"),
-          ignore_failures = True)
-  try:
-    Execute(format("! ({process_id_exists_command})"),
-            tries=20,
-            try_sleep=3,
-            )
-  except:
-    show_logs(log_dir, user)
-    raise
-
-  File(pid_file,
-       action="delete"
-       )
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 884d32a..4ea2018 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -56,9 +56,9 @@ credential_store_enabled = False
 if 'credentialStoreEnabled' in config:
   credential_store_enabled = config['credentialStoreEnabled']
 
-logsearch_server_conf = "/etc/ambari-logsearch-portal/conf"
+logsearch_server_conf = "/usr/lib/ambari-logsearch-portal/conf"
 logsearch_server_keys_folder = logsearch_server_conf + "/keys"
-logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+logsearch_logfeeder_conf = "/usr/lib/ambari-logsearch-logfeeder/conf"
 logsearch_logfeeder_keys_folder = logsearch_logfeeder_conf + "/keys"
 
 logsearch_config_set_dir = format("{logsearch_server_conf}/solr_configsets")
@@ -170,7 +170,7 @@ zookeeper_quorum = logsearch_solr_zk_quorum
 # logsearch-env configs
 logsearch_user = config['configurations']['logsearch-env']['logsearch_user']
 logsearch_log_dir = config['configurations']['logsearch-env']['logsearch_log_dir']
-logsearch_log = logsearch_log_dir + '/logsearch.out'
+logsearch_log = 'logsearch.out'
 logsearch_debug_enabled = str(config['configurations']['logsearch-env']["logsearch_debug_enabled"]).lower()
 logsearch_debug_port = config['configurations']['logsearch-env']["logsearch_debug_port"]
 logsearch_app_max_memory = config['configurations']['logsearch-env']['logsearch_app_max_memory']
@@ -304,7 +304,7 @@ logfeeder_json_log_maxbackupindex = default('/configurations/logfeeder-log4j/log
 
 # logfeeder-env configs
 logfeeder_log_dir = config['configurations']['logfeeder-env']['logfeeder_log_dir']
-logfeeder_log = logfeeder_log_dir + '/logfeeder.out'
+logfeeder_log = 'logfeeder.out'
 logfeeder_max_mem = config['configurations']['logfeeder-env']['logfeeder_max_mem']
 solr_service_logs_enable = default('/configurations/logfeeder-env/logfeeder_solr_service_logs_enable', True)
 solr_audit_logs_enable = default('/configurations/logfeeder-env/logfeeder_solr_audit_logs_enable', True)

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
index 653d604..52b1d76 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
@@ -40,7 +40,7 @@ def setup_logfeeder():
             recursive_ownership=True
             )
 
-  File(params.logfeeder_log,
+  File(format("{logfeeder_log_dir}/{logfeeder_log}"),
        mode=0644,
        content=''
        )

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
index 7738cc1..e804b9a 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
@@ -53,7 +53,7 @@ def setup_logsearch():
             owner=params.logsearch_user,
             group=params.user_group)
 
-  File(params.logsearch_log,
+  File(format("{logsearch_log_dir}/{logsearch_log}"),
        mode=0644,
        owner=params.logsearch_user,
        group=params.user_group,

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
index f2dd06b..f9f7e40 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
@@ -21,10 +21,11 @@ export LOGFEEDER_PATH={{logfeeder_dir}}
 export LOGFEEDER_CONF_DIR={{logsearch_logfeeder_conf}}
 
 #Logfile e.g. /var/log/logfeeder.log
-export LOGFILE={{logfeeder_log}}
+export LOG_PATH={{logfeeder_log_dir}}
+export LOG_FILE={{logfeeder_log}}
 
 #pid file e.g. /var/run/logfeeder.pid
-export PID_FILE={{logfeeder_pid_file}}
+export LOGFEEDER_PID_FILE={{logfeeder_pid_file}}
 
 export JAVA_HOME={{java64_home}}
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
index 7d9b5de..e823094 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
@@ -21,9 +21,10 @@ export LOGSEARCH_PATH={{logsearch_dir}}
 
 export LOGSEARCH_CONF_DIR={{logsearch_server_conf}}
 
-export LOGFILE={{logsearch_log_dir}}/logsearch.log
+export LOG_PATH={{logsearch_log_dir}}
+export LOG_FILE={{logsearch_log}}
 
-export PID_FILE={{logsearch_pid_file}}
+export LOGSEARCH_PID_FILE={{logsearch_pid_file}}
 
 export JAVA_HOME={{java64_home}}
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
index bf9d79b..4eecfa2 100644
--- a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
+++ b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
@@ -47,7 +47,7 @@ major_stack_version = get_major_version(stack_version_formatted)
 service_name = config['serviceName']
 
 # logsearch configuration
-logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+logsearch_logfeeder_conf = "/usr/lib/ambari-logsearch-logfeeder/conf"
 
 agent_cache_dir = config['hostLevelParams']['agentCacheDir']
 service_package_folder = config['commandParams']['service_package_folder']

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
index 19c81a8..1f1d3f7 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
@@ -58,7 +58,7 @@ class TestHookAfterInstall(RMFTestCase):
                               configuration_attributes = self.getConfig()['configuration_attributes']['core-site'],
                               only_if="ls /etc/hadoop/conf")
     self.assertResourceCalled('Directory',
-                              '/etc/ambari-logsearch-logfeeder/conf',
+                              '/usr/lib/ambari-logsearch-logfeeder/conf',
                               mode = 0755,
                               cd_access = 'a',
                               create_parents = True)
@@ -106,7 +106,7 @@ class TestHookAfterInstall(RMFTestCase):
       only_if="ls /usr/hdp/2.3.0.0-1234/hadoop/conf")
 
     self.assertResourceCalled('Directory',
-                              '/etc/ambari-logsearch-logfeeder/conf',
+                              '/usr/lib/ambari-logsearch-logfeeder/conf',
                               mode = 0755,
                               cd_access = 'a',
                               create_parents = True)
@@ -174,7 +174,7 @@ class TestHookAfterInstall(RMFTestCase):
       only_if="ls /usr/hdp/2.3.0.0-1234/hadoop/conf")
 
     self.assertResourceCalled('Directory',
-                              '/etc/ambari-logsearch-logfeeder/conf',
+                              '/usr/lib/ambari-logsearch-logfeeder/conf',
                               mode = 0755,
                               cd_access = 'a',
                               create_parents = True)
@@ -277,7 +277,7 @@ class TestHookAfterInstall(RMFTestCase):
       only_if="ls /usr/hdp/2.3.0.0-1234/hadoop/conf")
 
     self.assertResourceCalled('Directory',
-                              '/etc/ambari-logsearch-logfeeder/conf',
+                              '/usr/lib/ambari-logsearch-logfeeder/conf',
                               mode = 0755,
                               cd_access = 'a',
                               create_parents = True)

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
index 159cb81..13774f7 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
@@ -37,7 +37,7 @@ class TestLogFeeder(RMFTestCase):
                               cd_access='a',
                               mode=0755
                               )
-    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
+    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints',
                               create_parents=True,
                               cd_access='a',
                               mode=0755
@@ -49,7 +49,7 @@ class TestLogFeeder(RMFTestCase):
                               cd_access='a',
                               mode=0755
                               )
-    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-logfeeder/conf',
+    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf',
                               create_parents=True,
                               recursive_ownership=True,
                               cd_access='a',
@@ -60,18 +60,18 @@ class TestLogFeeder(RMFTestCase):
                               mode=0644,
                               content=''
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/keys/ks_pass.txt',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/keys/ks_pass.txt',
                               action = ['delete']
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/keys/ts_pass.txt',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/keys/ts_pass.txt',
                               action = ['delete']
                               )
-    self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-logfeeder/conf/logfeeder.properties',
+    self.assertResourceCalled('PropertiesFile', '/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder.properties',
                               properties={'cluster.name': 'c1',
                                           'common-property': 'common-value',
-                                          'hadoop.security.credential.provider.path': 'jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks',
-                                          'logfeeder.checkpoint.folder': '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
-                                          'logfeeder.config.dir': '/etc/ambari-logsearch-logfeeder/conf',
+                                          'hadoop.security.credential.provider.path': 'jceks://file/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder.jceks',
+                                          'logfeeder.checkpoint.folder': '/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints',
+                                          'logfeeder.config.dir': '/usr/lib/ambari-logsearch-logfeeder/conf',
                                           'logfeeder.config.files': 'output.config.json,global.config.json',
                                           'logfeeder.metrics.collector.hosts': '',
                                           'logfeeder.metrics.collector.path': '/ws/v1/timeline/metrics',
@@ -82,25 +82,25 @@ class TestLogFeeder(RMFTestCase):
                                           'logsearch.config.zk_connect_string': 'c6401.ambari.apache.org:2181'
                                          }
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
                               mode=0755,
                               content=InlineTemplate(self.getConfig()['configurations']['logfeeder-env']['content'])
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/log4j.xml',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/log4j.xml',
                               content=InlineTemplate(self.getConfig()['configurations']['logfeeder-log4j']['content'])
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/grok-patterns',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/grok-patterns',
                               content=InlineTemplate('GP'),
                               encoding='utf-8'
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/global.config.json',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/global.config.json',
                               content=Template('global.config.json.j2')
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/input.config-ambari.json',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/input.config-ambari.json',
                               content=InlineTemplate('ambari-grok-filter'),
                               encoding='utf-8'
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/output.config.json',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/output.config.json',
                               content=InlineTemplate('output-grok-filter'),
                               encoding='utf-8'
                               )
@@ -127,8 +127,6 @@ class TestLogFeeder(RMFTestCase):
                        )
 
     self.configureResourcesCalled()
-    self.assertResourceCalled('Execute', ('/usr/lib/ambari-logsearch-logfeeder/run.sh',),
-                              sudo=True,
-                              environment={
-                                'LOGFEEDER_INCLUDE': '/etc/ambari-logsearch-logfeeder/conf/logfeeder-env.sh'}
+    self.assertResourceCalled('Execute', ('/usr/lib/ambari-logsearch-logfeeder/bin/logfeeder.sh start',),
+                              sudo=True
                               )

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
index db19e0f..292773b 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
@@ -47,7 +47,7 @@ class TestLogSearch(RMFTestCase):
                               cd_access = 'a',
                               mode = 0755
     )
-    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf',
+    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal/conf',
                               owner = 'logsearch',
                               group = 'hadoop',
                               create_parents = True,
@@ -55,7 +55,7 @@ class TestLogSearch(RMFTestCase):
                               cd_access = 'a',
                               mode = 0755
     )
-    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/solr_configsets',
+    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets',
                               owner = 'logsearch',
                               group = 'hadoop',
                               create_parents = True,
@@ -63,7 +63,7 @@ class TestLogSearch(RMFTestCase):
                               cd_access = 'a',
                               mode = 0755
                               )
-    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/keys',
+    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal/conf/keys',
                               owner = 'logsearch',
                               group = 'hadoop',
                               cd_access = 'a',
@@ -76,15 +76,15 @@ class TestLogSearch(RMFTestCase):
                               mode = 0644,
                               content = ''
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/keys/ks_pass.txt',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/keys/ks_pass.txt',
                               action = ['delete']
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/keys/ts_pass.txt',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/keys/ts_pass.txt',
                               action = ['delete']
     )
-    self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-portal/conf/logsearch.properties',
+    self.assertResourceCalled('PropertiesFile', '/usr/lib/ambari-logsearch-portal/conf/logsearch.properties',
                               properties = {'common-property': 'common-value',
-                                            'hadoop.security.credential.provider.path': 'jceks://file/etc/ambari-logsearch-portal/conf/logsearch.jceks',
+                                            'hadoop.security.credential.provider.path': 'jceks://file/usr/lib/ambari-logsearch-portal/conf/logsearch.jceks',
                                             'logsearch.audit.logs.split.interval.mins': '1',
                                             'logsearch.auth.external_auth.enabled': 'false',
                                             'logsearch.auth.external_auth.host_url': 'http://c6401.ambari.apache.org:8080',
@@ -115,38 +115,38 @@ class TestLogSearch(RMFTestCase):
                                             'logsearch.spnego.kerberos.host': 'localhost'
                               }
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
                               owner = 'logsearch',
                               group='hadoop',
                               content = Template('HadoopServiceConfig.json.j2')
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/log4j.xml',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/log4j.xml',
                               owner = 'logsearch',
                               group='hadoop',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-log4j']['content'])
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/logsearch-env.sh',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-env']['content']),
                               mode = 0755,
                               owner = "logsearch",
                               group='hadoop'
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-admin.json',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/logsearch-admin.json',
                               owner = 'logsearch',
                               group='hadoop',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-admin-json']['content'])
                               )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
                               owner = 'logsearch',
                               group='hadoop',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-service_logs-solrconfig']['content'])
     )
-    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
+    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
                               owner = 'logsearch',
                               group='hadoop',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-audit_logs-solrconfig']['content'])
                               )
-    self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/etc/ambari-logsearch-portal/conf/solr_configsets'),
+    self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets'),
                               sudo = True
     )
     self.assertResourceCalled('Execute', 'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --check-znode --retry 30 --interval 5')
@@ -174,7 +174,6 @@ class TestLogSearch(RMFTestCase):
     )
 
     self.configureResourcesCalled()
-    self.assertResourceCalled('Execute', "/usr/lib/ambari-logsearch-portal/run.sh",
-                              environment = {'LOGSEARCH_INCLUDE': '/etc/ambari-logsearch-portal/conf/logsearch-env.sh'},
+    self.assertResourceCalled('Execute', "/usr/lib/ambari-logsearch-portal/bin/logsearch.sh start",
                               user = "logsearch"
     )

http://git-wip-us.apache.org/repos/asf/ambari/blob/562795c4/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index 9966f3e..701132a 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -315,7 +315,7 @@
         "logsearch.roles.allowed": "AMBARI.ADMINISTRATOR,CLUSTER.ADMINISTRATOR"
       },
       "logfeeder-properties": {
-        "logfeeder.checkpoint.folder" : "/etc/ambari-logsearch-logfeeder/conf/checkpoints",
+        "logfeeder.checkpoint.folder" : "/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints",
         "logfeeder.metrics.collector.hosts" : "{metrics_collector_hosts}",
         "logfeeder.config.files" : "{default_config_files}"
       },


Mime
View raw message