diff --git a/README.md b/README.md index 6751544..b4be571 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,16 @@ npm install npm start ``` -Open your local browser and try accessing -`https://localhost:18000/accounts/` -`https://localhost:18000/accounts/1` -`https://localhost:18000/accounts/1/cars/` +Open your local browser and verify the sample-node-api is working by accessing: +`http://localhost:18000/accounts/` +`http://localhost:18000/accounts/1` +`http://localhost:18000/accounts/1/cars/` ### 2) Transfer project files from local to remote host **Note** -Don't transfer `node_modules` folder, we can do install npm install later on remote server itself to pull down required node packages +The `node_modules` folder will not be transferred, we can do npm install later on remote server itself to pull down required node packages ``` cd sample-node-api @@ -38,29 +38,27 @@ npm run build scp -r dist ibmuser@my.mainframe.com:/sample-node-api ``` +For the next step, ensure that you have node installed on z/OS and your PATH includes nodejs/bin directory. + +``` +ssh ibmuser@my.mainframe.com +. ~/.profile - (Skip if you can already run "npm" on z/OS) +cd /sample-node-api +npm install +``` + ## Method 2: From Artifactory ### 1) Download latest pax from artifactory -Get latest package from [artifactory](https://zowe.jfrog.io/zowe/webapp/#/artifacts/browse/tree/General/libs-snapshot-local/org/zowe/sample-node-api/1.0.0-SNAPSHOT) +Get latest package from [artifactory](https://zowe.jfrog.io/artifactory/libs-snapshot-local/org/zowe/sample-node-api/1.0.0-SNAPSHOT) -Copy latest pax url and use curl to download: -``` -# on local or directly on z/OS -curl -O https://zowe.jfrog.io/zowe/libs-snapshot-local/org/zowe/sample-node-api/1.0.0-SNAPSHOT/sample-node-api-1.0.0-snapshot-1-20200903170045.pax -``` +Choose the latest pax build provided from the link above and download it into your local storage. ### 2) Transfer and unpax on z/OS ``` -# From local - if downloaded on z/OS skip this sftp ibmuser@mymainframe.ibm.com put .pax - -# On z/OS -mkdir sample-node-api -cd sample-node-api -pax -ppx -rf ../.pax ``` - ## PART II: Deploy with Zowe on server ### 1) login @@ -68,28 +66,21 @@ pax -ppx -rf ../.pax ssh ibmuser@my.mainframe.com ``` -### 2) install dependencies +### 2) install component using zowe-install-component.sh script ``` -cd /sample-node-api -npm install --only=prod - +.//bin/zowe-install-component.sh -d -i -o -l +``` +``` + - Directory that will hold all external extensions installed onto zowe + - Current installed Zowe's instance directory + - The path to the component being installed (the component file transferred from local to z/OS in PART I) + - Directory that will hold the logs of the component installation ``` -### 3) Manage lifecycle of service with core zowe components +### 3) Lifecycle scripts of the component -Use property `EXTERNAL_COMPONENTS` located in file `$INSTANCE_DIR/instance.env` -Append it (comma separated) with the directory containing your service lifecycle scripts. +We expect following in service folder `start.sh`. In our case its bin folder with relevant scripts. -In our sample it is: -``` - vi INSTANCE_DIR/instance.env - EXTERNAL_COMPONENTS=/sample-node-api/bin -``` - -We expect following in service folder `start.sh` and `configure.sh`. -In our case its bin folder with relevant scripts. - -`configure.sh` it adds static definition for sample-node-api to folder ${INSTANCE_DIR}/workspace/api-mediation/api-defs in IBM-850 encoding `start.sh` starts node app on configured port `env.sh` its custom script use to configure port for our node app, feel free to use your desired way diff --git a/bin/configure-2.sh b/bin/configure-2.sh deleted file mode 100755 index bd1cfbf..0000000 --- a/bin/configure-2.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -################################################################################ -# This program and the accompanying materials are made available under the terms of the -# Eclipse Public License v2.0 which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-v20.html -# -# SPDX-License-Identifier: EPL-2.0 -# -# Copyright IBM Corporation 2020 -################################################################################ - -# Variables required on shell: -# STATIC_DEF_CONFIG_DIR=${INSTANCE_DIR}/workspace/api-mediation/api-defs -# ZOWE_EXPLORER_HOST -# MY_API_NAME -# MY_API_PORT - -echo 'sample-node-api configure begin' - -echo "LAUNCH_COMPONENT: ${LAUNCH_COMPONENT} " -COMPONENT_DIR=$(dirname "${LAUNCH_COMPONENT}") -echo "COMPONENT_DIR: ${COMPONENT_DIR}" - -echo 'load sample-node-api config' -# load config from env -. ${COMPONENT_DIR}/bin/env.sh - -echo 'make sample-node-api.ebcidic.yml with replaced env variable' - -# Add static definition for sample-node-api -cat <${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml -# -services: - - serviceId: ${MY_API_NAME} - title: ${MY_API_NAME} - description: Example ${MY_API_NAME} Application - catalogUiTileId: ${MY_API_NAME} - instanceBaseUrls: - - https://${ZOWE_EXPLORER_HOST}:${MY_API_PORT}/ - homePageRelativeUrl: # Home page is at the same URL - routedServices: - - gatewayUrl: api/v1 # [api/ui/ws]/v{majorVersion} - serviceRelativeUrl: - apiInfo: - - apiId: com.ibm.${MY_API_NAME} - gatewayUrl: api/v1 - version: 0.0.1 - -catalogUiTiles: - ${MY_API_NAME}: - title: ${MY_API_NAME} - description: Example ${MY_API_NAME} Application -EOF - -echo 'change sample-node-api.ebcidic.yml encoding from ibm-1047 to ibm-850' - -# basically this yml file is only thing we need to do register our service with apiml -iconv -f IBM-1047 -t IBM-850 ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml > $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml -rm ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml -chmod 770 $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml - -echo 'sample-node-api configure done' \ No newline at end of file diff --git a/bin/configure.sh b/bin/configure.sh deleted file mode 100755 index ae8d456..0000000 --- a/bin/configure.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -################################################################################ -# This program and the accompanying materials are made available under the terms of the -# Eclipse Public License v2.0 which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-v20.html -# -# SPDX-License-Identifier: EPL-2.0 -# -# Copyright IBM Corporation 2020 -################################################################################ - -# Variables required on shell: -# STATIC_DEF_CONFIG_DIR=${INSTANCE_DIR}/workspace/api-mediation/api-defs -# ZOWE_EXPLORER_HOST -# MY_API_NAME -# MY_API_PORT - -echo 'sample-node-api configure begin' - -echo "LAUNCH_COMPONENT: ${LAUNCH_COMPONENT} " -COMPONENT_DIR=$(dirname "${LAUNCH_COMPONENT}") -echo "COMPONENT_DIR: ${COMPONENT_DIR}" - -# load config from env -echo 'load sample-node-api config' -. ${COMPONENT_DIR}/bin/env.sh - -echo 'Add static definition for sample-node-api' -#configure based on env.sh -sed -e "s/mymainframe.ibm.com/${ZOWE_EXPLORER_HOST}/g" \ - -e "s/18000/${MY_API_PORT}/g" \ - ${COMPONENT_DIR}/${MY_API_NAME}.yml \ - > ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml - -echo 'change sample-node-api.ebcidic.yml encoding from ibm-1047 to ibm-850' -# basically this yml file is only thing we need to do register our service with apiml -iconv -f IBM-1047 -t IBM-850 ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml > $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml -rm ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml -chmod 770 $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml - -echo 'sample-node-api configure done' diff --git a/manifest.yaml b/manifest.yaml index 95b6bfa..6357d13 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -13,7 +13,6 @@ build: timestamp: "{{build.timestamp}}" commands: start: bin/start.sh - configure: bin/configure.sh apimlServices: static: - file: sample-node-api.yml \ No newline at end of file diff --git a/package.json b/package.json index 38167ea..293e9d9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "nodemon src/index.js", "dev:https": "nodemon src/index.js --key sslcert/server.key --cert sslcert/server.cert", "start": "node src/index.js", - "build": "npm run clean && cp -r src dist/src && cp -r bin dist/bin && cp *.yml dist && cp *.json dist && cp README.md dist", + "build": "npm run clean && cp -r src dist/src && cp -r bin dist/bin && cp *.yml dist && cp *.yaml dist && cp *.json dist && cp README.md dist && cp LICENSE dist", "clean": "rimraf dist && mkdirp dist" }, "author": "",