1

I followed the systemd deployment instructions here at http://docs.gunicorn.org/en/stable/deploy.html

/etc/systemd/system/gunicorn3.service:

[Unit] Description=gunicorn3 daemon Requires=gunicorn3.socket After=network.target [Service] PIDFile=/run/gunicorn3/pid User=feritsuser Group=feritsuser RuntimeDirectory=gunicorn3 WorkingDirectory=/home/feritsuser/Ferits ExecStart=/usr/bin/gunicorn3 --pid /run/gunicorn3/pid \ --bind unix:/run/gunicorn3/socket Ferits.wsgi ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 

/etc/systemd/system/gunicorn3.socket

[Unit] Description=gunicorn3 socket [Socket] ListenStream=/run/gunicorn3/socket [Install] WantedBy=sockets.target 

/etc/tmpfiles.d/gunicorn3.conf:

d /run/gunicorn3 0755 feritsuser feritsuser \ --workers 2 \ --timeout 300 \ --error-logfile /var/log/gunicorn3/error.log \ --log-level=debug 

I have gunicorn.conf symlinked to gunicorn3.conf as well.

My nginx proxy to the gunicorn socket is working. I can load the application and use it in a browser, but I'm getting a 502 timeout on one page. Nginx error log is:

2018/07/25 10:31:18 [error] 614#614: *3 upstream prematurely closed connection while reading response header from upstream, client: 10.18.3.145, server: _, request: "GET /browse/expenses/ HTTP/1.1", upstream: "http://unix:/run/gunicorn3/socket:/browse/expenses/", host: "10.18.3.59", referrer: "http://10.18.3.59/"

The timeout is occurring after 30 seconds, and it's not writing to the log file specified in gunicorn3.conf/gunicorn.conf, so it appears that my socket implementation is not honoring the .conf file. What am I doing wrong? I've tried chowning the .conf files for feritsuser:feritsuser, and still, nothing.

1 Answer 1

1

I was never able to get it to use the .conf file, even when specifying it in gunicorn3.service. What ended up working was just getting rid of the .conf file completely and changing my gunicorn3.service file like so:

[Unit] Description=gunicorn3 daemon Requires=gunicorn3.socket After=network.target [Service] PIDFile=/run/gunicorn3/pid User=feritsuser Group=feritsuser RuntimeDirectory=gunicorn3 WorkingDirectory=/home/feritsuser/Ferits ExecStart=/usr/bin/gunicorn3 --pid /run/gunicorn3/pid \ --bind unix:/run/gunicorn3/socket Ferits.wsgi \ --workers 2 \ --timeout 300 \ --error-logfile /var/log/gunicorn3/error.log \ --log-level=debug ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.