cloudfoundry / nodejs-buildpack

Cloud Foundry buildpack for Node.js
http://docs.cloudfoundry.org/buildpacks/
Apache License 2.0
173 stars 385 forks source link

How to deploy nodejs Server that executes a Python Script? #515

Closed johBert01 closed 2 years ago

johBert01 commented 2 years ago

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version? SAP BTP Cloud Foundry environment, cf.exe version 7.5.0+0ad1d6398.2022-06-04

What version of the buildpack you are using?

If you were attempting to accomplish a task, what was it you were attempting to do? We are trying to deploy a nodejs Server on BTP that executes a Python Script.

What did you expect to happen? The local implementation works. It was expected that the python_buildpack uses all relevant data and provided files to install necessary packages defined in the requirements.txt

What was the actual behavior? The python_buildpack gets installed and also runs pip install but it does not use the provided files. Instead of the specified python version 3.10.6 in the runtime.txt it installs python version 3.10.5 and the packages from the requirements.txt do not get installed. When we added the command pip install -r requirements.txt to the start script in the package.json we got the error pip: command not found. When we switched the order of the buildpacks in the mta.yaml, the python_buildpack threw the error that no start command is specified in the buildpack or a Procfile (which is provided).

Configurations relevant for deployment:

Mta.yaml code:

`modules:

-name: test_srv

type: nodejs

path: gen/srv

parameters:

  buildpacks: 

  - python_buildpack

  - nodejs_buildpack

  memory: 256MB

build-parameters:

  builder: npm-ci`

requirements.txt numpy=1.23.2

runtime.txt python-3.10.6

Procfile: web:

robdimsdale commented 2 years ago

To answer the question about python 3.10.5 - the python buildpack v1.7.56 only contains python 3.10.4 and 3.10.5. You can see that in the manifest.

I'm not sure why pip wasn't working, but I would first ensure that you are using a version of python provided by the version of the buildpack (e.g. python 3.10.5). Or, update the buildpack to a newer version that supports the version of python you are looking for.

johBert01 commented 2 years ago

The mistaket turned out to be that we were using cf deploy but the provided files seem to be just read and executed with the cf push command. We updated the provided python version as recommended in the answer above and changed our command scripts accordingly. The deploy and execution is working now.