Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration improvements part 1 #81

Merged
merged 9 commits into from Nov 6, 2019
Merged
26 changes: 16 additions & 10 deletions bin/install-app.bat
Expand Up @@ -10,17 +10,27 @@ REM Copyright Contributors to the Zowe Project.
if [%1]==[] goto :fail
setlocal
set app_path="%~f1"
if "%ZLUX_INSTALL_LOG_DIR%" == "" (
set ZLUX_INSTALL_LOG_DIR=..\log
set temp_cd=%CD%
if not defined ZLUX_INSTALL_LOG_DIR (
set ZLUX_INSTALL_LOG_DIR="..\log"
call :makedir "..\log"
cd ..\log
for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\install.log"
) else (
call :makedir "%ZLUX_INSTALL_LOG_DIR%"
cd "%ZLUX_INSTALL_LOG_DIR%"
for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\install.log"
)
call :makedir %ZLUX_INSTALL_LOG_DIR%
call :abspath %ZLUX_INSTALL_LOG_DIR%\install.log
set LOG_PATH=%RETVAL%
cd %temp_cd%
if not defined ZLUX_CONFIG_FILE (
set ZLUX_CONFIG_FILE="%~dp0\..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json"
)

echo Checking for node
where node
if %ERRORLEVEL% neq 0 goto :nonode
echo Running installer. Log location=%LOG_PATH%
node "%~dp0..\..\zlux-server-framework\utils\install-app.js" -i "%app_path%" -o "%~dp0..\..\\" -c "%~dp0..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json" %2 > %LOG_PATH% 2>&1
node "%~dp0..\..\zlux-server-framework\utils\install-app.js" -i "%app_path%" -o "%~dp0..\..\\" -c "%ZLUX_CONFIG_FILE%" %2 > %LOG_PATH% 2>&1
set rc=%ERRORLEVEL%
echo Ended with rc=%rc%
endlocal
Expand All @@ -40,10 +50,6 @@ rem Create a directory if it does not exist yet
:makedir
if not exist %1 mkdir %1
goto :eof

:abspath
set RETVAL=%~dpfn1
exit /B
REM This program and the accompanying materials are
REM made available under the terms of the Eclipse Public License v2.0 which accompanies
REM this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
Expand Down
46 changes: 32 additions & 14 deletions bin/nodeCluster.bat
Expand Up @@ -7,30 +7,48 @@ REM SPDX-License-Identifier: EPL-2.0
REM
REM Copyright Contributors to the Zowe Project.
setlocal
if "%ZLUX_NODE_LOG_DIR%" == "" (
set ZLUX_NODE_LOG_DIR="../log"
set temp_cd=%CD%
if defined ZLUX_NODE_LOG_FILE (
FOR /F %%i IN ("%ZLUX_NODE_LOG_FILE%") DO set ZLUX_LOG_PATH=%%~fi
) else (

if not defined ZLUX_NODE_LOG_DIR (
call :makedir "..\log"
cd ..\log
for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log"
) else (
call :makedir "%ZLUX_NODE_LOG_DIR%"
cd "%ZLUX_NODE_LOG_DIR%"
for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log"
)
)
cd %temp_cd%
if not defined ZLUX_CONFIG_FILE (
set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json"
)
call :makedir %ZLUX_NODE_LOG_DIR%
set NODE_PATH=../..;../../zlux-server-framework/node_modules;%NODE_PATH%
cd ../lib
call :abspath %ZLUX_NODE_LOG_DIR%\nodeServer.log
set ZLUX_LOG_PATH=%RETVAL%
set minWorkers=2
set NODE_CLUSTER_SCHED_POLICY=rr
echo Server startup. Log location=%ZLUX_LOG_PATH%
node --harmony zluxCluster.js --config=../deploy/instance/ZLUX/serverConfig/zluxserver.json %* > %ZLUX_LOG_PATH% 2>&1
echo Ended with rc=%ERRORLEVEL%
REM Check if print to terminal argument exists
echo.%* | findstr /C:"--logToTerminal" 1>nul
if errorlevel 1 (
echo Server startup. Log location=%ZLUX_LOG_PATH%
node --harmony zluxCluster.js --config="%ZLUX_CONFIG_FILE%" %* > "%ZLUX_LOG_PATH%" 2>&1
) ELSE (
echo Server startup. Logging to terminal...
node --harmony zluxCluster.js --config="%ZLUX_CONFIG_FILE%" %*
)
set rc=%ERRORLEVEL%
echo Ended with rc=%rc%
endlocal
goto :eof
exit %rc%


rem Create a directory if it does not exist yet
:makedir
if not exist %ZLUX_NODE_LOG_DIR% mkdir %ZLUX_NODE_LOG_DIR%
if not exist %1 mkdir %1
goto :eof

:abspath
set RETVAL=%~dpfn1
exit /B
REM This program and the accompanying materials are
REM made available under the terms of the Eclipse Public License v2.0 which accompanies
REM this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
Expand Down
11 changes: 10 additions & 1 deletion bin/nodeCluster.sh
Expand Up @@ -6,6 +6,15 @@
# SPDX-License-Identifier: EPL-2.0
#
# Copyright Contributors to the Zowe Project.
dir=$(cd `dirname $0` && pwd)

if [ -n "$ZLUX_CONFIG_FILE" ]
then
CONFIG_FILE=$ZLUX_CONFIG_FILE
else
echo "No config file specified, using default"
CONFIG_FILE="${dir}/../deploy/instance/ZLUX/serverConfig/zluxserver.json"
fi

if [ -n "$ZLUX_NODE_LOG_FILE" ]
then
Expand Down Expand Up @@ -140,7 +149,7 @@ type node

echo Starting node

_BPX_JOBNAME=${ZOWE_PREFIX}DS1 node --harmony zluxCluster.js --config=../deploy/instance/ZLUX/serverConfig/zluxserver.json "$@" 2>&1 | tee $ZLUX_NODE_LOG_FILE
_BPX_JOBNAME=${ZOWE_PREFIX}DS1 node --harmony zluxCluster.js --config="${CONFIG_FILE}" "$@" 2>&1 | tee $ZLUX_NODE_LOG_FILE
echo "Ended with rc=$?"


Expand Down
38 changes: 23 additions & 15 deletions bin/nodeServer.bat
Expand Up @@ -6,38 +6,46 @@ REM
REM SPDX-License-Identifier: EPL-2.0
REM
REM Copyright Contributors to the Zowe Project.

setlocal
if "%ZLUX_NODE_LOG_DIR%" == "" (
set ZLUX_NODE_LOG_DIR=..\log
set temp_cd=%CD%
if defined ZLUX_NODE_LOG_FILE (
FOR /F %%i IN ("%ZLUX_NODE_LOG_FILE%") DO set ZLUX_LOG_PATH=%%~fi
) else (
if not defined ZLUX_NODE_LOG_DIR (
call :makedir "..\log"
cd ..\log
for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log"

) else (
call :makedir "%ZLUX_NODE_LOG_DIR%"
cd "%ZLUX_NODE_LOG_DIR%"
for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log"
)
)
cd %temp_cd%
if not defined ZLUX_CONFIG_FILE (
set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json"
)
call :makedir %ZLUX_NODE_LOG_DIR%
set NODE_PATH=../..;../../zlux-server-framework/node_modules;%NODE_PATH%
cd ../lib
call :abspath %ZLUX_NODE_LOG_DIR%\nodeServer.log
set ZLUX_LOG_PATH=%RETVAL%

REM Check if print to terminal argument exists
echo.%* | findstr /C:"--logToTerminal" 1>nul
if errorlevel 1 (
echo Server startup. Log location=%ZLUX_LOG_PATH%
node --harmony zluxServer.js --config=../deploy/instance/ZLUX/serverConfig/zluxserver.json %* > %ZLUX_LOG_PATH% 2>&1
node --harmony zluxServer.js --config="%ZLUX_CONFIG_FILE%" %* > %ZLUX_LOG_PATH% 2>&1
) ELSE (
echo Server startup. Logging to terminal...
node --harmony zluxServer.js --config=../deploy/instance/ZLUX/serverConfig/zluxserver.json %*
node --harmony zluxServer.js --config="%ZLUX_CONFIG_FILE%" %*
)
echo Ended with rc=%ERRORLEVEL%
set rc=%ERRORLEVEL%
echo Ended with rc=%rc%
endlocal
goto :eof
exit %rc%

REM Create a directory if it does not exist yet
:makedir
if not exist %1 mkdir %1
goto :eof

:abspath
set RETVAL=%~dpfn1
exit /B
REM This program and the accompanying materials are
REM made available under the terms of the Eclipse Public License v2.0 which accompanies
REM this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
Expand Down
11 changes: 10 additions & 1 deletion bin/nodeServer.sh
Expand Up @@ -6,6 +6,15 @@
# SPDX-License-Identifier: EPL-2.0
#
# Copyright Contributors to the Zowe Project.
dir=$(cd `dirname $0` && pwd)

if [ -n "$ZLUX_CONFIG_FILE" ]
then
CONFIG_FILE=$ZLUX_CONFIG_FILE
else
echo "No config file specified, using default"
CONFIG_FILE="${dir}/../deploy/instance/ZLUX/serverConfig/zluxserver.json"
fi

if [ -n "$ZLUX_NODE_LOG_FILE" ]
then
Expand Down Expand Up @@ -138,7 +147,7 @@ type node

echo Starting node

_BPX_JOBNAME=${ZOWE_PREFIX}DS1 node --harmony zluxServer.js --config=../deploy/instance/ZLUX/serverConfig/zluxserver.json "$@" 2>&1 | tee $ZLUX_NODE_LOG_FILE
_BPX_JOBNAME=${ZOWE_PREFIX}DS1 node --harmony zluxServer.js --config="${CONFIG_FILE}" "$@" 2>&1 | tee $ZLUX_NODE_LOG_FILE
echo "Ended with rc=$?"


Expand Down
17 changes: 15 additions & 2 deletions bin/zssServer.sh
Expand Up @@ -6,12 +6,25 @@
# SPDX-License-Identifier: EPL-2.0
#
# Copyright Contributors to the Zowe Project.
## launch the ZLUX secure services server

## launch the Zowe Secure Services Server

ZSS_SCRIPT_DIR=$(cd `dirname $0` && pwd)
echo "pwd = `pwd`"
echo "Script dir = $(cd `dirname $0` && pwd)"

if [ -n "$ZSS_CONFIG_FILE" ]
then
CONFIG_FILE=$ZSS_CONFIG_FILE
elif [ -n "$ZLUX_CONFIG_FILE" ]
then
CONFIG_FILE=$ZLUX_CONFIG_FILE
else
echo "No config file specified, using default"
CONFIG_FILE="${dir}/../deploy/instance/ZLUX/serverConfig/zluxserver.json"
fi


if [ -n "$ZSS_LOG_FILE" ]
then
if [[ $ZSS_LOG_FILE == /* ]]
Expand Down Expand Up @@ -125,7 +138,7 @@ fi
export dir=`dirname "$0"`
cd $dir

_BPX_SHAREAS=NO _BPX_JOBNAME=${ZOWE_PREFIX}SZ1 ./zssServer "../deploy/instance/ZLUX/serverConfig/zluxserver.json" 2>&1 | tee $ZSS_LOG_FILE
_BPX_SHAREAS=NO _BPX_JOBNAME=${ZOWE_PREFIX}SZ1 ./zssServer "${CONFIG_FILE}" 2>&1 | tee $ZSS_LOG_FILE


# This program and the accompanying materials are
Expand Down
31 changes: 17 additions & 14 deletions config/zluxserver.json
Expand Up @@ -12,7 +12,8 @@
"server": {
"hostname": "localhost",
"port": 10011,
"isHttps": false
"gatewayPort": 10012,
"isHttps": true
},
"enabled": false
},
Expand All @@ -23,18 +24,21 @@
}
]
},
"agent": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment it out instead of removing it?

//host is for zlux to know, not zss
"host": "localhost",
"http": {
"ipAddresses": ["127.0.0.1"],
//to be a replacement for zssPort
"port": 8542
}
},
// All paths relative to ZLUX/node or ZLUX/bin


// section used to define a connection to a server that can handle native or high privilege commands that the app server cannot
// "agent": {
// for the app server to know, not the agent
// "host": "localhost",
// used by the agent
// "http": {
// "ipAddresses": ["127.0.0.1"],
// "port": 8542
// }
// },

// All paths relative to zlux-app-server/bin
// In real installations, these values will be configured during the install.
"rootDir":"../deploy",
"productDir":"../deploy/product",
"siteDir":"../deploy/site",
"instanceDir":"../deploy/instance",
Expand All @@ -45,6 +49,7 @@
"dataserviceAuthentication": {
//this specifies the default authentication type for dataservices that didn't specify which type to use. These dataservices therefore should not expect a particular type of authentication to be used.
"defaultAuthentication": "fallback",
"rbac": false,

//each authentication type may have more than one implementing plugin. define defaults and fallbacks below as well
//any types that have no implementers are ignored, and any implementations specified here that are not known to the server are also ignored.
Expand All @@ -66,8 +71,6 @@

}
},
// internal port, do not connect browser to this port
"zssPort":8542,
// Specifies the default language for the server framework logging
"logLanguage": "en"
}