sbarzaghialteaup / demo-node-rfc-cf

0 stars 0 forks source link

What about using CF environment variables instead of changing the buildpack? #1

Open grenik opened 2 years ago

grenik commented 2 years ago

From your commits to the custom CF buildpack that you are using in this sample, I can see that the only difference to the default CF node.js buildpack are these two environment variables:

export LD_LIBRARY_PATH=/home/vcap/app/sap/nwrfcsdk/lib/
export SAPNWRFC_HOME=/home/vcap/app/sap/nwrfcsdk

How do you think, can one set them via CF user-provided environment variables?

CF CLI

cf set-env your-app SAPNWRFC_HOME /home/vcap/app/sap/nwrfcsdk
cf set-env your-app LD_LIBRARY_PATH /home/vcap/app/sap/nwrfcsdk/lib/

Deployment descriptor:

applications:
  - name: demo-node-rfc
    disk_quota: 300MB
    memory: 60MB
    instances: 1
    random-route: true
    health-check-type: process
    stack: cflinuxfs3
    env:
      LD_LIBRARY_PATH: /home/vcap/app/sap/nwrfcsdk/lib/
      SAPNWRFC_HOME: /home/vcap/app/sap/nwrfcsdk
    buildpacks:
      - nodejs_buildpack

SAP Business Technology Platform Cockpit: image

grenik commented 2 years ago

I also needed to add ^ to the node version because the exact version was not available anymore for the buildpack: https://github.com/sbarzaghialteaup/demo-node-rfc-cf/blob/665491d9926d654972f7fdc1def00885785aadd3/package.json#L7 became

         "node": "^12.20.2" 

I was able to push and start the app but I cannot test it unfortunately :-(