[ CoyoteKG @ 13.05.2019. 12:38 ] @
Gledam malo kako da hostujem neku Django aplikaciju. Nisam se sretao ranije sa pythonom, pa eto... isprobavanje, igranje...
I po nekoj preporuci pokušavam da uradim to sa kombinacijom nginx uwsgi.

Namestio sam sve po ovom uputstvu
https://uwsgi-docs.readthedocs...utorials/Django_and_nginx.html

I sve lepo radi, osim što sam sada hteo da umesto rc.d probam supervisord.

Ovo su mi konfiguracioni fajlovi

/etc/supervisord.d/mysite.ini

[program:mysite]
command=/usr/bin/uwsgi --emperor /etc/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log


[unix_http_server]
file=/var/run/supervisor/supervisor.sock ; (the path to the socket file)

[inet_http_server] ; inet (TCP) server disabled by default
port=*:9001 ; (ip_address:port specifier, *:port for all iface)
username=user ; (default is no username (open server))
password=123 ; (default is no password (open server))

/etc/supervisord.conf koji je skoro default, osim što sam enejblovao ovaj inet http server
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL for a unix socket
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
username=chris ; should be same as http_username if set
password=123 ; should be same as http_password if set

[include]
files = supervisord.d/*.ini


[uwsgi]
chdir = /opt/mydjango/mysite
module = mysite.wsgi
home = /opt/mydjango
master = true
processes = 10
socket = /opt/mydjango/mysite/mysite.sock
chmod-socket = 664
gid = nginx
vacuum = true


Ono što mi je najčudnije, kad startujem supervisord meni sajt radi, otvaram ga u browseru, ali u logu i statusu mi stoji da u stvari ne radi.

# supervisorctl
mysite FATAL Exited too quickly (process log may have details)


U emperor logu je sve OK, ne vidim nikakav problem
spawned uWSGI master process (pid: 4137)
Mon May 13 13:14:55 2019 - [emperor] vassal mysite_uwsgi.ini has been spawned
spawned uWSGI worker 1 (pid: 4142, cores: 1)
spawned uWSGI worker 2 (pid: 4143, cores: 1)
Mon May 13 13:14:55 2019 - [emperor] vassal mysite_uwsgi.ini is ready to accept requests
spawned uWSGI worker 3 (pid: 4144, cores: 1)
spawned uWSGI worker 4 (pid: 4145, cores: 1)
spawned uWSGI worker 5 (pid: 4146, cores: 1)
spawned uWSGI worker 6 (pid: 4147, cores: 1)
spawned uWSGI worker 7 (pid: 4148, cores: 1)
spawned uWSGI worker 8 (pid: 4149, cores: 1)
spawned uWSGI worker 9 (pid: 4150, cores: 1)
spawned uWSGI worker 10 (pid: 4151, cores: 1)
[pid: 4150|app: 0|req: 1/1] 192.168.209.120 () {44 vars in 665 bytes} [Mon May 13 11:18:13 2019] GET / => generated 1716 bytes in 66 msecs (HTTP/1.1 200) 3 headers in 95 bytes (1 switches on core 0)
announcing my loyalty to the Emperor...
Mon May 13 13:18:13 2019 - [emperor] vassal mysite_uwsgi.ini is now loyal


A ovo je u supervisord logu. I po ovome bi trebalo da mi sajt ne radi, ali radi :)
2019-05-13 13:14:47,843 CRIT Supervisor running as root (no user in config file)
2019-05-13 13:14:47,849 WARN Included extra file "/etc/supervisord.d/mysite.ini" during parsing
2019-05-13 13:14:47,984 INFO RPC interface 'supervisor' initialized
2019-05-13 13:14:47,985 INFO RPC interface 'supervisor' initialized
2019-05-13 13:14:47,985 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2019-05-13 13:14:47,986 INFO daemonizing the supervisord process
2019-05-13 13:14:47,987 INFO supervisord started with pid 4079
2019-05-13 13:14:48,990 INFO spawned: 'mysite' with pid 4080
2019-05-13 13:14:49,051 INFO exited: mysite (exit status 0; not expected)
2019-05-13 13:14:50,053 INFO spawned: 'mysite' with pid 4088
2019-05-13 13:14:50,061 INFO exited: mysite (exit status 0; not expected)
2019-05-13 13:14:52,066 INFO spawned: 'mysite' with pid 4116
2019-05-13 13:14:52,074 INFO exited: mysite (exit status 0; not expected)
2019-05-13 13:14:55,080 INFO spawned: 'mysite' with pid 4134
2019-05-13 13:14:55,089 INFO exited: mysite (exit status 0; not expected)
2019-05-13 13:14:56,091 INFO gave up: mysite entered FATAL state, too many start retries too quickly



u procesima kao da mi je 4 puta pokrenut servis
root 4079 0.0 1.2 243064 12884 ? Ss 13:14 0:00 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
root 4082 0.0 0.1 25340 1188 ? S 13:14 0:00 /usr/bin/uwsgi --emperor /etc/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log
root 4083 0.0 2.6 250284 27348 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4090 0.0 0.1 25340 1192 ? S 13:14 0:00 /usr/bin/uwsgi --emperor /etc/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log
root 4091 0.0 2.6 250280 27348 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4096 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4097 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4098 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4099 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4100 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4101 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4102 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4103 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4104 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4105 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4106 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4107 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4108 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4109 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4110 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4111 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4112 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4113 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4114 0.0 2.1 250280 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4115 0.0 2.1 250284 21984 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4118 0.0 0.1 25340 1184 ? S 13:14 0:00 /usr/bin/uwsgi --emperor /etc/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log
root 4119 0.0 2.6 250284 27352 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4124 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4125 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4126 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4127 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4128 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4129 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4130 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4131 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4132 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4133 0.0 2.1 250284 21988 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4136 0.0 0.1 25340 1188 ? S 13:14 0:00 /usr/bin/uwsgi --emperor /etc/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log
root 4137 0.0 2.6 250280 27344 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4142 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4143 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4144 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4145 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4146 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4147 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4148 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4149 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4150 0.0 2.2 250668 23112 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini
root 4151 0.0 2.1 250280 21980 ? S 13:14 0:00 /usr/bin/uwsgi --ini mysite_uwsgi.ini



Gde grešim? :)