Skip to content

Latest commit

 

History

History
95 lines (64 loc) · 2.69 KB

File metadata and controls

95 lines (64 loc) · 2.69 KB

HANA Cloud NodeJS API

Build docker hana-nodejs

This sample demonstrates how SAP HANA Cloud can be utilized within the Kyma runtime.

Prerequisites

  • SAP BTP, Kyma runtime instance
  • Docker
  • Node.js
  • kubectl configured to use the KUBECONFIG file downloaded from the Kyma runtime.

Set SAP HANA Cloud instance

Create a SAP HANA Cloud instance as describe in the first tutorial and complete the other two.

Run the app locally

  1. Clone the project.

  2. Inside the app directory, run:

    npm install

Set parameters for app

export HDB_HOST=**********.hana.trial-us10.hanacloud.ondemand.com
export HDB_PORT=443
export HDB_USER=USER1
export HDB_PASSWORD=Password1

Start the app

node server.js

App will be available at http://localhost:3000

Build the Docker image

  1. Build and push the image to your Docker repository:

    docker build -t {docker id}/hanadb-nodejs -f docker/Dockerfile .
    docker push {docker id}/hanadb-nodejs
  2. Run the image locally

    docker run -e HDB_HOST=*******.hana.trial-us10.hanacloud.ondemand.com -e HDB_PORT=443 -e NODE_ENV=production -e HDB_USER=USER1 -e HDB_PASSWORD=Password1 -p 3000:3000 -d {docker id}/hanadb-nodejs

Deploy the application

  1. Create a new dev Namespace:

    kubectl create namespace dev
    kubectl label namespaces dev istio-injection=enabled
  2. Adjust the values of the configmap to match your HANA Cloud instance and apply the Resources:

    kubectl -n dev apply -f ./k8s/deployment.yaml
    kubectl -n dev apply -f ./k8s/apirule.yaml
    kubectl -n dev apply -f ./k8s/configmap.yaml
    kubectl -n dev apply -f ./k8s/secret.yaml
  3. Use the APIRule to open the application:

    https://hanadb-nodejs.{cluster-domain}

Further Information

If you would like to set the HANA Cloud firewall to limit IP Addresses, the following query can be ran to determine the callers IPs.

select * from M_CONNECTIONS
where user_name LIKE 'USER1'