-
Notifications
You must be signed in to change notification settings - Fork 38
Description
I was surprised to get errors like "missing devel_kit (ndk) module" when trying to use environment variables with set_by_lua directive.
Checking here below using upstream image tsuru/nginx-tsuru:1.16.1 - also tried with locally built image, with 1.16.1, 1.17.3 and 1.17.4 nginx : same result.
First of all, there is no module "nginx devel kit" (ndk) in the running nginx instance, while it's cleary built when choosing tsuru flavor :
$ export TEST_IMAGE=docker.io/tsuru/nginx-tsuru:1.16.1
$ docker run -t ${TEST_IMAGE} nginx -V 2>&1 | tr -- - '\n' | grep module
modules
path=/usr/lib/nginx/modules
http_addition_module
http_auth_request_module
http_dav_module
http_flv_module
http_gunzip_module
http_gzip_static_module
http_mp4_module
http_random_index_module
http_realip_module
http_secure_link_module
http_slice_module
http_ssl_module
http_stub_status_module
http_sub_module
http_v2_module
mail_ssl_module
stream_realip_module
stream_ssl_module
stream_ssl_preread_module
At build level and image contents, it looks good :
$ docker run -t ${TEST_IMAGE} ls /etc/nginx/modules/ndk_http_module.so
/etc/nginx/modules/ndk_http_module.so
$
$ docker run -t ${TEST_IMAGE} grep ndk_http_module.so /etc/nginx/modules/all.conf
load_module /etc/nginx/modules/ndk_http_module.so;
But nginx.conf does not include /etc/nginx/modules/all.conf :
docker run -t ${TEST_IMAGE} cat /etc/nginx/nginx.conf | egrep -v '^[[:space:]]*$'
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
But this does not explain how some modules are loaded and some are not.
So I first built a new image based on nginx 1.17.4 and including a nginx.conf with directive include /etc/nginx/modules/all.conf;
at first line.
This nginx.conf is added to the Dockerfile like this COPY nginx.conf /etc/nginx/
I also added the configure option --with-http_perl_module in order to try env vars usage through perl module.
configure_args="$configure_args --with-http_perl_module=dynamic"; \
After build with command make image flavor=tsuru nginx_version=1.17.4
and a custom docker tag :
$ export TEST_IMAGE=local/nginx-tsuru:1.17.4-0.0.2
$ docker run -t ${TEST_IMAGE} nginx -V 2>&1 | tr -- - '\n' | grep module
modules
path=/usr/lib/nginx/modules
http_addition_module
http_auth_request_module
http_dav_module
http_flv_module
http_gunzip_module
http_gzip_static_module
http_mp4_module
http_random_index_module
http_realip_module
http_secure_link_module
http_slice_module
http_ssl_module
http_stub_status_module
http_sub_module
http_v2_module
mail_ssl_module
stream_realip_module
stream_ssl_module
stream_ssl_preread_module
$
$ docker run -t ${TEST_IMAGE} ls /etc/nginx/modules/ndk_http_module.so /etc/nginx/modules/ngx_http_perl_module.so
/etc/nginx/modules/ndk_http_module.so
/etc/nginx/modules/ngx_http_perl_module.so
$
$ docker run -t ${TEST_IMAGE} egrep 'ndk_http_module.so|ngx_http_perl_module.so' /etc/nginx/modules/all.conf
load_module /etc/nginx/modules/ndk_http_module.so;
load_module /etc/nginx/modules/ngx_http_perl_module.so;
$
$ docker run -t ${TEST_IMAGE} cat /etc/nginx/nginx.conf | egrep -v '^[[:space:]]*$' | head -4
include /etc/nginx/modules/all.conf;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /tmp/nginx.pid;
That means : even when adding include /etc/nginx/modules/all.conf
in nginx.conf, it looks like modules are not loaded by nginx.
Also tried with tag v0.3.1 instead of v0.3.0 for simplresty/ngx_devel_kit : no difference.
Any idea why modules are missing ?