Michael Blow has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/1142
Change subject: Start/Stop Sample Scripts for Windows ...................................................................... Start/Stop Sample Scripts for Windows - Fix windows binaries (ncservice, cc, nc, helper) - Add windows start/stop sample cluster scripts Change-Id: Id6eee2156a5c6e40e0e864c2b8be2c08593e71b1 --- M .gitignore M asterixdb/asterix-client-helper/pom.xml M asterixdb/asterix-client-helper/src/main/assembly/assembly.xml M asterixdb/asterix-server/pom.xml M asterixdb/asterix-server/src/main/assembly/binary-assembly.xml A asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.bat A asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.bat 7 files changed, 174 insertions(+), 11 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/42/1142/1 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 @@ 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 @@ .DS_Store *.swp .m2* -ß \ No newline at end of file +ß diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml index 7068cf6..e6d5684 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>cbashelper</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> 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> 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> 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> 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 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 -- To view, visit https://asterix-gerrit.ics.uci.edu/1142 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id6eee2156a5c6e40e0e864c2b8be2c08593e71b1 Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <mb...@apache.org>