cloudfoundry / php-buildpack

A Cloud Foundry Buildpack for PHP.
Apache License 2.0
142 stars 342 forks source link

PHP Buildpack does not work as multi buildpack with Python Buildpack #596

Open sweettbug3 opened 2 years ago

sweettbug3 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?

 cf curl /v2/info
    {
       "name": "VMware Tanzu Application Service",
       "build": "2.11.13-build.2",
       "support": "https://support.pivotal.io/",
       "version": 0,
       "description": "https://docs.pivotal.io/pivotalcf/2-11/pcf-release-notes/runtime-rn.html",
       "authorization_endpoint": "---omitted--",
       "token_endpoint": "---omitted--",
       "min_cli_version": "6.23.0",
       "min_recommended_cli_version": "6.23.0",
       "app_ssh_endpoint": "----omitted--",
       "app_ssh_host_key_fingerprint": "---omitted--",
       "app_ssh_oauth_client": "ssh-proxy",
       "doppler_logging_endpoint": "wss://---omitted--:443",
       "api_version": "2.164.0",
       "osbapi_version": "2.15",
       "routing_endpoint": "---omitted--",
       "user": "---omitted--"
    }
    + cf version
    cf version 7.3.0+645c3ce6a.2021-08-16

What version of the buildpack you are using?

4.4.53 (PHP buildpack)
v1.7.48+1639082814.  (Python Buildpack)

If you were attempting to accomplish a task, what was it you were attempting to do?

Deploy a web application. That uses python 3 code in the background.

What did you expect to happen?

For the web application to deploy cleanly and have web application start up.

What was the actual behavior?

Fails to start the web application. Cant run

   2022-02-02T15:23:55.06-0700 [CELL/0] OUT Cell ---omitted--- successfully created container for instance ---omitted---
   2022-02-02T15:23:55.32-0700 [CELL/0] OUT Downloading droplet...
   2022-02-02T15:24:02.52-0700 [CELL/0] OUT Downloaded droplet (153.1M)
   2022-02-02T15:24:02.59-0700 [CELL/0] OUT Starting health monitoring of container
   2022-02-02T15:24:02.69-0700 [APP/PROC/WEB/0] ERR ImportError: No module named site
   2022-02-02T15:24:02.69-0700 [APP/PROC/WEB/0] ERR ImportError: No module named site
   2022-02-02T15:24:02.70-0700 [APP/PROC/WEB/0] ERR ImportError: No module named site
   2022-02-02T15:24:02.70-0700 [APP/PROC/WEB/0] OUT Exit status 1
   2022-02-02T15:24:02.71-0700 [CELL/SSHD/0] OUT Exit status 0
   2022-02-02T15:24:08.02-0700 [CELL/0] OUT Cell  ---omitted--- stopping instance  ---omitted---
   2022-02-02T15:24:08.02-0700 [CELL/0] OUT Cell  ---omitted--- destroying container for instance  ---omitted---
   2022-02-02T15:24:08.02-0700 [API/0] OUT Process has crashed with type: "web"

Please confirm where necessary:

To reproduce create an extremely simple application:

manifest.yml :

---
applications:
- name: php-python-test-app
  memory: 256M
  disk_quota: 4G
  buildpacks:
  - python_buildpack
  - php_buildpack
  stack: cflinuxfs3

index.php :

<?php
phpinfo();
?>
arjun024 commented 2 years ago

Can you provide a full minimal app with both python and php parts? Also the start command you'd like the application to use.

sweettbug3 commented 2 years ago

The php and python app is nothing more than the index.php file in the same directory as the manifest. The start command being used is the default start command in the php buildpack.

What is provided above is enough to duplicate the error.

arjun024 commented 2 years ago

I see you had filed a similar issue in #478. Were you able to run your app correctly with the resolution provided for that issue? I'm trying to understand if this a regression since then or was never solved

sweettbug3 commented 2 years ago

The resolution for #478 provided in 4.4.38 did not work. I was unable to test this #478 after 4.4.38 was released because I am relying on a 3rd party to deploy Buildpacks. I do not believe #478 was ever really resolved, the comments said to open up another DR if I still have issues.

I wrote this DR against php buildpack 4.4.53 which is clearly after 4.4.38 and I am still having issues. The example above is as simple an application as is possible in php, and will not start up.

My only workaround it to depend on a very old python buildpack that supports python2. This is not a good long term workaround.

arjun024 commented 2 years ago

It looks like the only long-term solution for this would be to rewrite the PHP buildpack from python2 to python3. Is that something you'd be willing to contribute? @sweettbug3

sophiewigmore commented 1 year ago

As @arjun024 mentioned above, the only way to resolve this issue is to enable the PHP buildpack to be python3-compatible. We recently added cflinuxfs4 support to the PHP buildpack, and at that time, we decided that rewriting the buildpack to work with python3 could be a significant undertaking.

If the Python/PHP multi-buildpack use case is strong, then maybe we should reconsider doing the rewrite for both this use-case as well as the longevity of the buildpack (since python2 is technically out of support).

It would be helpful to understand more about the use-case here for Python/PHP apps, so we can decide if we want to pursue this as a track of work @johnnyr0x

sweettbug3 commented 1 year ago

Since Cloudfoundry advertises the ability to deploy multiple buildpacks, it seems wrong that Python/Php Buildpacks are incompatible (without using very old Python Buildpacks w/Python 2, which has been EOL for 3 years).

I can readily find docker containers that support relevant versions of php and python on the web, not being able to get compatible python/php buildpacks with relevant versions (w/ security support) has led me away from this technology.

johnnyr0x commented 1 year ago

Thanks @sweettbug3 for bringing this up - we're going to evaluate the best approach: re-write with python3, re-write with go, or another method. The use case is strong from a support/security perspective.

Will keep you in the loop.