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

Componentise apiml #743

Merged
merged 22 commits into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion manifest.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"version": "~0.0.13"
},
"com.ca.mfaas.sdk.mfaas-zowe-install": {
"version": "~1.1.5",
"version": "~1.1.11-SNAPSHOT",
"artifact": "mfaas-zowe-install-*.zip",
"target": ".pax/mediation/",
"explode": "true"
Expand Down
89 changes: 1 addition & 88 deletions scripts/configure/zowe-configure-api-mediation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,10 @@

echo "<zowe-api-mediation-configure.sh>" >> $LOG_FILE

API_MEDIATION_DIR=$ZOWE_ROOT_DIR"/api-mediation"
API_MEDIATION_DIR=$ZOWE_ROOT_DIR"/components/api-mediation"

cd $API_MEDIATION_DIR

# Set a+rx for API Mediation JARs
chmod a+rx *.jar

# Make the apiml-auth plugin readable by everyone
chmod a+rx apiml-auth
chmod a+rx apiml-auth/lib
chmod -R a+r apiml-auth

# Create the static api definitions folder
STATIC_DEF_CONFIG=$API_MEDIATION_DIR"/api-defs"
mkdir -p $STATIC_DEF_CONFIG
Expand All @@ -63,37 +55,6 @@ sed -e "s|\*\*JAVA_SETUP\*\*|export JAVA_HOME=$ZOWE_JAVA_HOME|g" \
# Make configured script executable
chmod a+x setup-apiml-certificates.sh

# Inject parameters into API Mediation startup scripts, which contains command-line parameters as configuration
sed -e "s|\*\*JAVA_SETUP\*\*|export JAVA_HOME=$ZOWE_JAVA_HOME|g" \
-e "s/\*\*HOSTNAME\*\*/$ZOWE_EXPLORER_HOST/g" \
-e "s/\*\*IPADDRESS\*\*/$ZOWE_IPADDRESS/g" \
-e "s/\*\*DISCOVERY_PORT\*\*/$ZOWE_APIM_DISCOVERY_PORT/g" \
-e "s/\*\*CATALOG_PORT\*\*/$ZOWE_APIM_CATALOG_PORT/g" \
-e "s/\*\*GATEWAY_PORT\*\*/$ZOWE_APIM_GATEWAY_PORT/g" \
-e "s/\*\*VERIFY_CERTIFICATES\*\*/$ZOWE_APIM_VERIFY_CERTIFICATES/g" \
api-mediation-start-catalog-template.sh > api-mediation-start-catalog.sh

# Inject parameters into API Mediation startup, which contains command-line parameters as configuration
sed -e "s|\*\*JAVA_SETUP\*\*|export JAVA_HOME=$ZOWE_JAVA_HOME|g" \
-e "s/\*\*HOSTNAME\*\*/$ZOWE_EXPLORER_HOST/g" \
-e "s/\*\*IPADDRESS\*\*/$ZOWE_IPADDRESS/g" \
-e "s/\*\*DISCOVERY_PORT\*\*/$ZOWE_APIM_DISCOVERY_PORT/g" \
-e "s/\*\*CATALOG_PORT\*\*/$ZOWE_APIM_CATALOG_PORT/g" \
-e "s/\*\*GATEWAY_PORT\*\*/$ZOWE_APIM_GATEWAY_PORT/g" \
-e "s/\*\*VERIFY_CERTIFICATES\*\*/$ZOWE_APIM_VERIFY_CERTIFICATES/g" \
api-mediation-start-gateway-template.sh > api-mediation-start-gateway.sh

# Inject parameters into API Mediation startup, which contains command-line parameters as configuration
sed -e "s|\*\*JAVA_SETUP\*\*|export JAVA_HOME=$ZOWE_JAVA_HOME|g" \
-e "s/\*\*HOSTNAME\*\*/$ZOWE_EXPLORER_HOST/g" \
-e "s/\*\*IPADDRESS\*\*/$ZOWE_IPADDRESS/g" \
-e "s/\*\*DISCOVERY_PORT\*\*/$ZOWE_APIM_DISCOVERY_PORT/g" \
-e "s/\*\*CATALOG_PORT\*\*/$ZOWE_APIM_CATALOG_PORT/g" \
-e "s/\*\*GATEWAY_PORT\*\*/$ZOWE_APIM_GATEWAY_PORT/g" \
-e "s|\*\*STATIC_DEF_CONFIG\*\*|$STATIC_DEF_CONFIG|g" \
-e "s/\*\*VERIFY_CERTIFICATES\*\*/$ZOWE_APIM_VERIFY_CERTIFICATES/g" \
api-mediation-start-discovery-template.sh > api-mediation-start-discovery.sh

# Make the scripts read and executable
chmod -R 750 "${API_MEDIATION_DIR}/scripts"

Expand All @@ -106,54 +67,6 @@ echo " Certificate setup done."

chmod -R 750 "${API_MEDIATION_DIR}/keystore"

# Get the zos version
ZOSMF_VERSION=""
ZOSMF_DOC_URL=""
# Hack - if opercmd fails default to latest OS
ZOS_RELEASE=`${ZOWE_ROOT_DIR}/scripts/internal/opercmd 'd iplinfo'|grep RELEASE` || ZOS_RELEASE="RELEASE z/OS 02.03.00"
ZOS_VRM=`echo $ZOS_RELEASE | sed 's+.*RELEASE z/OS \(........\).*+\1+'`

if [[ $ZOS_VRM == "02.03.00" ]]
then
ZOSMF_VERSION=2.3.0
ZOSMF_DOC_URL="https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.izua700/IZUHPINFO_RESTServices.htm"
elif [[ $ZOS_VRM == "02.02.00" ]]
then
ZOSMF_VERSION=2.2.0
ZOSMF_DOC_URL="https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.izua700/IZUHPINFO_RESTServices.htm"
fi

# Add static definition for zosmf
cat <<EOF >$TEMP_DIR/zosmf.yml
# Static definition for z/OSMF
#
# Once configured you can access z/OSMF via the API gateway:
# http --verify=no GET https://$ZOWE_ZOSMF_HOST:$ZOWE_APIM_GATEWAY_PORT/api/v1/zosmf/info 'X-CSRF-ZOSMF-HEADER;'
#
services:
- serviceId: zosmf
title: IBM z/OSMF
description: IBM z/OS Management Facility REST API service
catalogUiTileId: zosmf
instanceBaseUrls:
- https://$ZOWE_ZOSMF_HOST:$ZOWE_ZOSMF_PORT/zosmf/
homePageRelativeUrl: # Home page is at the same URL
routedServices:
- gatewayUrl: api/v1 # [api/ui/ws]/v{majorVersion}
serviceRelativeUrl:
apiInfo:
- apiId: com.ibm.zosmf
gatewayUrl: api/v1
version: $ZOSMF_VERSION
documentationUrl: $ZOSMF_DOC_URL

catalogUiTiles:
zosmf:
title: z/OSMF services
description: IBM z/OS Management Facility REST services
EOF
iconv -f IBM-1047 -t IBM-850 $TEMP_DIR/zosmf.yml > $STATIC_DEF_CONFIG/zosmf.yml

# Add static definition for MVS datasets
cat <<EOF >$TEMP_DIR/datasets_ui.yml
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure/zowe-configure-explorer-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [ ! -f $NODE_BIN ]; then
exit 0
fi
# define zlux certs from apiml keystore
APIML_KEYSTORE_PATH=${ZOWE_ROOT_DIR}/api-mediation/keystore
APIML_KEYSTORE_PATH=${ZOWE_ROOT_DIR}"/components/api-mediation/keystore"
SUFFIX=""
if [ `uname` = "OS/390" ]; then
SUFFIX="-ebcdic"
Expand Down
8 changes: 7 additions & 1 deletion scripts/configure/zowe-configure-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ sed -e "s#{{node_home}}#${NODE_HOME}#" \
-e "s#{{java_home}}#${ZOWE_JAVA_HOME}#" \
-e "s#{{files_api_port}}#${ZOWE_EXPLORER_SERVER_DATASETS_PORT}#" \
-e "s#{{jobs_api_port}}#${ZOWE_EXPLORER_SERVER_JOBS_PORT}#" \
-e "s#{{discovery_port}}#${ZOWE_APIM_DISCOVERY_PORT}#" \
-e "s#{{catalog_port}}#${ZOWE_APIM_CATALOG_PORT}#" \
-e "s#{{gateway_port}}#${ZOWE_APIM_GATEWAY_PORT}#" \
-e "s#{{verify_certificates}}#${ZOWE_APIM_VERIFY_CERTIFICATES}#" \
-e "s#{{zosmf_port}}#${ZOWE_ZOSMF_PORT}#" \
-e "s#{{zosmf_ip_address}}#${ZOWE_ZOSMF_HOST}#" \
-e "s#{{zowe_explorer_host}}#${ZOWE_EXPLORER_HOST}#" \
-e "s#{{zowe_ip_address}}#${ZOWE_IPADDRESS}#" \
-e "s#{{stc_name}}#${ZOWE_SERVER_PROCLIB_MEMBER}#" \
-e "s#{{key_alias}}#localhost#" \
-e "s#{{keystore}}#${ZOWE_ROOT_DIR}/api-mediation/keystore/localhost/localhost.keystore.p12#" \
-e "s#{{keystore}}#${ZOWE_ROOT_DIR}/components/api-mediation/keystore/localhost/localhost.keystore.p12#" \
-e "s#{{keystore_password}}#password#" \
-e "s#{{truststore}}#${ZOWE_ROOT_DIR}/components/api-mediation/keystore/localhost/localhost.truststore.p12#" \
"${ZOWE_ROOT_DIR}/scripts/templates/run-zowe.template.sh" \
> "${ZOWE_ROOT_DIR}/scripts/internal/run-zowe.sh"

Expand Down
2 changes: 1 addition & 1 deletion scripts/configure/zowe-configure-zlux-certificates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
################################################################################

ZLUX_SERVER_CONFIG_PATH=${ZOWE_ROOT_DIR}/zlux-app-server/config
APIML_KEYSTORE_PATH=${ZOWE_ROOT_DIR}/api-mediation/keystore
APIML_KEYSTORE_PATH=${ZOWE_ROOT_DIR}/components/api-mediation/keystore
SUFFIX=""
if [ `uname` = "OS/390" ]; then
SUFFIX="-ebcdic"
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure/zowe-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fi

# Add API Catalog application to zLUX - required before we issue ZLUX deploy.sh
# TODO - move into apiml config? run before deploy?
. $CONFIG_DIR/zowe-install-iframe-plugin.sh $ZOWE_ROOT_DIR "org.zowe.api.catalog" "API Catalog" $CATALOG_GATEWAY_URL $ZOWE_ROOT_DIR"/api-mediation/api-catalog.png"
. $CONFIG_DIR/zowe-install-iframe-plugin.sh $ZOWE_ROOT_DIR "org.zowe.api.catalog" "API Catalog" $CATALOG_GATEWAY_URL $ZOWE_ROOT_DIR"/components/api-mediation/api-catalog.png"

# Configure API Mediation layer. Because this script may fail because of priviledge issues with the user ID
# this script is run after all the folders have been created and paxes expanded above
Expand Down
25 changes: 15 additions & 10 deletions scripts/run-zowe.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,20 @@ ROOT_DIR={{root_dir}} # the install directory of zowe
USER_DIR={{user_dir}} # the workspace location for this instance. TODO Should we add this as a new to the yaml, or default it?
FILES_API_PORT={{files_api_port}} # the port the files api service will use
JOBS_API_PORT={{jobs_api_port}} # the port the files api service will use
DISCOVERY_PORT={{discovery_port}} # the port the discovery service will use
CATALOG_PORT={{catalog_port}} # the port the api catalog service will use
GATEWAY_PORT={{gateway_port}} # the port the api gateway service will use
VERIFY_CERTIFICATES={{verify_certificates}} # boolean saying if we accept only verified certificates
STC_NAME={{stc_name}}

# details to be read from higher level entry that instance PARMLIB/prop file?
KEY_ALIAS={{key_alias}}
KEYSTORE={{keystore}}
TRUSTSTORE={{truststore}}
KEYSTORE_PASSWORD={{keystore_password}}
ZOSMF_PORT={{zosmf_port}}
ZOSMF_IP_ADDRESS={{zosmf_ip_address}}
ZOWE_IP_ADDRESS={{zowe_ip_address}}
ZOWE_EXPLORER_HOST={{zowe_explorer_host}}
ZOWE_JAVA_HOME={{java_home}}

Expand Down Expand Up @@ -89,12 +95,8 @@ DIR=`dirname $0`
mkdir -p ${USER_DIR}/api-defs
STATIC_DEF_CONFIG_DIR=${USER_DIR}/api-defs

# TODO - temporary until APIML is componentised - Inject it into discovery script
sed -e "s#-Dapiml.discovery.staticApiDefinitionsDirectories.*[^\\]#-Dapiml.discovery.staticApiDefinitionsDirectories=\"${STATIC_DEF_CONFIG_DIR};${ROOT_DIR}/api-mediation/api-defs\" #" \
"${ROOT_DIR}/api-mediation/scripts/api-mediation-start-discovery.sh" \
> "${ROOT_DIR}/api-mediation/scripts/api-mediation-start-discovery.sh.copy"
mv "${ROOT_DIR}/api-mediation/scripts/api-mediation-start-discovery.sh.copy" "${ROOT_DIR}/api-mediation/scripts/api-mediation-start-discovery.sh"
chmod 770 "${ROOT_DIR}/api-mediation/scripts/api-mediation-start-discovery.sh"
# Until ui explorers componentised will copy them from the old location
cp ${ROOT_DIR}/components/api-mediation/api-defs/* ${STATIC_DEF_CONFIG_DIR}

if [[ $LAUNCH_COMPONENT_GROUPS == *"DESKTOP"* ]]
then
Expand All @@ -103,10 +105,7 @@ fi

if [[ $LAUNCH_COMPONENT_GROUPS == *"GATEWAY"* ]]
then
LAUNCH_COMPONENTS=${LAUNCH_COMPONENTS},files-api,jobs-api #TODO this is WIP - component ids not finalised at the moment
_BPX_JOBNAME=$ZOWE_API_DS $DIR/../../api-mediation/scripts/api-mediation-start-discovery.sh
_BPX_JOBNAME=$ZOWE_API_CT $DIR/../../api-mediation/scripts/api-mediation-start-catalog.sh
_BPX_JOBNAME=$ZOWE_API_GW $DIR/../../api-mediation/scripts/api-mediation-start-gateway.sh
LAUNCH_COMPONENTS=${LAUNCH_COMPONENTS},files-api,jobs-api,api-mediation #TODO this is WIP - component ids not finalised at the moment
_BPX_JOBNAME=$ZOWE_EXPL_UI_JES $DIR/../../jes_explorer/scripts/start-explorer-jes-ui-server.sh
_BPX_JOBNAME=$ZOWE_EXPL_UI_MVS $DIR/../../mvs_explorer/scripts/start-explorer-mvs-ui-server.sh
_BPX_JOBNAME=$ZOWE_EXPL_UI_USS $DIR/../../uss_explorer/scripts/start-explorer-uss-ui-server.sh
Expand Down Expand Up @@ -148,13 +147,19 @@ ROOT_DIR=${ROOT_DIR}
USER_DIR=${USER_DIR}
FILES_API_PORT=${FILES_API_PORT}
JOBS_API_PORT=${JOBS_API_PORT}
DISCOVERY_PORT=${DISCOVERY_PORT}
CATALOG_PORT=${CATALOG_PORT}
GATEWAY_PORT=${GATEWAY_PORT}
VERIFY_CERTIFICATES=${VERIFY_CERTIFICATES}
STC_NAME=${STC_NAME}
KEY_ALIAS=${KEY_ALIAS}
KEYSTORE=${KEYSTORE}
TRUSTSTORE=${TRUSTSTORE}
KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD}
STATIC_DEF_CONFIG_DIR=${STATIC_DEF_CONFIG_DIR}
ZOSMF_PORT=${ZOSMF_PORT}
ZOSMF_IP_ADDRESS=${ZOSMF_IP_ADDRESS}
ZOWE_IP_ADDRESS=${ZOWE_IP_ADDRESS}
ZOWE_EXPLORER_HOST=${ZOWE_EXPLORER_HOST}
ZOWE_JAVA_HOME=${ZOWE_JAVA_HOME}
LAUNCH_COMPONENTS=${LAUNCH_COMPONENTS}
Expand Down
21 changes: 17 additions & 4 deletions scripts/zowe-api-mediation-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# $ZOWE_JAVA_HOME
# $ZOWE_ROOT_DIR

API_MEDIATION_DIR=$ZOWE_ROOT_DIR"/components/api-mediation"

echo "<zowe-api-mediation-install.sh>" >> $LOG_FILE
cd $INSTALL_DIR
API_MEDIATION_PAX=$PWD/$(ls -t ./files/api-mediation-package*.pax | head -1)
Expand All @@ -26,15 +28,26 @@ if [ ! -f $API_MEDIATION_PAX ]
fi

# unpax the API Mediation services
echo "Installing API Mediation into" $ZOWE_ROOT_DIR"/api-mediation ..." >> $LOG_FILE
echo "Installing API Mediation into ${API_MEDIATION_DIR} ...">> $LOG_FILE
umask 0002
mkdir -p $ZOWE_ROOT_DIR"/api-mediation"
cd $ZOWE_ROOT_DIR"/api-mediation"
mkdir -p ${API_MEDIATION_DIR}
cd ${API_MEDIATION_DIR}
# Change to the place where we are expanding the .pax into the /api-mediation beneath the $rootDir environment variable, e.g /usr/lpp/zowe
echo "Unpax of $API_MEDIATION_PAX into $PWD" >> $LOG_FILE
pax -rf $API_MEDIATION_PAX -ppx

# TODO are these mediation steps needed (from api-ml config script)?

# Set a+rx for API Mediation JARs
chmod a+rx "${API_MEDIATION_DIR}"/*.jar
chmod -R 751 "${API_MEDIATION_DIR}/bin"

# Make the apiml-auth plugin readable by everyone
chmod a+rx "${API_MEDIATION_DIR}/apiml-auth"
chmod a+rx "${API_MEDIATION_DIR}/apiml-auth/lib"
chmod -R a+r "${API_MEDIATION_DIR}/apiml-auth"

# TODO - move image into apiml pax
cp $INSTALL_DIR/files/assets/api-catalog.png ${ZOWE_ROOT_DIR}"/api-mediation"
cp $INSTALL_DIR/files/assets/api-catalog.png ${API_MEDIATION_DIR}

echo "</zowe-api-mediation-install.sh>" >> $LOG_FILE
2 changes: 1 addition & 1 deletion scripts/zowe-explorer-api-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for COMPONENT_ID in $EXPLORER_API_LIST; do
exit 0
fi

echo " Installing Explorer ${COMPONENT_ID} API into ${ZOWE_ROOT_DIR}/${COMPONENT_ID} ..." >> $LOG_FILE
echo " Installing Explorer ${COMPONENT_ID} API into ${ZOWE_ROOT_DIR}/components/${COMPONENT_ID} ..." >> $LOG_FILE
umask 0002
mkdir -p "${ZOWE_ROOT_DIR}/components/${COMPONENT_ID}/bin"
# copy jar
Expand Down
2 changes: 0 additions & 2 deletions scripts/zowe-runtime-authorize.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ echo " Completed find and chmods to add o+x on directories" >> $LOG_FILE

#TODO SH: temporary fix whilst logs are't in the user-dir.
chmod -R g+w ${ZOWE_ROOT_DIR}/zlux-app-server/log
#TODO SH: temporary fix whilst APIML isn't componentised - we need to write discovery script to inject user-dir static defs
chmod -R g+w ${ZOWE_ROOT_DIR}/api-mediation/scripts/

# If this step fails it is because the user running this script is not part of the IZUADMIN group
chgrp -R ${ZOWE_ZOSMF_ADMIN_GROUP} ${ZOWE_ROOT_DIR}
Expand Down
3 changes: 0 additions & 3 deletions smpe/bld/SMPMCS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,5 @@
SHSCRIPT(ZWESHPAX,PRE,POST)
BINARY PARM(PATHMODE(0,7,5,5)) .
++HFS(ZWEPAX17) SYSLIB(SZWEZFS ) DISTLIB(AZWEZFS ) RELFILE(4)
SHSCRIPT(ZWESHPAX,PRE,POST)
BINARY PARM(PATHMODE(0,7,5,5)) .
++HFS(ZWEPAX18) SYSLIB(SZWEZFS ) DISTLIB(AZWEZFS ) RELFILE(4)
SHSCRIPT(ZWESHPAX,PRE,POST)
BINARY PARM(PATHMODE(0,7,5,5)) .
2 changes: 1 addition & 1 deletion smpe/bld/smpe-split.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ _move $stage $split/$file echo zss-auth
_move $stage $split/$file echo manifest.json

# api-mediation has a few big jar files, give them their own pax
for f in $(ls api-mediation/*.jar | grep -v /enabler) #*/
for f in $(ls components/api-mediation/*.jar | grep -v /enabler) #*/
do
let cnt=$cnt+1 ; file=${mask}$(echo 0$cnt | sed 's/.*\(..\)$/\1/')
_move $stage $split/$file echo $f
Expand Down