this is stuff copied from a backup, some clarity still needed, wiki links are to a different system, so no good
working uwsgi config
Notes on the evolving configuration for tiddlyspace with nginx+uwsgi. See also WorkingNginxConfig.
On wheezy uwsgi is set up to be able to independently handle lots of uwsgi containers doing lots of different things. The main system is started in the usual init.d way, and then apps defined in /etc/uwsgi/apps-{enabled,available}/<appname>.ini
are run.
tiddlyspace.ini
currently looks like this:
[uwsgi]
procname-master = tiddlyspace.uwsgi.master
max-fd = 2048
procname = tiddlyspace.uwsgi
workers = 8
threads = 8
thread-stacksize = 512
listen = 1024
plugins = python
socket = /tmp/%n.uwsgi.sock
uid = tiddlyweb
#gid = tiddlyweb
module = wsgiapp:application
chdir = /home/tiddlyweb/tiddlywebs/tiddlyspace.com
disable-logging
buffer-size = 16384
stats = /tmp/uwsgistats.sock
cpu-affinity = 3
reload-on-rss = 250
single-interpreter
The only overlap between this and nginx is the name of the socket, which is brilliant. There are probably ways to get around that too but given that we only want to deploy the one app...
listen
sets the socket listen queue size. It defaults to 100, but when doing some benchmarking nginx was unable to talk to uwsgi for some of the requests. Mind you this is on a single core machine. This configuration on an 8 core will be awesome, but will take some tweaking to get the right config.
working nginx config
This is the evolving nginx config for working with uwsgi + tiddlyweb. On debian the file is /etc/nginx/sites-{enabled,available}/tiddlyspace.org
:
server {
server_name tiddlyspace.org *.tiddlyspace.org;
# map in bring your own domain domains
include /etc/nginx/tiddlyspace-aliases.conf;
access_log /var/log/nginx/tiddlyspace.org-access.log;
location / { try_files $uri @tiddlyspace; }
location @tiddlyspace {
include uwsgi_params;
uwsgi_pass unix:/tmp/tiddlyspace.uwsgi.sock;
}
}
Some notes
- Done See ByodAliases. Further investigation required to deal with Bring Your Own Domain.
- The log file defaults to the combined format. I've found adding the virtual host and length of request to be very useful, so we may wish to add that.
- Numbers of workers and accepted connections per work are defined in
/etc/nginx/nginx.conf
. That file also controls things like outgoing gzip compression. By default onlytext/html
is compressed. - SslExploration