Skip to content

feat: Add uwsgi template support #569

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hax0rbana-adam
Copy link

Proposed changes

Anyone who wants to use uwsgi has to edit their configuration after deploying using nginx_config because the uwsgi_pass directive is not supported by this role.

This change will allow specifying the uwsgi_pass directive from within the role, eliminating the need to patch up the configuration file after the fact.

Checklist

Before creating a PR, run through this checklist and mark each as complete:

@hax0rbana-adam hax0rbana-adam requested a review from a team as a code owner June 4, 2025 20:58
Copy link

github-actions bot commented Jun 4, 2025

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

@hax0rbana-adam
Copy link
Author

I have hereby read the F5 CLA and agree to its terms

@alessfg
Copy link
Member

alessfg commented Jun 5, 2025

Thanks for the PR @hax0rbana-adam! Given how modules are implemented, and how big the uwsgi module is (https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html), the template should ideally be separated into a different file/template (e.g. like the proxy module is). Are you up for giving it a try?

@alessfg alessfg added feature New feature or request enhancement Enhance an existing feature and removed feature New feature or request labels Jun 5, 2025
@alessfg alessfg added this to the 0.7.2 milestone Jun 5, 2025
@alessfg alessfg changed the title Add uwsgi support feat: Add uwsgi template support Jun 5, 2025
@hax0rbana-adam
Copy link
Author

Yeah, I'll give that a shot. It might take me a bit to come back to the project that needs this, but I expect to be able to get to it within a week or two.

Thank you for succinctly and politely explaining why you want it to be done differently. I really appreciate the welcoming tone. ❤️

@hax0rbana-adam
Copy link
Author

hax0rbana-adam commented Jul 17, 2025

Edit: I took a stab at it. It doesn't work, but I think it might be closer than my first attempt. The current error is "AnsibleUndefinedVariable: the template 'http/uwsgi.j2' (imported on line 313) does not export the requested name 'uwsgi'." (and that's line 313 of templates/http/default.conf.j2 where I don't understand what I copied and pasted)

Original comment

OK, I'm having trouble understanding the structure here. Perhaps working through an example would help.

In my first attempt, I had my variables set up like this (I tried to strip out things nor relevant to this change):

nginx_config_http_template:
  - backup: false
    config:
      servers:
        - core:
            server_name: "{{lemur_allowable_hostname}}"
            listen:
              - address: 0.0.0.0
                port: 443
                default_server: true
                ssl: true
          locations:
            - location: '~ /\.ht'
              access:
                deny: all
            - location: /
              core:
                uwsgi_pass: django
                include: /etc/nginx/uwsgi_params

I believe the proposed change would mean that last bit would change to something like this:

            - location: /
              core:
                uwsgi:
                  pass: django
                include: /etc/nginx/uwsgi_params

If that's not correct, then everything else I'm about to say will be misguided.

The proxy module seems to have been included from default.conf.j2 and not from the core.j2 that I modified.

But if that's true, I don't know how everything would fit together. It seems like my new uwsgi block couldn't go under core. Should it go at the same level as core? If so, which .j2 file should I be modifying to to pull in templates/http/uwsgi.j2?

I think I just need a few pointers so I can get this in integrated.

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

Successfully merging this pull request may close these issues.

2 participants