cloudfoundry / nginx-buildpack

Cloud Foundry buildpack that provides NGINX
Apache License 2.0
30 stars 64 forks source link

Not able to load ngx_http_js_module #168

Closed Bsting closed 1 year ago

Bsting commented 1 year 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 && cf version {"name":"VMware Tanzu Application Service","build":"2.13.7-build.1","support":"https://support.pivotal.io","version":0,"description":"https://docs.pivotal.io/pivotalcf/2-13/pcf-release-notes/runtime-rn.html","min_cli_version":"6.23.0","min_recommended_cli_version":"6.23.0","api_version":"2.180.0","osbapi_version":"2.15""} cf version 8.0.0+e8d41cf8e.2021-09-16

What version of the buildpack you are using?

nginx_1.23.1_linux_x64_cflinuxfs3_86c81a97.tgz

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

I want to dynamic load ngx_http_js_module

What did you expect to happen?

Expect to load ngx_http_js_module module with steps below

What was the actual behavior?

Not able to load ngx_http_js_module with below error

2022-11-11T16:11:56.926+08:00 [STG/0] [OUT] Downloading app package... 2022-11-11T16:11:56.926+08:00 [STG/0] [OUT] Downloading build artifacts cache... 2022-11-11T16:11:57.052+08:00 [STG/0] [OUT] Downloaded build artifacts cache (221B) 2022-11-11T16:11:57.435+08:00 [STG/0] [OUT] Downloaded app package (6.7M) 2022-11-11T16:11:57.503+08:00 [STG/0] [OUT] -----> Nginx Buildpack version 1.1.42 2022-11-11T16:11:57.503+08:00 [STG/0] [OUT] -----> Supplying nginx 2022-11-11T16:11:57.508+08:00 [STG/0] [OUT] -----> Requested nginx version: mainline => 1.23.1 2022-11-11T16:11:57.508+08:00 [STG/0] [OUT] -----> Installing nginx 1.23.1 2022-11-11T16:11:57.508+08:00 [STG/0] [OUT] Copy [/tmp/buildpacks/733e4071199a2c8041fe5e81b8c9463b/dependencies/37698d4cfc147aff467ead1245fff7b2/nginx_1.23.1_linux_x64_cflinuxfs3_86c81a97.tgz] 2022-11-11T16:11:57.635+08:00 [STG/0] [ERR] 2022/11/11 08:11:57 [emerg] 44#0: dlopen() "/tmp/app/modules/ngx_http_js_module.so" failed (/tmp/app/modules/ngx_http_js_module.so: undefined symbol: pcre2_set_compile_extra_options_8) in /tmp/conf1235476901/nginx.conf:1 2022-11-11T16:11:57.635+08:00 [STG/0] [ERR] nginx: configuration file /tmp/conf1235476901/nginx.conf test failed 2022-11-11T16:11:57.638+08:00 [STG/0] [OUT] ERROR Could not validate nginx.conf: nginx.conf contains syntax errors: exit status 1

Please confirm where necessary:

Bsting commented 1 year ago

From https://nginx.org/packages/ubuntu/dists/xenial/nginx/binary-amd64/Packages, I can see the dependent library libpcre change from libpcre3 to libpcre2-8-0 from nginx 1.22.0 onwards and I cannot find this library from the buildpack I used. Can someone help to confirm is this the cause for the issue?

image

image

arjun024 commented 1 year ago

Building the nginx dependency is done here https://github.com/cloudfoundry/binary-builder/blob/main/recipe/nginx.rb#L27-L28 (See pcre build config). The PCRE library should be coming from the cflinuxfs3 stack (https://github.com/cloudfoundry/cflinuxfs3) not the buildpack. We don't directly install it so it should be installed as a dependency of some other package. Not sure which.

So this works prior to nginx 1.23? Is it possible for you to try with a custom stack that has libpcre of choice installed? The cflinuxfs3 readme has instructions to build a stack.

@ryanmoran @brayanhenao

Bsting commented 1 year ago

@arjun024 Yes, it is working with nginx-buildpack v1.1.38 and version to stable (nginx 1.20.2).

ryanmoran commented 1 year ago

This is caused by the PPA version of nginx changing its PCRE library from PCRE to PCRE2. We don't compile our version of nginx with PCRE2 and don't plan to on the cflinuxfs3 stack as it is close to its EOL date in April 2023. I would suggest that if you want to dynamically load this module, you compile it from source with PCRE support, not PCRE 2, instead of using what is shipped in the PPA from nginx. They built those modules to be installed in tandem, and we just won't ever be able to make sure it stays compatible always.

Bsting commented 1 year ago

@ryanmoran Thanks for the information. Since cflinuxfs3 will be EOL in April 2023, does this mean stack for nginx-buildpack will be upgraded to cflinuxfs4 in the near future? If yes, any timeline?

ryanmoran commented 1 year ago

@Bsting yes. Its on our roadmap. We just haven't gotten there yet. I'd expect it to happen before April.

johnnyr0x commented 1 year ago

@Bsting - it is supported on cflinuxfs4 as of nginx-buildpack v1.2.0

Closing the issue.