Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Dynamic Modules #766

Open
3flex opened this issue Feb 9, 2016 · 6 comments
Open

Support Dynamic Modules #766

3flex opened this issue Feb 9, 2016 · 6 comments
Labels
enhancement New feature or request

Comments

@3flex
Copy link
Contributor

3flex commented Feb 9, 2016

nginx 1.9.11 introduces support for dynamic module loading. Downstream module support is probably a little ways off, but it's easy to add support in this module!

http://nginx.org/en/docs/ngx_core_module.html#load_module
http://mailman.nginx.org/pipermail/nginx-devel/2016-February/007874.html

@3flex 3flex added the enhancement New feature or request label Feb 9, 2016
@Zophar78
Copy link
Contributor

Zophar78 commented May 10, 2016

+1
For now i'm just doing that with prepend/append features:
class {'::nginx::config':
nginx_cfg_prepend => {
'load_module' => '"modules/ngx_http_geoip_module.so"'
},
http_cfg_append => {
'geoip_country' => '/etc/nginx/GeoIP.dat',
},
}
But it doesn't manage module package (which is easily handle with a package ressource in any case).
Sounds not so easy as we have to handle multiple distro packages... as well we have to know which modules are dynamic and which are not (nginx -V)...

@wyardley
Copy link
Collaborator

Maybe we could use nginx -V output to set a param or params on whether it was built with dynamic modules or not (though since it's per module, don't know how granular we'd want to get about that), but with the various different "flavors" of nginx packages that are supported, and the various platforms, I'm imagining this could get pretty gnarly. I have seen cases where using relative path in the include didn't work as it's supposed to either (and ended up having to use full module path, which would be even nastier to code).

I guess we'd have params like $enable_geoip_module or similar, and then have some data in params that sets the package names for various platforms / repos?

dev [dev] root@c7node0:~ # nginx -V nginx version: nginx/1.10.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --add-dynamic-module=njs-1c50334fbea6/nginx --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

@marcgascon
Copy link

@Zophar78 @wyardley I've installed nginx with this module (puppet-nginx), then I've installed the geoip module as a separate package. What I've installed:

dpkg -l | grep nginx
ii  nginx                          1.10.2-1~jessie            amd64        high performance web server
ii  nginx-module-geoip             1.10.2-1~jessie            amd64        nginx GeoIP dynamic modules

Then I've loaded the module and the GeoIP.dat binary database. The thing is that nginx starts successfully but $geoip_country_code isn't set.

This is my nginx -V:

nginx -V
nginx version: nginx/1.10.2
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1t  3 May 2016
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-ipv6 --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed'

The only thing that I don't have and you mentioned is: --with-http_geoip_module=dynamic and I don't know how to add this flag when installing nginx with puppet-nginx module.

Could anyone help?

@wyardley
Copy link
Collaborator

@marcgascon: for the Passenger flavor of the package, it's already compiled in. I think for other versions the GeoIP module might be a separate package if it's available at all. I'm not sure what the package name is for Ubuntu / Debian, you could try libnginx-mod-http-geoip or similar.

@marcgascon
Copy link

Don't worry, my fault I forget to add an nginx directive to geolocate the client IP and not the ELB one.

@ghost ghost mentioned this issue Aug 22, 2017
@nabber00
Copy link

I had to add the following to make dynamic modules work right in Ubuntu 18.04:

class {'nginx':
nginx_cfg_prepend => {'include' => '/etc/nginx/modules-enabled/*'},
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants