##// END OF EJS Templates
config: updated changes to config files
super-admin -
r4827:fa70deee default
parent child Browse files
Show More
@@ -1,865 +1,890 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 3 ; #########################################
4 4 ; RHODECODE COMMUNITY EDITION CONFIGURATION
5 5 ; #########################################
6 6
7 7 [DEFAULT]
8 8 ; Debug flag sets all loggers to debug, and enables request tracking
9 9 debug = true
10 10
11 11 ; ########################################################################
12 12 ; EMAIL CONFIGURATION
13 13 ; These settings will be used by the RhodeCode mailing system
14 14 ; ########################################################################
15 15
16 16 ; prefix all emails subjects with given prefix, helps filtering out emails
17 17 #email_prefix = [RhodeCode]
18 18
19 19 ; email FROM address all mails will be sent
20 20 #app_email_from = rhodecode-noreply@localhost
21 21
22 22 #smtp_server = mail.server.com
23 23 #smtp_username =
24 24 #smtp_password =
25 25 #smtp_port =
26 26 #smtp_use_tls = false
27 27 #smtp_use_ssl = true
28 28
29 29 [server:main]
30 30 ; COMMON HOST/IP CONFIG
31 31 host = 127.0.0.1
32 32 port = 5000
33 33
34 34 ; ##################################################
35 35 ; WAITRESS WSGI SERVER - Recommended for Development
36 36 ; ##################################################
37 37
38 38 ; use server type
39 39 use = egg:waitress#main
40 40
41 41 ; number of worker threads
42 42 threads = 5
43 43
44 44 ; MAX BODY SIZE 100GB
45 45 max_request_body_size = 107374182400
46 46
47 47 ; Use poll instead of select, fixes file descriptors limits problems.
48 48 ; May not work on old windows systems.
49 49 asyncore_use_poll = true
50 50
51 51
52 52 ; ###########################
53 53 ; GUNICORN APPLICATION SERVER
54 54 ; ###########################
55 55
56 56 ; run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
57 57
58 58 ; Module to use, this setting shouldn't be changed
59 59 #use = egg:gunicorn#main
60 60
61 61 ; Sets the number of process workers. More workers means more concurrent connections
62 62 ; RhodeCode can handle at the same time. Each additional worker also it increases
63 63 ; memory usage as each has it's own set of caches.
64 64 ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
65 65 ; than 8-10 unless for really big deployments .e.g 700-1000 users.
66 66 ; `instance_id = *` must be set in the [app:main] section below (which is the default)
67 67 ; when using more than 1 worker.
68 68 #workers = 2
69 69
70 70 ; Gunicorn access log level
71 71 #loglevel = info
72 72
73 73 ; Process name visible in process list
74 74 #proc_name = rhodecode
75 75
76 76 ; Type of worker class, one of `sync`, `gevent`
77 77 ; Recommended type is `gevent`
78 78 #worker_class = gevent
79 79
80 80 ; The maximum number of simultaneous clients. Valid only for gevent
81 81 #worker_connections = 10
82 82
83 83 ; Max number of requests that worker will handle before being gracefully restarted.
84 84 ; Prevents memory leaks, jitter adds variability so not all workers are restarted at once.
85 85 #max_requests = 1000
86 86 #max_requests_jitter = 30
87 87
88 88 ; Amount of time a worker can spend with handling a request before it
89 89 ; gets killed and restarted. By default set to 21600 (6hrs)
90 90 ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
91 91 #timeout = 21600
92 92
93 93 ; The maximum size of HTTP request line in bytes.
94 94 ; 0 for unlimited
95 95 #limit_request_line = 0
96 96
97 97 ; Limit the number of HTTP headers fields in a request.
98 98 ; By default this value is 100 and can't be larger than 32768.
99 99 #limit_request_fields = 32768
100 100
101 101 ; Limit the allowed size of an HTTP request header field.
102 102 ; Value is a positive number or 0.
103 103 ; Setting it to 0 will allow unlimited header field sizes.
104 104 #limit_request_field_size = 0
105 105
106 106 ; Timeout for graceful workers restart.
107 107 ; After receiving a restart signal, workers have this much time to finish
108 108 ; serving requests. Workers still alive after the timeout (starting from the
109 109 ; receipt of the restart signal) are force killed.
110 110 ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
111 111 #graceful_timeout = 3600
112 112
113 113 # The number of seconds to wait for requests on a Keep-Alive connection.
114 114 # Generally set in the 1-5 seconds range.
115 115 #keepalive = 2
116 116
117 117 ; Maximum memory usage that each worker can use before it will receive a
118 118 ; graceful restart signal 0 = memory monitoring is disabled
119 119 ; Examples: 268435456 (256MB), 536870912 (512MB)
120 120 ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB)
121 121 #memory_max_usage = 0
122 122
123 123 ; How often in seconds to check for memory usage for each gunicorn worker
124 124 #memory_usage_check_interval = 60
125 125
126 126 ; Threshold value for which we don't recycle worker if GarbageCollection
127 127 ; frees up enough resources. Before each restart we try to run GC on worker
128 128 ; in case we get enough free memory after that, restart will not happen.
129 129 #memory_usage_recovery_threshold = 0.8
130 130
131 131
132 132 ; Prefix middleware for RhodeCode.
133 133 ; recommended when using proxy setup.
134 134 ; allows to set RhodeCode under a prefix in server.
135 135 ; eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
136 136 ; And set your prefix like: `prefix = /custom_prefix`
137 137 ; be sure to also set beaker.session.cookie_path = /custom_prefix if you need
138 138 ; to make your cookies only work on prefix url
139 139 [filter:proxy-prefix]
140 140 use = egg:PasteDeploy#prefix
141 141 prefix = /
142 142
143 143 [app:main]
144 144 ; The %(here)s variable will be replaced with the absolute path of parent directory
145 145 ; of this file
146 ; In addition ENVIRONMENT variables usage is possible, e.g
147 ; sqlalchemy.db1.url = {ENV_RC_DB_URL}
146 ; Each option in the app:main can be override by an environmental variable
147 ;
148 ;To override an option:
149 ;
150 ;RC_<KeyName>
151 ;Everything should be uppercase, . and - should be replaced by _.
152 ;For example, if you have these configuration settings:
153 ;rc_cache.repo_object.backend = foo
154 ;can be overridden by
155 ;export RC_CACHE_REPO_OBJECT_BACKEND=foo
148 156
149 157 use = egg:rhodecode-enterprise-ce
150 158
151 159 ; enable proxy prefix middleware, defined above
152 160 #filter-with = proxy-prefix
153 161
154 162 ; #############
155 163 ; DEBUG OPTIONS
156 164 ; #############
157 165
158 166 pyramid.reload_templates = true
159 167
160 168 # During development the we want to have the debug toolbar enabled
161 169 pyramid.includes =
162 170 pyramid_debugtoolbar
163 171
164 172 debugtoolbar.hosts = 0.0.0.0/0
165 173 debugtoolbar.exclude_prefixes =
166 174 /css
167 175 /fonts
168 176 /images
169 177 /js
170 178
171 179 ## RHODECODE PLUGINS ##
172 180 rhodecode.includes =
173 181 rhodecode.api
174 182
175 183
176 184 # api prefix url
177 185 rhodecode.api.url = /_admin/api
178 186
179 187 ; enable debug style page
180 188 debug_style = true
181 189
182 190 ; #################
183 191 ; END DEBUG OPTIONS
184 192 ; #################
185 193
186 194 ; encryption key used to encrypt social plugin tokens,
187 195 ; remote_urls with credentials etc, if not set it defaults to
188 196 ; `beaker.session.secret`
189 197 #rhodecode.encrypted_values.secret =
190 198
191 199 ; decryption strict mode (enabled by default). It controls if decryption raises
192 200 ; `SignatureVerificationError` in case of wrong key, or damaged encryption data.
193 201 #rhodecode.encrypted_values.strict = false
194 202
195 203 ; Pick algorithm for encryption. Either fernet (more secure) or aes (default)
196 204 ; fernet is safer, and we strongly recommend switching to it.
197 205 ; Due to backward compatibility aes is used as default.
198 206 #rhodecode.encrypted_values.algorithm = fernet
199 207
200 208 ; Return gzipped responses from RhodeCode (static files/application)
201 209 gzip_responses = false
202 210
203 211 ; Auto-generate javascript routes file on startup
204 212 generate_js_files = false
205 213
206 214 ; System global default language.
207 215 ; All available languages: en (default), be, de, es, fr, it, ja, pl, pt, ru, zh
208 216 lang = en
209 217
210 218 ; Perform a full repository scan and import on each server start.
211 219 ; Settings this to true could lead to very long startup time.
212 220 startup.import_repos = false
213 221
214 222 ; Uncomment and set this path to use archive download cache.
215 223 ; Once enabled, generated archives will be cached at this location
216 224 ; and served from the cache during subsequent requests for the same archive of
217 225 ; the repository.
218 226 #archive_cache_dir = /tmp/tarballcache
219 227
220 228 ; URL at which the application is running. This is used for Bootstrapping
221 229 ; requests in context when no web request is available. Used in ishell, or
222 230 ; SSH calls. Set this for events to receive proper url for SSH calls.
223 231 app.base_url = http://rhodecode.local
224 232
225 233 ; Unique application ID. Should be a random unique string for security.
226 234 app_instance_uuid = rc-production
227 235
228 236 ; Cut off limit for large diffs (size in bytes). If overall diff size on
229 237 ; commit, or pull request exceeds this limit this diff will be displayed
230 238 ; partially. E.g 512000 == 512Kb
231 239 cut_off_limit_diff = 512000
232 240
233 241 ; Cut off limit for large files inside diffs (size in bytes). Each individual
234 242 ; file inside diff which exceeds this limit will be displayed partially.
235 243 ; E.g 128000 == 128Kb
236 244 cut_off_limit_file = 128000
237 245
238 246 ; Use cached version of vcs repositories everywhere. Recommended to be `true`
239 247 vcs_full_cache = true
240 248
241 249 ; Force https in RhodeCode, fixes https redirects, assumes it's always https.
242 250 ; Normally this is controlled by proper flags sent from http server such as Nginx or Apache
243 251 force_https = false
244 252
245 253 ; use Strict-Transport-Security headers
246 254 use_htsts = false
247 255
248 256 ; Set to true if your repos are exposed using the dumb protocol
249 257 git_update_server_info = false
250 258
251 259 ; RSS/ATOM feed options
252 260 rss_cut_off_limit = 256000
253 261 rss_items_per_page = 10
254 262 rss_include_diff = false
255 263
256 264 ; gist URL alias, used to create nicer urls for gist. This should be an
257 265 ; url that does rewrites to _admin/gists/{gistid}.
258 266 ; example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
259 267 ; RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
260 268 gist_alias_url =
261 269
262 270 ; List of views (using glob pattern syntax) that AUTH TOKENS could be
263 271 ; used for access.
264 272 ; Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
265 273 ; came from the the logged in user who own this authentication token.
266 274 ; Additionally @TOKEN syntax can be used to bound the view to specific
267 275 ; authentication token. Such view would be only accessible when used together
268 276 ; with this authentication token
269 277 ; list of all views can be found under `/_admin/permissions/auth_token_access`
270 278 ; The list should be "," separated and on a single line.
271 279 ; Most common views to enable:
272 280
273 281 # RepoCommitsView:repo_commit_download
274 282 # RepoCommitsView:repo_commit_patch
275 283 # RepoCommitsView:repo_commit_raw
276 284 # RepoCommitsView:repo_commit_raw@TOKEN
277 285 # RepoFilesView:repo_files_diff
278 286 # RepoFilesView:repo_archivefile
279 287 # RepoFilesView:repo_file_raw
280 288 # GistView:*
281 289 api_access_controllers_whitelist =
282 290
283 291 ; Default encoding used to convert from and to unicode
284 292 ; can be also a comma separated list of encoding in case of mixed encodings
285 293 default_encoding = UTF-8
286 294
287 295 ; instance-id prefix
288 296 ; a prefix key for this instance used for cache invalidation when running
289 297 ; multiple instances of RhodeCode, make sure it's globally unique for
290 298 ; all running RhodeCode instances. Leave empty if you don't use it
291 299 instance_id =
292 300
293 301 ; Fallback authentication plugin. Set this to a plugin ID to force the usage
294 302 ; of an authentication plugin also if it is disabled by it's settings.
295 303 ; This could be useful if you are unable to log in to the system due to broken
296 304 ; authentication settings. Then you can enable e.g. the internal RhodeCode auth
297 305 ; module to log in again and fix the settings.
298 306 ; Available builtin plugin IDs (hash is part of the ID):
299 307 ; egg:rhodecode-enterprise-ce#rhodecode
300 308 ; egg:rhodecode-enterprise-ce#pam
301 309 ; egg:rhodecode-enterprise-ce#ldap
302 310 ; egg:rhodecode-enterprise-ce#jasig_cas
303 311 ; egg:rhodecode-enterprise-ce#headers
304 312 ; egg:rhodecode-enterprise-ce#crowd
305 313
306 314 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
307 315
308 316 ; Flag to control loading of legacy plugins in py:/path format
309 317 auth_plugin.import_legacy_plugins = true
310 318
311 319 ; alternative return HTTP header for failed authentication. Default HTTP
312 320 ; response is 401 HTTPUnauthorized. Currently HG clients have troubles with
313 321 ; handling that causing a series of failed authentication calls.
314 322 ; Set this variable to 403 to return HTTPForbidden, or any other HTTP code
315 323 ; This will be served instead of default 401 on bad authentication
316 324 auth_ret_code =
317 325
318 326 ; use special detection method when serving auth_ret_code, instead of serving
319 327 ; ret_code directly, use 401 initially (Which triggers credentials prompt)
320 328 ; and then serve auth_ret_code to clients
321 329 auth_ret_code_detection = false
322 330
323 331 ; locking return code. When repository is locked return this HTTP code. 2XX
324 332 ; codes don't break the transactions while 4XX codes do
325 333 lock_ret_code = 423
326 334
327 335 ; allows to change the repository location in settings page
328 336 allow_repo_location_change = true
329 337
330 338 ; allows to setup custom hooks in settings page
331 339 allow_custom_hooks_settings = true
332 340
333 341 ; Generated license token required for EE edition license.
334 342 ; New generated token value can be found in Admin > settings > license page.
335 343 license_token =
336 344
337 345 ; This flag hides sensitive information on the license page such as token, and license data
338 346 license.hide_license_info = false
339 347
340 348 ; supervisor connection uri, for managing supervisor and logs.
341 349 supervisor.uri =
342 350
343 351 ; supervisord group name/id we only want this RC instance to handle
344 352 supervisor.group_id = dev
345 353
346 354 ; Display extended labs settings
347 355 labs_settings_active = true
348 356
349 357 ; Custom exception store path, defaults to TMPDIR
350 358 ; This is used to store exception from RhodeCode in shared directory
351 359 #exception_tracker.store_path =
352 360
353 361 ; Send email with exception details when it happens
354 362 #exception_tracker.send_email = false
355 363
356 364 ; Comma separated list of recipients for exception emails,
357 365 ; e.g admin@rhodecode.com,devops@rhodecode.com
358 366 ; Can be left empty, then emails will be sent to ALL super-admins
359 367 #exception_tracker.send_email_recipients =
360 368
361 369 ; optional prefix to Add to email Subject
362 370 #exception_tracker.email_prefix = [RHODECODE ERROR]
363 371
364 372 ; File store configuration. This is used to store and serve uploaded files
365 373 file_store.enabled = true
366 374
367 375 ; Storage backend, available options are: local
368 376 file_store.backend = local
369 377
370 378 ; path to store the uploaded binaries
371 379 file_store.storage_path = %(here)s/data/file_store
372 380
373 381
374 382 ; #############
375 383 ; CELERY CONFIG
376 384 ; #############
377 385
378 386 ; manually run celery: /path/to/celery worker -E --beat --app rhodecode.lib.celerylib.loader --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler --loglevel DEBUG --ini /path/to/rhodecode.ini
379 387
380 388 use_celery = false
381 389
390 ; path to store schedule database
391 #celerybeat-schedule.path =
392
382 393 ; connection url to the message broker (default redis)
383 394 celery.broker_url = redis://localhost:6379/8
384 395
385 396 ; rabbitmq example
386 397 #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
387 398
388 399 ; maximum tasks to execute before worker restart
389 400 celery.max_tasks_per_child = 100
390 401
391 402 ; tasks will never be sent to the queue, but executed locally instead.
392 403 celery.task_always_eager = false
393 404
394 405 ; #############
395 406 ; DOGPILE CACHE
396 407 ; #############
397 408
398 409 ; Default cache dir for caches. Putting this into a ramdisk can boost performance.
399 410 ; eg. /tmpfs/data_ramdisk, however this directory might require large amount of space
400 411 cache_dir = %(here)s/data
401 412
402 413 ; *********************************************
403 414 ; `sql_cache_short` cache for heavy SQL queries
404 415 ; Only supported backend is `memory_lru`
405 416 ; *********************************************
406 417 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
407 418 rc_cache.sql_cache_short.expiration_time = 30
408 419
409 420
410 421 ; *****************************************************
411 422 ; `cache_repo_longterm` cache for repo object instances
412 423 ; Only supported backend is `memory_lru`
413 424 ; *****************************************************
414 425 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
415 426 ; by default we use 30 Days, cache is still invalidated on push
416 427 rc_cache.cache_repo_longterm.expiration_time = 2592000
417 428 ; max items in LRU cache, set to smaller number to save memory, and expire last used caches
418 429 rc_cache.cache_repo_longterm.max_size = 10000
419 430
420 431
421 432 ; *************************************************
422 433 ; `cache_perms` cache for permission tree, auth TTL
423 434 ; *************************************************
424 435 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
425 436 rc_cache.cache_perms.expiration_time = 300
426 437 ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set
427 438 #rc_cache.cache_perms.arguments.filename = /tmp/cache_perms.db
428 439
429 440 ; alternative `cache_perms` redis backend with distributed lock
430 441 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
431 442 #rc_cache.cache_perms.expiration_time = 300
432 443
433 444 ; redis_expiration_time needs to be greater then expiration_time
434 445 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
435 446
436 447 #rc_cache.cache_perms.arguments.host = localhost
437 448 #rc_cache.cache_perms.arguments.port = 6379
438 449 #rc_cache.cache_perms.arguments.db = 0
439 450 #rc_cache.cache_perms.arguments.socket_timeout = 30
440 451 ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
441 452 #rc_cache.cache_perms.arguments.distributed_lock = true
442 453
443 454 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
444 455 #rc_cache.cache_perms.arguments.lock_auto_renewal = true
445 456
446 457 ; ***************************************************
447 458 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
448 459 ; ***************************************************
449 460 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
450 461 rc_cache.cache_repo.expiration_time = 2592000
451 462 ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set
452 463 #rc_cache.cache_repo.arguments.filename = /tmp/cache_repo.db
453 464
454 465 ; alternative `cache_repo` redis backend with distributed lock
455 466 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
456 467 #rc_cache.cache_repo.expiration_time = 2592000
457 468
458 469 ; redis_expiration_time needs to be greater then expiration_time
459 470 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
460 471
461 472 #rc_cache.cache_repo.arguments.host = localhost
462 473 #rc_cache.cache_repo.arguments.port = 6379
463 474 #rc_cache.cache_repo.arguments.db = 1
464 475 #rc_cache.cache_repo.arguments.socket_timeout = 30
465 476 ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
466 477 #rc_cache.cache_repo.arguments.distributed_lock = true
467 478
468 479 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
469 480 #rc_cache.cache_repo.arguments.lock_auto_renewal = true
470 481
471 482 ; ##############
472 483 ; BEAKER SESSION
473 484 ; ##############
474 485
475 486 ; beaker.session.type is type of storage options for the logged users sessions. Current allowed
476 487 ; types are file, ext:redis, ext:database, ext:memcached, and memory (default if not specified).
477 488 ; Fastest ones are Redis and ext:database
478 489 beaker.session.type = file
479 490 beaker.session.data_dir = %(here)s/data/sessions
480 491
481 492 ; Redis based sessions
482 493 #beaker.session.type = ext:redis
483 494 #beaker.session.url = redis://127.0.0.1:6379/2
484 495
485 496 ; DB based session, fast, and allows easy management over logged in users
486 497 #beaker.session.type = ext:database
487 498 #beaker.session.table_name = db_session
488 499 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
489 500 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
490 501 #beaker.session.sa.pool_recycle = 3600
491 502 #beaker.session.sa.echo = false
492 503
493 504 beaker.session.key = rhodecode
494 505 beaker.session.secret = develop-rc-uytcxaz
495 506 beaker.session.lock_dir = %(here)s/data/sessions/lock
496 507
497 508 ; Secure encrypted cookie. Requires AES and AES python libraries
498 509 ; you must disable beaker.session.secret to use this
499 510 #beaker.session.encrypt_key = key_for_encryption
500 511 #beaker.session.validate_key = validation_key
501 512
502 513 ; Sets session as invalid (also logging out user) if it haven not been
503 514 ; accessed for given amount of time in seconds
504 515 beaker.session.timeout = 2592000
505 516 beaker.session.httponly = true
506 517
507 518 ; Path to use for the cookie. Set to prefix if you use prefix middleware
508 519 #beaker.session.cookie_path = /custom_prefix
509 520
510 521 ; Set https secure cookie
511 522 beaker.session.secure = false
512 523
513 524 ; default cookie expiration time in seconds, set to `true` to set expire
514 525 ; at browser close
515 526 #beaker.session.cookie_expires = 3600
516 527
517 528 ; #############################
518 529 ; SEARCH INDEXING CONFIGURATION
519 530 ; #############################
520 531
521 532 ; Full text search indexer is available in rhodecode-tools under
522 533 ; `rhodecode-tools index` command
523 534
524 535 ; WHOOSH Backend, doesn't require additional services to run
525 536 ; it works good with few dozen repos
526 537 search.module = rhodecode.lib.index.whoosh
527 538 search.location = %(here)s/data/index
528 539
529 540 ; ####################
530 541 ; CHANNELSTREAM CONFIG
531 542 ; ####################
532 543
533 544 ; channelstream enables persistent connections and live notification
534 545 ; in the system. It's also used by the chat system
535 546
536 547 channelstream.enabled = false
537 548
538 549 ; server address for channelstream server on the backend
539 550 channelstream.server = 127.0.0.1:9800
540 551
541 552 ; location of the channelstream server from outside world
542 553 ; use ws:// for http or wss:// for https. This address needs to be handled
543 554 ; by external HTTP server such as Nginx or Apache
544 555 ; see Nginx/Apache configuration examples in our docs
545 556 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
546 557 channelstream.secret = secret
547 558 channelstream.history.location = %(here)s/channelstream_history
548 559
549 560 ; Internal application path that Javascript uses to connect into.
550 561 ; If you use proxy-prefix the prefix should be added before /_channelstream
551 562 channelstream.proxy_path = /_channelstream
552 563
553 564
554 565 ; ##############################
555 566 ; MAIN RHODECODE DATABASE CONFIG
556 567 ; ##############################
557 568
558 569 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
559 570 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
560 571 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
561 572 ; pymysql is an alternative driver for MySQL, use in case of problems with default one
562 573 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
563 574
564 575 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
565 576
566 577 ; see sqlalchemy docs for other advanced settings
567 578 ; print the sql statements to output
568 579 sqlalchemy.db1.echo = false
569 580
570 581 ; recycle the connections after this amount of seconds
571 582 sqlalchemy.db1.pool_recycle = 3600
572 583 sqlalchemy.db1.convert_unicode = true
573 584
574 585 ; the number of connections to keep open inside the connection pool.
575 586 ; 0 indicates no limit
576 587 #sqlalchemy.db1.pool_size = 5
577 588
578 589 ; The number of connections to allow in connection pool "overflow", that is
579 590 ; connections that can be opened above and beyond the pool_size setting,
580 591 ; which defaults to five.
581 592 #sqlalchemy.db1.max_overflow = 10
582 593
583 594 ; Connection check ping, used to detect broken database connections
584 595 ; could be enabled to better handle cases if MySQL has gone away errors
585 596 #sqlalchemy.db1.ping_connection = true
586 597
587 598 ; ##########
588 599 ; VCS CONFIG
589 600 ; ##########
590 601 vcs.server.enable = true
591 602 vcs.server = localhost:9900
592 603
593 604 ; Web server connectivity protocol, responsible for web based VCS operations
594 605 ; Available protocols are:
595 606 ; `http` - use http-rpc backend (default)
596 607 vcs.server.protocol = http
597 608
598 609 ; Push/Pull operations protocol, available options are:
599 610 ; `http` - use http-rpc backend (default)
600 611 vcs.scm_app_implementation = http
601 612
602 613 ; Push/Pull operations hooks protocol, available options are:
603 614 ; `http` - use http-rpc backend (default)
604 615 vcs.hooks.protocol = http
605 616
606 617 ; Host on which this instance is listening for hooks. If vcsserver is in other location
607 618 ; this should be adjusted.
608 619 vcs.hooks.host = 127.0.0.1
609 620
610 621 ; Start VCSServer with this instance as a subprocess, useful for development
611 622 vcs.start_server = false
612 623
613 624 ; List of enabled VCS backends, available options are:
614 625 ; `hg` - mercurial
615 626 ; `git` - git
616 627 ; `svn` - subversion
617 628 vcs.backends = hg, git, svn
618 629
619 630 ; Wait this number of seconds before killing connection to the vcsserver
620 631 vcs.connection_timeout = 3600
621 632
622 633 ; Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
623 634 ; Set a numeric version for your current SVN e.g 1.8, or 1.12
624 635 ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
625 636 #vcs.svn.compatible_version = 1.8
626 637
638 ; Cache flag to cache vcsserver remote calls locally
639 ; It uses cache_region `cache_repo`
640 vcs.methods.cache = true
627 641
628 642 ; ####################################################
629 643 ; Subversion proxy support (mod_dav_svn)
630 644 ; Maps RhodeCode repo groups into SVN paths for Apache
631 645 ; ####################################################
632 646
633 647 ; Enable or disable the config file generation.
634 648 svn.proxy.generate_config = false
635 649
636 650 ; Generate config file with `SVNListParentPath` set to `On`.
637 651 svn.proxy.list_parent_path = true
638 652
639 653 ; Set location and file name of generated config file.
640 654 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
641 655
642 656 ; alternative mod_dav config template. This needs to be a valid mako template
643 657 ; Example template can be found in the source code:
644 658 ; rhodecode/apps/svn_support/templates/mod-dav-svn.conf.mako
645 659 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
646 660
647 661 ; Used as a prefix to the `Location` block in the generated config file.
648 662 ; In most cases it should be set to `/`.
649 663 svn.proxy.location_root = /
650 664
651 665 ; Command to reload the mod dav svn configuration on change.
652 666 ; Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
653 667 ; Make sure user who runs RhodeCode process is allowed to reload Apache
654 668 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
655 669
656 670 ; If the timeout expires before the reload command finishes, the command will
657 671 ; be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
658 672 #svn.proxy.reload_timeout = 10
659 673
660 674 ; ####################
661 675 ; SSH Support Settings
662 676 ; ####################
663 677
664 678 ; Defines if a custom authorized_keys file should be created and written on
665 679 ; any change user ssh keys. Setting this to false also disables possibility
666 680 ; of adding SSH keys by users from web interface. Super admins can still
667 681 ; manage SSH Keys.
668 682 ssh.generate_authorized_keyfile = false
669 683
670 684 ; Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
671 685 # ssh.authorized_keys_ssh_opts =
672 686
673 687 ; Path to the authorized_keys file where the generate entries are placed.
674 688 ; It is possible to have multiple key files specified in `sshd_config` e.g.
675 689 ; AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
676 690 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
677 691
678 692 ; Command to execute the SSH wrapper. The binary is available in the
679 693 ; RhodeCode installation directory.
680 694 ; e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
681 695 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
682 696
683 697 ; Allow shell when executing the ssh-wrapper command
684 698 ssh.wrapper_cmd_allow_shell = false
685 699
686 700 ; Enables logging, and detailed output send back to the client during SSH
687 701 ; operations. Useful for debugging, shouldn't be used in production.
688 702 ssh.enable_debug_logging = true
689 703
690 704 ; Paths to binary executable, by default they are the names, but we can
691 705 ; override them if we want to use a custom one
692 706 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
693 707 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
694 708 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
695 709
696 710 ; Enables SSH key generator web interface. Disabling this still allows users
697 711 ; to add their own keys.
698 712 ssh.enable_ui_key_generator = true
699 713
700 714
701 715 ; #################
702 716 ; APPENLIGHT CONFIG
703 717 ; #################
704 718
705 719 ; Appenlight is tailored to work with RhodeCode, see
706 720 ; http://appenlight.rhodecode.com for details how to obtain an account
707 721
708 722 ; Appenlight integration enabled
709 appenlight = false
723 #appenlight = false
710 724
711 appenlight.server_url = https://api.appenlight.com
712 appenlight.api_key = YOUR_API_KEY
725 #appenlight.server_url = https://api.appenlight.com
726 #appenlight.api_key = YOUR_API_KEY
713 727 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
714 728
715 729 ; used for JS client
716 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
730 #appenlight.api_public_key = YOUR_API_PUBLIC_KEY
717 731
718 732 ; TWEAK AMOUNT OF INFO SENT HERE
719 733
720 734 ; enables 404 error logging (default False)
721 appenlight.report_404 = false
735 #appenlight.report_404 = false
722 736
723 737 ; time in seconds after request is considered being slow (default 1)
724 appenlight.slow_request_time = 1
738 #appenlight.slow_request_time = 1
725 739
726 740 ; record slow requests in application
727 741 ; (needs to be enabled for slow datastore recording and time tracking)
728 appenlight.slow_requests = true
742 #appenlight.slow_requests = true
729 743
730 744 ; enable hooking to application loggers
731 appenlight.logging = true
745 #appenlight.logging = true
732 746
733 747 ; minimum log level for log capture
734 appenlight.logging.level = WARNING
748 #ppenlight.logging.level = WARNING
735 749
736 750 ; send logs only from erroneous/slow requests
737 751 ; (saves API quota for intensive logging)
738 appenlight.logging_on_error = false
752 #appenlight.logging_on_error = false
739 753
740 754 ; list of additional keywords that should be grabbed from environ object
741 755 ; can be string with comma separated list of words in lowercase
742 756 ; (by default client will always send following info:
743 757 ; 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
744 758 ; start with HTTP* this list be extended with additional keywords here
745 appenlight.environ_keys_whitelist =
759 #appenlight.environ_keys_whitelist =
746 760
747 761 ; list of keywords that should be blanked from request object
748 762 ; can be string with comma separated list of words in lowercase
749 763 ; (by default client will always blank keys that contain following words
750 764 ; 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
751 765 ; this list be extended with additional keywords set here
752 appenlight.request_keys_blacklist =
766 #appenlight.request_keys_blacklist =
753 767
754 768 ; list of namespaces that should be ignores when gathering log entries
755 769 ; can be string with comma separated list of namespaces
756 770 ; (by default the client ignores own entries: appenlight_client.client)
757 appenlight.log_namespace_blacklist =
771 #appenlight.log_namespace_blacklist =
758 772
759 773 ; Statsd client config, this is used to send metrics to statsd
760 774 ; We recommend setting statsd_exported and scrape them using Promethues
761 775 #statsd.enabled = false
762 776 #statsd.statsd_host = 0.0.0.0
763 777 #statsd.statsd_port = 8125
764 778 #statsd.statsd_prefix =
765 779 #statsd.statsd_ipv6 = false
766 780
781 ; configure logging automatically at server startup set to false
782 ; to use the below custom logging config.
783 ; RC_LOGGING_FORMATTER
784 ; RC_LOGGING_LEVEL
785 ; env variables can control the settings for logging in case of autoconfigure
786
787 #logging.autoconfigure = true
788
789 ; specify your own custom logging config file to configure logging
790 #logging.logging_conf_file = /path/to/custom_logging.ini
767 791
768 792 ; Dummy marker to add new entries after.
769 793 ; Add any custom entries below. Please don't remove this marker.
770 794 custom.conf = 1
771 795
772 796
773 797 ; #####################
774 798 ; LOGGING CONFIGURATION
775 799 ; #####################
800
776 801 [loggers]
777 802 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
778 803
779 804 [handlers]
780 805 keys = console, console_sql
781 806
782 807 [formatters]
783 keys = generic, color_formatter, color_formatter_sql
808 keys = generic, json, color_formatter, color_formatter_sql
784 809
785 810 ; #######
786 811 ; LOGGERS
787 812 ; #######
788 813 [logger_root]
789 814 level = NOTSET
790 815 handlers = console
791 816
792 817 [logger_sqlalchemy]
793 818 level = INFO
794 819 handlers = console_sql
795 820 qualname = sqlalchemy.engine
796 821 propagate = 0
797 822
798 823 [logger_beaker]
799 824 level = DEBUG
800 825 handlers =
801 826 qualname = beaker.container
802 827 propagate = 1
803 828
804 829 [logger_rhodecode]
805 830 level = DEBUG
806 831 handlers =
807 832 qualname = rhodecode
808 833 propagate = 1
809 834
810 835 [logger_ssh_wrapper]
811 836 level = DEBUG
812 837 handlers =
813 838 qualname = ssh_wrapper
814 839 propagate = 1
815 840
816 841 [logger_celery]
817 842 level = DEBUG
818 843 handlers =
819 844 qualname = celery
820 845
821 846
822 847 ; ########
823 848 ; HANDLERS
824 849 ; ########
825 850
826 851 [handler_console]
827 852 class = StreamHandler
828 853 args = (sys.stderr, )
829 854 level = DEBUG
830 855 formatter = color_formatter
831 856 ; To enable JSON formatted logs replace generic with json
832 857 ; This allows sending properly formatted logs to grafana loki or elasticsearch
833 858 #formatter = json
834 859
835 860 [handler_console_sql]
836 861 ; "level = DEBUG" logs SQL queries and results.
837 862 ; "level = INFO" logs SQL queries.
838 863 ; "level = WARN" logs neither. (Recommended for production systems.)
839 864 class = StreamHandler
840 865 args = (sys.stderr, )
841 866 level = WARN
842 867 formatter = color_formatter_sql
843 868
844 869 ; ##########
845 870 ; FORMATTERS
846 871 ; ##########
847 872
848 873 [formatter_generic]
849 874 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
850 875 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
851 876 datefmt = %Y-%m-%d %H:%M:%S
852 877
853 878 [formatter_color_formatter]
854 879 class = rhodecode.lib.logging_formatter.ColorFormatter
855 880 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
856 881 datefmt = %Y-%m-%d %H:%M:%S
857 882
858 883 [formatter_color_formatter_sql]
859 884 class = rhodecode.lib.logging_formatter.ColorFormatterSql
860 885 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
861 886 datefmt = %Y-%m-%d %H:%M:%S
862 887
863 888 [formatter_json]
864 format = %(message)s
865 class = rhodecode.lib._vendor.jsonlogger.JsonFormatter No newline at end of file
889 format = %(timestamp)s %(levelname)s %(name)s %(message)s %(req_id)s
890 class = rhodecode.lib._vendor.jsonlogger.JsonFormatter
@@ -1,272 +1,274 b''
1 1 """
2 2 Gunicorn config extension and hooks. This config file adds some extra settings and memory management.
3 3 Gunicorn configuration should be managed by .ini files entries of RhodeCode or VCSServer
4 4 """
5 5
6 6 import gc
7 7 import os
8 8 import sys
9 9 import math
10 10 import time
11 11 import threading
12 12 import traceback
13 13 import random
14 14 from gunicorn.glogging import Logger
15 15
16 16
17 17 def get_workers():
18 18 import multiprocessing
19 19 return multiprocessing.cpu_count() * 2 + 1
20 20
21 21 # GLOBAL
22 22 errorlog = '-'
23 23 accesslog = '-'
24 24
25 25
26 26 # SERVER MECHANICS
27 27 # None == system temp dir
28 28 # worker_tmp_dir is recommended to be set to some tmpfs
29 29 worker_tmp_dir = None
30 30 tmp_upload_dir = None
31 31
32 #reuse_port = True
33
32 34 # Custom log format
33 35 #access_log_format = (
34 36 # '%(t)s %(p)s INFO [GNCRN] %(h)-15s rqt:%(L)s %(s)s %(b)-6s "%(m)s:%(U)s %(q)s" usr:%(u)s "%(f)s" "%(a)s"')
35 37
36 38 # loki format for easier parsing in grafana
37 39 access_log_format = (
38 40 'time="%(t)s" pid=%(p)s level="INFO" type="[GNCRN]" ip="%(h)-15s" rqt="%(L)s" response_code="%(s)s" response_bytes="%(b)-6s" uri="%(m)s:%(U)s %(q)s" user=":%(u)s" user_agent="%(a)s"')
39 41
40 42 # self adjust workers based on CPU count
41 43 # workers = get_workers()
42 44
43 45
44 46 def _get_process_rss(pid=None):
45 47 try:
46 48 import psutil
47 49 if pid:
48 50 proc = psutil.Process(pid)
49 51 else:
50 52 proc = psutil.Process()
51 53 return proc.memory_info().rss
52 54 except Exception:
53 55 return None
54 56
55 57
56 58 def _get_config(ini_path):
57 59
58 60 try:
59 61 import configparser
60 62 except ImportError:
61 63 import ConfigParser as configparser
62 64 try:
63 65 config = configparser.RawConfigParser()
64 66 config.read(ini_path)
65 67 return config
66 68 except Exception:
67 69 return None
68 70
69 71
70 72 def _time_with_offset(memory_usage_check_interval):
71 73 return time.time() - random.randint(0, memory_usage_check_interval/2.0)
72 74
73 75
74 76 def pre_fork(server, worker):
75 77 pass
76 78
77 79
78 80 def post_fork(server, worker):
79 81
80 82 # memory spec defaults
81 83 _memory_max_usage = 0
82 84 _memory_usage_check_interval = 60
83 85 _memory_usage_recovery_threshold = 0.8
84 86
85 87 ini_path = os.path.abspath(server.cfg.paste)
86 88 conf = _get_config(ini_path)
87 89
88 90 section = 'server:main'
89 91 if conf and conf.has_section(section):
90 92
91 93 if conf.has_option(section, 'memory_max_usage'):
92 94 _memory_max_usage = conf.getint(section, 'memory_max_usage')
93 95
94 96 if conf.has_option(section, 'memory_usage_check_interval'):
95 97 _memory_usage_check_interval = conf.getint(section, 'memory_usage_check_interval')
96 98
97 99 if conf.has_option(section, 'memory_usage_recovery_threshold'):
98 100 _memory_usage_recovery_threshold = conf.getfloat(section, 'memory_usage_recovery_threshold')
99 101
100 102 worker._memory_max_usage = int(os.environ.get('RC_GUNICORN_MEMORY_MAX_USAGE', '')
101 103 or _memory_max_usage)
102 104 worker._memory_usage_check_interval = int(os.environ.get('RC_GUNICORN_MEMORY_USAGE_CHECK_INTERVAL', '')
103 105 or _memory_usage_check_interval)
104 106 worker._memory_usage_recovery_threshold = float(os.environ.get('RC_GUNICORN_MEMORY_USAGE_RECOVERY_THRESHOLD', '')
105 107 or _memory_usage_recovery_threshold)
106 108
107 109 # register memory last check time, with some random offset so we don't recycle all
108 110 # at once
109 111 worker._last_memory_check_time = _time_with_offset(_memory_usage_check_interval)
110 112
111 113 if _memory_max_usage:
112 114 server.log.info("[%-10s] WORKER spawned with max memory set at %s", worker.pid,
113 115 _format_data_size(_memory_max_usage))
114 116 else:
115 117 server.log.info("[%-10s] WORKER spawned", worker.pid)
116 118
117 119
118 120 def pre_exec(server):
119 121 server.log.info("Forked child, re-executing.")
120 122
121 123
122 124 def on_starting(server):
123 125 server_lbl = '{} {}'.format(server.proc_name, server.address)
124 126 server.log.info("Server %s is starting.", server_lbl)
125 127
126 128
127 129 def when_ready(server):
128 130 server.log.info("Server %s is ready. Spawning workers", server)
129 131
130 132
131 133 def on_reload(server):
132 134 pass
133 135
134 136
135 137 def _format_data_size(size, unit="B", precision=1, binary=True):
136 138 """Format a number using SI units (kilo, mega, etc.).
137 139
138 140 ``size``: The number as a float or int.
139 141
140 142 ``unit``: The unit name in plural form. Examples: "bytes", "B".
141 143
142 144 ``precision``: How many digits to the right of the decimal point. Default
143 145 is 1. 0 suppresses the decimal point.
144 146
145 147 ``binary``: If false, use base-10 decimal prefixes (kilo = K = 1000).
146 148 If true, use base-2 binary prefixes (kibi = Ki = 1024).
147 149
148 150 ``full_name``: If false (default), use the prefix abbreviation ("k" or
149 151 "Ki"). If true, use the full prefix ("kilo" or "kibi"). If false,
150 152 use abbreviation ("k" or "Ki").
151 153
152 154 """
153 155
154 156 if not binary:
155 157 base = 1000
156 158 multiples = ('', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
157 159 else:
158 160 base = 1024
159 161 multiples = ('', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi')
160 162
161 163 sign = ""
162 164 if size > 0:
163 165 m = int(math.log(size, base))
164 166 elif size < 0:
165 167 sign = "-"
166 168 size = -size
167 169 m = int(math.log(size, base))
168 170 else:
169 171 m = 0
170 172 if m > 8:
171 173 m = 8
172 174
173 175 if m == 0:
174 176 precision = '%.0f'
175 177 else:
176 178 precision = '%%.%df' % precision
177 179
178 180 size = precision % (size / math.pow(base, m))
179 181
180 182 return '%s%s %s%s' % (sign, size.strip(), multiples[m], unit)
181 183
182 184
183 185 def _check_memory_usage(worker):
184 186 memory_max_usage = worker._memory_max_usage
185 187 if not memory_max_usage:
186 188 return
187 189
188 190 memory_usage_check_interval = worker._memory_usage_check_interval
189 191 memory_usage_recovery_threshold = memory_max_usage * worker._memory_usage_recovery_threshold
190 192
191 193 elapsed = time.time() - worker._last_memory_check_time
192 194 if elapsed > memory_usage_check_interval:
193 195 mem_usage = _get_process_rss()
194 196 if mem_usage and mem_usage > memory_max_usage:
195 197 worker.log.info(
196 198 "memory usage %s > %s, forcing gc",
197 199 _format_data_size(mem_usage), _format_data_size(memory_max_usage))
198 200 # Try to clean it up by forcing a full collection.
199 201 gc.collect()
200 202 mem_usage = _get_process_rss()
201 203 if mem_usage > memory_usage_recovery_threshold:
202 204 # Didn't clean up enough, we'll have to terminate.
203 205 worker.log.warning(
204 206 "memory usage %s > %s after gc, quitting",
205 207 _format_data_size(mem_usage), _format_data_size(memory_max_usage))
206 208 # This will cause worker to auto-restart itself
207 209 worker.alive = False
208 210 worker._last_memory_check_time = time.time()
209 211
210 212
211 213 def worker_int(worker):
212 214 worker.log.info("[%-10s] worker received INT or QUIT signal", worker.pid)
213 215
214 216 # get traceback info, on worker crash
215 217 id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
216 218 code = []
217 219 for thread_id, stack in sys._current_frames().items():
218 220 code.append(
219 221 "\n# Thread: %s(%d)" % (id2name.get(thread_id, ""), thread_id))
220 222 for fname, lineno, name, line in traceback.extract_stack(stack):
221 223 code.append('File: "%s", line %d, in %s' % (fname, lineno, name))
222 224 if line:
223 225 code.append(" %s" % (line.strip()))
224 226 worker.log.debug("\n".join(code))
225 227
226 228
227 229 def worker_abort(worker):
228 230 worker.log.info("[%-10s] worker received SIGABRT signal", worker.pid)
229 231
230 232
231 233 def worker_exit(server, worker):
232 234 worker.log.info("[%-10s] worker exit", worker.pid)
233 235
234 236
235 237 def child_exit(server, worker):
236 238 worker.log.info("[%-10s] worker child exit", worker.pid)
237 239
238 240
239 241 def pre_request(worker, req):
240 242 worker.start_time = time.time()
241 243 worker.log.debug(
242 244 "GNCRN PRE WORKER [cnt:%s]: %s %s", worker.nr, req.method, req.path)
243 245
244 246
245 247 def post_request(worker, req, environ, resp):
246 248 total_time = time.time() - worker.start_time
247 249 # Gunicorn sometimes has problems with reading the status_code
248 250 status_code = getattr(resp, 'status_code', '')
249 251 worker.log.debug(
250 252 "GNCRN POST WORKER [cnt:%s]: %s %s resp: %s, Load Time: %.4fs",
251 253 worker.nr, req.method, req.path, status_code, total_time)
252 254 _check_memory_usage(worker)
253 255
254 256
255 257 class RhodeCodeLogger(Logger):
256 258 """
257 259 Custom Logger that allows some customization that gunicorn doesn't allow
258 260 """
259 261
260 262 datefmt = r"%Y-%m-%d %H:%M:%S"
261 263
262 264 def __init__(self, cfg):
263 265 Logger.__init__(self, cfg)
264 266
265 267 def now(self):
266 268 """ return date in RhodeCode Log format """
267 269 now = time.time()
268 270 msecs = int((now - long(now)) * 1000)
269 271 return time.strftime(self.datefmt, time.localtime(now)) + '.{0:03d}'.format(msecs)
270 272
271 273
272 274 logger_class = RhodeCodeLogger
@@ -1,825 +1,841 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 3 ; #########################################
4 4 ; RHODECODE COMMUNITY EDITION CONFIGURATION
5 5 ; #########################################
6 6
7 7 [DEFAULT]
8 8 ; Debug flag sets all loggers to debug, and enables request tracking
9 9 debug = false
10 10
11 11 ; ########################################################################
12 12 ; EMAIL CONFIGURATION
13 13 ; These settings will be used by the RhodeCode mailing system
14 14 ; ########################################################################
15 15
16 16 ; prefix all emails subjects with given prefix, helps filtering out emails
17 17 #email_prefix = [RhodeCode]
18 18
19 19 ; email FROM address all mails will be sent
20 20 #app_email_from = rhodecode-noreply@localhost
21 21
22 22 #smtp_server = mail.server.com
23 23 #smtp_username =
24 24 #smtp_password =
25 25 #smtp_port =
26 26 #smtp_use_tls = false
27 27 #smtp_use_ssl = true
28 28
29 29 [server:main]
30 30 ; COMMON HOST/IP CONFIG
31 31 host = 127.0.0.1
32 32 port = 5000
33 33
34 34
35 35 ; ###########################
36 36 ; GUNICORN APPLICATION SERVER
37 37 ; ###########################
38 38
39 ; run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
39 ; run with gunicorn --paste rhodecode.ini
40 40
41 41 ; Module to use, this setting shouldn't be changed
42 42 use = egg:gunicorn#main
43 43
44 44 ; Sets the number of process workers. More workers means more concurrent connections
45 45 ; RhodeCode can handle at the same time. Each additional worker also it increases
46 46 ; memory usage as each has it's own set of caches.
47 47 ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
48 48 ; than 8-10 unless for really big deployments .e.g 700-1000 users.
49 49 ; `instance_id = *` must be set in the [app:main] section below (which is the default)
50 50 ; when using more than 1 worker.
51 51 workers = 2
52 52
53 53 ; Gunicorn access log level
54 54 loglevel = info
55 55
56 56 ; Process name visible in process list
57 57 proc_name = rhodecode
58 58
59 59 ; Type of worker class, one of `sync`, `gevent`
60 60 ; Recommended type is `gevent`
61 61 worker_class = gevent
62 62
63 63 ; The maximum number of simultaneous clients per worker. Valid only for gevent
64 64 worker_connections = 10
65 65
66 66 ; Max number of requests that worker will handle before being gracefully restarted.
67 67 ; Prevents memory leaks, jitter adds variability so not all workers are restarted at once.
68 68 max_requests = 1000
69 69 max_requests_jitter = 30
70 70
71 71 ; Amount of time a worker can spend with handling a request before it
72 72 ; gets killed and restarted. By default set to 21600 (6hrs)
73 73 ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
74 74 timeout = 21600
75 75
76 76 ; The maximum size of HTTP request line in bytes.
77 77 ; 0 for unlimited
78 78 limit_request_line = 0
79 79
80 80 ; Limit the number of HTTP headers fields in a request.
81 81 ; By default this value is 100 and can't be larger than 32768.
82 82 limit_request_fields = 32768
83 83
84 84 ; Limit the allowed size of an HTTP request header field.
85 85 ; Value is a positive number or 0.
86 86 ; Setting it to 0 will allow unlimited header field sizes.
87 87 limit_request_field_size = 0
88 88
89 89 ; Timeout for graceful workers restart.
90 90 ; After receiving a restart signal, workers have this much time to finish
91 91 ; serving requests. Workers still alive after the timeout (starting from the
92 92 ; receipt of the restart signal) are force killed.
93 93 ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
94 94 graceful_timeout = 3600
95 95
96 96 # The number of seconds to wait for requests on a Keep-Alive connection.
97 97 # Generally set in the 1-5 seconds range.
98 98 keepalive = 2
99 99
100 100 ; Maximum memory usage that each worker can use before it will receive a
101 101 ; graceful restart signal 0 = memory monitoring is disabled
102 102 ; Examples: 268435456 (256MB), 536870912 (512MB)
103 103 ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB)
104 104 memory_max_usage = 0
105 105
106 106 ; How often in seconds to check for memory usage for each gunicorn worker
107 107 memory_usage_check_interval = 60
108 108
109 109 ; Threshold value for which we don't recycle worker if GarbageCollection
110 110 ; frees up enough resources. Before each restart we try to run GC on worker
111 111 ; in case we get enough free memory after that, restart will not happen.
112 112 memory_usage_recovery_threshold = 0.8
113 113
114 114
115 115 ; Prefix middleware for RhodeCode.
116 116 ; recommended when using proxy setup.
117 117 ; allows to set RhodeCode under a prefix in server.
118 118 ; eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
119 119 ; And set your prefix like: `prefix = /custom_prefix`
120 120 ; be sure to also set beaker.session.cookie_path = /custom_prefix if you need
121 121 ; to make your cookies only work on prefix url
122 122 [filter:proxy-prefix]
123 123 use = egg:PasteDeploy#prefix
124 124 prefix = /
125 125
126 126 [app:main]
127 ; The %(here)s variable will be replaced with the absolute path of parent directory
128 ; of this file
129 ; Each option in the app:main can be override by an environmental variable
130 ;
131 ;To override an option:
132 ;
133 ;RC_<KeyName>
134 ;Everything should be uppercase, . and - should be replaced by _.
135 ;For example, if you have these configuration settings:
136 ;rc_cache.repo_object.backend = foo
137 ;can be overridden by
138 ;export RC_CACHE_REPO_OBJECT_BACKEND=foo
127 139
128 140 use = egg:rhodecode-enterprise-ce
129 141
130 142 ; enable proxy prefix middleware, defined above
131 143 #filter-with = proxy-prefix
132 144
133 145 ; encryption key used to encrypt social plugin tokens,
134 146 ; remote_urls with credentials etc, if not set it defaults to
135 147 ; `beaker.session.secret`
136 148 #rhodecode.encrypted_values.secret =
137 149
138 150 ; decryption strict mode (enabled by default). It controls if decryption raises
139 151 ; `SignatureVerificationError` in case of wrong key, or damaged encryption data.
140 152 #rhodecode.encrypted_values.strict = false
141 153
142 154 ; Pick algorithm for encryption. Either fernet (more secure) or aes (default)
143 155 ; fernet is safer, and we strongly recommend switching to it.
144 156 ; Due to backward compatibility aes is used as default.
145 157 #rhodecode.encrypted_values.algorithm = fernet
146 158
147 159 ; Return gzipped responses from RhodeCode (static files/application)
148 160 gzip_responses = false
149 161
150 162 ; Auto-generate javascript routes file on startup
151 163 generate_js_files = false
152 164
153 165 ; System global default language.
154 166 ; All available languages: en (default), be, de, es, fr, it, ja, pl, pt, ru, zh
155 167 lang = en
156 168
157 169 ; Perform a full repository scan and import on each server start.
158 170 ; Settings this to true could lead to very long startup time.
159 171 startup.import_repos = false
160 172
161 173 ; Uncomment and set this path to use archive download cache.
162 174 ; Once enabled, generated archives will be cached at this location
163 175 ; and served from the cache during subsequent requests for the same archive of
164 176 ; the repository.
165 177 #archive_cache_dir = /tmp/tarballcache
166 178
167 179 ; URL at which the application is running. This is used for Bootstrapping
168 180 ; requests in context when no web request is available. Used in ishell, or
169 181 ; SSH calls. Set this for events to receive proper url for SSH calls.
170 182 app.base_url = http://rhodecode.local
171 183
172 184 ; Unique application ID. Should be a random unique string for security.
173 185 app_instance_uuid = rc-production
174 186
175 187 ; Cut off limit for large diffs (size in bytes). If overall diff size on
176 188 ; commit, or pull request exceeds this limit this diff will be displayed
177 189 ; partially. E.g 512000 == 512Kb
178 190 cut_off_limit_diff = 512000
179 191
180 192 ; Cut off limit for large files inside diffs (size in bytes). Each individual
181 193 ; file inside diff which exceeds this limit will be displayed partially.
182 194 ; E.g 128000 == 128Kb
183 195 cut_off_limit_file = 128000
184 196
185 197 ; Use cached version of vcs repositories everywhere. Recommended to be `true`
186 198 vcs_full_cache = true
187 199
188 200 ; Force https in RhodeCode, fixes https redirects, assumes it's always https.
189 201 ; Normally this is controlled by proper flags sent from http server such as Nginx or Apache
190 202 force_https = false
191 203
192 204 ; use Strict-Transport-Security headers
193 205 use_htsts = false
194 206
195 207 ; Set to true if your repos are exposed using the dumb protocol
196 208 git_update_server_info = false
197 209
198 210 ; RSS/ATOM feed options
199 211 rss_cut_off_limit = 256000
200 212 rss_items_per_page = 10
201 213 rss_include_diff = false
202 214
203 215 ; gist URL alias, used to create nicer urls for gist. This should be an
204 216 ; url that does rewrites to _admin/gists/{gistid}.
205 217 ; example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
206 218 ; RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
207 219 gist_alias_url =
208 220
209 221 ; List of views (using glob pattern syntax) that AUTH TOKENS could be
210 222 ; used for access.
211 223 ; Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
212 224 ; came from the the logged in user who own this authentication token.
213 225 ; Additionally @TOKEN syntax can be used to bound the view to specific
214 226 ; authentication token. Such view would be only accessible when used together
215 227 ; with this authentication token
216 228 ; list of all views can be found under `/_admin/permissions/auth_token_access`
217 229 ; The list should be "," separated and on a single line.
218 230 ; Most common views to enable:
219 231
220 232 # RepoCommitsView:repo_commit_download
221 233 # RepoCommitsView:repo_commit_patch
222 234 # RepoCommitsView:repo_commit_raw
223 235 # RepoCommitsView:repo_commit_raw@TOKEN
224 236 # RepoFilesView:repo_files_diff
225 237 # RepoFilesView:repo_archivefile
226 238 # RepoFilesView:repo_file_raw
227 239 # GistView:*
228 240 api_access_controllers_whitelist =
229 241
230 242 ; Default encoding used to convert from and to unicode
231 243 ; can be also a comma separated list of encoding in case of mixed encodings
232 244 default_encoding = UTF-8
233 245
234 246 ; instance-id prefix
235 247 ; a prefix key for this instance used for cache invalidation when running
236 248 ; multiple instances of RhodeCode, make sure it's globally unique for
237 249 ; all running RhodeCode instances. Leave empty if you don't use it
238 250 instance_id =
239 251
240 252 ; Fallback authentication plugin. Set this to a plugin ID to force the usage
241 253 ; of an authentication plugin also if it is disabled by it's settings.
242 254 ; This could be useful if you are unable to log in to the system due to broken
243 255 ; authentication settings. Then you can enable e.g. the internal RhodeCode auth
244 256 ; module to log in again and fix the settings.
245 257 ; Available builtin plugin IDs (hash is part of the ID):
246 258 ; egg:rhodecode-enterprise-ce#rhodecode
247 259 ; egg:rhodecode-enterprise-ce#pam
248 260 ; egg:rhodecode-enterprise-ce#ldap
249 261 ; egg:rhodecode-enterprise-ce#jasig_cas
250 262 ; egg:rhodecode-enterprise-ce#headers
251 263 ; egg:rhodecode-enterprise-ce#crowd
252 264
253 265 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
254 266
255 267 ; Flag to control loading of legacy plugins in py:/path format
256 268 auth_plugin.import_legacy_plugins = true
257 269
258 270 ; alternative return HTTP header for failed authentication. Default HTTP
259 271 ; response is 401 HTTPUnauthorized. Currently HG clients have troubles with
260 272 ; handling that causing a series of failed authentication calls.
261 273 ; Set this variable to 403 to return HTTPForbidden, or any other HTTP code
262 274 ; This will be served instead of default 401 on bad authentication
263 275 auth_ret_code =
264 276
265 277 ; use special detection method when serving auth_ret_code, instead of serving
266 278 ; ret_code directly, use 401 initially (Which triggers credentials prompt)
267 279 ; and then serve auth_ret_code to clients
268 280 auth_ret_code_detection = false
269 281
270 282 ; locking return code. When repository is locked return this HTTP code. 2XX
271 283 ; codes don't break the transactions while 4XX codes do
272 284 lock_ret_code = 423
273 285
274 286 ; allows to change the repository location in settings page
275 287 allow_repo_location_change = true
276 288
277 289 ; allows to setup custom hooks in settings page
278 290 allow_custom_hooks_settings = true
279 291
280 292 ; Generated license token required for EE edition license.
281 293 ; New generated token value can be found in Admin > settings > license page.
282 294 license_token =
283 295
284 296 ; This flag hides sensitive information on the license page such as token, and license data
285 297 license.hide_license_info = false
286 298
287 299 ; supervisor connection uri, for managing supervisor and logs.
288 300 supervisor.uri =
289 301
290 302 ; supervisord group name/id we only want this RC instance to handle
291 303 supervisor.group_id = prod
292 304
293 305 ; Display extended labs settings
294 306 labs_settings_active = true
295 307
296 308 ; Custom exception store path, defaults to TMPDIR
297 309 ; This is used to store exception from RhodeCode in shared directory
298 310 #exception_tracker.store_path =
299 311
300 312 ; Send email with exception details when it happens
301 313 #exception_tracker.send_email = false
302 314
303 315 ; Comma separated list of recipients for exception emails,
304 316 ; e.g admin@rhodecode.com,devops@rhodecode.com
305 317 ; Can be left empty, then emails will be sent to ALL super-admins
306 318 #exception_tracker.send_email_recipients =
307 319
308 320 ; optional prefix to Add to email Subject
309 321 #exception_tracker.email_prefix = [RHODECODE ERROR]
310 322
311 323 ; File store configuration. This is used to store and serve uploaded files
312 324 file_store.enabled = true
313 325
314 326 ; Storage backend, available options are: local
315 327 file_store.backend = local
316 328
317 329 ; path to store the uploaded binaries
318 330 file_store.storage_path = %(here)s/data/file_store
319 331
320 332
321 333 ; #############
322 334 ; CELERY CONFIG
323 335 ; #############
324 336
325 337 ; manually run celery: /path/to/celery worker -E --beat --app rhodecode.lib.celerylib.loader --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler --loglevel DEBUG --ini /path/to/rhodecode.ini
326 338
327 339 use_celery = false
328 340
329 341 ; path to store schedule database
330 342 #celerybeat-schedule.path =
331 343
332 344 ; connection url to the message broker (default redis)
333 345 celery.broker_url = redis://localhost:6379/8
334 346
335 347 ; rabbitmq example
336 348 #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
337 349
338 350 ; maximum tasks to execute before worker restart
339 351 celery.max_tasks_per_child = 100
340 352
341 353 ; tasks will never be sent to the queue, but executed locally instead.
342 354 celery.task_always_eager = false
343 355
344 356 ; #############
345 357 ; DOGPILE CACHE
346 358 ; #############
347 359
348 360 ; Default cache dir for caches. Putting this into a ramdisk can boost performance.
349 361 ; eg. /tmpfs/data_ramdisk, however this directory might require large amount of space
350 362 cache_dir = %(here)s/data
351 363
352 364 ; *********************************************
353 365 ; `sql_cache_short` cache for heavy SQL queries
354 366 ; Only supported backend is `memory_lru`
355 367 ; *********************************************
356 368 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
357 369 rc_cache.sql_cache_short.expiration_time = 30
358 370
359 371
360 372 ; *****************************************************
361 373 ; `cache_repo_longterm` cache for repo object instances
362 374 ; Only supported backend is `memory_lru`
363 375 ; *****************************************************
364 376 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
365 377 ; by default we use 30 Days, cache is still invalidated on push
366 378 rc_cache.cache_repo_longterm.expiration_time = 2592000
367 379 ; max items in LRU cache, set to smaller number to save memory, and expire last used caches
368 380 rc_cache.cache_repo_longterm.max_size = 10000
369 381
370 382
371 383 ; *************************************************
372 384 ; `cache_perms` cache for permission tree, auth TTL
373 385 ; *************************************************
374 386 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
375 387 rc_cache.cache_perms.expiration_time = 300
376 388 ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set
377 389 #rc_cache.cache_perms.arguments.filename = /tmp/cache_perms.db
378 390
379 391 ; alternative `cache_perms` redis backend with distributed lock
380 392 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
381 393 #rc_cache.cache_perms.expiration_time = 300
382 394
383 395 ; redis_expiration_time needs to be greater then expiration_time
384 396 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
385 397
386 398 #rc_cache.cache_perms.arguments.host = localhost
387 399 #rc_cache.cache_perms.arguments.port = 6379
388 400 #rc_cache.cache_perms.arguments.db = 0
389 401 #rc_cache.cache_perms.arguments.socket_timeout = 30
390 402 ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
391 403 #rc_cache.cache_perms.arguments.distributed_lock = true
392 404
393 405 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
394 406 #rc_cache.cache_perms.arguments.lock_auto_renewal = true
395 407
396 408 ; ***************************************************
397 409 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
398 410 ; ***************************************************
399 411 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
400 412 rc_cache.cache_repo.expiration_time = 2592000
401 413 ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set
402 414 #rc_cache.cache_repo.arguments.filename = /tmp/cache_repo.db
403 415
404 416 ; alternative `cache_repo` redis backend with distributed lock
405 417 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
406 418 #rc_cache.cache_repo.expiration_time = 2592000
407 419
408 420 ; redis_expiration_time needs to be greater then expiration_time
409 421 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
410 422
411 423 #rc_cache.cache_repo.arguments.host = localhost
412 424 #rc_cache.cache_repo.arguments.port = 6379
413 425 #rc_cache.cache_repo.arguments.db = 1
414 426 #rc_cache.cache_repo.arguments.socket_timeout = 30
415 427 ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
416 428 #rc_cache.cache_repo.arguments.distributed_lock = true
417 429
418 430 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
419 431 #rc_cache.cache_repo.arguments.lock_auto_renewal = true
420 432
421 433 ; ##############
422 434 ; BEAKER SESSION
423 435 ; ##############
424 436
425 437 ; beaker.session.type is type of storage options for the logged users sessions. Current allowed
426 438 ; types are file, ext:redis, ext:database, ext:memcached, and memory (default if not specified).
427 439 ; Fastest ones are Redis and ext:database
428 440 beaker.session.type = file
429 441 beaker.session.data_dir = %(here)s/data/sessions
430 442
431 443 ; Redis based sessions
432 444 #beaker.session.type = ext:redis
433 445 #beaker.session.url = redis://127.0.0.1:6379/2
434 446
435 447 ; DB based session, fast, and allows easy management over logged in users
436 448 #beaker.session.type = ext:database
437 449 #beaker.session.table_name = db_session
438 450 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
439 451 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
440 452 #beaker.session.sa.pool_recycle = 3600
441 453 #beaker.session.sa.echo = false
442 454
443 455 beaker.session.key = rhodecode
444 456 beaker.session.secret = production-rc-uytcxaz
445 457 beaker.session.lock_dir = %(here)s/data/sessions/lock
446 458
447 459 ; Secure encrypted cookie. Requires AES and AES python libraries
448 460 ; you must disable beaker.session.secret to use this
449 461 #beaker.session.encrypt_key = key_for_encryption
450 462 #beaker.session.validate_key = validation_key
451 463
452 464 ; Sets session as invalid (also logging out user) if it haven not been
453 465 ; accessed for given amount of time in seconds
454 466 beaker.session.timeout = 2592000
455 467 beaker.session.httponly = true
456 468
457 469 ; Path to use for the cookie. Set to prefix if you use prefix middleware
458 470 #beaker.session.cookie_path = /custom_prefix
459 471
460 472 ; Set https secure cookie
461 473 beaker.session.secure = false
462 474
463 475 ; default cookie expiration time in seconds, set to `true` to set expire
464 476 ; at browser close
465 477 #beaker.session.cookie_expires = 3600
466 478
467 479 ; #############################
468 480 ; SEARCH INDEXING CONFIGURATION
469 481 ; #############################
470 482
471 483 ; Full text search indexer is available in rhodecode-tools under
472 484 ; `rhodecode-tools index` command
473 485
474 486 ; WHOOSH Backend, doesn't require additional services to run
475 487 ; it works good with few dozen repos
476 488 search.module = rhodecode.lib.index.whoosh
477 489 search.location = %(here)s/data/index
478 490
479 491 ; ####################
480 492 ; CHANNELSTREAM CONFIG
481 493 ; ####################
482 494
483 495 ; channelstream enables persistent connections and live notification
484 496 ; in the system. It's also used by the chat system
485 497
486 498 channelstream.enabled = false
487 499
488 500 ; server address for channelstream server on the backend
489 501 channelstream.server = 127.0.0.1:9800
490 502
491 503 ; location of the channelstream server from outside world
492 504 ; use ws:// for http or wss:// for https. This address needs to be handled
493 505 ; by external HTTP server such as Nginx or Apache
494 506 ; see Nginx/Apache configuration examples in our docs
495 507 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
496 508 channelstream.secret = secret
497 509 channelstream.history.location = %(here)s/channelstream_history
498 510
499 511 ; Internal application path that Javascript uses to connect into.
500 512 ; If you use proxy-prefix the prefix should be added before /_channelstream
501 513 channelstream.proxy_path = /_channelstream
502 514
503 515
504 516 ; ##############################
505 517 ; MAIN RHODECODE DATABASE CONFIG
506 518 ; ##############################
507 519
508 520 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
509 521 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
510 522 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
511 523 ; pymysql is an alternative driver for MySQL, use in case of problems with default one
512 524 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
513 525
514 526 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
515 527
516 528 ; see sqlalchemy docs for other advanced settings
517 529 ; print the sql statements to output
518 530 sqlalchemy.db1.echo = false
519 531
520 532 ; recycle the connections after this amount of seconds
521 533 sqlalchemy.db1.pool_recycle = 3600
522 534 sqlalchemy.db1.convert_unicode = true
523 535
524 536 ; the number of connections to keep open inside the connection pool.
525 537 ; 0 indicates no limit
526 538 #sqlalchemy.db1.pool_size = 5
527 539
528 540 ; The number of connections to allow in connection pool "overflow", that is
529 541 ; connections that can be opened above and beyond the pool_size setting,
530 542 ; which defaults to five.
531 543 #sqlalchemy.db1.max_overflow = 10
532 544
533 545 ; Connection check ping, used to detect broken database connections
534 546 ; could be enabled to better handle cases if MySQL has gone away errors
535 547 #sqlalchemy.db1.ping_connection = true
536 548
537 549 ; ##########
538 550 ; VCS CONFIG
539 551 ; ##########
540 552 vcs.server.enable = true
541 553 vcs.server = localhost:9900
542 554
543 555 ; Web server connectivity protocol, responsible for web based VCS operations
544 556 ; Available protocols are:
545 557 ; `http` - use http-rpc backend (default)
546 558 vcs.server.protocol = http
547 559
548 560 ; Push/Pull operations protocol, available options are:
549 561 ; `http` - use http-rpc backend (default)
550 562 vcs.scm_app_implementation = http
551 563
552 564 ; Push/Pull operations hooks protocol, available options are:
553 565 ; `http` - use http-rpc backend (default)
554 566 vcs.hooks.protocol = http
555 567
556 568 ; Host on which this instance is listening for hooks. If vcsserver is in other location
557 569 ; this should be adjusted.
558 570 vcs.hooks.host = 127.0.0.1
559 571
560 572 ; Start VCSServer with this instance as a subprocess, useful for development
561 573 vcs.start_server = false
562 574
563 575 ; List of enabled VCS backends, available options are:
564 576 ; `hg` - mercurial
565 577 ; `git` - git
566 578 ; `svn` - subversion
567 579 vcs.backends = hg, git, svn
568 580
569 581 ; Wait this number of seconds before killing connection to the vcsserver
570 582 vcs.connection_timeout = 3600
571 583
572 584 ; Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
573 585 ; Set a numeric version for your current SVN e.g 1.8, or 1.12
574 586 ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
575 587 #vcs.svn.compatible_version = 1.8
576 588
577 589 ; Cache flag to cache vcsserver remote calls locally
578 590 ; It uses cache_region `cache_repo`
579 591 vcs.methods.cache = true
580 592
581 593 ; ####################################################
582 594 ; Subversion proxy support (mod_dav_svn)
583 595 ; Maps RhodeCode repo groups into SVN paths for Apache
584 596 ; ####################################################
585 597
586 598 ; Enable or disable the config file generation.
587 599 svn.proxy.generate_config = false
588 600
589 601 ; Generate config file with `SVNListParentPath` set to `On`.
590 602 svn.proxy.list_parent_path = true
591 603
592 604 ; Set location and file name of generated config file.
593 605 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
594 606
595 607 ; alternative mod_dav config template. This needs to be a valid mako template
596 608 ; Example template can be found in the source code:
597 609 ; rhodecode/apps/svn_support/templates/mod-dav-svn.conf.mako
598 610 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
599 611
600 612 ; Used as a prefix to the `Location` block in the generated config file.
601 613 ; In most cases it should be set to `/`.
602 614 svn.proxy.location_root = /
603 615
604 616 ; Command to reload the mod dav svn configuration on change.
605 617 ; Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
606 618 ; Make sure user who runs RhodeCode process is allowed to reload Apache
607 619 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
608 620
609 621 ; If the timeout expires before the reload command finishes, the command will
610 622 ; be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
611 623 #svn.proxy.reload_timeout = 10
612 624
613 625 ; ####################
614 626 ; SSH Support Settings
615 627 ; ####################
616 628
617 629 ; Defines if a custom authorized_keys file should be created and written on
618 630 ; any change user ssh keys. Setting this to false also disables possibility
619 631 ; of adding SSH keys by users from web interface. Super admins can still
620 632 ; manage SSH Keys.
621 633 ssh.generate_authorized_keyfile = false
622 634
623 635 ; Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
624 636 # ssh.authorized_keys_ssh_opts =
625 637
626 638 ; Path to the authorized_keys file where the generate entries are placed.
627 639 ; It is possible to have multiple key files specified in `sshd_config` e.g.
628 640 ; AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
629 641 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
630 642
631 643 ; Command to execute the SSH wrapper. The binary is available in the
632 644 ; RhodeCode installation directory.
633 645 ; e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
634 646 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
635 647
636 648 ; Allow shell when executing the ssh-wrapper command
637 649 ssh.wrapper_cmd_allow_shell = false
638 650
639 651 ; Enables logging, and detailed output send back to the client during SSH
640 652 ; operations. Useful for debugging, shouldn't be used in production.
641 653 ssh.enable_debug_logging = false
642 654
643 655 ; Paths to binary executable, by default they are the names, but we can
644 656 ; override them if we want to use a custom one
645 657 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
646 658 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
647 659 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
648 660
649 661 ; Enables SSH key generator web interface. Disabling this still allows users
650 662 ; to add their own keys.
651 663 ssh.enable_ui_key_generator = true
652 664
653 665
654 666 ; #################
655 667 ; APPENLIGHT CONFIG
656 668 ; #################
657 669
658 670 ; Appenlight is tailored to work with RhodeCode, see
659 671 ; http://appenlight.rhodecode.com for details how to obtain an account
660 672
661 673 ; Appenlight integration enabled
662 674 #appenlight = false
663 675
664 676 #appenlight.server_url = https://api.appenlight.com
665 677 #appenlight.api_key = YOUR_API_KEY
666 678 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
667 679
668 680 ; used for JS client
669 681 #appenlight.api_public_key = YOUR_API_PUBLIC_KEY
670 682
671 683 ; TWEAK AMOUNT OF INFO SENT HERE
672 684
673 685 ; enables 404 error logging (default False)
674 686 #appenlight.report_404 = false
675 687
676 688 ; time in seconds after request is considered being slow (default 1)
677 689 #appenlight.slow_request_time = 1
678 690
679 691 ; record slow requests in application
680 692 ; (needs to be enabled for slow datastore recording and time tracking)
681 693 #appenlight.slow_requests = true
682 694
683 695 ; enable hooking to application loggers
684 696 #appenlight.logging = true
685 697
686 698 ; minimum log level for log capture
687 699 #ppenlight.logging.level = WARNING
688 700
689 701 ; send logs only from erroneous/slow requests
690 702 ; (saves API quota for intensive logging)
691 703 #appenlight.logging_on_error = false
692 704
693 705 ; list of additional keywords that should be grabbed from environ object
694 706 ; can be string with comma separated list of words in lowercase
695 707 ; (by default client will always send following info:
696 708 ; 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
697 709 ; start with HTTP* this list be extended with additional keywords here
698 710 #appenlight.environ_keys_whitelist =
699 711
700 712 ; list of keywords that should be blanked from request object
701 713 ; can be string with comma separated list of words in lowercase
702 714 ; (by default client will always blank keys that contain following words
703 715 ; 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
704 716 ; this list be extended with additional keywords set here
705 717 #appenlight.request_keys_blacklist =
706 718
707 719 ; list of namespaces that should be ignores when gathering log entries
708 720 ; can be string with comma separated list of namespaces
709 721 ; (by default the client ignores own entries: appenlight_client.client)
710 722 #appenlight.log_namespace_blacklist =
711 723
712 724 ; Statsd client config, this is used to send metrics to statsd
713 725 ; We recommend setting statsd_exported and scrape them using Promethues
714 726 #statsd.enabled = false
715 727 #statsd.statsd_host = 0.0.0.0
716 728 #statsd.statsd_port = 8125
717 729 #statsd.statsd_prefix =
718 730 #statsd.statsd_ipv6 = false
719 731
720
721 732 ; configure logging automatically at server startup set to false
722 733 ; to use the below custom logging config.
734 ; RC_LOGGING_FORMATTER
735 ; RC_LOGGING_LEVEL
736 ; env variables can control the settings for logging in case of autoconfigure
737
723 738 #logging.autoconfigure = true
724 739
725 740 ; specify your own custom logging config file to configure logging
726 741 #logging.logging_conf_file = /path/to/custom_logging.ini
727 742
728 743 ; Dummy marker to add new entries after.
729 744 ; Add any custom entries below. Please don't remove this marker.
730 745 custom.conf = 1
731 746
732 747
733 748 ; #####################
734 749 ; LOGGING CONFIGURATION
735 750 ; #####################
751
736 752 [loggers]
737 753 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
738 754
739 755 [handlers]
740 756 keys = console, console_sql
741 757
742 758 [formatters]
743 keys = generic, color_formatter, color_formatter_sql
759 keys = generic, json, color_formatter, color_formatter_sql
744 760
745 761 ; #######
746 762 ; LOGGERS
747 763 ; #######
748 764 [logger_root]
749 765 level = NOTSET
750 766 handlers = console
751 767
752 768 [logger_sqlalchemy]
753 769 level = INFO
754 770 handlers = console_sql
755 771 qualname = sqlalchemy.engine
756 772 propagate = 0
757 773
758 774 [logger_beaker]
759 775 level = DEBUG
760 776 handlers =
761 777 qualname = beaker.container
762 778 propagate = 1
763 779
764 780 [logger_rhodecode]
765 781 level = DEBUG
766 782 handlers =
767 783 qualname = rhodecode
768 784 propagate = 1
769 785
770 786 [logger_ssh_wrapper]
771 787 level = DEBUG
772 788 handlers =
773 789 qualname = ssh_wrapper
774 790 propagate = 1
775 791
776 792 [logger_celery]
777 793 level = DEBUG
778 794 handlers =
779 795 qualname = celery
780 796
781 797
782 798 ; ########
783 799 ; HANDLERS
784 800 ; ########
785 801
786 802 [handler_console]
787 803 class = StreamHandler
788 804 args = (sys.stderr, )
789 805 level = INFO
790 806 formatter = generic
791 807 ; To enable JSON formatted logs replace generic with json
792 808 ; This allows sending properly formatted logs to grafana loki or elasticsearch
793 809 #formatter = json
794 810
795 811 [handler_console_sql]
796 812 ; "level = DEBUG" logs SQL queries and results.
797 813 ; "level = INFO" logs SQL queries.
798 814 ; "level = WARN" logs neither. (Recommended for production systems.)
799 815 class = StreamHandler
800 816 args = (sys.stderr, )
801 817 level = WARN
802 818 formatter = generic
803 819
804 820 ; ##########
805 821 ; FORMATTERS
806 822 ; ##########
807 823
808 824 [formatter_generic]
809 825 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
810 826 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
811 827 datefmt = %Y-%m-%d %H:%M:%S
812 828
813 829 [formatter_color_formatter]
814 830 class = rhodecode.lib.logging_formatter.ColorFormatter
815 831 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
816 832 datefmt = %Y-%m-%d %H:%M:%S
817 833
818 834 [formatter_color_formatter_sql]
819 835 class = rhodecode.lib.logging_formatter.ColorFormatterSql
820 836 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
821 837 datefmt = %Y-%m-%d %H:%M:%S
822 838
823 839 [formatter_json]
824 format = %(message)s
825 class = rhodecode.lib._vendor.jsonlogger.JsonFormatter No newline at end of file
840 format = %(timestamp)s %(levelname)s %(name)s %(message)s %(req_id)s
841 class = rhodecode.lib._vendor.jsonlogger.JsonFormatter
General Comments 0
You need to be logged in to leave comments. Login now