nginxinc / ansible-role-nginx

Ansible role for installing NGINX
https://galaxy.ansible.com/nginxinc/nginx
Apache License 2.0
644 stars 348 forks source link

Allow users to add a dynamic module during a build from source #640

Open alessfg opened 1 year ago

alessfg commented 1 year ago

Discussed in https://github.com/nginxinc/ansible-role-nginx/discussions/638

Originally posted by **tibz7** August 3, 2023 Is there a way to use this role and install geoip2 for the opensource version? Something like using the source and passing compilation flags? Otherwise the only option i thought of was to not use this role and write my own tasks to compile it with the needed module.
olwe0002 commented 1 year ago

Hi alessfg,

try

nginx_install_from: source
nginx_static_modules: [http_ssl_module,http_geoip2_module]
alessfg commented 1 year ago

That parameter is used for NGINX modules following the --with pattern listed here http://nginx.org/en/docs/configure.html and given the open source geoip2 module is considered an external module, you would have to use --add-module=... or --add-dynamic-module=... instead.

tibz7 commented 1 year ago

Hello, any progress on this?

alessfg commented 1 year ago

Not really, no. Building from source is not recommended and as such building from source options are what we consider a "community" developed feature. This does not mean that it will not get worked on, but any other active issue and/or PR is affecting any other feature of the role is prioritized.

PRs are always welcome!

oxpa commented 1 year ago

I'm not sure if Ansible (which is a configuration management tool?) is the best solution for a build automation. Nginx offers pkg-oss "framework": http://hg.nginx.org/pkg-oss . With it you can build nginx and any module with, like, 3 commands:

hg clone http://hg.nginx.org/pkg-oss
cd pkg-oss/$os_flavor
make base module-geoip2

You can swap hg for git if you have proper git module installed. It doesn't get much easier than that. And if you need a module which is not in the list of provided "examples" - you can use build_module.sh which will write a stub makefile for you. And instead of just putting some binaries somewhere (good luck accounting those) you'll have proper OS specific packages which are way easier to maintain. Is it really worth maintaining 10 different ways of doing the same in a worse way?..

And you can ask for help with pkg-oss in a community slack, IRC channel or mailing lists (if you are like really, really old. Like my age maybe :)