directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-690 Add shell script to start and stop Web Server.
Date Mon, 05 Feb 2018 07:43:54 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk 682362079 -> d94dad48b


DIRKRB-690 Add shell script to start and stop Web Server.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/d94dad48
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/d94dad48
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/d94dad48

Branch: refs/heads/trunk
Commit: d94dad48ba28b8c265a4b2583df61ee2bd95b863
Parents: 6823620
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Mon Feb 5 15:40:31 2018 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Mon Feb 5 15:40:31 2018 +0800

----------------------------------------------------------------------
 .gitignore                                  |   1 +
 kerby-dist/has-dist/assembly.xml            |  43 +++++++++
 kerby-dist/has-dist/bin/start-has.sh        | 115 +++++++++++++++++++++++
 kerby-dist/has-dist/bin/stop-has.sh         |  75 +++++++++++++++
 kerby-dist/has-dist/conf/backend.conf       |  23 +++++
 kerby-dist/has-dist/conf/has-server.conf    |  24 +++++
 kerby-dist/has-dist/conf/kdc.conf           |  23 +++++
 kerby-dist/has-dist/log4j.properties        |  27 ++++++
 kerby-dist/has-dist/pom.xml                 |  64 +++++++++++++
 kerby-dist/has-dist/webapps/WEB-INF/web.xml |  17 ++++
 kerby-dist/has-dist/webapps/has/index.html  |  24 +++++
 kerby-dist/pom.xml                          |   1 +
 12 files changed, 437 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index c01efda..e0bf2cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ dependency-reduced-pom.xml
 .checkstyle
 kerby-dist/kdc-dist/logs/
 kerby-dist/tool-dist/logs/
