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

Deploy docs for nginx unclear #2436

Closed
Helveg opened this issue Oct 12, 2020 · 1 comment
Closed

Deploy docs for nginx unclear #2436

Helveg opened this issue Oct 12, 2020 · 1 comment

Comments

@Helveg
Copy link

Helveg commented Oct 12, 2020

The deploy documentation for nginx contains the following config:

     upstream app_server {
        # fail_timeout=0 means we always retry an upstream even if it failed
       # to return a good HTTP response

       # for UNIX domain socket setups
       server unix:/tmp/gunicorn.sock fail_timeout=0;

       # for a TCP configuration
       # server 192.168.0.7:8000 fail_timeout=0;
     }

    location @proxy_to_app {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;
      # we don't want nginx trying to do something clever with
      # redirects, we set the Host: header above already.
      proxy_redirect off;
      proxy_pass http://app_server;
    }

But it does not continue to provide steps to make gunicorn listen to http://app_server or unix:/tmp/gunicorn.sock. As the main recommended deployment option I think it's important to ensure that a minimal working example can be obtained from the docs without any blanks.

Combining this with the default command for Django gunicorn my_app.wsgi seems to make gunicorn listen on port 8000:

(venv) robin@Physio_NAS:~/ndsv# gunicorn vault.wsgi
[2020-10-12 18:36:13 +0200] [5237] [INFO] Starting gunicorn 20.0.4
[2020-10-12 18:36:13 +0200] [5237] [INFO] Listening at: http://127.0.0.1:8000 (5237)
[2020-10-12 18:36:13 +0200] [5237] [INFO] Using worker: sync
[2020-10-12 18:36:13 +0200] [5240] [INFO] Booting worker with pid: 5240

Meaning that the documentation for the recommended deployment for Python's largest web framework is not optimal.

Shouldn't we change:

       # for UNIX domain socket setups
       server unix:/tmp/gunicorn.sock fail_timeout=0;

       # for a TCP configuration
       # server 192.168.0.7:8000 fail_timeout=0;

to

       # for UNIX domain socket setups
       # server unix:/tmp/gunicorn.sock fail_timeout=0;

       # for a TCP configuration
       server 127.0.0.1:8000 fail_timeout=0;

and explain that you still have to run have gunicorn running on 127.0.0.1:8000 behind this (and not that it somehow gets invoked like someone coming from Apache+mod_wsgi might expect) and a simple command to test this like gunicorn -w 3 <your_wsgi_module> followed by a note that there are other better ways to ensure gunicorn is always running and then link to the monitoring part of the docs?

@benoitc benoitc closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2023
@benoitc
Copy link
Owner

benoitc commented May 7, 2023

unix socket is a good default.

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

No branches or pull requests

2 participants