Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UNIX socket option to runserver #2627

Merged
merged 2 commits into from
Apr 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions superset/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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())
Expand Down