You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2016/09/02 18:29:55 UTC

asterixdb git commit: Start/Stop Sample Scripts for Windows

Repository: asterixdb
Updated Branches:
  refs/heads/master 55a558f21 -> 8ed625629


Start/Stop Sample Scripts for Windows

- Fix windows binaries (ncservice, cc, nc, helper)
- Add windows start/stop sample cluster scripts

Change-Id: Id6eee2156a5c6e40e0e864c2b8be2c08593e71b1
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1142
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/8ed62562
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/8ed62562
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/8ed62562

Branch: refs/heads/master
Commit: 8ed625629ead97b2fea470d40dc4447c3d53c5f6
Parents: 55a558f
Author: Michael Blow <mb...@apache.org>
Authored: Fri Sep 2 13:23:09 2016 -0400
Committer: Michael Blow <mb...@apache.org>
Committed: Fri Sep 2 11:29:19 2016 -0700

----------------------------------------------------------------------
 .gitignore                                      |  5 +-
 asterixdb/asterix-client-helper/pom.xml         | 17 +++-
 .../src/main/assembly/assembly.xml              | 12 +++
 asterixdb/asterix-server/pom.xml                |  4 +-
 .../src/main/assembly/binary-assembly.xml       |  5 +-
 .../samples/local/bin/start-sample-cluster.bat  | 83 ++++++++++++++++++++
 .../samples/local/bin/stop-sample-cluster.bat   | 59 ++++++++++++++
 7 files changed, 174 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 11d149b..ba4e894 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
 invIndex*
 primaryBTree*
-bin
 target
 .classpath
 .settings
@@ -13,8 +12,6 @@ asterix_logs
 build
 asterixdb/asterix-opt
 asterixdb/asterix-app/src/test/resources/externallib
-asterixdb/asterix-app/rttest
-asterixdb/asterix-app/mdtest
 asterixdb/asterix-app/opttest
 asterixdb/asterix-app/parserts
 asterixdb/asterix-app/library
@@ -51,4 +48,4 @@ dist
 .DS_Store
 *.swp
 .m2*
-�
\ No newline at end of file
+�

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/asterixdb/asterix-client-helper/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml
index 7068cf6..1fbc0ec 100644
--- a/asterixdb/asterix-client-helper/pom.xml
+++ b/asterixdb/asterix-client-helper/pom.xml
@@ -29,7 +29,7 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>appassembler-maven-plugin</artifactId>
-        <version>1.3</version>
+        <version>1.10</version>
         <configuration>
           <assembleDirectory>
             ${project.build.directory}/appassembler
@@ -46,7 +46,15 @@
               <mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
             </program>
           </programs>
-          <daemons/>
+          <daemons>
+            <daemon>
+              <id>asterixhelper</id>
+              <mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
+              <platforms>
+                <platform>booter-windows</platform>
+              </platforms>
+            </daemon>
+          </daemons>
         </configuration>
         <executions>
           <execution>
@@ -84,5 +92,10 @@
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.mojo.appassembler</groupId>
+      <artifactId>appassembler-booter</artifactId>
+      <version>1.10</version>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml b/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
index 2e4e133..122ee38 100644
--- a/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
+++ b/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
@@ -34,5 +34,17 @@
       <outputDirectory>bin</outputDirectory>
       <fileMode>0755</fileMode>
     </fileSet>
+    <fileSet>
+      <directory>target/generated-resources/appassembler/booter-windows/etc</directory>
+      <outputDirectory>etc</outputDirectory>
+      <includes>
+        <include>*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>target/generated-resources/appassembler/booter-windows/bin</directory>
+      <outputDirectory>bin</outputDirectory>
+      <fileMode>0755</fileMode>
+    </fileSet>
   </fileSets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/asterixdb/asterix-server/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index 269c219..0897145 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -44,7 +44,7 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>appassembler-maven-plugin</artifactId>
-        <version>1.3</version>
+        <version>1.10</version>
         <configuration>
           <assembleDirectory>
             ${project.build.directory}/appassembler
@@ -235,7 +235,7 @@
     <dependency>
       <groupId>org.codehaus.mojo.appassembler</groupId>
       <artifactId>appassembler-booter</artifactId>
-      <version>1.3.1</version>
+      <version>1.10</version>
     </dependency>
     <dependency>
       <groupId>org.apache.asterix</groupId>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
index 0c82f41..19f0034 100644
--- a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
+++ b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
@@ -69,10 +69,9 @@
     </fileSet>
     <fileSet>
       <directory>target/generated-resources/appassembler/booter-windows/etc</directory>
-      <outputDirectory>bin</outputDirectory>
+      <outputDirectory>etc</outputDirectory>
       <includes>
