From cdc6657bda6a70ecc036f53cf265f1815dc2badc Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Mon, 15 Jan 2018 15:08:42 -0500 Subject: [PATCH] Update galaxy.yml.sample uwsgi section from defaults in get_uwsgi_args.py --- config/galaxy.yml.sample | 57 ++++++++++++++++-- lib/galaxy/webapps/config_manage.py | 91 ++++++++++++++++++++++++----- 2 files changed, 131 insertions(+), 17 deletions(-) diff --git a/config/galaxy.yml.sample b/config/galaxy.yml.sample index 011d98383ee..9911f4ab323 100644 --- a/config/galaxy.yml.sample +++ b/config/galaxy.yml.sample @@ -20,17 +20,59 @@ uwsgi: # The address and port on which to listen. By default, only listen to # localhost (galaxy will not be accessible over the network). Use - # '0.0.0.0' to listen on all available network interfaces. + # ':8080' to listen on all available network interfaces. http: 127.0.0.1:8080 - threads: 8 + # Number of web server (worker) processes to fork after the + # application has loaded. + processes: 1 - http-raw-body: True + # Number of threads for each web server process. + threads: 4 - offload-threads: 8 + # Number of threads for serving static content and handling internal + # routing requests. + offload-threads: 2 + # Mapping to serve style content. + static-map: /static/style=static/style/blue + + # Mapping to serve the remainder of the static content. + static-map: /static=static + + # Enable the master process manager. Disabled by default for maximum + # compatibility with CTRL+C, but should be enabled for use with + # --daemon and/or production deployments. + master: false + + # Path to the application's Python virtual environment. + virtualenv: .venv + + # Path to the application's Python library. + pythonpath: lib + + # The entry point which returns the web application (e.g. Galaxy, + # Reports, etc.) that you are loading. module: galaxy.webapps.galaxy.buildapp:uwsgi_app() + # Cause uWSGI to respect the traditional behavior of dying on SIGTERM + # (its default is to brutally reload workers) + die-on-term: true + + # Cause uWSGI to gracefully reload workers and mules upon receipt of + # SIGINT (its default is to brutally kill workers) + hook-master-start: unix_signal:2 gracefully_kill_them_all + + # Cause uWSGI to gracefully reload workers and mules upon receipt of + # SIGTERM (its default is to brutally kill workers) + hook-master-start: unix_signal:15 gracefully_kill_them_all + + # Feature necessary for proper mule signal handling + py-call-osafterfork: true + + # Ensure application threads will run if `threads` is unset. + enable-threads: true + galaxy: # If running behind a proxy server and Galaxy is served from a @@ -811,6 +853,13 @@ galaxy: # verbosity. #log_level: DEBUG + # Controls where and how the server logs messages. If unset, the + # default is to log all messages to standard output at the level + # defined by the `log_level` configuration option. Configuration is + # described in the documentation at: + # https://docs.galaxyproject.org/en/master/admin/config_logging.html + #logging: galaxy.config.LOGGING_CONFIG_DEFAULT + # Print database operations to the server log (warning, quite # verbose!). #database_engine_option_echo: false diff --git a/lib/galaxy/webapps/config_manage.py b/lib/galaxy/webapps/config_manage.py index bdcad53d441..f92be052ad2 100644 --- a/lib/galaxy/webapps/config_manage.py +++ b/lib/galaxy/webapps/config_manage.py @@ -51,14 +51,84 @@ App = namedtuple( UWSGI_OPTIONS = OrderedDict([ ('http', { - 'desc': """The address and port on which to listen. By default, only listen to localhost ($app_name will not be accessible over the network). Use '0.0.0.0' to listen on all available network interfaces.""", + 'desc': """The address and port on which to listen. By default, only listen to localhost ($app_name will not be accessible over the network). Use ':$default_port' to listen on all available network interfaces.""", 'default': '127.0.0.1:$default_port', 'type': 'str', }), - ('threads', { - 'default': 8, + ('processes', { + 'desc': """Number of web server (worker) processes to fork after the application has loaded.""", + 'default': '1', 'type': 'int', }), + ('threads', { + 'desc': """Number of threads for each web server process.""", + 'default': 4, + 'type': 'int', + }), + ('offload-threads', { + 'desc': """Number of threads for serving static content and handling internal routing requests.""", + 'default': '2', + 'type': 'int', + }), + ('static-map.1', { + 'key': 'static-map', + 'desc': """Mapping to serve style content.""", + 'default': '/static/style=static/style/blue', + 'type': 'str', + }), + ('static-map.2', { + 'key': 'static-map', + 'desc': """Mapping to serve the remainder of the static content.""", + 'default': '/static=static', + 'type': 'str', + }), + ('master', { + 'desc': """Enable the master process manager. Disabled by default for maximum compatibility with CTRL+C, but should be enabled for use with --daemon and/or production deployments.""", + 'default': 'false', + 'type': 'str', + }), + ('virtualenv', { + 'desc': """Path to the application's Python virtual environment.""", + 'default': '.venv', + 'type': 'str', + }), + ('pythonpath', { + 'desc': """Path to the application's Python library.""", + 'default': 'lib', + 'type': 'str', + }), + ('module', { + 'desc': """The entry point which returns the web application (e.g. Galaxy, Reports, etc.) that you are loading.""", + 'default': '$uwsgi_module', + 'type': 'str', + }), + ('die-on-term', { + 'desc': """Cause uWSGI to respect the traditional behavior of dying on SIGTERM (its default is to brutally reload workers)""", + 'default': 'true', + 'type': 'str', + }), + ('hook-master-start.1', { + 'key': 'hook-master-start', + 'desc': """Cause uWSGI to gracefully reload workers and mules upon receipt of SIGINT (its default is to brutally kill workers)""", + 'default': 'unix_signal:2 gracefully_kill_them_all', + 'type': 'str', + }), + ('hook-master-start.2', { + 'key': 'hook-master-start', + 'desc': """Cause uWSGI to gracefully reload workers and mules upon receipt of SIGTERM (its default is to brutally kill workers)""", + 'default': 'unix_signal:15 gracefully_kill_them_all', + 'type': 'str', + }), + ('py-call-osafterfork', { + 'desc': """Feature necessary for proper mule signal handling""", + 'default': 'true', + 'type': 'str', + }), + ('enable-threads', { + 'desc': """Ensure application threads will run if `threads` is unset.""", + 'default': 'true', + 'type': 'str', + }), # ('route-uri', { # 'default': '^/proxy/ goto:proxy' # }), @@ -74,16 +144,9 @@ UWSGI_OPTIONS = OrderedDict([ # ('route-run', { # 'default': "['log:Proxy ${HTTP_HOST} to ${TARGET_HOST}', 'httpdumb:${TARGET_HOST}']", # }), - ('http-raw-body', { - 'default': 'True' - }), - ('offload-threads', { - 'default': '8', - }), - ('module', { - 'default': '$uwsgi_module', - 'type': 'str', - }) + #('http-raw-body', { + # 'default': 'True' + #}), ]) DROP_OPTION_VALUE = object() @@ -654,6 +717,8 @@ def _write_sample_section(args, f, section_header, schema, as_comment=True, uwsg default = None if "default" not in value else value["default"] option = schema.get_app_option(key) option_value = OptionValue(key, default, option) + # support uWSGI "dumb yaml parser" (unbit/uwsgi#863) + key = option.get('key', key) _write_option(args, f, key, option_value, as_comment=as_comment, uwsgi_hack=uwsgi_hack)