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

A fix for incorrect redirects in app-server.sh script #235

Open
wants to merge 3 commits into
base: v2.x/staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions bin/app-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,96 @@
#
# Copyright Contributors to the Zowe Project.


# Required variables on shell:
# - ZWE_zowe_runtimeDirectory
# - ZWE_zowe_workspaceDirectory
# - NODE_HOME
#
# Optional variables on shell:
# - APIML_ENABLE_SSO
# - GATEWAY_PORT
# - DISCOVERY_PORT
# - ZWED_SSH_PORT
# - ZWED_TN3270_PORT
# - ZWED_TN3270_SECURITY

if [ -z "${ZWE_zowe_runtimeDirectory}" ]
then
#this may be a dev environment, or backward compat, so stay in current dir and check node
. ./validate.sh
fi

if [ ! -e "${dir}/utils/convert-env.sh" ]
then
if [ -n "$CONDA_PREFIX" ]
then
dir="$CONDA_PREFIX/share/zowe/app-server/zlux-app-server/bin"
cd $dir
fi
fi

. ./utils/convert-env.sh
. ./init/node-init.sh

if [ -e "$ZLUX_CONFIG_FILE" ]
then
CONFIG_FILE=$ZLUX_CONFIG_FILE
elif [ -e "$ZWE_CLI_PARAMETER_CONFIG" ]
then
CONFIG_FILE="$ZWE_CLI_PARAMETER_CONFIG"
elif [ -z "${ZWE_zowe_runtimeDirectory}" ]
then
#dev env or backwards compat, do late configure
# should we also export ZWE_zowe_workspaceDirectory=~/.zowe/zowe.yaml?
# potentially zowe.yaml in there could point workspaceDirectory elsewhere to cause further confusion
. ./init/workspace-init.sh
CONFIG_FILE=~/.zowe/zowe.yaml
fi

# Will skip log trimming if ZWED_NODE_LOG_FILE already defined (such as by start.sh)
. ../bin/utils/setup-logs.sh

#Determined log file. Run node appropriately.
cd ../lib

export ZOWE_LIB_DIR=$(pwd)
export ZLUX_ROOT_DIR=$(cd ../..; pwd)

export "_CEE_RUNOPTS=XPLINK(ON),HEAPPOOLS(ON)"

echo Show Environment
env

if [ -z "$ZOWE_WORKING_DIR" ]
then
export ZOWE_WORKING_DIR=$ZOWE_LIB_DIR
else
echo "Server is about to start with a non default working directory. Working dir=$ZOWE_WORKING_DIR"
fi

cd $ZOWE_WORKING_DIR

export ZWED_NODE_LOG_FILE=$ZWED_NODE_LOG_FILE

echo Starting node
if [ -z "$ZLUX_NO_CLUSTER" ]
then
ZLUX_SERVER_FILE=zluxCluster.js
if [ -z "$ZLUX_MIN_WORKERS" ]
then
export ZLUX_MIN_WORKERS=2
fi
else
ZLUX_SERVER_FILE=zluxServer.js
fi

if [ -z "$ZLUX_NO_LOGFILE" ]; then
__UNTAGGED_READ_MODE=V6 _BPX_JOBNAME=${ZOWE_PREFIX}DS ${NODE_BIN} --harmony ${ZOWE_LIB_DIR}/${ZLUX_SERVER_FILE} --config="${CONFIG_FILE}" "$@" 2>&1 | tee $ZWED_NODE_LOG_FILE
else
__UNTAGGED_READ_MODE=V6 _BPX_JOBNAME=${ZOWE_PREFIX}DS ${NODE_BIN} --harmony ${ZOWE_LIB_DIR}/${ZLUX_SERVER_FILE} --config="${CONFIG_FILE}" "$@"
echo "Ended with rc=$?"
fi


./start.sh
30 changes: 29 additions & 1 deletion bin/init/workspace-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,32 @@
#ZLUX_CONFIG_FILE and ZWE_zowe_workspaceDirectory are for official Zowe environment use.
#If none found, will assume dev environment and consider ~/.zowe/workspace as ZWE_zowe_workspaceDirectory


if [ -n "${ZWE_zowe_workspaceDirectory}" ]
then
if [ -e "${ZWE_zowe_workspaceDirectory}/app-server/serverConfig/zowe.yaml" ]
then
export CONFIG_FILE="${ZWE_zowe_workspaceDirectory}/app-server/serverConfig/zowe.yaml"
else
cd ../../lib
__UNTAGGED_READ_MODE=V6 $NODE_BIN initInstance.js
export CONFIG_FILE="${ZWE_zowe_workspaceDirectory}/app-server/serverConfig/zowe.yaml"
fi
elif [ -e "${HOME}/.zowe/workspace/app-server/serverConfig/zowe.yaml" ]
then
export CONFIG_FILE="${HOME}/.zowe/workspace/app-server/serverConfig/zowe.yaml"
if [ -z "${ZWE_zowe_logDirectory}" ]; then
export ZWE_zowe_logDirectory="${HOME}/.zowe/logs"
fi
mkdir -p ${ZWE_zowe_logDirectory}
export WORKSPACE_DIR="${HOME}/.zowe/workspace"
else
echo "No config file found, initializing..."
export WORKSPACE_DIR="${HOME}/.zowe/workspace"
if [ -z "${ZWE_zowe_logDirectory}" ]; then
export ZWE_zowe_logDirectory="${HOME}/.zowe/logs"
fi
mkdir -p ${ZWE_zowe_logDirectory}
cd ../lib
__UNTAGGED_READ_MODE=V6 $NODE_BIN initInstance.js
export CONFIG_FILE="${HOME}/.zowe/workspace/app-server/serverConfig/zowe.yaml"
fi