You may also want to set the uwsgi uid and gid to the nginx server user and
group.
That will stop the error message about running as root.
On 25/02/2016 13:06, "kyle graves" <[email protected]> wrote:

> I want to close this issue.
>
> I figured out what was causing the issue. In short, the person I'm working
> with made some rouge edits to our nginx conf files that I didn't know about.
> This caused the issue with nginx that made it log upon restart:
>
> ```
>
> ==> /var/log/nginx/error.log <==
> 2016/02/23 20:06:47 [warn] 30766#0: conflicting server name "" on
> 0.0.0.0:80 <http://0.0.0.0/>, ignored
> 2016/02/23 20:06:48 [warn] 30770#0: conflicting server name "" on
> 0.0.0.0:80 <http://0.0.0.0/>, ignored
>
> ```
>
> I've reverted the edits that were made to the conf files, then restarted
> both nginx and supervisor and all is good. :)
>
> Sorry for the spamming,
> KG
>
> On Tuesday, February 23, 2016 at 12:44:31 PM UTC-8, kyle graves wrote:
>>
>> I'm having a problem getting uwsgi to stay running when supervisor starts
>> it.
>>
>> To explain, I'm running through the 'Bare Metal' section of the deploy
>> guide. (https://mayan.readthedocs.org/en/latest/topics/deploying.html)
>> I have only changed two things about the deploy:
>> 1) I installed mayan from the gitlab repo, instead of pip sources, via
>> `pip install git+https://gitlab.com/mayan-edms/mayan-edms.git`
>> <https://gitlab.com/mayan-edms/mayan-edms.git> (I want to be able to
>> deploy some future changes from a repo to test in prod)
>> 2) For now, I'm using sqlite3, so I didn't add postgres settings to
>> `mayan/settings/local.py`, but I installed all postgres libraries. (I'm
>> going to switch to using postgres once I iron out these deploy issues)
>>
>> I ran into my first warnings/errors when restarting nginx and supervisor.
>> They are as follows:
>> 1) I get warnings in nginx error log:
>>
>>
>> ```
>> $ /etc/init.d/nginx restart
>>  * Restarting nginx nginx
>>    ...done.
>> $
>>
>> // I'm tailing the error logs and I see this:
>> ==> /var/log/nginx/error.log <==
>> 2016/02/23 20:06:47 [warn] 30766#0: conflicting server name "" on
>> 0.0.0.0:80, ignored
>> 2016/02/23 20:06:48 [warn] 30770#0: conflicting server name "" on
>> 0.0.0.0:80, ignored
>> ```
>>
>>
>> It says that it's ignoring this, and the processes are running, so I
>> figure I can move on.
>>
>> ```
>> $ ps aux | grep nginx
>> root           30802  0.0  0.0  85884  1356 ?        Ss   20:08   0:00
>> nginx: master process /usr/sbin/nginx
>> www-data 30803  0.0  0.0  86236  1780 ?        S    20:08   0:00 nginx:
>> worker process
>> www-data 30804  0.0  0.0  86236  1780 ?        S    20:08   0:00 nginx:
>> worker process
>> www-data 30805  0.0  0.0  86236  1780 ?        S    20:08   0:00 nginx:
>> worker process
>> www-data 30806  0.0  0.0  86236  1780 ?        S    20:08   0:00 nginx:
>> worker process
>> root     30811  0.0  0.0  10460   936 pts/2    S+   20:12   0:00 grep
>> --color=auto nginx
>> ```
>>
>>
>> 2) I get uwsgi errors when restarting supervisor:
>>
>> ```
>> $ /etc/init.d/supervisor start
>> Starting supervisor: supervisord.
>> $
>>
>> // tailing the logs shows this:
>> ==> /var/log/supervisor/supervisord.log <==
>> 2016-02-23 20:27:47,885 CRIT Supervisor running as root (no user in
>> config file)
>> 2016-02-23 20:27:47,885 WARN Included extra file
>> "/etc/supervisor/conf.d/mayan-celery.conf" during parsing
>> 2016-02-23 20:27:47,885 WARN Included extra file
>> "/etc/supervisor/conf.d/mayan-uwsgi.conf" during parsing
>> 2016-02-23 20:27:47,901 INFO RPC interface 'supervisor' initialized
>> 2016-02-23 20:27:47,901 CRIT Server 'unix_http_server' running without
>> any HTTP authentication checking
>> 2016-02-23 20:27:47,902 INFO daemonizing the supervisord process
>> 2016-02-23 20:27:47,902 INFO supervisord started with pid 30991
>> 2016-02-23 20:27:48,904 INFO spawned: 'mayan-worker' with pid 30992
>> 2016-02-23 20:27:48,905 INFO spawned: 'mayan-beat' with pid 30993
>> 2016-02-23 20:27:48,906 INFO spawned: 'mayan-uwsgi' with pid 30994
>>
>> ==> /var/log/uwsgi/uwsgi.log <==
>> *** Starting uWSGI 2.0.12 (64bit) on [Tue Feb 23 20:27:48 2016] ***
>> compiled with version: 4.8.4 on 23 February 2016 18:55:04
>> os: Linux-3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015
>> nodename: ip-172-31-33-202
>> machine: x86_64
>> clock source: unix
>> detected number of CPU cores: 2
>> current working directory: /
>> detected binary path: /usr/share/mayan-edms/bin/uwsgi
>> !!! no internal routing support, rebuild with pcre support !!!
>> chdir() to /usr/share/mayan-edms/lib/python2.7/site-packages/mayan
>> your processes number limit is 31538
>> your memory page size is 4096 bytes
>> detected max file descriptor number: 1024
>> lock engine: pthread robust mutexes
>> thunder lock: disabled (you can enable it with --thunder-lock)
>> uwsgi socket 0 bound to UNIX address /usr/share/mayan-edms/uwsgi.sock fd 3
>> setgid() to 33
>> setuid() to 33
>> Python version: 2.7.6 (default, Jun 22 2015, 18:01:27)  [GCC 4.8.2]
>> *** Python threads support is disabled. You can enable it with
>> --enable-threads ***
>> Python main interpreter initialized at 0xc56130
>> your server socket listen backlog is limited to 100 connections
>> your mercy for graceful operations on workers is 60 seconds
>> mapped 145536 bytes (142 KB) for 1 cores
>> *** Operational MODE: single process ***
>> added /usr/share/mayan-edms/lib/python2.7/site-packages/ to pythonpath.
>>
>> ==> /var/log/supervisor/supervisord.log <==
>> 2016-02-23 20:27:49,914 INFO success: mayan-uwsgi entered RUNNING state,
>> process has stayed up for > than 1 seconds (startsecs)
>>
>> ==> /var/log/uwsgi/uwsgi.log <==
>> WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0xc56130
>> pid: 30994 (default app)
>> *** uWSGI is running in multiple interpreter mode ***
>> spawned uWSGI master process (pid: 30994)
>> spawned uWSGI worker 1 (pid: 31072, cores: 1)
>>
>> ==> /var/log/supervisor/supervisord.log <==
>> 2016-02-23 20:27:59,058 INFO success: mayan-worker entered RUNNING state,
>> process has stayed up for > than 10 seconds (startsecs)
>> 2016-02-23 20:27:59,058 INFO success: mayan-beat entered RUNNING state,
>> process has stayed up for > than 10 seconds (startsecs)
>> ```
>>
>> A few things to note about the above log messages:
>> -  near the beginning `CRIT Supervisor running as root (no user in
>> config file)`
>>
>> - I'm not sure what this means, but it doesn't sound good
>>
>> - On past supervisor restarts I had issues where uwsgi workers would fail
>> to start, see the following logs:
>>
>> ```
>>
>> ==> /var/log/supervisor/supervisord.log <==
>> 2016-02-23 19:41:46,507 INFO stopped: mayan-uwsgi (terminated by SIGKILL)
>> 2016-02-23 19:41:46,604 INFO stopped: mayan-beat (exit status 0)
>> 2016-02-23 19:41:48,205 INFO stopped: mayan-worker (exit status 0)
>> 2016-02-23 19:43:24,287 CRIT Supervisor running as root (no user in
>> config file)
>> 2016-02-23 19:43:24,287 WARN Included extra file
>> "/etc/supervisor/conf.d/mayan-celery.conf" during parsing
>> 2016-02-23 19:43:24,287 WARN Included extra file
>> "/etc/supervisor/conf.d/mayan-uwsgi.conf" during parsing
>> 2016-02-23 19:43:24,303 INFO RPC interface 'supervisor' initialized
>> 2016-02-23 19:43:24,303 CRIT Server 'unix_http_server' running without
>> any HTTP authentication checking
>> 2016-02-23 19:43:24,304 INFO daemonizing the supervisord process
>> 2016-02-23 19:43:24,304 INFO supervisord started with pid 30532
>> 2016-02-23 19:43:25,306 INFO spawned: 'mayan-worker' with pid 30535
>> 2016-02-23 19:43:25,307 INFO spawned: 'mayan-beat' with pid 30536
>> *2016-02-23 19:43:25,308 INFO spawned: 'mayan-uwsgi' with pid 30537*
>> *2016-02-23 19:43:25,321 INFO exited: mayan-uwsgi (exit status 1; not
>> expected)*
>> *2016-02-23 19:43:26,323 INFO spawned: 'mayan-uwsgi' with pid 30560*
>> *2016-02-23 19:43:26,335 INFO exited: mayan-uwsgi (exit status 1; not
>> expected)*
>> *2016-02-23 19:43:29,118 INFO spawned: 'mayan-uwsgi' with pid 30595*
>> *2016-02-23 19:43:29,123 INFO exited: mayan-uwsgi (exit status 1; not
>> expected)*
>> *2016-02-23 19:43:32,128 INFO spawned: 'mayan-uwsgi' with pid 30596*
>> *2016-02-23 19:43:32,132 INFO exited: mayan-uwsgi (exit status 1; not
>> expected)*
>> *2016-02-23 19:43:33,133 INFO gave up: mayan-uwsgi entered FATAL state,
>> too many start retries too quickly*
>> 2016-02-23 19:43:36,137 INFO success: mayan-worker entered RUNNING state,
>> process has stayed up for > than 10 seconds (startsecs)
>> 2016-02-23 19:43:36,137 INFO success: mayan-beat entered RUNNING state,
>> process has stayed up for > than 10 seconds (startsecs)
>>
>> ```
>>
>>
>>
>> So now everything seems like it's running, but when I try accessing the
>> server I get 502s (Bad Gateway) errors:
>>
>> ```
>>
>> ==> /var/log/nginx/error.log <==
>> 2016/02/23 20:34:52 [error] 30981#0: *1 connect() failed (111: Connection
>> refused) while connecting to upstream, client: 24.4.141.34, server: ,
>> request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/";, host:
>> "XX.XX.XX.XXX"
>>
>> ==> /var/log/nginx/access.log <==
>> 24.4.141.34 - - [23/Feb/2016:20:34:52 +0000] "GET / HTTP/1.1" 502 583 "-"
>> "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
>> Chrome/48.0.2564.116 Safari/537.36"
>>
>> ==> /var/log/nginx/error.log <==
>> 2016/02/23 20:34:52 [error] 30981#0: *1 connect() failed (111: Connection
>> refused) while connecting to upstream, client: 24.4.141.34, server: ,
>> request: "GET /favicon.ico HTTP/1.1", upstream: "
>> http://127.0.0.1:8000/favicon.ico";, host: "XX.XX.XX.XXX", referrer:
>> "http://XX.XX.XX.XXX/";
>>
>> ==> /var/log/nginx/access.log <==
>> 24.4.141.34 - - [23/Feb/2016:20:34:52 +0000] "GET /favicon.ico HTTP/1.1"
>> 502 583 "http://XX.XX.XX.XXX/"; "Mozilla/5.0 (X11; Linux x86_64)
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"
>>
>> ```
>>
>>
>>
>>
>> Has anyone else run into these issues? I've tried looking around this
>> group, as well as github, gitlab repos and the internet for more generic
>> nginx, uwsgi, supervisor help but to no avail.
>> Let me know if there's anymore info needed. :)
>>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Mayan EDMS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to