Changeset - 2c0e7e1d2584
[Not reviewed]
default
0 2 0
Mads Kiilerich - 8 years ago 2017-10-11 02:41:07
mads@kiilerich.com
config: tweak template http_server conditionals - don't leave an empty section when using UWSGI

The web servers run by 'gearbox serve' share the same basic configuration:

[server:main]
host = ...
port = ...
use = egg:...
...

UWSGI doesn't use gearbox and doesn't use a [server:main] section but will read
it's own section:

[uwsgi]
http = ...:...
...

Before, 'make-config my.ini http_server=uwsgi' would create an empty
[server:main] section, and only after 6a5fb5070765 it stopped putting unused
host/port information there.

Now, let everything but UWSGI share the [server:main] template section and put
host/port first. Everything UWSGI is handled in its own conditional template
section.
2 files changed with 12 insertions and 11 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -57,28 +57,28 @@ smtp_server =
 
#smtp_username =
 
#smtp_password =
 
smtp_port =
 
#smtp_use_ssl = false
 
#smtp_use_tls = false
 

	
 
## Entry point for 'gearbox serve'
 
[server:main]
 
#host = 127.0.0.1
 
host = 0.0.0.0
 
port = 5000
 

	
 
## WAITRESS ##
 
use = egg:waitress#main
 
## number of worker threads
 
threads = 1
 
## MAX BODY SIZE 100GB
 
max_request_body_size = 107374182400
 
## use poll instead of select, fixes fd limits, may not work on old
 
## windows systems.
 
#asyncore_use_poll = True
 

	
 
## COMMON ##
 
#host = 127.0.0.1
 
host = 0.0.0.0
 
port = 5000
 

	
 
## middleware for hosting the WSGI application under a URL prefix
 
#[filter:proxy-prefix]
 
#use = egg:PasteDeploy#prefix
 
#prefix = /<your-prefix>
 

	
 
[app:main]
kallithea/lib/paster_commands/template.ini.mako
Show inline comments
 
@@ -58,13 +58,18 @@ smtp_server =
 
#smtp_username =
 
#smtp_password =
 
smtp_port =
 
#smtp_use_ssl = false
 
#smtp_use_tls = false
 

	
 
%if http_server != 'uwsgi':
 
<%text>## Entry point for 'gearbox serve'</%text>
 
[server:main]
 
host = ${host}
 
port = ${port}
 

	
 
%if http_server == 'gearbox':
 
<%text>## Gearbox default web server ##</%text>
 
use = egg:gearbox#wsgiref
 
<%text>## nr of worker threads to spawn</%text>
 
threadpool_workers = 1
 
<%text>## max request before thread respawn</%text>
 
@@ -100,13 +105,14 @@ proc_name = kallithea
 
worker_class = sync
 
max_requests = 1000
 
<%text>## amount of time a worker can handle request before it gets killed and</%text>
 
<%text>## restarted</%text>
 
timeout = 3600
 

	
 
%elif http_server == 'uwsgi':
 
%endif
 
%else:
 
<%text>## UWSGI ##</%text>
 
<%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text>
 
[uwsgi]
 
socket = /tmp/uwsgi.sock
 
master = true
 
http = ${host}:${port}
 
@@ -162,17 +168,12 @@ cheaper-initial = 1
 
workers = 4
 

	
 
<%text>## how many workers should be spawned at a time</%text>
 
cheaper-step = 1
 

	
 
%endif
 
%if http_server != 'uwsgi':
 
host = ${host}
 
port = ${port}
 

	
 
%endif
 
<%text>## middleware for hosting the WSGI application under a URL prefix</%text>
 
#[filter:proxy-prefix]
 
#use = egg:PasteDeploy#prefix
 
#prefix = /<your-prefix>
 

	
 
[app:main]
0 comments (0 inline, 0 general)