Repository: incubator-airflow Updated Branches: refs/heads/master dddfd3b5b -> e332f6362
ssl gunicorn support Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/e332f636 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/e332f636 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/e332f636 Branch: refs/heads/master Commit: e332f63620a5f85e38c4a1a5ac9c9a4a5bfc6035 Parents: dddfd3b Author: Stanilovsky Evgeny <[email protected]> Authored: Thu May 12 09:58:40 2016 +0300 Committer: Stanilovsky Evgeny <[email protected]> Committed: Thu May 12 10:07:45 2016 +0300 ---------------------------------------------------------------------- airflow/bin/cli.py | 21 +++++++++++++++++---- airflow/configuration.py | 8 ++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/e332f636/airflow/bin/cli.py ---------------------------------------------------------------------- diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py index d735bad..f2dceee 100755 --- a/airflow/bin/cli.py +++ b/airflow/bin/cli.py @@ -410,10 +410,17 @@ def webserver(args): app.run(debug=True, port=args.port, host=args.hostname) else: pid, stdout, stderr, log_file = setup_locations("webserver", pid=args.pid) + secure_params = args.ssl_certfile and args.ssl_keyfile + if secure_params: + sec_params = ['--certfile=' + args.ssl_certfile, '--keyfile=' + + args.ssl_keyfile] + else: + sec_params = [] print( 'Running the Gunicorn server with {workers} {args.workerclass}' 'workers on host {args.hostname} and port ' - '{args.port} with a timeout of {worker_timeout}...'.format(**locals())) + '{args.port} with a timeout of {worker_timeout},' + ' secure={secure_params}'.format(**locals())) run_args = ['gunicorn', '-w ' + str(args.workers), @@ -421,7 +428,7 @@ def webserver(args): '-t ' + str(args.worker_timeout), '-b ' + args.hostname + ':' + str(args.port), '-n ' + 'airflow-webserver', - '-p ' + str(pid)] + '-p ' + str(pid)] + sec_params if args.daemon: run_args.append("-D") @@ -776,6 +783,12 @@ class CLIFactory(object): ("-hn", "--hostname"), default=conf.get('webserver', 'WEB_SERVER_HOST'), help="Set the hostname on which to run the web server"), + 'ssl_certfile': Arg( + ("-scf", "--ssl_certfile"), + help="ssl certificate file"), + 'ssl_keyfile': Arg( + ("-skf", "--ssl_keyfile"), + help="ssl key file"), 'debug': Arg( ("-d", "--debug"), "Use the server that ships with Flask in debug mode", @@ -902,8 +915,8 @@ class CLIFactory(object): 'func': webserver, 'help': "Start a Airflow webserver instance", 'args': ('port', 'workers', 'workerclass', 'worker_timeout', 'hostname', - 'pid', 'daemon', 'stdout', 'stderr', 'log_file', - 'debug'), + 'pid', 'daemon', 'stdout', 'stderr', 'log_file','ssl_certfile', + 'ssl_keyfile', 'debug'), }, { 'func': resetdb, 'help': "Burn down and rebuild the metadata database", http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/e332f636/airflow/configuration.py ---------------------------------------------------------------------- diff --git a/airflow/configuration.py b/airflow/configuration.py index 173eddb..6478891 100644 --- a/airflow/configuration.py +++ b/airflow/configuration.py @@ -109,6 +109,8 @@ defaults = { 'expose_config': False, 'workers': 4, 'worker_class': 'sync', + 'ssl_certfile': None, + 'ssl_keyfile': None, }, 'scheduler': { 'statsd_on': False, @@ -263,6 +265,12 @@ authenticate = False # Filter the list of dags by owner name (requires authentication to be enabled) filter_by_owner = False +# SSL certificate file +# ssl_certfile = + +# SSL key file +# ssl_keyfile = + [email] email_backend = airflow.utils.email.send_email_smtp
