diff --git a/superset/cli.py b/superset/cli.py index b2a05e1379..a71029149d 100755 --- a/superset/cli.py +++ b/superset/cli.py @@ -46,8 +46,13 @@ def init(): @manager.option( '-t', '--timeout', default=config.get("SUPERSET_WEBSERVER_TIMEOUT"), help="Specify the timeout (seconds) for the gunicorn web server") -def runserver(debug, no_reload, address, port, timeout, workers): - """Starts a Superset web server""" +@manager.option( + '-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") if debug: app.run( @@ -57,11 +62,12 @@ def runserver(debug, no_reload, address, port, timeout, workers): debug=True, use_reloader=no_reload) else: + addr_str = " unix:{socket} " if socket else" {address}:{port} " cmd = ( "gunicorn " "-w {workers} " "--timeout {timeout} " - "-b {address}:{port} " + "-b " + addr_str + "--limit-request-line 0 " "--limit-request-field_size 0 " "superset:app").format(**locals())