From ace2acf296e237bce2737b3d4a3b1c1ccbd8d03d Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 21 Oct 2019 18:06:20 -0400 Subject: [PATCH 1/9] Change to enable D args, more options available from JSON, and some cleanup Signed-off-by: 1000TurquoisePogs --- bin/install-app.bat | 8 ++- bin/nodeCluster.bat | 39 +++++++---- bin/nodeCluster.sh | 11 ++- bin/nodeServer.bat | 33 ++++----- bin/nodeServer.sh | 11 ++- bin/zssServer.sh | 17 ++++- config/zluxserver.json | 18 ++--- lib/zluxArgs.js | 151 +++++++++++++++++++---------------------- 8 files changed, 157 insertions(+), 131 deletions(-) diff --git a/bin/install-app.bat b/bin/install-app.bat index 7e8b1fe5..d1aee0ee 100644 --- a/bin/install-app.bat +++ b/bin/install-app.bat @@ -10,9 +10,13 @@ REM Copyright Contributors to the Zowe Project. if [%1]==[] goto :fail setlocal set app_path="%~f1" -if "%ZLUX_INSTALL_LOG_DIR%" == "" ( +if not defined ZLUX_INSTALL_LOG_DIR ( set ZLUX_INSTALL_LOG_DIR=..\log ) +if not defined ZLUX_CONFIG_FILE ( + set ZLUX_CONFIG_FILE=%~dp0\..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json +) + call :makedir %ZLUX_INSTALL_LOG_DIR% call :abspath %ZLUX_INSTALL_LOG_DIR%\install.log set LOG_PATH=%RETVAL% @@ -20,7 +24,7 @@ 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 diff --git a/bin/nodeCluster.bat b/bin/nodeCluster.bat index c73deac5..a8e8aec6 100644 --- a/bin/nodeCluster.bat +++ b/bin/nodeCluster.bat @@ -7,30 +7,41 @@ 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" +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 ( + set ZLUX_NODE_LOG_DIR="../log" + ) + call :makedir + FOR /F %%i IN ("%ZLUX_NODE_LOG_DIR%\nodeServer.log") DO set ZLUX_LOG_PATH=%%~fi +) +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 "%ZLUX_NODE_LOG_DIR%" mkdir "%ZLUX_NODE_LOG_DIR%" 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 diff --git a/bin/nodeCluster.sh b/bin/nodeCluster.sh index 5344395c..365e0133 100755 --- a/bin/nodeCluster.sh +++ b/bin/nodeCluster.sh @@ -6,6 +6,15 @@ # SPDX-License-Identifier: EPL-2.0 # # Copyright Contributors to the Zowe Project. +dir="$(dirname $(readlink -f $0))" + +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 @@ -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=$?" diff --git a/bin/nodeServer.bat b/bin/nodeServer.bat index 11ce1ef3..86daaf65 100644 --- a/bin/nodeServer.bat +++ b/bin/nodeServer.bat @@ -6,38 +6,39 @@ 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 +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 ( + set ZLUX_NODE_LOG_DIR="../log" + ) + call :makedir "%ZLUX_NODE_LOG_DIR%" + FOR /F %%i IN ("%ZLUX_NODE_LOG_DIR%\nodeServer.log") DO set ZLUX_LOG_PATH=%%~fi +) +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 +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 diff --git a/bin/nodeServer.sh b/bin/nodeServer.sh index df9cee3e..889d8fc7 100755 --- a/bin/nodeServer.sh +++ b/bin/nodeServer.sh @@ -6,6 +6,15 @@ # SPDX-License-Identifier: EPL-2.0 # # Copyright Contributors to the Zowe Project. +dir="$(dirname $(readlink -f $0))" + +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 @@ -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=$?" diff --git a/bin/zssServer.sh b/bin/zssServer.sh index b67c3e93..b948fc53 100755 --- a/bin/zssServer.sh +++ b/bin/zssServer.sh @@ -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 == /* ]] @@ -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 diff --git a/config/zluxserver.json b/config/zluxserver.json index da0597c6..16a3a970 100644 --- a/config/zluxserver.json +++ b/config/zluxserver.json @@ -12,7 +12,8 @@ "server": { "hostname": "localhost", "port": 10011, - "isHttps": false + "gatewayPort": 10012, + "isHttps": true }, "enabled": false }, @@ -23,18 +24,8 @@ } ] }, - "agent": { - //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 +// 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", @@ -45,6 +36,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. @@ -66,8 +58,6 @@ } }, - // internal port, do not connect browser to this port - "zssPort":8542, // Specifies the default language for the server framework logging "logLanguage": "en" } diff --git a/lib/zluxArgs.js b/lib/zluxArgs.js index 84455932..9f68797c 100644 --- a/lib/zluxArgs.js +++ b/lib/zluxArgs.js @@ -12,57 +12,12 @@ 'use strict'; const ProxyServer = require('zlux-server-framework'); -const argParser = require('zlux-server-framework/lib/argumentParser'); +const argParser = require('zlux-server-framework/utils/argumentParser'); const jsonUtils = require('zlux-server-framework/lib/jsonUtils'); - +const mergeUtils = require('zlux-server-framework/utils/mergeUtils'); const PRODUCT_CODE = 'ZLUX'; -const appConfig = { - productCode: PRODUCT_CODE, - rootRedirectURL: '/' + PRODUCT_CODE + '/plugins/org.zowe.zlux.bootstrap/web/', - rootServices: [ - { - method: '*', - url: '/login', - requiresAuth: false - }, - { - method: '*', - url: '/unixfile' - }, - { - method: '*', - url: '/datasetContents' - }, - { - method: '*', - url: '/VSAMdatasetContents' - }, - { - method: '*', - url: '/datasetMetadata' - }, - { - method: '*', - url: '/omvs' - }, - { - method: '*', - url: '/ras' - }, - { - method: '*', - url: '/security-mgmt' - }, - { - method: '*', - url: '/saf-auth' - } - ] -}; - const DEFAULT_CONFIG = { - "rootDir":"../deploy", "productDir":"../deploy/product", "siteDir":"../deploy/site", "instanceDir":"../deploy/instance", @@ -71,46 +26,31 @@ const DEFAULT_CONFIG = { "pluginsDir":"../deploy/instance/"+PRODUCT_CODE+"/plugins", "node": { + "rootRedirectURL": '/' + PRODUCT_CODE + '/plugins/org.zowe.zlux.bootstrap/web/', "allowInvalidTLSProxy": false, "noChild": false, "noPrompt": false, "https": { "ipAddresses": ["0.0.0.0"], "port": 8544, - //pfx (string), keys, certificates, certificateAuthorities, and certificateRevocationLists are all valid here. - "keys": ["../deploy/product/ZLUX/serverConfig/zlux.keystore.key"], + "keys": ["../deploy/product/ZLUX/serverConfig/zlux.keystore.cer"], "certificates": ["../deploy/product/ZLUX/serverConfig/zlux.keystore.cer"], - "certificateAuthorities": ["../deploy/product/ZLUX/serverConfig/apiml-localca.cer"] - }, - "mediationLayer": { - "server": { - "hostname": "localhost", - "port": 10011, - "isHttps": false - }, - "enabled": false + "certificateAuthorities": ["../deploy/product/ZLUX/serverConfig/zlux.keystore.cer"] } }, "dataserviceAuthentication": { + "rbac": false, "defaultAuthentication": "fallback", "implementationDefaults": { "fallback": { "plugins": ["org.zowe.zlux.auth.trivial"] } } - }, - "agent": { - //host is for zlux to know, not zss - "host": "localhost", - "http": { - "ipAddresses": ["0.0.0.0"], - //to be a replacement for zssPort - "port": 8542 - } - } + } }; const MVD_ARGS = [ + new argParser.CLIArgument(null, 'D', argParser.constants.ARG_TYPE_JSON), new argParser.CLIArgument('config', 'c', argParser.constants.ARG_TYPE_VALUE), new argParser.CLIArgument('hostServer', 'h', argParser.constants.ARG_TYPE_VALUE), new argParser.CLIArgument('hostPort', 'P', argParser.constants.ARG_TYPE_VALUE), @@ -125,7 +65,8 @@ const MVD_ARGS = [ ]; var config; -var zssHost = '127.0.0.1'; +let agentHost = undefined; +let agentPort = undefined; var commandArgs = process.argv.slice(2); var argumentParser = argParser.createParser(MVD_ARGS); var userInput = argumentParser.parse(commandArgs); @@ -137,27 +78,28 @@ if (!userInput.config) { console.log('config file was '+userInput.config); process.exit(-1); } -const configJSON = DEFAULT_CONFIG; +let configJSON = DEFAULT_CONFIG; const userConfig = jsonUtils.parseJSONWithComments(userInput.config); -let hostPort; -for (const attribute in userConfig) { - configJSON[attribute] = userConfig[attribute]; +configJSON = mergeUtils.deepAssign(configJSON, userConfig); +if (userInput.D) { + configJSON = mergeUtils.deepAssign(configJSON, userInput.D); } +console.log('configjson=',configJSON); if (configJSON.agent) { if (configJSON.agent.https) { - hostPort = configJSON.agent.https.port; + agentPort = configJSON.agent.https.port; } else if (configJSON.agent.http) { - hostPort = configJSON.agent.http.port; + agentPort = configJSON.agent.http.port; } else { console.warn(`Invalid server configuration. Agent specified without http or https port`); } if(configJSON.agent.host){ - zssHost = configJSON.agent.host; + agentHost = configJSON.agent.host; } } else if (configJSON.zssPort) { - hostPort = configJSON.zssPort; + agentPort = configJSON.zssPort; } if(configJSON.node.noChild === true){ delete configJSON.node.childProcesses; @@ -176,7 +118,7 @@ if(process.env.overrideFileConfig !== "false"){ configJSON.node.mediationLayer.eureka.serviceUrls.default = [`http://${eUser}:${ePass}@${configJSON.node.mediationLayer.server.hostname}:${configJSON.node.mediationLayer.server.port}/eureka/apps/`]; } if (userInput.hostPort) { - hostPort = userInput.hostPort; + agentPort = userInput.hostPort; } if(userInput.noPrompt){ noPrompt = true; @@ -185,7 +127,7 @@ if(process.env.overrideFileConfig !== "false"){ configJSON.node.noPrompt = true; } if (userInput.hostServer) { - zssHost = userInput.hostServer; + agentHost = userInput.hostServer; } if (userInput.port) { if (!configJSON.node.http) { configJSON.node.http = {}; } @@ -204,11 +146,58 @@ if(process.env.overrideFileConfig !== "false"){ } const startUpConfig = { - proxiedHost: zssHost, - proxiedPort: hostPort, + proxiedHost: agentHost, + proxiedPort: agentPort, allowInvalidTLSProxy: allowInvalidTLS }; +const appConfig = { + productCode: PRODUCT_CODE, + rootRedirectURL: configJSON.node.rootRedirectURL +}; + +if (startUpConfig.proxiedHost && startUpConfig.proxiedPort) { + appConfig.rootServices = configJSON.agent && Array.isArray(configJSON.agent.rootServices) + ? configJSON.agent.rootServices + : [{ + method: '*', + url: '/login', + requiresAuth: false + }, + { + method: '*', + url: '/unixfile' + }, + { + method: '*', + url: '/datasetContents' + }, + { + method: '*', + url: '/VSAMdatasetContents' + }, + { + method: '*', + url: '/datasetMetadata' + }, + { + method: '*', + url: '/omvs' + }, + { + method: '*', + url: '/ras' + }, + { + method: '*', + url: '/security-mgmt' + }, + { + method: '*', + url: '/saf-auth' + }]; +} + module.exports = function() { return {appConfig: appConfig, configJSON: configJSON, startUpConfig: startUpConfig, configLocation: userInput.config} } From 0d47b34d0624ed4c0e884f76de6dc465bbe7b109 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Thu, 31 Oct 2019 18:55:32 -0400 Subject: [PATCH 2/9] Reintroduce agent, commented out, and fix dirname for zos Signed-off-by: 1000TurquoisePogs --- bin/nodeCluster.sh | 2 +- bin/nodeServer.sh | 2 +- config/zluxserver.json | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/nodeCluster.sh b/bin/nodeCluster.sh index 365e0133..795c7df8 100755 --- a/bin/nodeCluster.sh +++ b/bin/nodeCluster.sh @@ -6,7 +6,7 @@ # SPDX-License-Identifier: EPL-2.0 # # Copyright Contributors to the Zowe Project. -dir="$(dirname $(readlink -f $0))" +dir=$(cd `dirname $0` && pwd) if [ -n "$ZLUX_CONFIG_FILE" ] then diff --git a/bin/nodeServer.sh b/bin/nodeServer.sh index 889d8fc7..ea902945 100755 --- a/bin/nodeServer.sh +++ b/bin/nodeServer.sh @@ -6,7 +6,7 @@ # SPDX-License-Identifier: EPL-2.0 # # Copyright Contributors to the Zowe Project. -dir="$(dirname $(readlink -f $0))" +dir=$(cd `dirname $0` && pwd) if [ -n "$ZLUX_CONFIG_FILE" ] then diff --git a/config/zluxserver.json b/config/zluxserver.json index 16a3a970..9e1897db 100644 --- a/config/zluxserver.json +++ b/config/zluxserver.json @@ -12,7 +12,7 @@ "server": { "hostname": "localhost", "port": 10011, - "gatewayPort": 10012, + "gatewayPort": 10012, "isHttps": true }, "enabled": false @@ -24,6 +24,19 @@ } ] }, + + +// 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. "productDir":"../deploy/product", From 2b9f442923401cce6620ad7d3cc403b55e39d048 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 4 Nov 2019 17:35:48 -0500 Subject: [PATCH 3/9] Add logging for initialization Signed-off-by: 1000TurquoisePogs --- lib/zluxArgs.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/zluxArgs.js b/lib/zluxArgs.js index 9f68797c..6af4a396 100644 --- a/lib/zluxArgs.js +++ b/lib/zluxArgs.js @@ -15,6 +15,7 @@ const ProxyServer = require('zlux-server-framework'); const argParser = require('zlux-server-framework/utils/argumentParser'); const jsonUtils = require('zlux-server-framework/lib/jsonUtils'); const mergeUtils = require('zlux-server-framework/utils/mergeUtils'); +const cluster = require('cluster'); const PRODUCT_CODE = 'ZLUX'; const DEFAULT_CONFIG = { @@ -81,12 +82,6 @@ if (!userInput.config) { let configJSON = DEFAULT_CONFIG; const userConfig = jsonUtils.parseJSONWithComments(userInput.config); configJSON = mergeUtils.deepAssign(configJSON, userConfig); -if (userInput.D) { - configJSON = mergeUtils.deepAssign(configJSON, userInput.D); -} -console.log('configjson=',configJSON); - - if (configJSON.agent) { if (configJSON.agent.https) { agentPort = configJSON.agent.https.port; @@ -108,8 +103,18 @@ if(configJSON.node.allowInvalidTLSProxy){ allowInvalidTLS = true; } - if(process.env.overrideFileConfig !== "false"){ + if (cluster.isMaster) { + console.log('Environment variables:\n'+JSON.stringify(process.env, null, 2)); + console.log('\nProcessing CLI arguments:\n'+commandArgs); + } + if (userInput.D) { + if (cluster.isMaster) { + console.log('\nProcessed -D arguments:\n'+JSON.stringify(userInput.D, null, 2)); + } + configJSON = mergeUtils.deepAssign(configJSON, userInput.D); + } + let eUser = userInput.mlUser; let ePass = userInput.mlPass; if(eUser && ePass){ @@ -197,7 +202,7 @@ if (startUpConfig.proxiedHost && startUpConfig.proxiedPort) { url: '/saf-auth' }]; } - +console.log('\nInitializing with configuration:\n',JSON.stringify(configJSON, null, 2)); module.exports = function() { return {appConfig: appConfig, configJSON: configJSON, startUpConfig: startUpConfig, configLocation: userInput.config} } From 7a9fd894fa8eb42bb6080c9de9889c2f496c800a Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Tue, 5 Nov 2019 10:43:37 -0500 Subject: [PATCH 4/9] Fix whitespace Signed-off-by: 1000TurquoisePogs --- config/zluxserver.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/zluxserver.json b/config/zluxserver.json index 9e1897db..e31b1e24 100644 --- a/config/zluxserver.json +++ b/config/zluxserver.json @@ -49,7 +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, + "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. From e9299a1a45689d0989459f6bd977c8b9bbf60399 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Tue, 5 Nov 2019 22:12:25 -0500 Subject: [PATCH 5/9] Fix batch env var problem Signed-off-by: 1000TurquoisePogs --- bin/nodeCluster.bat | 4 ++-- bin/nodeServer.bat | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/nodeCluster.bat b/bin/nodeCluster.bat index a8e8aec6..b8517583 100644 --- a/bin/nodeCluster.bat +++ b/bin/nodeCluster.bat @@ -11,13 +11,13 @@ 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 ( - set ZLUX_NODE_LOG_DIR="../log" + set ZLUX_NODE_LOG_DIR = "../log" ) call :makedir FOR /F %%i IN ("%ZLUX_NODE_LOG_DIR%\nodeServer.log") DO set ZLUX_LOG_PATH=%%~fi ) if not defined ZLUX_CONFIG_FILE ( - set ZLUX_CONFIG_FILE=../deploy/instance/ZLUX/serverConfig/zluxserver.json + set ZLUX_CONFIG_FILE = "../deploy/instance/ZLUX/serverConfig/zluxserver.json" ) set NODE_PATH=../..;../../zlux-server-framework/node_modules;%NODE_PATH% cd ../lib diff --git a/bin/nodeServer.bat b/bin/nodeServer.bat index 86daaf65..d53f2b73 100644 --- a/bin/nodeServer.bat +++ b/bin/nodeServer.bat @@ -11,13 +11,13 @@ 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 ( - set ZLUX_NODE_LOG_DIR="../log" + set ZLUX_NODE_LOG_DIR = "../log" ) call :makedir "%ZLUX_NODE_LOG_DIR%" FOR /F %%i IN ("%ZLUX_NODE_LOG_DIR%\nodeServer.log") DO set ZLUX_LOG_PATH=%%~fi ) if not defined ZLUX_CONFIG_FILE ( - set ZLUX_CONFIG_FILE=../deploy/instance/ZLUX/serverConfig/zluxserver.json + set ZLUX_CONFIG_FILE = "../deploy/instance/ZLUX/serverConfig/zluxserver.json" ) set NODE_PATH=../..;../../zlux-server-framework/node_modules;%NODE_PATH% cd ../lib From 24dfbabbb9d64309fbf13357c6fe2a9466022af5 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 6 Nov 2019 15:24:38 -0500 Subject: [PATCH 6/9] Batch updates Signed-off-by: 1000TurquoisePogs --- bin/nodeCluster.bat | 14 +++++++++----- bin/nodeServer.bat | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/bin/nodeCluster.bat b/bin/nodeCluster.bat index b8517583..edda36ff 100644 --- a/bin/nodeCluster.bat +++ b/bin/nodeCluster.bat @@ -11,13 +11,17 @@ 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 ( - set ZLUX_NODE_LOG_DIR = "../log" + call :makedir "..\log" + set ZLUX_NODE_LOG_DIR="..\log" + ) else ( + call :makedir "%ZLUX_NODE_LOG_DIR%" ) - call :makedir - FOR /F %%i IN ("%ZLUX_NODE_LOG_DIR%\nodeServer.log") DO set ZLUX_LOG_PATH=%%~fi + pushd %ZLUX_NODE_LOG_DIR% + set ZLUX_LOG_PATH="%CD%\nodeServer.log" + popd ) if not defined ZLUX_CONFIG_FILE ( - set ZLUX_CONFIG_FILE = "../deploy/instance/ZLUX/serverConfig/zluxserver.json" + set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json" ) set NODE_PATH=../..;../../zlux-server-framework/node_modules;%NODE_PATH% cd ../lib @@ -40,7 +44,7 @@ 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 REM This program and the accompanying materials are REM made available under the terms of the Eclipse Public License v2.0 which accompanies diff --git a/bin/nodeServer.bat b/bin/nodeServer.bat index d53f2b73..fd735134 100644 --- a/bin/nodeServer.bat +++ b/bin/nodeServer.bat @@ -11,13 +11,17 @@ 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 ( - set ZLUX_NODE_LOG_DIR = "../log" + call :makedir "..\log" + set ZLUX_NODE_LOG_DIR="..\log" + ) else ( + call :makedir "%ZLUX_NODE_LOG_DIR%" ) - call :makedir "%ZLUX_NODE_LOG_DIR%" - FOR /F %%i IN ("%ZLUX_NODE_LOG_DIR%\nodeServer.log") DO set ZLUX_LOG_PATH=%%~fi + pushd %ZLUX_NODE_LOG_DIR% + set ZLUX_LOG_PATH="%CD%\nodeServer.log" + popd ) if not defined ZLUX_CONFIG_FILE ( - set ZLUX_CONFIG_FILE = "../deploy/instance/ZLUX/serverConfig/zluxserver.json" + set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json" ) set NODE_PATH=../..;../../zlux-server-framework/node_modules;%NODE_PATH% cd ../lib @@ -37,7 +41,7 @@ exit %rc% REM Create a directory if it does not exist yet :makedir -if not exist "%1" mkdir "%1" +if not exist %1 mkdir %1 goto :eof REM This program and the accompanying materials are REM made available under the terms of the Eclipse Public License v2.0 which accompanies From 25c981578d26c25993258e56ab007a8cfed4b695 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 6 Nov 2019 15:29:03 -0500 Subject: [PATCH 7/9] Batch updates Signed-off-by: 1000TurquoisePogs --- bin/install-app.bat | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/install-app.bat b/bin/install-app.bat index d1aee0ee..3d12e79d 100644 --- a/bin/install-app.bat +++ b/bin/install-app.bat @@ -11,15 +11,18 @@ if [%1]==[] goto :fail setlocal set app_path="%~f1" if not defined ZLUX_INSTALL_LOG_DIR ( - set ZLUX_INSTALL_LOG_DIR=..\log + set ZLUX_INSTALL_LOG_DIR="..\log" + call :makedir "..\log" +) else ( + call :makedir "%ZLUX_INSTALL_LOG_DIR%" ) if not defined ZLUX_CONFIG_FILE ( - set ZLUX_CONFIG_FILE=%~dp0\..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json + set ZLUX_CONFIG_FILE="%~dp0\..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json" ) -call :makedir %ZLUX_INSTALL_LOG_DIR% -call :abspath %ZLUX_INSTALL_LOG_DIR%\install.log -set LOG_PATH=%RETVAL% +pushd %ZLUX_INSTALL_LOG_DIR% +set LOG_PATH="%CD%\install.log" +popd echo Checking for node where node if %ERRORLEVEL% neq 0 goto :nonode @@ -44,10 +47,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 From c0f224e30cce91d7ab957deaa2b20a0c1599e416 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 6 Nov 2019 16:25:46 -0500 Subject: [PATCH 8/9] More batch fixes Signed-off-by: 1000TurquoisePogs --- bin/install-app.bat | 10 +++++++--- bin/nodeCluster.bat | 11 +++++++---- bin/nodeServer.bat | 11 +++++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/bin/install-app.bat b/bin/install-app.bat index 3d12e79d..df5667f0 100644 --- a/bin/install-app.bat +++ b/bin/install-app.bat @@ -10,19 +10,23 @@ REM Copyright Contributors to the Zowe Project. if [%1]==[] goto :fail setlocal set app_path="%~f1" +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" + cd %temp_cd% ) else ( call :makedir "%ZLUX_INSTALL_LOG_DIR%" + cd "%ZLUX_INSTALL_LOG_DIR%" + for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\install.log" + cd %temp_cd% ) if not defined ZLUX_CONFIG_FILE ( set ZLUX_CONFIG_FILE="%~dp0\..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json" ) -pushd %ZLUX_INSTALL_LOG_DIR% -set LOG_PATH="%CD%\install.log" -popd echo Checking for node where node if %ERRORLEVEL% neq 0 goto :nonode diff --git a/bin/nodeCluster.bat b/bin/nodeCluster.bat index edda36ff..df349e23 100644 --- a/bin/nodeCluster.bat +++ b/bin/nodeCluster.bat @@ -10,15 +10,18 @@ setlocal if defined ZLUX_NODE_LOG_FILE ( FOR /F %%i IN ("%ZLUX_NODE_LOG_FILE%") DO set ZLUX_LOG_PATH=%%~fi ) else ( + set temp_cd=%CD% if not defined ZLUX_NODE_LOG_DIR ( call :makedir "..\log" - set ZLUX_NODE_LOG_DIR="..\log" + cd ..\log + for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log" + cd %temp_cd% ) 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% ) - pushd %ZLUX_NODE_LOG_DIR% - set ZLUX_LOG_PATH="%CD%\nodeServer.log" - popd ) if not defined ZLUX_CONFIG_FILE ( set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json" diff --git a/bin/nodeServer.bat b/bin/nodeServer.bat index fd735134..4f38d401 100644 --- a/bin/nodeServer.bat +++ b/bin/nodeServer.bat @@ -10,15 +10,18 @@ setlocal if defined ZLUX_NODE_LOG_FILE ( FOR /F %%i IN ("%ZLUX_NODE_LOG_FILE%") DO set ZLUX_LOG_PATH=%%~fi ) else ( + set temp_cd=%CD% if not defined ZLUX_NODE_LOG_DIR ( call :makedir "..\log" - set ZLUX_NODE_LOG_DIR="..\log" + cd ..\log + for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log" + cd %temp_cd% ) 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% ) - pushd %ZLUX_NODE_LOG_DIR% - set ZLUX_LOG_PATH="%CD%\nodeServer.log" - popd ) if not defined ZLUX_CONFIG_FILE ( set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json" From bd1bd76b881b579afb7bd6f6c98f17e98e4e4e44 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 6 Nov 2019 16:45:49 -0500 Subject: [PATCH 9/9] Even more batch fixes Signed-off-by: 1000TurquoisePogs --- bin/install-app.bat | 3 +-- bin/nodeCluster.bat | 6 +++--- bin/nodeServer.bat | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/install-app.bat b/bin/install-app.bat index df5667f0..a1f8598d 100644 --- a/bin/install-app.bat +++ b/bin/install-app.bat @@ -16,13 +16,12 @@ if not defined ZLUX_INSTALL_LOG_DIR ( call :makedir "..\log" cd ..\log for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\install.log" - cd %temp_cd% ) else ( call :makedir "%ZLUX_INSTALL_LOG_DIR%" cd "%ZLUX_INSTALL_LOG_DIR%" for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\install.log" - cd %temp_cd% ) +cd %temp_cd% if not defined ZLUX_CONFIG_FILE ( set ZLUX_CONFIG_FILE="%~dp0\..\..\zlux-app-server\deploy\instance\ZLUX\serverConfig\zluxserver.json" ) diff --git a/bin/nodeCluster.bat b/bin/nodeCluster.bat index df349e23..e81bfe69 100644 --- a/bin/nodeCluster.bat +++ b/bin/nodeCluster.bat @@ -7,22 +7,22 @@ REM SPDX-License-Identifier: EPL-2.0 REM REM Copyright Contributors to the Zowe Project. setlocal +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 ( - set temp_cd=%CD% + if not defined ZLUX_NODE_LOG_DIR ( call :makedir "..\log" cd ..\log for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log" - cd %temp_cd% ) 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% ) ) +cd %temp_cd% if not defined ZLUX_CONFIG_FILE ( set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json" ) diff --git a/bin/nodeServer.bat b/bin/nodeServer.bat index 4f38d401..608f7db6 100644 --- a/bin/nodeServer.bat +++ b/bin/nodeServer.bat @@ -7,22 +7,22 @@ REM SPDX-License-Identifier: EPL-2.0 REM REM Copyright Contributors to the Zowe Project. setlocal +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 ( - set temp_cd=%CD% if not defined ZLUX_NODE_LOG_DIR ( call :makedir "..\log" cd ..\log for %%I in (.) do set ZLUX_LOG_PATH="%%~dpfI\nodeServer.log" - cd %temp_cd% + ) 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% ) ) +cd %temp_cd% if not defined ZLUX_CONFIG_FILE ( set ZLUX_CONFIG_FILE="../deploy/instance/ZLUX/serverConfig/zluxserver.json" )