# HG changeset patch # User RhodeCode Admin # Date 2023-01-05 08:50:14 # Node ID e978516267d69a9a3331acb8e681c309de4ed3a4 # Parent 56c4f0445b7591826b09571784f594720bc299a6 ini: cleanups + added generic cache definition diff --git a/configs/development.ini b/configs/development.ini --- a/configs/development.ini +++ b/configs/development.ini @@ -429,11 +429,40 @@ rc_cache.cache_repo_longterm.expiration_ rc_cache.cache_repo_longterm.max_size = 10000 +; ********************************************* +; `cache_general` cache for general purpose use +; for simplicity use rc.file_namespace backend, +; for performance and scale use rc.redis +; ********************************************* +rc_cache.cache_general.backend = dogpile.cache.rc.file_namespace +rc_cache.cache_general.expiration_time = 43200 +; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set +#rc_cache.cache_general.arguments.filename = /tmp/cache_general.db + +; alternative `cache_general` redis backend with distributed lock +#rc_cache.cache_general.backend = dogpile.cache.rc.redis +#rc_cache.cache_general.expiration_time = 300 + +; redis_expiration_time needs to be greater then expiration_time +#rc_cache.cache_general.arguments.redis_expiration_time = 7200 + +#rc_cache.cache_general.arguments.host = localhost +#rc_cache.cache_general.arguments.port = 6379 +#rc_cache.cache_general.arguments.db = 0 +#rc_cache.cache_general.arguments.socket_timeout = 30 +; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends +#rc_cache.cache_general.arguments.distributed_lock = true + +; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen +#rc_cache.cache_general.arguments.lock_auto_renewal = true + ; ************************************************* ; `cache_perms` cache for permission tree, auth TTL +; for simplicity use rc.file_namespace backend, +; for performance and scale use rc.redis ; ************************************************* rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace -rc_cache.cache_perms.expiration_time = 300 +rc_cache.cache_perms.expiration_time = 3600 ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set #rc_cache.cache_perms.arguments.filename = /tmp/cache_perms.db @@ -456,6 +485,8 @@ rc_cache.cache_perms.expiration_time = 3 ; *************************************************** ; `cache_repo` cache for file tree, Readme, RSS FEEDS +; for simplicity use rc.file_namespace backend, +; for performance and scale use rc.redis ; *************************************************** rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace rc_cache.cache_repo.expiration_time = 2592000 @@ -852,10 +883,9 @@ qualname = celery class = StreamHandler args = (sys.stderr, ) level = DEBUG +; To enable JSON formatted logs replace 'generic/color_formatter' with 'json' +; This allows sending properly formatted logs to grafana loki or elasticsearch formatter = color_formatter -; To enable JSON formatted logs replace generic with json -; This allows sending properly formatted logs to grafana loki or elasticsearch -#formatter = json [handler_console_sql] ; "level = DEBUG" logs SQL queries and results. @@ -864,6 +894,8 @@ formatter = color_formatter class = StreamHandler args = (sys.stderr, ) level = WARN +; To enable JSON formatted logs replace 'generic/color_formatter_sql' with 'json' +; This allows sending properly formatted logs to grafana loki or elasticsearch formatter = color_formatter_sql ; ########## diff --git a/configs/logging.ini b/configs/logging.ini --- a/configs/logging.ini +++ b/configs/logging.ini @@ -1,6 +1,7 @@ ; ##################### ; LOGGING CONFIGURATION ; ##################### + [loggers] keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper @@ -55,10 +56,8 @@ qualname = celery class = StreamHandler args = (sys.stderr, ) level = $RC_LOGGING_LEVEL -; To enable JSON formatted logs replace generic with json +; To enable JSON formatted logs replace 'generic' with 'json' ; This allows sending properly formatted logs to grafana loki or elasticsearch -#formatter = json -#formatter = generic formatter = $RC_LOGGING_FORMATTER [handler_console_sql] @@ -68,10 +67,8 @@ formatter = $RC_LOGGING_FORMATTER class = StreamHandler args = (sys.stderr, ) level = WARN -; To enable JSON formatted logs replace generic with json +; To enable JSON formatted logs replace 'generic/color_formatter_sql' with 'json' ; This allows sending properly formatted logs to grafana loki or elasticsearch -#formatter = json -#formatter = generic formatter = $RC_LOGGING_FORMATTER ; ########## @@ -94,5 +91,5 @@ format = %(asctime)s.%(msecs)03d [%(proc datefmt = %Y-%m-%d %H:%M:%S [formatter_json] -format = %(message)s -class = rhodecode.lib._vendor.jsonlogger.JsonFormatter \ No newline at end of file +format = %(timestamp)s %(levelname)s %(name)s %(message)s %(req_id)s +class = rhodecode.lib._vendor.jsonlogger.JsonFormatter diff --git a/configs/production.ini b/configs/production.ini --- a/configs/production.ini +++ b/configs/production.ini @@ -380,11 +380,40 @@ rc_cache.cache_repo_longterm.expiration_ rc_cache.cache_repo_longterm.max_size = 10000 +; ********************************************* +; `cache_general` cache for general purpose use +; for simplicity use rc.file_namespace backend, +; for performance and scale use rc.redis +; ********************************************* +rc_cache.cache_general.backend = dogpile.cache.rc.file_namespace +rc_cache.cache_general.expiration_time = 43200 +; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set +#rc_cache.cache_general.arguments.filename = /tmp/cache_general.db + +; alternative `cache_general` redis backend with distributed lock +#rc_cache.cache_general.backend = dogpile.cache.rc.redis +#rc_cache.cache_general.expiration_time = 300 + +; redis_expiration_time needs to be greater then expiration_time +#rc_cache.cache_general.arguments.redis_expiration_time = 7200 + +#rc_cache.cache_general.arguments.host = localhost +#rc_cache.cache_general.arguments.port = 6379 +#rc_cache.cache_general.arguments.db = 0 +#rc_cache.cache_general.arguments.socket_timeout = 30 +; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends +#rc_cache.cache_general.arguments.distributed_lock = true + +; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen +#rc_cache.cache_general.arguments.lock_auto_renewal = true + ; ************************************************* ; `cache_perms` cache for permission tree, auth TTL +; for simplicity use rc.file_namespace backend, +; for performance and scale use rc.redis ; ************************************************* rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace -rc_cache.cache_perms.expiration_time = 300 +rc_cache.cache_perms.expiration_time = 3600 ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set #rc_cache.cache_perms.arguments.filename = /tmp/cache_perms.db @@ -407,6 +436,8 @@ rc_cache.cache_perms.expiration_time = 3 ; *************************************************** ; `cache_repo` cache for file tree, Readme, RSS FEEDS +; for simplicity use rc.file_namespace backend, +; for performance and scale use rc.redis ; *************************************************** rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace rc_cache.cache_repo.expiration_time = 2592000 @@ -803,10 +834,9 @@ qualname = celery class = StreamHandler args = (sys.stderr, ) level = INFO +; To enable JSON formatted logs replace 'generic/color_formatter' with 'json' +; This allows sending properly formatted logs to grafana loki or elasticsearch formatter = generic -; To enable JSON formatted logs replace generic with json -; This allows sending properly formatted logs to grafana loki or elasticsearch -#formatter = json [handler_console_sql] ; "level = DEBUG" logs SQL queries and results. @@ -815,6 +845,8 @@ formatter = generic class = StreamHandler args = (sys.stderr, ) level = WARN +; To enable JSON formatted logs replace 'generic/color_formatter_sql' with 'json' +; This allows sending properly formatted logs to grafana loki or elasticsearch formatter = generic ; ##########