This sample demostrates how SAP HANA Cloud can be utilized within the Kyma runtime.
- SAP BTP, Kyma runtime instance
- Docker
- Node.js
- kubectl configured to use the
KUBECONFIG
file downloaded from the Kyma runtime.
Create a SAP HANA Cloud instance as describe in the first tutorial and complete the other two.
-
Clone the project.
-
Inside the app directory, run:
npm install
export HDB_HOST=**********.hana.trial-us10.hanacloud.ondemand.com
export HDB_PORT=443
export HDB_USER=USER1
export HDB_PASSWORD=Password1
node server.js
App will be availabe at http://localhost:3000
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
To 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
- Create a new
dev
Namespace:
kubectl create namespace dev
- 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
- Use the APIRule to open the application:
https://hanadb-nodejs.{cluster-domain}
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'