mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Add UNIX socket option to runserver (#2627)
* Add UNIX socket option to runserver Added an optional parameter to runserver to server from a UNIX socket instead of an address:port. I believe it is fairly common to server from sockets when using a web server like Nginx on the same host. * Collapsed if/else logic for address or socket Also wrapped help description for socket parameter
This commit is contained in:
parent
6b1bf3b395
commit
70c6cad0e3
@ -46,8 +46,13 @@ def init():
|
|||||||
@manager.option(
|
@manager.option(
|
||||||
'-t', '--timeout', default=config.get("SUPERSET_WEBSERVER_TIMEOUT"),
|
'-t', '--timeout', default=config.get("SUPERSET_WEBSERVER_TIMEOUT"),
|
||||||
help="Specify the timeout (seconds) for the gunicorn web server")
|
help="Specify the timeout (seconds) for the gunicorn web server")
|
||||||
def runserver(debug, no_reload, address, port, timeout, workers):
|
@manager.option(
|
||||||
"""Starts a Superset web server"""
|
'-s', '--socket', default=config.get("SUPERSET_WEBSERVER_SOCKET"),
|
||||||
|
help="Path to a UNIX socket as an alternative to address:port, e.g. "
|
||||||
|
"/var/run/superset.sock. "
|
||||||
|
"Will override the address and port values.")
|
||||||
|
def runserver(debug, no_reload, address, port, timeout, workers, socket):
|
||||||
|
"""Starts a Superset web server."""
|
||||||
debug = debug or config.get("DEBUG")
|
debug = debug or config.get("DEBUG")
|
||||||
if debug:
|
if debug:
|
||||||
app.run(
|
app.run(
|
||||||
@ -57,11 +62,12 @@ def runserver(debug, no_reload, address, port, timeout, workers):
|
|||||||
debug=True,
|
debug=True,
|
||||||
use_reloader=no_reload)
|
use_reloader=no_reload)
|
||||||
else:
|
else:
|
||||||
|
addr_str = " unix:{socket} " if socket else" {address}:{port} "
|
||||||
cmd = (
|
cmd = (
|
||||||
"gunicorn "
|
"gunicorn "
|
||||||
"-w {workers} "
|
"-w {workers} "
|
||||||
"--timeout {timeout} "
|
"--timeout {timeout} "
|
||||||
"-b {address}:{port} "
|
"-b " + addr_str +
|
||||||
"--limit-request-line 0 "
|
"--limit-request-line 0 "
|
||||||
"--limit-request-field_size 0 "
|
"--limit-request-field_size 0 "
|
||||||
"superset:app").format(**locals())
|
"superset:app").format(**locals())
|
||||||
|
Loading…
Reference in New Issue
Block a user