+kerby-dist/has-dist/logs/

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/assembly.xml
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/assembly.xml b/kerby-dist/has-dist/assembly.xml
new file mode 100644
index 0000000..ab64630
--- /dev/null
+++ b/kerby-dist/has-dist/assembly.xml
@@ -0,0 +1,43 @@
+<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.0.0.xsd">
+  <!--
+  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. See accompanying LICENSE file.
+-->
+  <id>package</id>
+  <formats>
+    <format>zip</format>
+    <format>tar</format>
+    <format>tar.gz</format>
+  </formats>
+  <fileSets>
+    <fileSet>
+      <directory>bin</directory>
+      <outputDirectory>bin</outputDirectory>
+    </fileSet>
+    <fileSet>
+      <directory>conf</directory>
+      <outputDirectory>conf</outputDirectory>
+    </fileSet>
+    <fileSet>
+      <directory>lib</directory>
+      <outputDirectory>lib</outputDirectory>
+    </fileSet>
+    <fileSet>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>log4j.properties</include>
+        <include>README.txt</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/bin/start-has.sh
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/bin/start-has.sh b/kerby-dist/has-dist/bin/start-has.sh
new file mode 100644
index 0000000..c7e999f
--- /dev/null
+++ b/kerby-dist/has-dist/bin/start-has.sh
@@ -0,0 +1,115 @@
+#!/usr/bin/env 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.
+
+usage()
+{
+  echo "Usage: sh bin/start-has.sh <conf_dir> <working_dir>"
+  echo "    Example:"
+  echo "        sh bin/start-has.sh conf work"
+  exit
+}
+
+CONF_DIR=$1
+WORK_DIR=$2
+pid=/tmp/has.pid # Pid file to save pid numbers
+APP_MAIN=org.apache.kerby.has.server.HasServer
+
+# Reset HAS_CONF_DIR and HAS_WORK_DIR if CONF_DIR or WORK_DIR not null
+if [ "$CONF_DIR" != "" ]; then
+  if [ ! -d "$CONF_DIR" ]; then
+    echo "[ERROR] ${CONF_DIR} is not a directory"
+    usage
+  fi
+else
+  if [ "$HAS_CONF_DIR" != "" ] && [ -d "$HAS_CONF_DIR" ]; then
+    CONF_DIR=${HAS_CONF_DIR}
+  else
+    echo "[ERROR] HAS_CONF_DIR is null or not a directory"
+    exit
+  fi
+fi
+
+# Load HAS environment variables
+if [ -f "${CONF_DIR}/has-env.sh" ]; then
+  . "${CONF_DIR}/has-env.sh"
+fi
+
+if [ "${WORK_DIR}" != "" ]; then
+  if [ ! -d "$WORK_DIR" ]; then
+    echo "[ERROR] ${WORK_DIR} is not a directory"
+    usage
+  fi
+else
+  if [ "$HAS_WORK_DIR" != "" ] && [ -d "$HAS_WORK_DIR" ]; then
+    WORK_DIR=${HAS_WORK_DIR}
+  else
+    echo "[ERROR] HAS_WORK_DIR is null or not a directory"
+    exit
+  fi
+fi
+
+# Get HAS_HOME directory
+bin=`dirname "$0"`
+HAS_HOME=`cd ${bin}/..; pwd`
+cd ${HAS_HOME}
+
+for var in $*; do
+  if [ X"$var" = X"-D" ]; then
+    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8010,server=y,suspend=n"
+  fi
+done
+args="$CONF_DIR $WORK_DIR"
+
+echo "[INFO] conf_dir=$CONF_DIR"
+echo "[INFO] work_dir=$WORK_DIR"
+
+HAS_OPTS="$HAS_JVM_OPTS -DHAS_LOGFILE=has"
+
+# Print a warning if has servers are already running
+if [ -f ${pid} ]; then
+  active=()
+  while IFS='' read -r p || [ -n "$p" ]; do
+    kill -0 ${p} >/dev/null 2>&1
+    if [ $? -eq 0 ]; then
+      active+=(${p})
+    fi
+  done < "$pid"
+
+  count="${#active[@]}"
+
+  if [ "$count" -gt 0 ]; then
+    echo "[WARN] ${count} instance(s) of HAS server are already running."
+  fi
+fi
+
+echo "Starting HAS server..."
+
+# Start HAS server
+java ${DEBUG} -classpath target/lib/*:. ${HAS_OPTS} ${APP_MAIN} -start ${args} > /dev/null
2>&1 &
+
+mypid=$!
+
+# Add mypid to pid file if start successfully
+sleep 3
+if [ "$mypid" -gt 0 ] && kill -0 "$mypid" > /dev/null 2>&1; then
+  echo ${mypid} >> ${pid}
+  echo "[SUCCESS] HAS server (pid: ${mypid}) has been started."
+else
+  echo "[ERROR] Failed to start HAS server."
+  exit 1
+fi

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/bin/stop-has.sh
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/bin/stop-has.sh b/kerby-dist/has-dist/bin/stop-has.sh
new file mode 100644
index 0000000..6ca414d
--- /dev/null
+++ b/kerby-dist/has-dist/bin/stop-has.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env 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.
+
+OPERATION=$1
+pid=/tmp/has.pid # Pid file
+
+stop()
+{
+  if kill -0 ${to_stop} > /dev/null 2>&1; then
+    echo "Stopping HAS server (pid: ${to_stop})..."
+    kill ${to_stop}
+    sleep 5
+    if kill -0 ${pid} > /dev/null 2>&1; then
+      echo "[WARN] HAS server still alive after 5 seconds, Trying to kill it by force."
+      kill -9 ${to_stop}
+    else
+      echo "[SUCCESS] HAS server has been stopped."
+    fi
+  else
+    echo "[INFO] Skipping HAS server (pid: ${to_stop}), because it is not running anymore."
+  fi
+}
+
+case ${OPERATION} in
+
+  (all)
+    if [ -f "$pid" ]; then
+      mv ${pid} ${pid}.tmp
+      cat ${pid}.tmp | while read to_stop; do
+        stop
+      done < ${pid}.tmp
+      rm ${pid}.tmp
+    else
+      echo "[INFO] No HAS server to stop."
+    fi
+  ;;
+
+  (*)
+    if [ -f "$pid" ]; then
+      # Get latest pid number in pid file
+      to_stop=$(tail -n 1 ${pid})
+
+      if [ -z "$to_stop" ]; then
+        rm ${pid} # If $to_stop is null, delete the pid file
+        echo "[INFO] No HAS server to stop."
+      else
+        sed \$d ${pid} > ${pid}.tmp
+        if [ $(wc -l < ${pid}.tmp) -eq 0 ]; then
+          rm ${pid}.tmp ${pid} # If all stopped, clean up pid files
+        else
+          mv ${pid}.tmp ${pid}
+        fi
+        stop
+      fi
+
+    else
+      echo "[INFO] No HAS server to stop."
+    fi
+  ;;
+esac

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/conf/backend.conf
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/conf/backend.conf b/kerby-dist/has-dist/conf/backend.conf
new file mode 100644
index 0000000..99c9d0a
--- /dev/null
+++ b/kerby-dist/has-dist/conf/backend.conf
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+kdc_identity_backend = org.apache.kerby.kerberos.kdc.identitybackend.JsonIdentityBackend
+backend.json.dir = /tmp/has/jsonbackend
+mysql_url = jdbc:mysql://127.0.0.1:3306/mysqlbackend
+mysql_user = root 
+mysql_password = passwd

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/conf/has-server.conf
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/conf/has-server.conf b/kerby-dist/has-dist/conf/has-server.conf
new file mode 100644
index 0000000..57ef56e
--- /dev/null
+++ b/kerby-dist/has-dist/conf/has-server.conf
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+[HAS]
+  https_host = localhost
+  https_port = 8092
+  filter_auth_type = kerberos
+  enable_conf = true
+

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/conf/kdc.conf
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/conf/kdc.conf b/kerby-dist/has-dist/conf/kdc.conf
new file mode 100644
index 0000000..c9c7921
--- /dev/null
+++ b/kerby-dist/has-dist/conf/kdc.conf
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+[kdcdefaults]
+  kdc_host = localhost
+  kdc_udp_port = 88
+  kdc_tcp_port = 88
+  kdc_realm = HADOOP.COM

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/log4j.properties
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/log4j.properties b/kerby-dist/has-dist/log4j.properties
new file mode 100644
index 0000000..1b36fec
--- /dev/null
+++ b/kerby-dist/has-dist/log4j.properties
@@ -0,0 +1,27 @@
+#############################################################################
+#    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.
+#############################################################################
+log4j.rootLogger=INFO,R
+
+log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
+log4j.appender.STDOUT.layout.ConversionPattern=Logger-->%5p{%F:%L}-%m%n
+
+log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.R.File=logs/${HAS_LOGFILE}.log
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p{%F:%L}-%m%n
+

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/pom.xml b/kerby-dist/has-dist/pom.xml
new file mode 100644
index 0000000..d64c2a9
--- /dev/null
+++ b/kerby-dist/has-dist/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>kerby-dist</artifactId>
+    <groupId>org.apache.kerby</groupId>
+    <version>1.1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>has-dist</artifactId>
+  <description>HAS dist</description>
+  <name>HAS dist</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.kerby</groupId>
+      <artifactId>has-server</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+   <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/lib</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <appendAssemblyId>false</appendAssemblyId>
+          <descriptors>
+            <descriptor>assembly.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/webapps/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/webapps/WEB-INF/web.xml b/kerby-dist/has-dist/webapps/WEB-INF/web.xml
new file mode 100644
index 0000000..b13cb1f
--- /dev/null
+++ b/kerby-dist/has-dist/webapps/WEB-INF/web.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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. See accompanying LICENSE file.
+-->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
+
+</web-app>

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/has-dist/webapps/has/index.html
----------------------------------------------------------------------
diff --git a/kerby-dist/has-dist/webapps/has/index.html b/kerby-dist/has-dist/webapps/has/index.html
new file mode 100644
index 0000000..6f80950
--- /dev/null
+++ b/kerby-dist/has-dist/webapps/has/index.html
@@ -0,0 +1,24 @@
+<!--
+   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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="REFRESH" charset="UTF-8" />
+<title>HAS Administration</title>
+</head>
+</html>

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d94dad48/kerby-dist/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-dist/pom.xml b/kerby-dist/pom.xml
index b2af472..be09104 100644
--- a/kerby-dist/pom.xml
+++ b/kerby-dist/pom.xml
@@ -29,6 +29,7 @@
   <modules>
     <module>kdc-dist</module>
     <module>tool-dist</module>
+    <module>has-dist</module>
   </modules>
 
   <build>


Mime
View raw message