-        <include>asterixcc.xml</include>
-        <include>asterixnc.xml</include>
+        <include>*.xml</include>
       </includes>
     </fileSet>
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.bat
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.bat b/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.bat
new file mode 100644
index 0000000..4d10261
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.bat
@@ -0,0 +1,83 @@
+@REM ------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM   http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ------------------------------------------------------------
+
+@echo off
+setlocal
+if NOT DEFINED JAVA_HOME (
+  echo ERROR: JAVA_HOME not defined
+  goto :ERROR
+)
+REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle them
+for %%I in (%JAVA_HOME%) do (
+  set JAVA_HOME=%%~sI
+)
+
+set JAVACMD=%JAVA_HOME%\bin\java
+
+REM TODO(mblow): check java version, spaces in CWD
+
+set DIRNAME=%~dp0
+
+pushd %DIRNAME%\..
+set CLUSTERDIR=%cd%
+cd %CLUSTERDIR%\..\..
+set INSTALLDIR=%cd%
+set LOGSDIR=%CLUSTERDIR%\logs
+
+echo CLUSTERDIR=%CLUSTERDIR%
+echo INSTALLDIR=%INSTALLDIR%
+echo.
+cd %CLUSTERDIR%
+if NOT EXIST %LOGSDIR% (
+  mkdir %LOGSDIR%
+)
+call %INSTALLDIR%\bin\${HELPER_COMMAND} get_cluster_state -quiet
+
+IF %ERRORLEVEL% EQU 0 (
+  echo ERROR: sample cluster address [localhost:${LISTEN_PORT}] already in use
+  goto :ERROR
+)
+
+REM TODO(mblow): append timestamp to logs when starting
+
+echo Starting sample cluster...
+
+start /MIN "blue-nc" cmd /c "echo See output in %LOGSDIR%\blue-service.log && %INSTALLDIR%\bin\${NC_SERVICE_COMMAND} -logdir - -config-file %CLUSTERDIR%\conf\blue.conf >> %LOGSDIR%\blue-service.log 2>&1"
+start /MIN "red-nc" cmd /c "echo See output in %LOGSDIR%\red-service.log && %INSTALLDIR%\bin\${NC_SERVICE_COMMAND} -logdir - >> %LOGSDIR%\red-service.log 2>&1"
+start /MIN "cc" cmd /c "echo See output in %LOGSDIR%\cc.log && %INSTALLDIR%\bin\${CC_COMMAND} -config-file %CLUSTERDIR%\conf\cc.conf >>%LOGSDIR%\cc.log 2>&1"
+
+echo.
+echo Waiting for sample cluster [localhost:${LISTEN_PORT}] to be ready...
+call %INSTALLDIR%\bin\${HELPER_COMMAND} wait_for_cluster -quiet -timeout 30
+if %ERRORLEVEL% NEQ 0 (
+  echo ERROR: cluster did not start successfully
+  echo See output in %LOGSDIR%\
+  goto :ERROR
+)
+echo Sample cluster [localhost:${LISTEN_PORT}] is ready...
+echo.
+echo See output in %LOGSDIR%
+echo.
+popd
+endlocal
+
+:ERROR
+popd
+endlocal
+exit /B 1

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8ed62562/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.bat
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.bat b/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.bat
new file mode 100644
index 0000000..7cbf107
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.bat
@@ -0,0 +1,59 @@
+@REM ------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM   http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ------------------------------------------------------------
+@echo off
+setlocal
+if NOT DEFINED JAVA_HOME (
+  echo ERROR: JAVA_HOME not defined
+  goto :ERROR
+)
+
+REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle them
+for %%I in (%JAVA_HOME%) do (
+  set JAVA_HOME=%%~sI
+)
+
+set DIRNAME=%~dp0
+
+pushd %DIRNAME%\..
+set CLUSTERDIR=%cd%
+cd %CLUSTERDIR%\..\..
+set INSTALLDIR=%cd%
+
+call %INSTALLDIR%\bin\${HELPER_COMMAND} get_cluster_state -quiet
+if %ERRORLEVEL% EQU 0 (
+  call %INSTALLDIR%\bin\${HELPER_COMMAND} shutdown_cluster
+) else (
+  echo WARNING: sample cluster does not appear to be running, will attempt to kill any running
+  echo          NCServices and wait for CCDriver to terminate if running.
+)
+echo.
+echo Terminating NC services...
+powershell "%JAVA_HOME%\bin\jps.exe -v | select-string -pattern ${NC_SERVICE_COMMAND} | %%{ $_.ToString().Split(' ')[0] } | %%{ Stop-Process $_ }"
+
+powershell "Write-Host "Waiting for CCDriver to terminate..." -nonewline; do { if ($running) { Start-Sleep 1 }; %JAVA_HOME%\bin\jps.exe -v | select-string -pattern ${CC_COMMAND} -quiet -outvariable running | Out-Null; Write-Host "." -nonewline } while ($running)"
+echo .done.
+goto :END
+:ERROR
+echo.
+popd
+exit /B 1
+
+:END
+echo.
+popd