# HG changeset patch # User RhodeCode Admin # Date 2023-08-23 11:42:49 # Node ID 3c1ad60a1ac79502ef2981651b265002e6b0c274 # Parent 02a0c91dd4dfb7059e1ad451579f5980394713ed tests: fixup the config stubs diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -567,10 +567,14 @@ def add_events_routes(config): def bootstrap_config(request, registry_name='RcTestRegistry'): + from rhodecode.config.middleware import sanitize_settings_and_apply_defaults import pyramid.testing registry = pyramid.testing.Registry(registry_name) + global_config = {'__file__': ''} + config = pyramid.testing.setUp(registry=registry, request=request) + sanitize_settings_and_apply_defaults(global_config, config.registry.settings) # allow pyramid lookup in testing config.include('pyramid_mako') diff --git a/rhodecode/lib/hooks_daemon.py b/rhodecode/lib/hooks_daemon.py --- a/rhodecode/lib/hooks_daemon.py +++ b/rhodecode/lib/hooks_daemon.py @@ -32,7 +32,6 @@ from socketserver import TCPServer import rhodecode from rhodecode.lib.exceptions import HTTPLockedRC, HTTPBranchProtected from rhodecode.model import meta -from rhodecode.lib.base import bootstrap_request, bootstrap_config from rhodecode.lib import hooks_base from rhodecode.lib.utils2 import AttributeDict from rhodecode.lib.ext_json import json diff --git a/rhodecode/lib/system_info.py b/rhodecode/lib/system_info.py --- a/rhodecode/lib/system_info.py +++ b/rhodecode/lib/system_info.py @@ -31,6 +31,7 @@ import resource import configparser +from rc_license.models import LicenseModel from rhodecode.lib.str_utils import safe_str log = logging.getLogger(__name__) @@ -684,7 +685,7 @@ def rhodecode_config(): rhodecode_ini_safe['server:main'] = parsed_ini blacklist = [ - 'rhodecode_license_key', + f'rhodecode_{LicenseModel.LICENSE_DB_KEY}', 'routes.map', 'sqlalchemy.db1.url', 'channelstream.secret', diff --git a/rhodecode/tests/rhodecode.ini b/rhodecode/tests/rhodecode.ini --- a/rhodecode/tests/rhodecode.ini +++ b/rhodecode/tests/rhodecode.ini @@ -26,94 +26,21 @@ debug = true #smtp_use_ssl = true [server:main] -; COMMON HOST/IP CONFIG -host = 0.0.0.0 -port = 5000 +; COMMON HOST/IP CONFIG, This applies mostly to develop setup, +; Host port for gunicorn are controlled by gunicorn_conf.py +host = 127.0.0.1 +port = 10020 ; ########################### ; GUNICORN APPLICATION SERVER ; ########################### -; run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini +; run with gunicorn --paste rhodecode.ini --config gunicorn_conf.py ; Module to use, this setting shouldn't be changed use = egg:gunicorn#main -; Sets the number of process workers. More workers means more concurrent connections -; RhodeCode can handle at the same time. Each additional worker also it increases -; memory usage as each has it's own set of caches. -; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more -; than 8-10 unless for really big deployments .e.g 700-1000 users. -; `instance_id = *` must be set in the [app:main] section below (which is the default) -; when using more than 1 worker. -#workers = 2 - -; Gunicorn access log level -#loglevel = info - -; Process name visible in process list -#proc_name = rhodecode - -; Type of worker class, one of `sync`, `gevent` -; Recommended type is `gevent` -#worker_class = gevent - -; The maximum number of simultaneous clients per worker. Valid only for gevent -#worker_connections = 10 - -; The maximum number of pending connections worker will queue to handle -#backlog = 64 - -; Max number of requests that worker will handle before being gracefully restarted. -; Prevents memory leaks, jitter adds variability so not all workers are restarted at once. -#max_requests = 1000 -#max_requests_jitter = 30 - -; Amount of time a worker can spend with handling a request before it -; gets killed and restarted. By default set to 21600 (6hrs) -; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) -#timeout = 21600 - -; The maximum size of HTTP request line in bytes. -; 0 for unlimited -#limit_request_line = 0 - -; Limit the number of HTTP headers fields in a request. -; By default this value is 100 and can't be larger than 32768. -#limit_request_fields = 32768 - -; Limit the allowed size of an HTTP request header field. -; Value is a positive number or 0. -; Setting it to 0 will allow unlimited header field sizes. -#limit_request_field_size = 0 - -; Timeout for graceful workers restart. -; After receiving a restart signal, workers have this much time to finish -; serving requests. Workers still alive after the timeout (starting from the -; receipt of the restart signal) are force killed. -; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) -#graceful_timeout = 3600 - -# The number of seconds to wait for requests on a Keep-Alive connection. -# Generally set in the 1-5 seconds range. -#keepalive = 2 - -; Maximum memory usage that each worker can use before it will receive a -; graceful restart signal 0 = memory monitoring is disabled -; Examples: 268435456 (256MB), 536870912 (512MB) -; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB) -#memory_max_usage = 0 - -; How often in seconds to check for memory usage for each gunicorn worker -#memory_usage_check_interval = 60 - -; Threshold value for which we don't recycle worker if GarbageCollection -; frees up enough resources. Before each restart we try to run GC on worker -; in case we get enough free memory after that, restart will not happen. -#memory_usage_recovery_threshold = 0.8 - - ; Prefix middleware for RhodeCode. ; recommended when using proxy setup. ; allows to set RhodeCode under a prefix in server. @@ -579,6 +506,9 @@ sqlalchemy.db1.pool_recycle = 3600 ; the number of connections to keep open inside the connection pool. ; 0 indicates no limit +; the general calculus with gevent is: +; if your system allows 500 concurrent greenlets (max_connections) that all do database access, +; then increase pool size + max overflow so that they add up to 500. #sqlalchemy.db1.pool_size = 5 ; The number of connections to allow in connection pool "overflow", that is @@ -594,7 +524,6 @@ sqlalchemy.db1.pool_recycle = 3600 ; VCS CONFIG ; ########## vcs.server.enable = true -#vcs.server = localhost:9901 vcs.server = vcsserver:10010 ; Web server connectivity protocol, responsible for web based VCS operations @@ -709,7 +638,7 @@ ssh.executable.svn = ~/.rccontrol/vcsser ssh.enable_ui_key_generator = true ; Statsd client config, this is used to send metrics to statsd -; We recommend setting statsd_exported and scrape them using Promethues +; We recommend setting statsd_exported and scrape them using Prometheus #statsd.enabled = false #statsd.statsd_host = 0.0.0.0 #statsd.statsd_port = 8125