##// END OF EJS Templates
exception_store: rename .ini option for future
marcink -
r3024:eb235cbd stable
parent child Browse files
Show More
@@ -1,736 +1,724 b''
1
1
2
2
3 ################################################################################
3 ################################################################################
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 ################################################################################
5 ################################################################################
6
6
7 [DEFAULT]
7 [DEFAULT]
8 debug = true
8 debug = true
9
9
10 ################################################################################
10 ################################################################################
11 ## EMAIL CONFIGURATION ##
11 ## EMAIL CONFIGURATION ##
12 ## Uncomment and replace with the email address which should receive ##
12 ## Uncomment and replace with the email address which should receive ##
13 ## any error reports after an application crash ##
13 ## any error reports after an application crash ##
14 ## Additionally these settings will be used by the RhodeCode mailing system ##
14 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16
16
17 ## prefix all emails subjects with given prefix, helps filtering out emails
17 ## prefix all emails subjects with given prefix, helps filtering out emails
18 #email_prefix = [RhodeCode]
18 #email_prefix = [RhodeCode]
19
19
20 ## email FROM address all mails will be sent
20 ## email FROM address all mails will be sent
21 #app_email_from = rhodecode-noreply@localhost
21 #app_email_from = rhodecode-noreply@localhost
22
22
23 ## Uncomment and replace with the address which should receive any error report
24 ## note: using appenlight for error handling doesn't need this to be uncommented
25 #email_to = admin@localhost
26
27 ## in case of Application errors, sent an error email form
28 #error_email_from = rhodecode_error@localhost
29
30 ## additional error message to be send in case of server crash
31 #error_message =
32
33
34 #smtp_server = mail.server.com
23 #smtp_server = mail.server.com
35 #smtp_username =
24 #smtp_username =
36 #smtp_password =
25 #smtp_password =
37 #smtp_port =
26 #smtp_port =
38 #smtp_use_tls = false
27 #smtp_use_tls = false
39 #smtp_use_ssl = true
28 #smtp_use_ssl = true
40 ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
41 #smtp_auth =
30 #smtp_auth =
42
31
43 [server:main]
32 [server:main]
44 ## COMMON ##
33 ## COMMON ##
45 host = 127.0.0.1
34 host = 127.0.0.1
46 port = 5000
35 port = 5000
47
36
48 ###########################################################
37 ###########################################################
49 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 ## WAITRESS WSGI SERVER - Recommended for Development ####
50 ###########################################################
39 ###########################################################
51
40
52 use = egg:waitress#main
41 use = egg:waitress#main
53 ## number of worker threads
42 ## number of worker threads
54 threads = 5
43 threads = 5
55 ## MAX BODY SIZE 100GB
44 ## MAX BODY SIZE 100GB
56 max_request_body_size = 107374182400
45 max_request_body_size = 107374182400
57 ## Use poll instead of select, fixes file descriptors limits problems.
46 ## Use poll instead of select, fixes file descriptors limits problems.
58 ## May not work on old windows systems.
47 ## May not work on old windows systems.
59 asyncore_use_poll = true
48 asyncore_use_poll = true
60
49
61
50
62 ##########################
51 ##########################
63 ## GUNICORN WSGI SERVER ##
52 ## GUNICORN WSGI SERVER ##
64 ##########################
53 ##########################
65 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
66
55
67 #use = egg:gunicorn#main
56 #use = egg:gunicorn#main
68 ## Sets the number of process workers. More workers means more concurent connections
57 ## Sets the number of process workers. More workers means more concurent connections
69 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 ## RhodeCode can handle at the same time. Each additional worker also it increases
70 ## memory usage as each has it's own set of caches.
59 ## memory usage as each has it's own set of caches.
71 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
72 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
73 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
74 ## when using more than 1 worker.
63 ## when using more than 1 worker.
75 #workers = 2
64 #workers = 2
76 ## process name visible in process list
65 ## process name visible in process list
77 #proc_name = rhodecode
66 #proc_name = rhodecode
78 ## type of worker class, one of sync, gevent
67 ## type of worker class, one of sync, gevent
79 ## recommended for bigger setup is using of of other than sync one
68 ## recommended for bigger setup is using of of other than sync one
80 #worker_class = gevent
69 #worker_class = gevent
81 ## The maximum number of simultaneous clients. Valid only for Gevent
70 ## The maximum number of simultaneous clients. Valid only for Gevent
82 #worker_connections = 10
71 #worker_connections = 10
83 ## max number of requests that worker will handle before being gracefully
72 ## max number of requests that worker will handle before being gracefully
84 ## restarted, could prevent memory leaks
73 ## restarted, could prevent memory leaks
85 #max_requests = 1000
74 #max_requests = 1000
86 #max_requests_jitter = 30
75 #max_requests_jitter = 30
87 ## amount of time a worker can spend with handling a request before it
76 ## amount of time a worker can spend with handling a request before it
88 ## gets killed and restarted. Set to 6hrs
77 ## gets killed and restarted. Set to 6hrs
89 #timeout = 21600
78 #timeout = 21600
90
79
91
80
92 ## prefix middleware for RhodeCode.
81 ## prefix middleware for RhodeCode.
93 ## recommended when using proxy setup.
82 ## recommended when using proxy setup.
94 ## allows to set RhodeCode under a prefix in server.
83 ## allows to set RhodeCode under a prefix in server.
95 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
84 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
96 ## And set your prefix like: `prefix = /custom_prefix`
85 ## And set your prefix like: `prefix = /custom_prefix`
97 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
86 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
98 ## to make your cookies only work on prefix url
87 ## to make your cookies only work on prefix url
99 [filter:proxy-prefix]
88 [filter:proxy-prefix]
100 use = egg:PasteDeploy#prefix
89 use = egg:PasteDeploy#prefix
101 prefix = /
90 prefix = /
102
91
103 [app:main]
92 [app:main]
104 ## The %(here)s variable will be replaced with the absolute path of parent directory
93 ## The %(here)s variable will be replaced with the absolute path of parent directory
105 ## of this file
94 ## of this file
106 ## In addition ENVIRONMENT variables usage is possible, e.g
95 ## In addition ENVIRONMENT variables usage is possible, e.g
107 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
96 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
108
97
109 use = egg:rhodecode-enterprise-ce
98 use = egg:rhodecode-enterprise-ce
110
99
111 ## enable proxy prefix middleware, defined above
100 ## enable proxy prefix middleware, defined above
112 #filter-with = proxy-prefix
101 #filter-with = proxy-prefix
113
102
114 # During development the we want to have the debug toolbar enabled
103 # During development the we want to have the debug toolbar enabled
115 pyramid.includes =
104 pyramid.includes =
116 pyramid_debugtoolbar
105 pyramid_debugtoolbar
117 rhodecode.lib.middleware.request_wrapper
106 rhodecode.lib.middleware.request_wrapper
118
107
119 pyramid.reload_templates = true
108 pyramid.reload_templates = true
120
109
121 debugtoolbar.hosts = 0.0.0.0/0
110 debugtoolbar.hosts = 0.0.0.0/0
122 debugtoolbar.exclude_prefixes =
111 debugtoolbar.exclude_prefixes =
123 /css
112 /css
124 /fonts
113 /fonts
125 /images
114 /images
126 /js
115 /js
127
116
128 ## RHODECODE PLUGINS ##
117 ## RHODECODE PLUGINS ##
129 rhodecode.includes =
118 rhodecode.includes =
130 rhodecode.api
119 rhodecode.api
131
120
132
121
133 # api prefix url
122 # api prefix url
134 rhodecode.api.url = /_admin/api
123 rhodecode.api.url = /_admin/api
135
124
136
125
137 ## END RHODECODE PLUGINS ##
126 ## END RHODECODE PLUGINS ##
138
127
139 ## encryption key used to encrypt social plugin tokens,
128 ## encryption key used to encrypt social plugin tokens,
140 ## remote_urls with credentials etc, if not set it defaults to
129 ## remote_urls with credentials etc, if not set it defaults to
141 ## `beaker.session.secret`
130 ## `beaker.session.secret`
142 #rhodecode.encrypted_values.secret =
131 #rhodecode.encrypted_values.secret =
143
132
144 ## decryption strict mode (enabled by default). It controls if decryption raises
133 ## decryption strict mode (enabled by default). It controls if decryption raises
145 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
134 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
146 #rhodecode.encrypted_values.strict = false
135 #rhodecode.encrypted_values.strict = false
147
136
148 ## return gzipped responses from Rhodecode (static files/application)
137 ## return gzipped responses from Rhodecode (static files/application)
149 gzip_responses = false
138 gzip_responses = false
150
139
151 ## autogenerate javascript routes file on startup
140 ## autogenerate javascript routes file on startup
152 generate_js_files = false
141 generate_js_files = false
153
142
154 ## System global default language.
143 ## System global default language.
155 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
144 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
156 lang = en
145 lang = en
157
146
158 ## Perform a full repository scan and import on each server start.
147 ## Perform a full repository scan and import on each server start.
159 ## Settings this to true could lead to very long startup time.
148 ## Settings this to true could lead to very long startup time.
160 startup.import_repos = false
149 startup.import_repos = false
161
150
162 ## Uncomment and set this path to use archive download cache.
151 ## Uncomment and set this path to use archive download cache.
163 ## Once enabled, generated archives will be cached at this location
152 ## Once enabled, generated archives will be cached at this location
164 ## and served from the cache during subsequent requests for the same archive of
153 ## and served from the cache during subsequent requests for the same archive of
165 ## the repository.
154 ## the repository.
166 #archive_cache_dir = /tmp/tarballcache
155 #archive_cache_dir = /tmp/tarballcache
167
156
168 ## URL at which the application is running. This is used for bootstraping
157 ## URL at which the application is running. This is used for bootstraping
169 ## requests in context when no web request is available. Used in ishell, or
158 ## requests in context when no web request is available. Used in ishell, or
170 ## SSH calls. Set this for events to receive proper url for SSH calls.
159 ## SSH calls. Set this for events to receive proper url for SSH calls.
171 app.base_url = http://rhodecode.local
160 app.base_url = http://rhodecode.local
172
161
173 ## Unique application ID. Should be a random unique string for security.
162 ## Unique application ID. Should be a random unique string for security.
174 app_instance_uuid = rc-production
163 app_instance_uuid = rc-production
175
164
176 ## Cut off limit for large diffs (size in bytes). If overall diff size on
165 ## Cut off limit for large diffs (size in bytes). If overall diff size on
177 ## commit, or pull request exceeds this limit this diff will be displayed
166 ## commit, or pull request exceeds this limit this diff will be displayed
178 ## partially. E.g 512000 == 512Kb
167 ## partially. E.g 512000 == 512Kb
179 cut_off_limit_diff = 512000
168 cut_off_limit_diff = 512000
180
169
181 ## Cut off limit for large files inside diffs (size in bytes). Each individual
170 ## Cut off limit for large files inside diffs (size in bytes). Each individual
182 ## file inside diff which exceeds this limit will be displayed partially.
171 ## file inside diff which exceeds this limit will be displayed partially.
183 ## E.g 128000 == 128Kb
172 ## E.g 128000 == 128Kb
184 cut_off_limit_file = 128000
173 cut_off_limit_file = 128000
185
174
186 ## use cached version of vcs repositories everywhere. Recommended to be `true`
175 ## use cached version of vcs repositories everywhere. Recommended to be `true`
187 vcs_full_cache = true
176 vcs_full_cache = true
188
177
189 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
178 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
190 ## Normally this is controlled by proper http flags sent from http server
179 ## Normally this is controlled by proper http flags sent from http server
191 force_https = false
180 force_https = false
192
181
193 ## use Strict-Transport-Security headers
182 ## use Strict-Transport-Security headers
194 use_htsts = false
183 use_htsts = false
195
184
196 ## git rev filter option, --all is the default filter, if you need to
185 ## git rev filter option, --all is the default filter, if you need to
197 ## hide all refs in changelog switch this to --branches --tags
186 ## hide all refs in changelog switch this to --branches --tags
198 git_rev_filter = --branches --tags
187 git_rev_filter = --branches --tags
199
188
200 # Set to true if your repos are exposed using the dumb protocol
189 # Set to true if your repos are exposed using the dumb protocol
201 git_update_server_info = false
190 git_update_server_info = false
202
191
203 ## RSS/ATOM feed options
192 ## RSS/ATOM feed options
204 rss_cut_off_limit = 256000
193 rss_cut_off_limit = 256000
205 rss_items_per_page = 10
194 rss_items_per_page = 10
206 rss_include_diff = false
195 rss_include_diff = false
207
196
208 ## gist URL alias, used to create nicer urls for gist. This should be an
197 ## gist URL alias, used to create nicer urls for gist. This should be an
209 ## url that does rewrites to _admin/gists/{gistid}.
198 ## url that does rewrites to _admin/gists/{gistid}.
210 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
199 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
211 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
200 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
212 gist_alias_url =
201 gist_alias_url =
213
202
214 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
203 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
215 ## used for access.
204 ## used for access.
216 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
205 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
217 ## came from the the logged in user who own this authentication token.
206 ## came from the the logged in user who own this authentication token.
218 ## Additionally @TOKEN syntaxt can be used to bound the view to specific
207 ## Additionally @TOKEN syntaxt can be used to bound the view to specific
219 ## authentication token. Such view would be only accessible when used together
208 ## authentication token. Such view would be only accessible when used together
220 ## with this authentication token
209 ## with this authentication token
221 ##
210 ##
222 ## list of all views can be found under `/_admin/permissions/auth_token_access`
211 ## list of all views can be found under `/_admin/permissions/auth_token_access`
223 ## The list should be "," separated and on a single line.
212 ## The list should be "," separated and on a single line.
224 ##
213 ##
225 ## Most common views to enable:
214 ## Most common views to enable:
226 # RepoCommitsView:repo_commit_download
215 # RepoCommitsView:repo_commit_download
227 # RepoCommitsView:repo_commit_patch
216 # RepoCommitsView:repo_commit_patch
228 # RepoCommitsView:repo_commit_raw
217 # RepoCommitsView:repo_commit_raw
229 # RepoCommitsView:repo_commit_raw@TOKEN
218 # RepoCommitsView:repo_commit_raw@TOKEN
230 # RepoFilesView:repo_files_diff
219 # RepoFilesView:repo_files_diff
231 # RepoFilesView:repo_archivefile
220 # RepoFilesView:repo_archivefile
232 # RepoFilesView:repo_file_raw
221 # RepoFilesView:repo_file_raw
233 # GistView:*
222 # GistView:*
234 api_access_controllers_whitelist =
223 api_access_controllers_whitelist =
235
224
236 ## Default encoding used to convert from and to unicode
225 ## Default encoding used to convert from and to unicode
237 ## can be also a comma separated list of encoding in case of mixed encodings
226 ## can be also a comma separated list of encoding in case of mixed encodings
238 default_encoding = UTF-8
227 default_encoding = UTF-8
239
228
240 ## instance-id prefix
229 ## instance-id prefix
241 ## a prefix key for this instance used for cache invalidation when running
230 ## a prefix key for this instance used for cache invalidation when running
242 ## multiple instances of rhodecode, make sure it's globally unique for
231 ## multiple instances of rhodecode, make sure it's globally unique for
243 ## all running rhodecode instances. Leave empty if you don't use it
232 ## all running rhodecode instances. Leave empty if you don't use it
244 instance_id =
233 instance_id =
245
234
246 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
235 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
247 ## of an authentication plugin also if it is disabled by it's settings.
236 ## of an authentication plugin also if it is disabled by it's settings.
248 ## This could be useful if you are unable to log in to the system due to broken
237 ## This could be useful if you are unable to log in to the system due to broken
249 ## authentication settings. Then you can enable e.g. the internal rhodecode auth
238 ## authentication settings. Then you can enable e.g. the internal rhodecode auth
250 ## module to log in again and fix the settings.
239 ## module to log in again and fix the settings.
251 ##
240 ##
252 ## Available builtin plugin IDs (hash is part of the ID):
241 ## Available builtin plugin IDs (hash is part of the ID):
253 ## egg:rhodecode-enterprise-ce#rhodecode
242 ## egg:rhodecode-enterprise-ce#rhodecode
254 ## egg:rhodecode-enterprise-ce#pam
243 ## egg:rhodecode-enterprise-ce#pam
255 ## egg:rhodecode-enterprise-ce#ldap
244 ## egg:rhodecode-enterprise-ce#ldap
256 ## egg:rhodecode-enterprise-ce#jasig_cas
245 ## egg:rhodecode-enterprise-ce#jasig_cas
257 ## egg:rhodecode-enterprise-ce#headers
246 ## egg:rhodecode-enterprise-ce#headers
258 ## egg:rhodecode-enterprise-ce#crowd
247 ## egg:rhodecode-enterprise-ce#crowd
259 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
248 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
260
249
261 ## alternative return HTTP header for failed authentication. Default HTTP
250 ## alternative return HTTP header for failed authentication. Default HTTP
262 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
251 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
263 ## handling that causing a series of failed authentication calls.
252 ## handling that causing a series of failed authentication calls.
264 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
253 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
265 ## This will be served instead of default 401 on bad authnetication
254 ## This will be served instead of default 401 on bad authnetication
266 auth_ret_code =
255 auth_ret_code =
267
256
268 ## use special detection method when serving auth_ret_code, instead of serving
257 ## use special detection method when serving auth_ret_code, instead of serving
269 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
258 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
270 ## and then serve auth_ret_code to clients
259 ## and then serve auth_ret_code to clients
271 auth_ret_code_detection = false
260 auth_ret_code_detection = false
272
261
273 ## locking return code. When repository is locked return this HTTP code. 2XX
262 ## locking return code. When repository is locked return this HTTP code. 2XX
274 ## codes don't break the transactions while 4XX codes do
263 ## codes don't break the transactions while 4XX codes do
275 lock_ret_code = 423
264 lock_ret_code = 423
276
265
277 ## allows to change the repository location in settings page
266 ## allows to change the repository location in settings page
278 allow_repo_location_change = true
267 allow_repo_location_change = true
279
268
280 ## allows to setup custom hooks in settings page
269 ## allows to setup custom hooks in settings page
281 allow_custom_hooks_settings = true
270 allow_custom_hooks_settings = true
282
271
283 ## Generated license token required for EE edition license.
272 ## Generated license token required for EE edition license.
284 ## New generated token value can be found in Admin > settings > license page.
273 ## New generated token value can be found in Admin > settings > license page.
285 license_token =
274 license_token =
286
275
287 ## supervisor connection uri, for managing supervisor and logs.
276 ## supervisor connection uri, for managing supervisor and logs.
288 supervisor.uri =
277 supervisor.uri =
289 ## supervisord group name/id we only want this RC instance to handle
278 ## supervisord group name/id we only want this RC instance to handle
290 supervisor.group_id = dev
279 supervisor.group_id = dev
291
280
292 ## Display extended labs settings
281 ## Display extended labs settings
293 labs_settings_active = true
282 labs_settings_active = true
294
283
295 ## custom exception store path, defaults to TMPDIR
284 ## custom exception store path, defaults to TMPDIR
296 exception_store_path =
285 exception_tracker.store_path =
297
298
286
299 ####################################
287 ####################################
300 ### CELERY CONFIG ####
288 ### CELERY CONFIG ####
301 ####################################
289 ####################################
302 ## run: /path/to/celery worker \
290 ## run: /path/to/celery worker \
303 ## -E --beat --app rhodecode.lib.celerylib.loader \
291 ## -E --beat --app rhodecode.lib.celerylib.loader \
304 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
292 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
305 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
293 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
306
294
307 use_celery = false
295 use_celery = false
308
296
309 ## connection url to the message broker (default rabbitmq)
297 ## connection url to the message broker (default rabbitmq)
310 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
298 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
311
299
312 ## maximum tasks to execute before worker restart
300 ## maximum tasks to execute before worker restart
313 celery.max_tasks_per_child = 100
301 celery.max_tasks_per_child = 100
314
302
315 ## tasks will never be sent to the queue, but executed locally instead.
303 ## tasks will never be sent to the queue, but executed locally instead.
316 celery.task_always_eager = false
304 celery.task_always_eager = false
317
305
318 #####################################
306 #####################################
319 ### DOGPILE CACHE ####
307 ### DOGPILE CACHE ####
320 #####################################
308 #####################################
321 ## Default cache dir for caches. Putting this into a ramdisk
309 ## Default cache dir for caches. Putting this into a ramdisk
322 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
310 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
323 ## large amount of space
311 ## large amount of space
324 cache_dir = %(here)s/data
312 cache_dir = %(here)s/data
325
313
326 ## `cache_perms` cache settings for permission tree, auth TTL.
314 ## `cache_perms` cache settings for permission tree, auth TTL.
327 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
315 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
328 rc_cache.cache_perms.expiration_time = 300
316 rc_cache.cache_perms.expiration_time = 300
329
317
330 ## alternative `cache_perms` redis backend with distributed lock
318 ## alternative `cache_perms` redis backend with distributed lock
331 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
319 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
332 #rc_cache.cache_perms.expiration_time = 300
320 #rc_cache.cache_perms.expiration_time = 300
333 ## redis_expiration_time needs to be greater then expiration_time
321 ## redis_expiration_time needs to be greater then expiration_time
334 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
322 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
335 #rc_cache.cache_perms.arguments.socket_timeout = 30
323 #rc_cache.cache_perms.arguments.socket_timeout = 30
336 #rc_cache.cache_perms.arguments.host = localhost
324 #rc_cache.cache_perms.arguments.host = localhost
337 #rc_cache.cache_perms.arguments.port = 6379
325 #rc_cache.cache_perms.arguments.port = 6379
338 #rc_cache.cache_perms.arguments.db = 0
326 #rc_cache.cache_perms.arguments.db = 0
339 #rc_cache.cache_perms.arguments.distributed_lock = true
327 #rc_cache.cache_perms.arguments.distributed_lock = true
340
328
341 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
329 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
342 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
330 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
343 rc_cache.cache_repo.expiration_time = 2592000
331 rc_cache.cache_repo.expiration_time = 2592000
344
332
345 ## alternative `cache_repo` redis backend with distributed lock
333 ## alternative `cache_repo` redis backend with distributed lock
346 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
334 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
347 #rc_cache.cache_repo.expiration_time = 2592000
335 #rc_cache.cache_repo.expiration_time = 2592000
348 ## redis_expiration_time needs to be greater then expiration_time
336 ## redis_expiration_time needs to be greater then expiration_time
349 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
337 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
350 #rc_cache.cache_repo.arguments.socket_timeout = 30
338 #rc_cache.cache_repo.arguments.socket_timeout = 30
351 #rc_cache.cache_repo.arguments.host = localhost
339 #rc_cache.cache_repo.arguments.host = localhost
352 #rc_cache.cache_repo.arguments.port = 6379
340 #rc_cache.cache_repo.arguments.port = 6379
353 #rc_cache.cache_repo.arguments.db = 1
341 #rc_cache.cache_repo.arguments.db = 1
354 #rc_cache.cache_repo.arguments.distributed_lock = true
342 #rc_cache.cache_repo.arguments.distributed_lock = true
355
343
356 ## cache settings for SQL queries, this needs to use memory type backend
344 ## cache settings for SQL queries, this needs to use memory type backend
357 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
345 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
358 rc_cache.sql_cache_short.expiration_time = 30
346 rc_cache.sql_cache_short.expiration_time = 30
359
347
360 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
348 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
361 ## type backend as the objects kept are not pickle serializable
349 ## type backend as the objects kept are not pickle serializable
362 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
350 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
363 ## by default we use 96H, this is using invalidation on push anyway
351 ## by default we use 96H, this is using invalidation on push anyway
364 rc_cache.cache_repo_longterm.expiration_time = 345600
352 rc_cache.cache_repo_longterm.expiration_time = 345600
365 ## max items in LRU cache, reduce this number to save memory, and expire last used
353 ## max items in LRU cache, reduce this number to save memory, and expire last used
366 ## cached objects
354 ## cached objects
367 rc_cache.cache_repo_longterm.max_size = 10000
355 rc_cache.cache_repo_longterm.max_size = 10000
368
356
369
357
370 ####################################
358 ####################################
371 ### BEAKER SESSION ####
359 ### BEAKER SESSION ####
372 ####################################
360 ####################################
373
361
374 ## .session.type is type of storage options for the session, current allowed
362 ## .session.type is type of storage options for the session, current allowed
375 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
363 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
376 beaker.session.type = file
364 beaker.session.type = file
377 beaker.session.data_dir = %(here)s/data/sessions
365 beaker.session.data_dir = %(here)s/data/sessions
378
366
379 ## db based session, fast, and allows easy management over logged in users
367 ## db based session, fast, and allows easy management over logged in users
380 #beaker.session.type = ext:database
368 #beaker.session.type = ext:database
381 #beaker.session.table_name = db_session
369 #beaker.session.table_name = db_session
382 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
370 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
383 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
371 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
384 #beaker.session.sa.pool_recycle = 3600
372 #beaker.session.sa.pool_recycle = 3600
385 #beaker.session.sa.echo = false
373 #beaker.session.sa.echo = false
386
374
387 beaker.session.key = rhodecode
375 beaker.session.key = rhodecode
388 beaker.session.secret = develop-rc-uytcxaz
376 beaker.session.secret = develop-rc-uytcxaz
389 beaker.session.lock_dir = %(here)s/data/sessions/lock
377 beaker.session.lock_dir = %(here)s/data/sessions/lock
390
378
391 ## Secure encrypted cookie. Requires AES and AES python libraries
379 ## Secure encrypted cookie. Requires AES and AES python libraries
392 ## you must disable beaker.session.secret to use this
380 ## you must disable beaker.session.secret to use this
393 #beaker.session.encrypt_key = key_for_encryption
381 #beaker.session.encrypt_key = key_for_encryption
394 #beaker.session.validate_key = validation_key
382 #beaker.session.validate_key = validation_key
395
383
396 ## sets session as invalid(also logging out user) if it haven not been
384 ## sets session as invalid(also logging out user) if it haven not been
397 ## accessed for given amount of time in seconds
385 ## accessed for given amount of time in seconds
398 beaker.session.timeout = 2592000
386 beaker.session.timeout = 2592000
399 beaker.session.httponly = true
387 beaker.session.httponly = true
400 ## Path to use for the cookie. Set to prefix if you use prefix middleware
388 ## Path to use for the cookie. Set to prefix if you use prefix middleware
401 #beaker.session.cookie_path = /custom_prefix
389 #beaker.session.cookie_path = /custom_prefix
402
390
403 ## uncomment for https secure cookie
391 ## uncomment for https secure cookie
404 beaker.session.secure = false
392 beaker.session.secure = false
405
393
406 ## auto save the session to not to use .save()
394 ## auto save the session to not to use .save()
407 beaker.session.auto = false
395 beaker.session.auto = false
408
396
409 ## default cookie expiration time in seconds, set to `true` to set expire
397 ## default cookie expiration time in seconds, set to `true` to set expire
410 ## at browser close
398 ## at browser close
411 #beaker.session.cookie_expires = 3600
399 #beaker.session.cookie_expires = 3600
412
400
413 ###################################
401 ###################################
414 ## SEARCH INDEXING CONFIGURATION ##
402 ## SEARCH INDEXING CONFIGURATION ##
415 ###################################
403 ###################################
416 ## Full text search indexer is available in rhodecode-tools under
404 ## Full text search indexer is available in rhodecode-tools under
417 ## `rhodecode-tools index` command
405 ## `rhodecode-tools index` command
418
406
419 ## WHOOSH Backend, doesn't require additional services to run
407 ## WHOOSH Backend, doesn't require additional services to run
420 ## it works good with few dozen repos
408 ## it works good with few dozen repos
421 search.module = rhodecode.lib.index.whoosh
409 search.module = rhodecode.lib.index.whoosh
422 search.location = %(here)s/data/index
410 search.location = %(here)s/data/index
423
411
424 ########################################
412 ########################################
425 ### CHANNELSTREAM CONFIG ####
413 ### CHANNELSTREAM CONFIG ####
426 ########################################
414 ########################################
427 ## channelstream enables persistent connections and live notification
415 ## channelstream enables persistent connections and live notification
428 ## in the system. It's also used by the chat system
416 ## in the system. It's also used by the chat system
429 channelstream.enabled = false
417 channelstream.enabled = false
430
418
431 ## server address for channelstream server on the backend
419 ## server address for channelstream server on the backend
432 channelstream.server = 127.0.0.1:9800
420 channelstream.server = 127.0.0.1:9800
433
421
434 ## location of the channelstream server from outside world
422 ## location of the channelstream server from outside world
435 ## use ws:// for http or wss:// for https. This address needs to be handled
423 ## use ws:// for http or wss:// for https. This address needs to be handled
436 ## by external HTTP server such as Nginx or Apache
424 ## by external HTTP server such as Nginx or Apache
437 ## see nginx/apache configuration examples in our docs
425 ## see nginx/apache configuration examples in our docs
438 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
426 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
439 channelstream.secret = secret
427 channelstream.secret = secret
440 channelstream.history.location = %(here)s/channelstream_history
428 channelstream.history.location = %(here)s/channelstream_history
441
429
442 ## Internal application path that Javascript uses to connect into.
430 ## Internal application path that Javascript uses to connect into.
443 ## If you use proxy-prefix the prefix should be added before /_channelstream
431 ## If you use proxy-prefix the prefix should be added before /_channelstream
444 channelstream.proxy_path = /_channelstream
432 channelstream.proxy_path = /_channelstream
445
433
446
434
447 ###################################
435 ###################################
448 ## APPENLIGHT CONFIG ##
436 ## APPENLIGHT CONFIG ##
449 ###################################
437 ###################################
450
438
451 ## Appenlight is tailored to work with RhodeCode, see
439 ## Appenlight is tailored to work with RhodeCode, see
452 ## http://appenlight.com for details how to obtain an account
440 ## http://appenlight.com for details how to obtain an account
453
441
454 ## appenlight integration enabled
442 ## appenlight integration enabled
455 appenlight = false
443 appenlight = false
456
444
457 appenlight.server_url = https://api.appenlight.com
445 appenlight.server_url = https://api.appenlight.com
458 appenlight.api_key = YOUR_API_KEY
446 appenlight.api_key = YOUR_API_KEY
459 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
447 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
460
448
461 # used for JS client
449 # used for JS client
462 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
450 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
463
451
464 ## TWEAK AMOUNT OF INFO SENT HERE
452 ## TWEAK AMOUNT OF INFO SENT HERE
465
453
466 ## enables 404 error logging (default False)
454 ## enables 404 error logging (default False)
467 appenlight.report_404 = false
455 appenlight.report_404 = false
468
456
469 ## time in seconds after request is considered being slow (default 1)
457 ## time in seconds after request is considered being slow (default 1)
470 appenlight.slow_request_time = 1
458 appenlight.slow_request_time = 1
471
459
472 ## record slow requests in application
460 ## record slow requests in application
473 ## (needs to be enabled for slow datastore recording and time tracking)
461 ## (needs to be enabled for slow datastore recording and time tracking)
474 appenlight.slow_requests = true
462 appenlight.slow_requests = true
475
463
476 ## enable hooking to application loggers
464 ## enable hooking to application loggers
477 appenlight.logging = true
465 appenlight.logging = true
478
466
479 ## minimum log level for log capture
467 ## minimum log level for log capture
480 appenlight.logging.level = WARNING
468 appenlight.logging.level = WARNING
481
469
482 ## send logs only from erroneous/slow requests
470 ## send logs only from erroneous/slow requests
483 ## (saves API quota for intensive logging)
471 ## (saves API quota for intensive logging)
484 appenlight.logging_on_error = false
472 appenlight.logging_on_error = false
485
473
486 ## list of additonal keywords that should be grabbed from environ object
474 ## list of additonal keywords that should be grabbed from environ object
487 ## can be string with comma separated list of words in lowercase
475 ## can be string with comma separated list of words in lowercase
488 ## (by default client will always send following info:
476 ## (by default client will always send following info:
489 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
477 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
490 ## start with HTTP* this list be extended with additional keywords here
478 ## start with HTTP* this list be extended with additional keywords here
491 appenlight.environ_keys_whitelist =
479 appenlight.environ_keys_whitelist =
492
480
493 ## list of keywords that should be blanked from request object
481 ## list of keywords that should be blanked from request object
494 ## can be string with comma separated list of words in lowercase
482 ## can be string with comma separated list of words in lowercase
495 ## (by default client will always blank keys that contain following words
483 ## (by default client will always blank keys that contain following words
496 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
484 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
497 ## this list be extended with additional keywords set here
485 ## this list be extended with additional keywords set here
498 appenlight.request_keys_blacklist =
486 appenlight.request_keys_blacklist =
499
487
500 ## list of namespaces that should be ignores when gathering log entries
488 ## list of namespaces that should be ignores when gathering log entries
501 ## can be string with comma separated list of namespaces
489 ## can be string with comma separated list of namespaces
502 ## (by default the client ignores own entries: appenlight_client.client)
490 ## (by default the client ignores own entries: appenlight_client.client)
503 appenlight.log_namespace_blacklist =
491 appenlight.log_namespace_blacklist =
504
492
505
493
506 ################################################################################
494 ################################################################################
507 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
495 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
508 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
496 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
509 ## execute malicious code after an exception is raised. ##
497 ## execute malicious code after an exception is raised. ##
510 ################################################################################
498 ################################################################################
511 #set debug = false
499 #set debug = false
512
500
513 # enable debug style page
501 # enable debug style page
514 debug_style = true
502 debug_style = true
515
503
516 ###########################################
504 ###########################################
517 ### MAIN RHODECODE DATABASE CONFIG ###
505 ### MAIN RHODECODE DATABASE CONFIG ###
518 ###########################################
506 ###########################################
519 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
507 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
520 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
508 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
521 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
509 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
522 # pymysql is an alternative driver for MySQL, use in case of problems with default one
510 # pymysql is an alternative driver for MySQL, use in case of problems with default one
523 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
511 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
524
512
525 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
513 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
526
514
527 # see sqlalchemy docs for other advanced settings
515 # see sqlalchemy docs for other advanced settings
528
516
529 ## print the sql statements to output
517 ## print the sql statements to output
530 sqlalchemy.db1.echo = false
518 sqlalchemy.db1.echo = false
531 ## recycle the connections after this amount of seconds
519 ## recycle the connections after this amount of seconds
532 sqlalchemy.db1.pool_recycle = 3600
520 sqlalchemy.db1.pool_recycle = 3600
533 sqlalchemy.db1.convert_unicode = true
521 sqlalchemy.db1.convert_unicode = true
534
522
535 ## the number of connections to keep open inside the connection pool.
523 ## the number of connections to keep open inside the connection pool.
536 ## 0 indicates no limit
524 ## 0 indicates no limit
537 #sqlalchemy.db1.pool_size = 5
525 #sqlalchemy.db1.pool_size = 5
538
526
539 ## the number of connections to allow in connection pool "overflow", that is
527 ## the number of connections to allow in connection pool "overflow", that is
540 ## connections that can be opened above and beyond the pool_size setting,
528 ## connections that can be opened above and beyond the pool_size setting,
541 ## which defaults to five.
529 ## which defaults to five.
542 #sqlalchemy.db1.max_overflow = 10
530 #sqlalchemy.db1.max_overflow = 10
543
531
544 ## Connection check ping, used to detect broken database connections
532 ## Connection check ping, used to detect broken database connections
545 ## could be enabled to better handle cases if MySQL has gone away errors
533 ## could be enabled to better handle cases if MySQL has gone away errors
546 #sqlalchemy.db1.ping_connection = true
534 #sqlalchemy.db1.ping_connection = true
547
535
548 ##################
536 ##################
549 ### VCS CONFIG ###
537 ### VCS CONFIG ###
550 ##################
538 ##################
551 vcs.server.enable = true
539 vcs.server.enable = true
552 vcs.server = localhost:9900
540 vcs.server = localhost:9900
553
541
554 ## Web server connectivity protocol, responsible for web based VCS operatations
542 ## Web server connectivity protocol, responsible for web based VCS operatations
555 ## Available protocols are:
543 ## Available protocols are:
556 ## `http` - use http-rpc backend (default)
544 ## `http` - use http-rpc backend (default)
557 vcs.server.protocol = http
545 vcs.server.protocol = http
558
546
559 ## Push/Pull operations protocol, available options are:
547 ## Push/Pull operations protocol, available options are:
560 ## `http` - use http-rpc backend (default)
548 ## `http` - use http-rpc backend (default)
561 vcs.scm_app_implementation = http
549 vcs.scm_app_implementation = http
562
550
563 ## Push/Pull operations hooks protocol, available options are:
551 ## Push/Pull operations hooks protocol, available options are:
564 ## `http` - use http-rpc backend (default)
552 ## `http` - use http-rpc backend (default)
565 vcs.hooks.protocol = http
553 vcs.hooks.protocol = http
566
554
567 ## Host on which this instance is listening for hooks. If vcsserver is in other location
555 ## Host on which this instance is listening for hooks. If vcsserver is in other location
568 ## this should be adjusted.
556 ## this should be adjusted.
569 vcs.hooks.host = 127.0.0.1
557 vcs.hooks.host = 127.0.0.1
570
558
571 vcs.server.log_level = debug
559 vcs.server.log_level = debug
572 ## Start VCSServer with this instance as a subprocess, useful for development
560 ## Start VCSServer with this instance as a subprocess, useful for development
573 vcs.start_server = false
561 vcs.start_server = false
574
562
575 ## List of enabled VCS backends, available options are:
563 ## List of enabled VCS backends, available options are:
576 ## `hg` - mercurial
564 ## `hg` - mercurial
577 ## `git` - git
565 ## `git` - git
578 ## `svn` - subversion
566 ## `svn` - subversion
579 vcs.backends = hg, git, svn
567 vcs.backends = hg, git, svn
580
568
581 vcs.connection_timeout = 3600
569 vcs.connection_timeout = 3600
582 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
570 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
583 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
571 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
584 #vcs.svn.compatible_version = pre-1.8-compatible
572 #vcs.svn.compatible_version = pre-1.8-compatible
585
573
586
574
587 ############################################################
575 ############################################################
588 ### Subversion proxy support (mod_dav_svn) ###
576 ### Subversion proxy support (mod_dav_svn) ###
589 ### Maps RhodeCode repo groups into SVN paths for Apache ###
577 ### Maps RhodeCode repo groups into SVN paths for Apache ###
590 ############################################################
578 ############################################################
591 ## Enable or disable the config file generation.
579 ## Enable or disable the config file generation.
592 svn.proxy.generate_config = false
580 svn.proxy.generate_config = false
593 ## Generate config file with `SVNListParentPath` set to `On`.
581 ## Generate config file with `SVNListParentPath` set to `On`.
594 svn.proxy.list_parent_path = true
582 svn.proxy.list_parent_path = true
595 ## Set location and file name of generated config file.
583 ## Set location and file name of generated config file.
596 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
584 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
597 ## alternative mod_dav config template. This needs to be a mako template
585 ## alternative mod_dav config template. This needs to be a mako template
598 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
586 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
599 ## Used as a prefix to the `Location` block in the generated config file.
587 ## Used as a prefix to the `Location` block in the generated config file.
600 ## In most cases it should be set to `/`.
588 ## In most cases it should be set to `/`.
601 svn.proxy.location_root = /
589 svn.proxy.location_root = /
602 ## Command to reload the mod dav svn configuration on change.
590 ## Command to reload the mod dav svn configuration on change.
603 ## Example: `/etc/init.d/apache2 reload`
591 ## Example: `/etc/init.d/apache2 reload`
604 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
592 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
605 ## If the timeout expires before the reload command finishes, the command will
593 ## If the timeout expires before the reload command finishes, the command will
606 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
594 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
607 #svn.proxy.reload_timeout = 10
595 #svn.proxy.reload_timeout = 10
608
596
609 ############################################################
597 ############################################################
610 ### SSH Support Settings ###
598 ### SSH Support Settings ###
611 ############################################################
599 ############################################################
612
600
613 ## Defines if a custom authorized_keys file should be created and written on
601 ## Defines if a custom authorized_keys file should be created and written on
614 ## any change user ssh keys. Setting this to false also disables posibility
602 ## any change user ssh keys. Setting this to false also disables posibility
615 ## of adding SSH keys by users from web interface. Super admins can still
603 ## of adding SSH keys by users from web interface. Super admins can still
616 ## manage SSH Keys.
604 ## manage SSH Keys.
617 ssh.generate_authorized_keyfile = false
605 ssh.generate_authorized_keyfile = false
618
606
619 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
607 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
620 # ssh.authorized_keys_ssh_opts =
608 # ssh.authorized_keys_ssh_opts =
621
609
622 ## Path to the authrozied_keys file where the generate entries are placed.
610 ## Path to the authrozied_keys file where the generate entries are placed.
623 ## It is possible to have multiple key files specified in `sshd_config` e.g.
611 ## It is possible to have multiple key files specified in `sshd_config` e.g.
624 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
612 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
625 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
613 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
626
614
627 ## Command to execute the SSH wrapper. The binary is available in the
615 ## Command to execute the SSH wrapper. The binary is available in the
628 ## rhodecode installation directory.
616 ## rhodecode installation directory.
629 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
617 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
630 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
618 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
631
619
632 ## Allow shell when executing the ssh-wrapper command
620 ## Allow shell when executing the ssh-wrapper command
633 ssh.wrapper_cmd_allow_shell = false
621 ssh.wrapper_cmd_allow_shell = false
634
622
635 ## Enables logging, and detailed output send back to the client during SSH
623 ## Enables logging, and detailed output send back to the client during SSH
636 ## operations. Usefull for debugging, shouldn't be used in production.
624 ## operations. Usefull for debugging, shouldn't be used in production.
637 ssh.enable_debug_logging = true
625 ssh.enable_debug_logging = true
638
626
639 ## Paths to binary executable, by default they are the names, but we can
627 ## Paths to binary executable, by default they are the names, but we can
640 ## override them if we want to use a custom one
628 ## override them if we want to use a custom one
641 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
629 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
642 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
630 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
643 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
631 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
644
632
645
633
646 ## Dummy marker to add new entries after.
634 ## Dummy marker to add new entries after.
647 ## Add any custom entries below. Please don't remove.
635 ## Add any custom entries below. Please don't remove.
648 custom.conf = 1
636 custom.conf = 1
649
637
650
638
651 ################################
639 ################################
652 ### LOGGING CONFIGURATION ####
640 ### LOGGING CONFIGURATION ####
653 ################################
641 ################################
654 [loggers]
642 [loggers]
655 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
643 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
656
644
657 [handlers]
645 [handlers]
658 keys = console, console_sql
646 keys = console, console_sql
659
647
660 [formatters]
648 [formatters]
661 keys = generic, color_formatter, color_formatter_sql
649 keys = generic, color_formatter, color_formatter_sql
662
650
663 #############
651 #############
664 ## LOGGERS ##
652 ## LOGGERS ##
665 #############
653 #############
666 [logger_root]
654 [logger_root]
667 level = NOTSET
655 level = NOTSET
668 handlers = console
656 handlers = console
669
657
670 [logger_sqlalchemy]
658 [logger_sqlalchemy]
671 level = INFO
659 level = INFO
672 handlers = console_sql
660 handlers = console_sql
673 qualname = sqlalchemy.engine
661 qualname = sqlalchemy.engine
674 propagate = 0
662 propagate = 0
675
663
676 [logger_beaker]
664 [logger_beaker]
677 level = DEBUG
665 level = DEBUG
678 handlers =
666 handlers =
679 qualname = beaker.container
667 qualname = beaker.container
680 propagate = 1
668 propagate = 1
681
669
682 [logger_rhodecode]
670 [logger_rhodecode]
683 level = DEBUG
671 level = DEBUG
684 handlers =
672 handlers =
685 qualname = rhodecode
673 qualname = rhodecode
686 propagate = 1
674 propagate = 1
687
675
688 [logger_ssh_wrapper]
676 [logger_ssh_wrapper]
689 level = DEBUG
677 level = DEBUG
690 handlers =
678 handlers =
691 qualname = ssh_wrapper
679 qualname = ssh_wrapper
692 propagate = 1
680 propagate = 1
693
681
694 [logger_celery]
682 [logger_celery]
695 level = DEBUG
683 level = DEBUG
696 handlers =
684 handlers =
697 qualname = celery
685 qualname = celery
698
686
699
687
700 ##############
688 ##############
701 ## HANDLERS ##
689 ## HANDLERS ##
702 ##############
690 ##############
703
691
704 [handler_console]
692 [handler_console]
705 class = StreamHandler
693 class = StreamHandler
706 args = (sys.stderr, )
694 args = (sys.stderr, )
707 level = DEBUG
695 level = DEBUG
708 formatter = color_formatter
696 formatter = color_formatter
709
697
710 [handler_console_sql]
698 [handler_console_sql]
711 # "level = DEBUG" logs SQL queries and results.
699 # "level = DEBUG" logs SQL queries and results.
712 # "level = INFO" logs SQL queries.
700 # "level = INFO" logs SQL queries.
713 # "level = WARN" logs neither. (Recommended for production systems.)
701 # "level = WARN" logs neither. (Recommended for production systems.)
714 class = StreamHandler
702 class = StreamHandler
715 args = (sys.stderr, )
703 args = (sys.stderr, )
716 level = WARN
704 level = WARN
717 formatter = color_formatter_sql
705 formatter = color_formatter_sql
718
706
719 ################
707 ################
720 ## FORMATTERS ##
708 ## FORMATTERS ##
721 ################
709 ################
722
710
723 [formatter_generic]
711 [formatter_generic]
724 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
712 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
725 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
713 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
726 datefmt = %Y-%m-%d %H:%M:%S
714 datefmt = %Y-%m-%d %H:%M:%S
727
715
728 [formatter_color_formatter]
716 [formatter_color_formatter]
729 class = rhodecode.lib.logging_formatter.ColorFormatter
717 class = rhodecode.lib.logging_formatter.ColorFormatter
730 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
718 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
731 datefmt = %Y-%m-%d %H:%M:%S
719 datefmt = %Y-%m-%d %H:%M:%S
732
720
733 [formatter_color_formatter_sql]
721 [formatter_color_formatter_sql]
734 class = rhodecode.lib.logging_formatter.ColorFormatterSql
722 class = rhodecode.lib.logging_formatter.ColorFormatterSql
735 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
723 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
736 datefmt = %Y-%m-%d %H:%M:%S
724 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,708 +1,697 b''
1
1
2
2
3 ################################################################################
3 ################################################################################
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 ################################################################################
5 ################################################################################
6
6
7 [DEFAULT]
7 [DEFAULT]
8 debug = true
8 debug = true
9
9
10 ################################################################################
10 ################################################################################
11 ## EMAIL CONFIGURATION ##
11 ## EMAIL CONFIGURATION ##
12 ## Uncomment and replace with the email address which should receive ##
12 ## Uncomment and replace with the email address which should receive ##
13 ## any error reports after an application crash ##
13 ## any error reports after an application crash ##
14 ## Additionally these settings will be used by the RhodeCode mailing system ##
14 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16
16
17 ## prefix all emails subjects with given prefix, helps filtering out emails
17 ## prefix all emails subjects with given prefix, helps filtering out emails
18 #email_prefix = [RhodeCode]
18 #email_prefix = [RhodeCode]
19
19
20 ## email FROM address all mails will be sent
20 ## email FROM address all mails will be sent
21 #app_email_from = rhodecode-noreply@localhost
21 #app_email_from = rhodecode-noreply@localhost
22
22
23 ## Uncomment and replace with the address which should receive any error report
24 ## note: using appenlight for error handling doesn't need this to be uncommented
25 #email_to = admin@localhost
26
27 ## in case of Application errors, sent an error email form
28 #error_email_from = rhodecode_error@localhost
29
30 ## additional error message to be send in case of server crash
31 #error_message =
32
33
34 #smtp_server = mail.server.com
23 #smtp_server = mail.server.com
35 #smtp_username =
24 #smtp_username =
36 #smtp_password =
25 #smtp_password =
37 #smtp_port =
26 #smtp_port =
38 #smtp_use_tls = false
27 #smtp_use_tls = false
39 #smtp_use_ssl = true
28 #smtp_use_ssl = true
40 ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
41 #smtp_auth =
30 #smtp_auth =
42
31
43 [server:main]
32 [server:main]
44 ## COMMON ##
33 ## COMMON ##
45 host = 127.0.0.1
34 host = 127.0.0.1
46 port = 5000
35 port = 5000
47
36
48 ###########################################################
37 ###########################################################
49 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 ## WAITRESS WSGI SERVER - Recommended for Development ####
50 ###########################################################
39 ###########################################################
51
40
52 #use = egg:waitress#main
41 #use = egg:waitress#main
53 ## number of worker threads
42 ## number of worker threads
54 #threads = 5
43 #threads = 5
55 ## MAX BODY SIZE 100GB
44 ## MAX BODY SIZE 100GB
56 #max_request_body_size = 107374182400
45 #max_request_body_size = 107374182400
57 ## Use poll instead of select, fixes file descriptors limits problems.
46 ## Use poll instead of select, fixes file descriptors limits problems.
58 ## May not work on old windows systems.
47 ## May not work on old windows systems.
59 #asyncore_use_poll = true
48 #asyncore_use_poll = true
60
49
61
50
62 ##########################
51 ##########################
63 ## GUNICORN WSGI SERVER ##
52 ## GUNICORN WSGI SERVER ##
64 ##########################
53 ##########################
65 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
66
55
67 use = egg:gunicorn#main
56 use = egg:gunicorn#main
68 ## Sets the number of process workers. More workers means more concurent connections
57 ## Sets the number of process workers. More workers means more concurent connections
69 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 ## RhodeCode can handle at the same time. Each additional worker also it increases
70 ## memory usage as each has it's own set of caches.
59 ## memory usage as each has it's own set of caches.
71 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
72 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
73 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
74 ## when using more than 1 worker.
63 ## when using more than 1 worker.
75 workers = 2
64 workers = 2
76 ## process name visible in process list
65 ## process name visible in process list
77 proc_name = rhodecode
66 proc_name = rhodecode
78 ## type of worker class, one of sync, gevent
67 ## type of worker class, one of sync, gevent
79 ## recommended for bigger setup is using of of other than sync one
68 ## recommended for bigger setup is using of of other than sync one
80 worker_class = gevent
69 worker_class = gevent
81 ## The maximum number of simultaneous clients. Valid only for Gevent
70 ## The maximum number of simultaneous clients. Valid only for Gevent
82 worker_connections = 10
71 worker_connections = 10
83 ## max number of requests that worker will handle before being gracefully
72 ## max number of requests that worker will handle before being gracefully
84 ## restarted, could prevent memory leaks
73 ## restarted, could prevent memory leaks
85 max_requests = 1000
74 max_requests = 1000
86 max_requests_jitter = 30
75 max_requests_jitter = 30
87 ## amount of time a worker can spend with handling a request before it
76 ## amount of time a worker can spend with handling a request before it
88 ## gets killed and restarted. Set to 6hrs
77 ## gets killed and restarted. Set to 6hrs
89 timeout = 21600
78 timeout = 21600
90
79
91
80
92 ## prefix middleware for RhodeCode.
81 ## prefix middleware for RhodeCode.
93 ## recommended when using proxy setup.
82 ## recommended when using proxy setup.
94 ## allows to set RhodeCode under a prefix in server.
83 ## allows to set RhodeCode under a prefix in server.
95 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
84 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
96 ## And set your prefix like: `prefix = /custom_prefix`
85 ## And set your prefix like: `prefix = /custom_prefix`
97 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
86 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
98 ## to make your cookies only work on prefix url
87 ## to make your cookies only work on prefix url
99 [filter:proxy-prefix]
88 [filter:proxy-prefix]
100 use = egg:PasteDeploy#prefix
89 use = egg:PasteDeploy#prefix
101 prefix = /
90 prefix = /
102
91
103 [app:main]
92 [app:main]
104 ## The %(here)s variable will be replaced with the absolute path of parent directory
93 ## The %(here)s variable will be replaced with the absolute path of parent directory
105 ## of this file
94 ## of this file
106 ## In addition ENVIRONMENT variables usage is possible, e.g
95 ## In addition ENVIRONMENT variables usage is possible, e.g
107 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
96 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
108
97
109 use = egg:rhodecode-enterprise-ce
98 use = egg:rhodecode-enterprise-ce
110
99
111 ## enable proxy prefix middleware, defined above
100 ## enable proxy prefix middleware, defined above
112 #filter-with = proxy-prefix
101 #filter-with = proxy-prefix
113
102
114 ## encryption key used to encrypt social plugin tokens,
103 ## encryption key used to encrypt social plugin tokens,
115 ## remote_urls with credentials etc, if not set it defaults to
104 ## remote_urls with credentials etc, if not set it defaults to
116 ## `beaker.session.secret`
105 ## `beaker.session.secret`
117 #rhodecode.encrypted_values.secret =
106 #rhodecode.encrypted_values.secret =
118
107
119 ## decryption strict mode (enabled by default). It controls if decryption raises
108 ## decryption strict mode (enabled by default). It controls if decryption raises
120 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
109 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
121 #rhodecode.encrypted_values.strict = false
110 #rhodecode.encrypted_values.strict = false
122
111
123 ## return gzipped responses from Rhodecode (static files/application)
112 ## return gzipped responses from Rhodecode (static files/application)
124 gzip_responses = false
113 gzip_responses = false
125
114
126 ## autogenerate javascript routes file on startup
115 ## autogenerate javascript routes file on startup
127 generate_js_files = false
116 generate_js_files = false
128
117
129 ## System global default language.
118 ## System global default language.
130 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
119 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
131 lang = en
120 lang = en
132
121
133 ## Perform a full repository scan and import on each server start.
122 ## Perform a full repository scan and import on each server start.
134 ## Settings this to true could lead to very long startup time.
123 ## Settings this to true could lead to very long startup time.
135 startup.import_repos = false
124 startup.import_repos = false
136
125
137 ## Uncomment and set this path to use archive download cache.
126 ## Uncomment and set this path to use archive download cache.
138 ## Once enabled, generated archives will be cached at this location
127 ## Once enabled, generated archives will be cached at this location
139 ## and served from the cache during subsequent requests for the same archive of
128 ## and served from the cache during subsequent requests for the same archive of
140 ## the repository.
129 ## the repository.
141 #archive_cache_dir = /tmp/tarballcache
130 #archive_cache_dir = /tmp/tarballcache
142
131
143 ## URL at which the application is running. This is used for bootstraping
132 ## URL at which the application is running. This is used for bootstraping
144 ## requests in context when no web request is available. Used in ishell, or
133 ## requests in context when no web request is available. Used in ishell, or
145 ## SSH calls. Set this for events to receive proper url for SSH calls.
134 ## SSH calls. Set this for events to receive proper url for SSH calls.
146 app.base_url = http://rhodecode.local
135 app.base_url = http://rhodecode.local
147
136
148 ## Unique application ID. Should be a random unique string for security.
137 ## Unique application ID. Should be a random unique string for security.
149 app_instance_uuid = rc-production
138 app_instance_uuid = rc-production
150
139
151 ## Cut off limit for large diffs (size in bytes). If overall diff size on
140 ## Cut off limit for large diffs (size in bytes). If overall diff size on
152 ## commit, or pull request exceeds this limit this diff will be displayed
141 ## commit, or pull request exceeds this limit this diff will be displayed
153 ## partially. E.g 512000 == 512Kb
142 ## partially. E.g 512000 == 512Kb
154 cut_off_limit_diff = 512000
143 cut_off_limit_diff = 512000
155
144
156 ## Cut off limit for large files inside diffs (size in bytes). Each individual
145 ## Cut off limit for large files inside diffs (size in bytes). Each individual
157 ## file inside diff which exceeds this limit will be displayed partially.
146 ## file inside diff which exceeds this limit will be displayed partially.
158 ## E.g 128000 == 128Kb
147 ## E.g 128000 == 128Kb
159 cut_off_limit_file = 128000
148 cut_off_limit_file = 128000
160
149
161 ## use cached version of vcs repositories everywhere. Recommended to be `true`
150 ## use cached version of vcs repositories everywhere. Recommended to be `true`
162 vcs_full_cache = true
151 vcs_full_cache = true
163
152
164 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
153 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
165 ## Normally this is controlled by proper http flags sent from http server
154 ## Normally this is controlled by proper http flags sent from http server
166 force_https = false
155 force_https = false
167
156
168 ## use Strict-Transport-Security headers
157 ## use Strict-Transport-Security headers
169 use_htsts = false
158 use_htsts = false
170
159
171 ## git rev filter option, --all is the default filter, if you need to
160 ## git rev filter option, --all is the default filter, if you need to
172 ## hide all refs in changelog switch this to --branches --tags
161 ## hide all refs in changelog switch this to --branches --tags
173 git_rev_filter = --branches --tags
162 git_rev_filter = --branches --tags
174
163
175 # Set to true if your repos are exposed using the dumb protocol
164 # Set to true if your repos are exposed using the dumb protocol
176 git_update_server_info = false
165 git_update_server_info = false
177
166
178 ## RSS/ATOM feed options
167 ## RSS/ATOM feed options
179 rss_cut_off_limit = 256000
168 rss_cut_off_limit = 256000
180 rss_items_per_page = 10
169 rss_items_per_page = 10
181 rss_include_diff = false
170 rss_include_diff = false
182
171
183 ## gist URL alias, used to create nicer urls for gist. This should be an
172 ## gist URL alias, used to create nicer urls for gist. This should be an
184 ## url that does rewrites to _admin/gists/{gistid}.
173 ## url that does rewrites to _admin/gists/{gistid}.
185 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
174 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
186 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
175 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
187 gist_alias_url =
176 gist_alias_url =
188
177
189 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
178 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
190 ## used for access.
179 ## used for access.
191 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
180 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
192 ## came from the the logged in user who own this authentication token.
181 ## came from the the logged in user who own this authentication token.
193 ## Additionally @TOKEN syntaxt can be used to bound the view to specific
182 ## Additionally @TOKEN syntaxt can be used to bound the view to specific
194 ## authentication token. Such view would be only accessible when used together
183 ## authentication token. Such view would be only accessible when used together
195 ## with this authentication token
184 ## with this authentication token
196 ##
185 ##
197 ## list of all views can be found under `/_admin/permissions/auth_token_access`
186 ## list of all views can be found under `/_admin/permissions/auth_token_access`
198 ## The list should be "," separated and on a single line.
187 ## The list should be "," separated and on a single line.
199 ##
188 ##
200 ## Most common views to enable:
189 ## Most common views to enable:
201 # RepoCommitsView:repo_commit_download
190 # RepoCommitsView:repo_commit_download
202 # RepoCommitsView:repo_commit_patch
191 # RepoCommitsView:repo_commit_patch
203 # RepoCommitsView:repo_commit_raw
192 # RepoCommitsView:repo_commit_raw
204 # RepoCommitsView:repo_commit_raw@TOKEN
193 # RepoCommitsView:repo_commit_raw@TOKEN
205 # RepoFilesView:repo_files_diff
194 # RepoFilesView:repo_files_diff
206 # RepoFilesView:repo_archivefile
195 # RepoFilesView:repo_archivefile
207 # RepoFilesView:repo_file_raw
196 # RepoFilesView:repo_file_raw
208 # GistView:*
197 # GistView:*
209 api_access_controllers_whitelist =
198 api_access_controllers_whitelist =
210
199
211 ## Default encoding used to convert from and to unicode
200 ## Default encoding used to convert from and to unicode
212 ## can be also a comma separated list of encoding in case of mixed encodings
201 ## can be also a comma separated list of encoding in case of mixed encodings
213 default_encoding = UTF-8
202 default_encoding = UTF-8
214
203
215 ## instance-id prefix
204 ## instance-id prefix
216 ## a prefix key for this instance used for cache invalidation when running
205 ## a prefix key for this instance used for cache invalidation when running
217 ## multiple instances of rhodecode, make sure it's globally unique for
206 ## multiple instances of rhodecode, make sure it's globally unique for
218 ## all running rhodecode instances. Leave empty if you don't use it
207 ## all running rhodecode instances. Leave empty if you don't use it
219 instance_id =
208 instance_id =
220
209
221 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
210 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
222 ## of an authentication plugin also if it is disabled by it's settings.
211 ## of an authentication plugin also if it is disabled by it's settings.
223 ## This could be useful if you are unable to log in to the system due to broken
212 ## This could be useful if you are unable to log in to the system due to broken
224 ## authentication settings. Then you can enable e.g. the internal rhodecode auth
213 ## authentication settings. Then you can enable e.g. the internal rhodecode auth
225 ## module to log in again and fix the settings.
214 ## module to log in again and fix the settings.
226 ##
215 ##
227 ## Available builtin plugin IDs (hash is part of the ID):
216 ## Available builtin plugin IDs (hash is part of the ID):
228 ## egg:rhodecode-enterprise-ce#rhodecode
217 ## egg:rhodecode-enterprise-ce#rhodecode
229 ## egg:rhodecode-enterprise-ce#pam
218 ## egg:rhodecode-enterprise-ce#pam
230 ## egg:rhodecode-enterprise-ce#ldap
219 ## egg:rhodecode-enterprise-ce#ldap
231 ## egg:rhodecode-enterprise-ce#jasig_cas
220 ## egg:rhodecode-enterprise-ce#jasig_cas
232 ## egg:rhodecode-enterprise-ce#headers
221 ## egg:rhodecode-enterprise-ce#headers
233 ## egg:rhodecode-enterprise-ce#crowd
222 ## egg:rhodecode-enterprise-ce#crowd
234 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
223 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
235
224
236 ## alternative return HTTP header for failed authentication. Default HTTP
225 ## alternative return HTTP header for failed authentication. Default HTTP
237 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
226 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
238 ## handling that causing a series of failed authentication calls.
227 ## handling that causing a series of failed authentication calls.
239 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
228 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
240 ## This will be served instead of default 401 on bad authnetication
229 ## This will be served instead of default 401 on bad authnetication
241 auth_ret_code =
230 auth_ret_code =
242
231
243 ## use special detection method when serving auth_ret_code, instead of serving
232 ## use special detection method when serving auth_ret_code, instead of serving
244 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
233 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
245 ## and then serve auth_ret_code to clients
234 ## and then serve auth_ret_code to clients
246 auth_ret_code_detection = false
235 auth_ret_code_detection = false
247
236
248 ## locking return code. When repository is locked return this HTTP code. 2XX
237 ## locking return code. When repository is locked return this HTTP code. 2XX
249 ## codes don't break the transactions while 4XX codes do
238 ## codes don't break the transactions while 4XX codes do
250 lock_ret_code = 423
239 lock_ret_code = 423
251
240
252 ## allows to change the repository location in settings page
241 ## allows to change the repository location in settings page
253 allow_repo_location_change = true
242 allow_repo_location_change = true
254
243
255 ## allows to setup custom hooks in settings page
244 ## allows to setup custom hooks in settings page
256 allow_custom_hooks_settings = true
245 allow_custom_hooks_settings = true
257
246
258 ## Generated license token required for EE edition license.
247 ## Generated license token required for EE edition license.
259 ## New generated token value can be found in Admin > settings > license page.
248 ## New generated token value can be found in Admin > settings > license page.
260 license_token =
249 license_token =
261
250
262 ## supervisor connection uri, for managing supervisor and logs.
251 ## supervisor connection uri, for managing supervisor and logs.
263 supervisor.uri =
252 supervisor.uri =
264 ## supervisord group name/id we only want this RC instance to handle
253 ## supervisord group name/id we only want this RC instance to handle
265 supervisor.group_id = prod
254 supervisor.group_id = prod
266
255
267 ## Display extended labs settings
256 ## Display extended labs settings
268 labs_settings_active = true
257 labs_settings_active = true
269
258
270 ## custom exception store path, defaults to TMPDIR
259 ## custom exception store path, defaults to TMPDIR
271 exception_store_path =
260 exception_tracker.store_path =
272
261
273
262
274 ####################################
263 ####################################
275 ### CELERY CONFIG ####
264 ### CELERY CONFIG ####
276 ####################################
265 ####################################
277 ## run: /path/to/celery worker \
266 ## run: /path/to/celery worker \
278 ## -E --beat --app rhodecode.lib.celerylib.loader \
267 ## -E --beat --app rhodecode.lib.celerylib.loader \
279 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
268 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
280 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
269 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
281
270
282 use_celery = false
271 use_celery = false
283
272
284 ## connection url to the message broker (default rabbitmq)
273 ## connection url to the message broker (default rabbitmq)
285 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
274 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
286
275
287 ## maximum tasks to execute before worker restart
276 ## maximum tasks to execute before worker restart
288 celery.max_tasks_per_child = 100
277 celery.max_tasks_per_child = 100
289
278
290 ## tasks will never be sent to the queue, but executed locally instead.
279 ## tasks will never be sent to the queue, but executed locally instead.
291 celery.task_always_eager = false
280 celery.task_always_eager = false
292
281
293 #####################################
282 #####################################
294 ### DOGPILE CACHE ####
283 ### DOGPILE CACHE ####
295 #####################################
284 #####################################
296 ## Default cache dir for caches. Putting this into a ramdisk
285 ## Default cache dir for caches. Putting this into a ramdisk
297 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
286 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
298 ## large amount of space
287 ## large amount of space
299 cache_dir = %(here)s/data
288 cache_dir = %(here)s/data
300
289
301 ## `cache_perms` cache settings for permission tree, auth TTL.
290 ## `cache_perms` cache settings for permission tree, auth TTL.
302 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
291 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
303 rc_cache.cache_perms.expiration_time = 300
292 rc_cache.cache_perms.expiration_time = 300
304
293
305 ## alternative `cache_perms` redis backend with distributed lock
294 ## alternative `cache_perms` redis backend with distributed lock
306 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
295 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
307 #rc_cache.cache_perms.expiration_time = 300
296 #rc_cache.cache_perms.expiration_time = 300
308 ## redis_expiration_time needs to be greater then expiration_time
297 ## redis_expiration_time needs to be greater then expiration_time
309 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
298 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
310 #rc_cache.cache_perms.arguments.socket_timeout = 30
299 #rc_cache.cache_perms.arguments.socket_timeout = 30
311 #rc_cache.cache_perms.arguments.host = localhost
300 #rc_cache.cache_perms.arguments.host = localhost
312 #rc_cache.cache_perms.arguments.port = 6379
301 #rc_cache.cache_perms.arguments.port = 6379
313 #rc_cache.cache_perms.arguments.db = 0
302 #rc_cache.cache_perms.arguments.db = 0
314 #rc_cache.cache_perms.arguments.distributed_lock = true
303 #rc_cache.cache_perms.arguments.distributed_lock = true
315
304
316 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
305 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
317 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
306 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
318 rc_cache.cache_repo.expiration_time = 2592000
307 rc_cache.cache_repo.expiration_time = 2592000
319
308
320 ## alternative `cache_repo` redis backend with distributed lock
309 ## alternative `cache_repo` redis backend with distributed lock
321 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
310 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
322 #rc_cache.cache_repo.expiration_time = 2592000
311 #rc_cache.cache_repo.expiration_time = 2592000
323 ## redis_expiration_time needs to be greater then expiration_time
312 ## redis_expiration_time needs to be greater then expiration_time
324 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
313 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
325 #rc_cache.cache_repo.arguments.socket_timeout = 30
314 #rc_cache.cache_repo.arguments.socket_timeout = 30
326 #rc_cache.cache_repo.arguments.host = localhost
315 #rc_cache.cache_repo.arguments.host = localhost
327 #rc_cache.cache_repo.arguments.port = 6379
316 #rc_cache.cache_repo.arguments.port = 6379
328 #rc_cache.cache_repo.arguments.db = 1
317 #rc_cache.cache_repo.arguments.db = 1
329 #rc_cache.cache_repo.arguments.distributed_lock = true
318 #rc_cache.cache_repo.arguments.distributed_lock = true
330
319
331 ## cache settings for SQL queries, this needs to use memory type backend
320 ## cache settings for SQL queries, this needs to use memory type backend
332 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
321 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
333 rc_cache.sql_cache_short.expiration_time = 30
322 rc_cache.sql_cache_short.expiration_time = 30
334
323
335 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
324 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
336 ## type backend as the objects kept are not pickle serializable
325 ## type backend as the objects kept are not pickle serializable
337 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
326 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
338 ## by default we use 96H, this is using invalidation on push anyway
327 ## by default we use 96H, this is using invalidation on push anyway
339 rc_cache.cache_repo_longterm.expiration_time = 345600
328 rc_cache.cache_repo_longterm.expiration_time = 345600
340 ## max items in LRU cache, reduce this number to save memory, and expire last used
329 ## max items in LRU cache, reduce this number to save memory, and expire last used
341 ## cached objects
330 ## cached objects
342 rc_cache.cache_repo_longterm.max_size = 10000
331 rc_cache.cache_repo_longterm.max_size = 10000
343
332
344
333
345 ####################################
334 ####################################
346 ### BEAKER SESSION ####
335 ### BEAKER SESSION ####
347 ####################################
336 ####################################
348
337
349 ## .session.type is type of storage options for the session, current allowed
338 ## .session.type is type of storage options for the session, current allowed
350 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
339 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
351 beaker.session.type = file
340 beaker.session.type = file
352 beaker.session.data_dir = %(here)s/data/sessions
341 beaker.session.data_dir = %(here)s/data/sessions
353
342
354 ## db based session, fast, and allows easy management over logged in users
343 ## db based session, fast, and allows easy management over logged in users
355 #beaker.session.type = ext:database
344 #beaker.session.type = ext:database
356 #beaker.session.table_name = db_session
345 #beaker.session.table_name = db_session
357 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
346 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
358 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
347 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
359 #beaker.session.sa.pool_recycle = 3600
348 #beaker.session.sa.pool_recycle = 3600
360 #beaker.session.sa.echo = false
349 #beaker.session.sa.echo = false
361
350
362 beaker.session.key = rhodecode
351 beaker.session.key = rhodecode
363 beaker.session.secret = production-rc-uytcxaz
352 beaker.session.secret = production-rc-uytcxaz
364 beaker.session.lock_dir = %(here)s/data/sessions/lock
353 beaker.session.lock_dir = %(here)s/data/sessions/lock
365
354
366 ## Secure encrypted cookie. Requires AES and AES python libraries
355 ## Secure encrypted cookie. Requires AES and AES python libraries
367 ## you must disable beaker.session.secret to use this
356 ## you must disable beaker.session.secret to use this
368 #beaker.session.encrypt_key = key_for_encryption
357 #beaker.session.encrypt_key = key_for_encryption
369 #beaker.session.validate_key = validation_key
358 #beaker.session.validate_key = validation_key
370
359
371 ## sets session as invalid(also logging out user) if it haven not been
360 ## sets session as invalid(also logging out user) if it haven not been
372 ## accessed for given amount of time in seconds
361 ## accessed for given amount of time in seconds
373 beaker.session.timeout = 2592000
362 beaker.session.timeout = 2592000
374 beaker.session.httponly = true
363 beaker.session.httponly = true
375 ## Path to use for the cookie. Set to prefix if you use prefix middleware
364 ## Path to use for the cookie. Set to prefix if you use prefix middleware
376 #beaker.session.cookie_path = /custom_prefix
365 #beaker.session.cookie_path = /custom_prefix
377
366
378 ## uncomment for https secure cookie
367 ## uncomment for https secure cookie
379 beaker.session.secure = false
368 beaker.session.secure = false
380
369
381 ## auto save the session to not to use .save()
370 ## auto save the session to not to use .save()
382 beaker.session.auto = false
371 beaker.session.auto = false
383
372
384 ## default cookie expiration time in seconds, set to `true` to set expire
373 ## default cookie expiration time in seconds, set to `true` to set expire
385 ## at browser close
374 ## at browser close
386 #beaker.session.cookie_expires = 3600
375 #beaker.session.cookie_expires = 3600
387
376
388 ###################################
377 ###################################
389 ## SEARCH INDEXING CONFIGURATION ##
378 ## SEARCH INDEXING CONFIGURATION ##
390 ###################################
379 ###################################
391 ## Full text search indexer is available in rhodecode-tools under
380 ## Full text search indexer is available in rhodecode-tools under
392 ## `rhodecode-tools index` command
381 ## `rhodecode-tools index` command
393
382
394 ## WHOOSH Backend, doesn't require additional services to run
383 ## WHOOSH Backend, doesn't require additional services to run
395 ## it works good with few dozen repos
384 ## it works good with few dozen repos
396 search.module = rhodecode.lib.index.whoosh
385 search.module = rhodecode.lib.index.whoosh
397 search.location = %(here)s/data/index
386 search.location = %(here)s/data/index
398
387
399 ########################################
388 ########################################
400 ### CHANNELSTREAM CONFIG ####
389 ### CHANNELSTREAM CONFIG ####
401 ########################################
390 ########################################
402 ## channelstream enables persistent connections and live notification
391 ## channelstream enables persistent connections and live notification
403 ## in the system. It's also used by the chat system
392 ## in the system. It's also used by the chat system
404 channelstream.enabled = false
393 channelstream.enabled = false
405
394
406 ## server address for channelstream server on the backend
395 ## server address for channelstream server on the backend
407 channelstream.server = 127.0.0.1:9800
396 channelstream.server = 127.0.0.1:9800
408
397
409 ## location of the channelstream server from outside world
398 ## location of the channelstream server from outside world
410 ## use ws:// for http or wss:// for https. This address needs to be handled
399 ## use ws:// for http or wss:// for https. This address needs to be handled
411 ## by external HTTP server such as Nginx or Apache
400 ## by external HTTP server such as Nginx or Apache
412 ## see nginx/apache configuration examples in our docs
401 ## see nginx/apache configuration examples in our docs
413 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
402 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
414 channelstream.secret = secret
403 channelstream.secret = secret
415 channelstream.history.location = %(here)s/channelstream_history
404 channelstream.history.location = %(here)s/channelstream_history
416
405
417 ## Internal application path that Javascript uses to connect into.
406 ## Internal application path that Javascript uses to connect into.
418 ## If you use proxy-prefix the prefix should be added before /_channelstream
407 ## If you use proxy-prefix the prefix should be added before /_channelstream
419 channelstream.proxy_path = /_channelstream
408 channelstream.proxy_path = /_channelstream
420
409
421
410
422 ###################################
411 ###################################
423 ## APPENLIGHT CONFIG ##
412 ## APPENLIGHT CONFIG ##
424 ###################################
413 ###################################
425
414
426 ## Appenlight is tailored to work with RhodeCode, see
415 ## Appenlight is tailored to work with RhodeCode, see
427 ## http://appenlight.com for details how to obtain an account
416 ## http://appenlight.com for details how to obtain an account
428
417
429 ## appenlight integration enabled
418 ## appenlight integration enabled
430 appenlight = false
419 appenlight = false
431
420
432 appenlight.server_url = https://api.appenlight.com
421 appenlight.server_url = https://api.appenlight.com
433 appenlight.api_key = YOUR_API_KEY
422 appenlight.api_key = YOUR_API_KEY
434 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
423 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
435
424
436 # used for JS client
425 # used for JS client
437 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
426 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
438
427
439 ## TWEAK AMOUNT OF INFO SENT HERE
428 ## TWEAK AMOUNT OF INFO SENT HERE
440
429
441 ## enables 404 error logging (default False)
430 ## enables 404 error logging (default False)
442 appenlight.report_404 = false
431 appenlight.report_404 = false
443
432
444 ## time in seconds after request is considered being slow (default 1)
433 ## time in seconds after request is considered being slow (default 1)
445 appenlight.slow_request_time = 1
434 appenlight.slow_request_time = 1
446
435
447 ## record slow requests in application
436 ## record slow requests in application
448 ## (needs to be enabled for slow datastore recording and time tracking)
437 ## (needs to be enabled for slow datastore recording and time tracking)
449 appenlight.slow_requests = true
438 appenlight.slow_requests = true
450
439
451 ## enable hooking to application loggers
440 ## enable hooking to application loggers
452 appenlight.logging = true
441 appenlight.logging = true
453
442
454 ## minimum log level for log capture
443 ## minimum log level for log capture
455 appenlight.logging.level = WARNING
444 appenlight.logging.level = WARNING
456
445
457 ## send logs only from erroneous/slow requests
446 ## send logs only from erroneous/slow requests
458 ## (saves API quota for intensive logging)
447 ## (saves API quota for intensive logging)
459 appenlight.logging_on_error = false
448 appenlight.logging_on_error = false
460
449
461 ## list of additonal keywords that should be grabbed from environ object
450 ## list of additonal keywords that should be grabbed from environ object
462 ## can be string with comma separated list of words in lowercase
451 ## can be string with comma separated list of words in lowercase
463 ## (by default client will always send following info:
452 ## (by default client will always send following info:
464 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
453 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
465 ## start with HTTP* this list be extended with additional keywords here
454 ## start with HTTP* this list be extended with additional keywords here
466 appenlight.environ_keys_whitelist =
455 appenlight.environ_keys_whitelist =
467
456
468 ## list of keywords that should be blanked from request object
457 ## list of keywords that should be blanked from request object
469 ## can be string with comma separated list of words in lowercase
458 ## can be string with comma separated list of words in lowercase
470 ## (by default client will always blank keys that contain following words
459 ## (by default client will always blank keys that contain following words
471 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
460 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
472 ## this list be extended with additional keywords set here
461 ## this list be extended with additional keywords set here
473 appenlight.request_keys_blacklist =
462 appenlight.request_keys_blacklist =
474
463
475 ## list of namespaces that should be ignores when gathering log entries
464 ## list of namespaces that should be ignores when gathering log entries
476 ## can be string with comma separated list of namespaces
465 ## can be string with comma separated list of namespaces
477 ## (by default the client ignores own entries: appenlight_client.client)
466 ## (by default the client ignores own entries: appenlight_client.client)
478 appenlight.log_namespace_blacklist =
467 appenlight.log_namespace_blacklist =
479
468
480
469
481 ################################################################################
470 ################################################################################
482 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
471 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
483 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
472 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
484 ## execute malicious code after an exception is raised. ##
473 ## execute malicious code after an exception is raised. ##
485 ################################################################################
474 ################################################################################
486 set debug = false
475 set debug = false
487
476
488
477
489 ###########################################
478 ###########################################
490 ### MAIN RHODECODE DATABASE CONFIG ###
479 ### MAIN RHODECODE DATABASE CONFIG ###
491 ###########################################
480 ###########################################
492 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
481 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
493 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
482 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
494 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
483 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
495 # pymysql is an alternative driver for MySQL, use in case of problems with default one
484 # pymysql is an alternative driver for MySQL, use in case of problems with default one
496 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
485 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
497
486
498 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
487 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
499
488
500 # see sqlalchemy docs for other advanced settings
489 # see sqlalchemy docs for other advanced settings
501
490
502 ## print the sql statements to output
491 ## print the sql statements to output
503 sqlalchemy.db1.echo = false
492 sqlalchemy.db1.echo = false
504 ## recycle the connections after this amount of seconds
493 ## recycle the connections after this amount of seconds
505 sqlalchemy.db1.pool_recycle = 3600
494 sqlalchemy.db1.pool_recycle = 3600
506 sqlalchemy.db1.convert_unicode = true
495 sqlalchemy.db1.convert_unicode = true
507
496
508 ## the number of connections to keep open inside the connection pool.
497 ## the number of connections to keep open inside the connection pool.
509 ## 0 indicates no limit
498 ## 0 indicates no limit
510 #sqlalchemy.db1.pool_size = 5
499 #sqlalchemy.db1.pool_size = 5
511
500
512 ## the number of connections to allow in connection pool "overflow", that is
501 ## the number of connections to allow in connection pool "overflow", that is
513 ## connections that can be opened above and beyond the pool_size setting,
502 ## connections that can be opened above and beyond the pool_size setting,
514 ## which defaults to five.
503 ## which defaults to five.
515 #sqlalchemy.db1.max_overflow = 10
504 #sqlalchemy.db1.max_overflow = 10
516
505
517 ## Connection check ping, used to detect broken database connections
506 ## Connection check ping, used to detect broken database connections
518 ## could be enabled to better handle cases if MySQL has gone away errors
507 ## could be enabled to better handle cases if MySQL has gone away errors
519 #sqlalchemy.db1.ping_connection = true
508 #sqlalchemy.db1.ping_connection = true
520
509
521 ##################
510 ##################
522 ### VCS CONFIG ###
511 ### VCS CONFIG ###
523 ##################
512 ##################
524 vcs.server.enable = true
513 vcs.server.enable = true
525 vcs.server = localhost:9900
514 vcs.server = localhost:9900
526
515
527 ## Web server connectivity protocol, responsible for web based VCS operatations
516 ## Web server connectivity protocol, responsible for web based VCS operatations
528 ## Available protocols are:
517 ## Available protocols are:
529 ## `http` - use http-rpc backend (default)
518 ## `http` - use http-rpc backend (default)
530 vcs.server.protocol = http
519 vcs.server.protocol = http
531
520
532 ## Push/Pull operations protocol, available options are:
521 ## Push/Pull operations protocol, available options are:
533 ## `http` - use http-rpc backend (default)
522 ## `http` - use http-rpc backend (default)
534 vcs.scm_app_implementation = http
523 vcs.scm_app_implementation = http
535
524
536 ## Push/Pull operations hooks protocol, available options are:
525 ## Push/Pull operations hooks protocol, available options are:
537 ## `http` - use http-rpc backend (default)
526 ## `http` - use http-rpc backend (default)
538 vcs.hooks.protocol = http
527 vcs.hooks.protocol = http
539 ## Host on which this instance is listening for hooks. If vcsserver is in other location
528 ## Host on which this instance is listening for hooks. If vcsserver is in other location
540 ## this should be adjusted.
529 ## this should be adjusted.
541 vcs.hooks.host = 127.0.0.1
530 vcs.hooks.host = 127.0.0.1
542
531
543 vcs.server.log_level = info
532 vcs.server.log_level = info
544 ## Start VCSServer with this instance as a subprocess, useful for development
533 ## Start VCSServer with this instance as a subprocess, useful for development
545 vcs.start_server = false
534 vcs.start_server = false
546
535
547 ## List of enabled VCS backends, available options are:
536 ## List of enabled VCS backends, available options are:
548 ## `hg` - mercurial
537 ## `hg` - mercurial
549 ## `git` - git
538 ## `git` - git
550 ## `svn` - subversion
539 ## `svn` - subversion
551 vcs.backends = hg, git, svn
540 vcs.backends = hg, git, svn
552
541
553 vcs.connection_timeout = 3600
542 vcs.connection_timeout = 3600
554 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
543 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
555 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
544 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
556 #vcs.svn.compatible_version = pre-1.8-compatible
545 #vcs.svn.compatible_version = pre-1.8-compatible
557
546
558
547
559 ############################################################
548 ############################################################
560 ### Subversion proxy support (mod_dav_svn) ###
549 ### Subversion proxy support (mod_dav_svn) ###
561 ### Maps RhodeCode repo groups into SVN paths for Apache ###
550 ### Maps RhodeCode repo groups into SVN paths for Apache ###
562 ############################################################
551 ############################################################
563 ## Enable or disable the config file generation.
552 ## Enable or disable the config file generation.
564 svn.proxy.generate_config = false
553 svn.proxy.generate_config = false
565 ## Generate config file with `SVNListParentPath` set to `On`.
554 ## Generate config file with `SVNListParentPath` set to `On`.
566 svn.proxy.list_parent_path = true
555 svn.proxy.list_parent_path = true
567 ## Set location and file name of generated config file.
556 ## Set location and file name of generated config file.
568 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
557 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
569 ## alternative mod_dav config template. This needs to be a mako template
558 ## alternative mod_dav config template. This needs to be a mako template
570 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
559 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
571 ## Used as a prefix to the `Location` block in the generated config file.
560 ## Used as a prefix to the `Location` block in the generated config file.
572 ## In most cases it should be set to `/`.
561 ## In most cases it should be set to `/`.
573 svn.proxy.location_root = /
562 svn.proxy.location_root = /
574 ## Command to reload the mod dav svn configuration on change.
563 ## Command to reload the mod dav svn configuration on change.
575 ## Example: `/etc/init.d/apache2 reload`
564 ## Example: `/etc/init.d/apache2 reload`
576 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
565 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
577 ## If the timeout expires before the reload command finishes, the command will
566 ## If the timeout expires before the reload command finishes, the command will
578 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
567 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
579 #svn.proxy.reload_timeout = 10
568 #svn.proxy.reload_timeout = 10
580
569
581 ############################################################
570 ############################################################
582 ### SSH Support Settings ###
571 ### SSH Support Settings ###
583 ############################################################
572 ############################################################
584
573
585 ## Defines if a custom authorized_keys file should be created and written on
574 ## Defines if a custom authorized_keys file should be created and written on
586 ## any change user ssh keys. Setting this to false also disables posibility
575 ## any change user ssh keys. Setting this to false also disables posibility
587 ## of adding SSH keys by users from web interface. Super admins can still
576 ## of adding SSH keys by users from web interface. Super admins can still
588 ## manage SSH Keys.
577 ## manage SSH Keys.
589 ssh.generate_authorized_keyfile = false
578 ssh.generate_authorized_keyfile = false
590
579
591 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
580 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
592 # ssh.authorized_keys_ssh_opts =
581 # ssh.authorized_keys_ssh_opts =
593
582
594 ## Path to the authrozied_keys file where the generate entries are placed.
583 ## Path to the authrozied_keys file where the generate entries are placed.
595 ## It is possible to have multiple key files specified in `sshd_config` e.g.
584 ## It is possible to have multiple key files specified in `sshd_config` e.g.
596 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
585 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
597 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
586 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
598
587
599 ## Command to execute the SSH wrapper. The binary is available in the
588 ## Command to execute the SSH wrapper. The binary is available in the
600 ## rhodecode installation directory.
589 ## rhodecode installation directory.
601 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
590 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
602 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
591 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
603
592
604 ## Allow shell when executing the ssh-wrapper command
593 ## Allow shell when executing the ssh-wrapper command
605 ssh.wrapper_cmd_allow_shell = false
594 ssh.wrapper_cmd_allow_shell = false
606
595
607 ## Enables logging, and detailed output send back to the client during SSH
596 ## Enables logging, and detailed output send back to the client during SSH
608 ## operations. Usefull for debugging, shouldn't be used in production.
597 ## operations. Usefull for debugging, shouldn't be used in production.
609 ssh.enable_debug_logging = false
598 ssh.enable_debug_logging = false
610
599
611 ## Paths to binary executable, by default they are the names, but we can
600 ## Paths to binary executable, by default they are the names, but we can
612 ## override them if we want to use a custom one
601 ## override them if we want to use a custom one
613 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
602 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
614 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
603 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
615 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
604 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
616
605
617
606
618 ## Dummy marker to add new entries after.
607 ## Dummy marker to add new entries after.
619 ## Add any custom entries below. Please don't remove.
608 ## Add any custom entries below. Please don't remove.
620 custom.conf = 1
609 custom.conf = 1
621
610
622
611
623 ################################
612 ################################
624 ### LOGGING CONFIGURATION ####
613 ### LOGGING CONFIGURATION ####
625 ################################
614 ################################
626 [loggers]
615 [loggers]
627 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
616 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
628
617
629 [handlers]
618 [handlers]
630 keys = console, console_sql
619 keys = console, console_sql
631
620
632 [formatters]
621 [formatters]
633 keys = generic, color_formatter, color_formatter_sql
622 keys = generic, color_formatter, color_formatter_sql
634
623
635 #############
624 #############
636 ## LOGGERS ##
625 ## LOGGERS ##
637 #############
626 #############
638 [logger_root]
627 [logger_root]
639 level = NOTSET
628 level = NOTSET
640 handlers = console
629 handlers = console
641
630
642 [logger_sqlalchemy]
631 [logger_sqlalchemy]
643 level = INFO
632 level = INFO
644 handlers = console_sql
633 handlers = console_sql
645 qualname = sqlalchemy.engine
634 qualname = sqlalchemy.engine
646 propagate = 0
635 propagate = 0
647
636
648 [logger_beaker]
637 [logger_beaker]
649 level = DEBUG
638 level = DEBUG
650 handlers =
639 handlers =
651 qualname = beaker.container
640 qualname = beaker.container
652 propagate = 1
641 propagate = 1
653
642
654 [logger_rhodecode]
643 [logger_rhodecode]
655 level = DEBUG
644 level = DEBUG
656 handlers =
645 handlers =
657 qualname = rhodecode
646 qualname = rhodecode
658 propagate = 1
647 propagate = 1
659
648
660 [logger_ssh_wrapper]
649 [logger_ssh_wrapper]
661 level = DEBUG
650 level = DEBUG
662 handlers =
651 handlers =
663 qualname = ssh_wrapper
652 qualname = ssh_wrapper
664 propagate = 1
653 propagate = 1
665
654
666 [logger_celery]
655 [logger_celery]
667 level = DEBUG
656 level = DEBUG
668 handlers =
657 handlers =
669 qualname = celery
658 qualname = celery
670
659
671
660
672 ##############
661 ##############
673 ## HANDLERS ##
662 ## HANDLERS ##
674 ##############
663 ##############
675
664
676 [handler_console]
665 [handler_console]
677 class = StreamHandler
666 class = StreamHandler
678 args = (sys.stderr, )
667 args = (sys.stderr, )
679 level = INFO
668 level = INFO
680 formatter = generic
669 formatter = generic
681
670
682 [handler_console_sql]
671 [handler_console_sql]
683 # "level = DEBUG" logs SQL queries and results.
672 # "level = DEBUG" logs SQL queries and results.
684 # "level = INFO" logs SQL queries.
673 # "level = INFO" logs SQL queries.
685 # "level = WARN" logs neither. (Recommended for production systems.)
674 # "level = WARN" logs neither. (Recommended for production systems.)
686 class = StreamHandler
675 class = StreamHandler
687 args = (sys.stderr, )
676 args = (sys.stderr, )
688 level = WARN
677 level = WARN
689 formatter = generic
678 formatter = generic
690
679
691 ################
680 ################
692 ## FORMATTERS ##
681 ## FORMATTERS ##
693 ################
682 ################
694
683
695 [formatter_generic]
684 [formatter_generic]
696 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
685 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
697 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
686 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
698 datefmt = %Y-%m-%d %H:%M:%S
687 datefmt = %Y-%m-%d %H:%M:%S
699
688
700 [formatter_color_formatter]
689 [formatter_color_formatter]
701 class = rhodecode.lib.logging_formatter.ColorFormatter
690 class = rhodecode.lib.logging_formatter.ColorFormatter
702 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
691 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
703 datefmt = %Y-%m-%d %H:%M:%S
692 datefmt = %Y-%m-%d %H:%M:%S
704
693
705 [formatter_color_formatter_sql]
694 [formatter_color_formatter_sql]
706 class = rhodecode.lib.logging_formatter.ColorFormatterSql
695 class = rhodecode.lib.logging_formatter.ColorFormatterSql
707 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
696 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
708 datefmt = %Y-%m-%d %H:%M:%S
697 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,582 +1,582 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2018 RhodeCode GmbH
3 # Copyright (C) 2010-2018 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import os
21 import os
22 import sys
22 import sys
23 import logging
23 import logging
24 import collections
24 import collections
25 import tempfile
25 import tempfile
26
26
27 from paste.gzipper import make_gzip_middleware
27 from paste.gzipper import make_gzip_middleware
28 import pyramid.events
28 import pyramid.events
29 from pyramid.wsgi import wsgiapp
29 from pyramid.wsgi import wsgiapp
30 from pyramid.authorization import ACLAuthorizationPolicy
30 from pyramid.authorization import ACLAuthorizationPolicy
31 from pyramid.config import Configurator
31 from pyramid.config import Configurator
32 from pyramid.settings import asbool, aslist
32 from pyramid.settings import asbool, aslist
33 from pyramid.httpexceptions import (
33 from pyramid.httpexceptions import (
34 HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
34 HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
35 from pyramid.renderers import render_to_response
35 from pyramid.renderers import render_to_response
36
36
37 from rhodecode.model import meta
37 from rhodecode.model import meta
38 from rhodecode.config import patches
38 from rhodecode.config import patches
39 from rhodecode.config import utils as config_utils
39 from rhodecode.config import utils as config_utils
40 from rhodecode.config.environment import load_pyramid_environment
40 from rhodecode.config.environment import load_pyramid_environment
41
41
42 import rhodecode.events
42 import rhodecode.events
43 from rhodecode.lib.middleware.vcs import VCSMiddleware
43 from rhodecode.lib.middleware.vcs import VCSMiddleware
44 from rhodecode.lib.request import Request
44 from rhodecode.lib.request import Request
45 from rhodecode.lib.vcs import VCSCommunicationError
45 from rhodecode.lib.vcs import VCSCommunicationError
46 from rhodecode.lib.exceptions import VCSServerUnavailable
46 from rhodecode.lib.exceptions import VCSServerUnavailable
47 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
47 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
48 from rhodecode.lib.middleware.https_fixup import HttpsFixup
48 from rhodecode.lib.middleware.https_fixup import HttpsFixup
49 from rhodecode.lib.celerylib.loader import configure_celery
49 from rhodecode.lib.celerylib.loader import configure_celery
50 from rhodecode.lib.plugins.utils import register_rhodecode_plugin
50 from rhodecode.lib.plugins.utils import register_rhodecode_plugin
51 from rhodecode.lib.utils2 import aslist as rhodecode_aslist, AttributeDict
51 from rhodecode.lib.utils2 import aslist as rhodecode_aslist, AttributeDict
52 from rhodecode.lib.exc_tracking import store_exception
52 from rhodecode.lib.exc_tracking import store_exception
53 from rhodecode.subscribers import (
53 from rhodecode.subscribers import (
54 scan_repositories_if_enabled, write_js_routes_if_enabled,
54 scan_repositories_if_enabled, write_js_routes_if_enabled,
55 write_metadata_if_needed, inject_app_settings)
55 write_metadata_if_needed, inject_app_settings)
56
56
57
57
58 log = logging.getLogger(__name__)
58 log = logging.getLogger(__name__)
59
59
60
60
61 def is_http_error(response):
61 def is_http_error(response):
62 # error which should have traceback
62 # error which should have traceback
63 return response.status_code > 499
63 return response.status_code > 499
64
64
65
65
66 def make_pyramid_app(global_config, **settings):
66 def make_pyramid_app(global_config, **settings):
67 """
67 """
68 Constructs the WSGI application based on Pyramid.
68 Constructs the WSGI application based on Pyramid.
69
69
70 Specials:
70 Specials:
71
71
72 * The application can also be integrated like a plugin via the call to
72 * The application can also be integrated like a plugin via the call to
73 `includeme`. This is accompanied with the other utility functions which
73 `includeme`. This is accompanied with the other utility functions which
74 are called. Changing this should be done with great care to not break
74 are called. Changing this should be done with great care to not break
75 cases when these fragments are assembled from another place.
75 cases when these fragments are assembled from another place.
76
76
77 """
77 """
78
78
79 # Allows to use format style "{ENV_NAME}" placeholders in the configuration. It
79 # Allows to use format style "{ENV_NAME}" placeholders in the configuration. It
80 # will be replaced by the value of the environment variable "NAME" in this case.
80 # will be replaced by the value of the environment variable "NAME" in this case.
81 environ = {
81 environ = {
82 'ENV_{}'.format(key): value for key, value in os.environ.items()}
82 'ENV_{}'.format(key): value for key, value in os.environ.items()}
83
83
84 global_config = _substitute_values(global_config, environ)
84 global_config = _substitute_values(global_config, environ)
85 settings = _substitute_values(settings, environ)
85 settings = _substitute_values(settings, environ)
86
86
87 sanitize_settings_and_apply_defaults(settings)
87 sanitize_settings_and_apply_defaults(settings)
88
88
89 config = Configurator(settings=settings)
89 config = Configurator(settings=settings)
90
90
91 # Apply compatibility patches
91 # Apply compatibility patches
92 patches.inspect_getargspec()
92 patches.inspect_getargspec()
93
93
94 load_pyramid_environment(global_config, settings)
94 load_pyramid_environment(global_config, settings)
95
95
96 # Static file view comes first
96 # Static file view comes first
97 includeme_first(config)
97 includeme_first(config)
98
98
99 includeme(config)
99 includeme(config)
100
100
101 pyramid_app = config.make_wsgi_app()
101 pyramid_app = config.make_wsgi_app()
102 pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config)
102 pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config)
103 pyramid_app.config = config
103 pyramid_app.config = config
104
104
105 config.configure_celery(global_config['__file__'])
105 config.configure_celery(global_config['__file__'])
106 # creating the app uses a connection - return it after we are done
106 # creating the app uses a connection - return it after we are done
107 meta.Session.remove()
107 meta.Session.remove()
108
108
109 log.info('Pyramid app %s created and configured.', pyramid_app)
109 log.info('Pyramid app %s created and configured.', pyramid_app)
110 return pyramid_app
110 return pyramid_app
111
111
112
112
113 def not_found_view(request):
113 def not_found_view(request):
114 """
114 """
115 This creates the view which should be registered as not-found-view to
115 This creates the view which should be registered as not-found-view to
116 pyramid.
116 pyramid.
117 """
117 """
118
118
119 if not getattr(request, 'vcs_call', None):
119 if not getattr(request, 'vcs_call', None):
120 # handle like regular case with our error_handler
120 # handle like regular case with our error_handler
121 return error_handler(HTTPNotFound(), request)
121 return error_handler(HTTPNotFound(), request)
122
122
123 # handle not found view as a vcs call
123 # handle not found view as a vcs call
124 settings = request.registry.settings
124 settings = request.registry.settings
125 ae_client = getattr(request, 'ae_client', None)
125 ae_client = getattr(request, 'ae_client', None)
126 vcs_app = VCSMiddleware(
126 vcs_app = VCSMiddleware(
127 HTTPNotFound(), request.registry, settings,
127 HTTPNotFound(), request.registry, settings,
128 appenlight_client=ae_client)
128 appenlight_client=ae_client)
129
129
130 return wsgiapp(vcs_app)(None, request)
130 return wsgiapp(vcs_app)(None, request)
131
131
132
132
133 def error_handler(exception, request):
133 def error_handler(exception, request):
134 import rhodecode
134 import rhodecode
135 from rhodecode.lib import helpers
135 from rhodecode.lib import helpers
136
136
137 rhodecode_title = rhodecode.CONFIG.get('rhodecode_title') or 'RhodeCode'
137 rhodecode_title = rhodecode.CONFIG.get('rhodecode_title') or 'RhodeCode'
138
138
139 base_response = HTTPInternalServerError()
139 base_response = HTTPInternalServerError()
140 # prefer original exception for the response since it may have headers set
140 # prefer original exception for the response since it may have headers set
141 if isinstance(exception, HTTPException):
141 if isinstance(exception, HTTPException):
142 base_response = exception
142 base_response = exception
143 elif isinstance(exception, VCSCommunicationError):
143 elif isinstance(exception, VCSCommunicationError):
144 base_response = VCSServerUnavailable()
144 base_response = VCSServerUnavailable()
145
145
146 if is_http_error(base_response):
146 if is_http_error(base_response):
147 log.exception(
147 log.exception(
148 'error occurred handling this request for path: %s', request.path)
148 'error occurred handling this request for path: %s', request.path)
149
149
150 error_explanation = base_response.explanation or str(base_response)
150 error_explanation = base_response.explanation or str(base_response)
151 if base_response.status_code == 404:
151 if base_response.status_code == 404:
152 error_explanation += " Or you don't have permission to access it."
152 error_explanation += " Or you don't have permission to access it."
153 c = AttributeDict()
153 c = AttributeDict()
154 c.error_message = base_response.status
154 c.error_message = base_response.status
155 c.error_explanation = error_explanation
155 c.error_explanation = error_explanation
156 c.visual = AttributeDict()
156 c.visual = AttributeDict()
157
157
158 c.visual.rhodecode_support_url = (
158 c.visual.rhodecode_support_url = (
159 request.registry.settings.get('rhodecode_support_url') or
159 request.registry.settings.get('rhodecode_support_url') or
160 request.route_url('rhodecode_support')
160 request.route_url('rhodecode_support')
161 )
161 )
162 c.redirect_time = 0
162 c.redirect_time = 0
163 c.rhodecode_name = rhodecode_title
163 c.rhodecode_name = rhodecode_title
164 if not c.rhodecode_name:
164 if not c.rhodecode_name:
165 c.rhodecode_name = 'Rhodecode'
165 c.rhodecode_name = 'Rhodecode'
166
166
167 c.causes = []
167 c.causes = []
168 if is_http_error(base_response):
168 if is_http_error(base_response):
169 c.causes.append('Server is overloaded.')
169 c.causes.append('Server is overloaded.')
170 c.causes.append('Server database connection is lost.')
170 c.causes.append('Server database connection is lost.')
171 c.causes.append('Server expected unhandled error.')
171 c.causes.append('Server expected unhandled error.')
172
172
173 if hasattr(base_response, 'causes'):
173 if hasattr(base_response, 'causes'):
174 c.causes = base_response.causes
174 c.causes = base_response.causes
175
175
176 c.messages = helpers.flash.pop_messages(request=request)
176 c.messages = helpers.flash.pop_messages(request=request)
177
177
178 exc_info = sys.exc_info()
178 exc_info = sys.exc_info()
179 c.exception_id = id(exc_info)
179 c.exception_id = id(exc_info)
180 c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \
180 c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \
181 or base_response.status_code > 499
181 or base_response.status_code > 499
182 c.exception_id_url = request.route_url(
182 c.exception_id_url = request.route_url(
183 'admin_settings_exception_tracker_show', exception_id=c.exception_id)
183 'admin_settings_exception_tracker_show', exception_id=c.exception_id)
184
184
185 if c.show_exception_id:
185 if c.show_exception_id:
186 store_exception(c.exception_id, exc_info)
186 store_exception(c.exception_id, exc_info)
187
187
188 response = render_to_response(
188 response = render_to_response(
189 '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request,
189 '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request,
190 response=base_response)
190 response=base_response)
191
191
192 return response
192 return response
193
193
194
194
195 def includeme_first(config):
195 def includeme_first(config):
196 # redirect automatic browser favicon.ico requests to correct place
196 # redirect automatic browser favicon.ico requests to correct place
197 def favicon_redirect(context, request):
197 def favicon_redirect(context, request):
198 return HTTPFound(
198 return HTTPFound(
199 request.static_path('rhodecode:public/images/favicon.ico'))
199 request.static_path('rhodecode:public/images/favicon.ico'))
200
200
201 config.add_view(favicon_redirect, route_name='favicon')
201 config.add_view(favicon_redirect, route_name='favicon')
202 config.add_route('favicon', '/favicon.ico')
202 config.add_route('favicon', '/favicon.ico')
203
203
204 def robots_redirect(context, request):
204 def robots_redirect(context, request):
205 return HTTPFound(
205 return HTTPFound(
206 request.static_path('rhodecode:public/robots.txt'))
206 request.static_path('rhodecode:public/robots.txt'))
207
207
208 config.add_view(robots_redirect, route_name='robots')
208 config.add_view(robots_redirect, route_name='robots')
209 config.add_route('robots', '/robots.txt')
209 config.add_route('robots', '/robots.txt')
210
210
211 config.add_static_view(
211 config.add_static_view(
212 '_static/deform', 'deform:static')
212 '_static/deform', 'deform:static')
213 config.add_static_view(
213 config.add_static_view(
214 '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24)
214 '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24)
215
215
216
216
217 def includeme(config):
217 def includeme(config):
218 settings = config.registry.settings
218 settings = config.registry.settings
219 config.set_request_factory(Request)
219 config.set_request_factory(Request)
220
220
221 # plugin information
221 # plugin information
222 config.registry.rhodecode_plugins = collections.OrderedDict()
222 config.registry.rhodecode_plugins = collections.OrderedDict()
223
223
224 config.add_directive(
224 config.add_directive(
225 'register_rhodecode_plugin', register_rhodecode_plugin)
225 'register_rhodecode_plugin', register_rhodecode_plugin)
226
226
227 config.add_directive('configure_celery', configure_celery)
227 config.add_directive('configure_celery', configure_celery)
228
228
229 if asbool(settings.get('appenlight', 'false')):
229 if asbool(settings.get('appenlight', 'false')):
230 config.include('appenlight_client.ext.pyramid_tween')
230 config.include('appenlight_client.ext.pyramid_tween')
231
231
232 # Includes which are required. The application would fail without them.
232 # Includes which are required. The application would fail without them.
233 config.include('pyramid_mako')
233 config.include('pyramid_mako')
234 config.include('pyramid_beaker')
234 config.include('pyramid_beaker')
235 config.include('rhodecode.lib.rc_cache')
235 config.include('rhodecode.lib.rc_cache')
236
236
237 config.include('rhodecode.authentication')
237 config.include('rhodecode.authentication')
238 config.include('rhodecode.integrations')
238 config.include('rhodecode.integrations')
239
239
240 # apps
240 # apps
241 config.include('rhodecode.apps._base')
241 config.include('rhodecode.apps._base')
242 config.include('rhodecode.apps.ops')
242 config.include('rhodecode.apps.ops')
243
243
244 config.include('rhodecode.apps.admin')
244 config.include('rhodecode.apps.admin')
245 config.include('rhodecode.apps.channelstream')
245 config.include('rhodecode.apps.channelstream')
246 config.include('rhodecode.apps.login')
246 config.include('rhodecode.apps.login')
247 config.include('rhodecode.apps.home')
247 config.include('rhodecode.apps.home')
248 config.include('rhodecode.apps.journal')
248 config.include('rhodecode.apps.journal')
249 config.include('rhodecode.apps.repository')
249 config.include('rhodecode.apps.repository')
250 config.include('rhodecode.apps.repo_group')
250 config.include('rhodecode.apps.repo_group')
251 config.include('rhodecode.apps.user_group')
251 config.include('rhodecode.apps.user_group')
252 config.include('rhodecode.apps.search')
252 config.include('rhodecode.apps.search')
253 config.include('rhodecode.apps.user_profile')
253 config.include('rhodecode.apps.user_profile')
254 config.include('rhodecode.apps.user_group_profile')
254 config.include('rhodecode.apps.user_group_profile')
255 config.include('rhodecode.apps.my_account')
255 config.include('rhodecode.apps.my_account')
256 config.include('rhodecode.apps.svn_support')
256 config.include('rhodecode.apps.svn_support')
257 config.include('rhodecode.apps.ssh_support')
257 config.include('rhodecode.apps.ssh_support')
258 config.include('rhodecode.apps.gist')
258 config.include('rhodecode.apps.gist')
259
259
260 config.include('rhodecode.apps.debug_style')
260 config.include('rhodecode.apps.debug_style')
261 config.include('rhodecode.tweens')
261 config.include('rhodecode.tweens')
262 config.include('rhodecode.api')
262 config.include('rhodecode.api')
263
263
264 config.add_route(
264 config.add_route(
265 'rhodecode_support', 'https://rhodecode.com/help/', static=True)
265 'rhodecode_support', 'https://rhodecode.com/help/', static=True)
266
266
267 config.add_translation_dirs('rhodecode:i18n/')
267 config.add_translation_dirs('rhodecode:i18n/')
268 settings['default_locale_name'] = settings.get('lang', 'en')
268 settings['default_locale_name'] = settings.get('lang', 'en')
269
269
270 # Add subscribers.
270 # Add subscribers.
271 config.add_subscriber(inject_app_settings,
271 config.add_subscriber(inject_app_settings,
272 pyramid.events.ApplicationCreated)
272 pyramid.events.ApplicationCreated)
273 config.add_subscriber(scan_repositories_if_enabled,
273 config.add_subscriber(scan_repositories_if_enabled,
274 pyramid.events.ApplicationCreated)
274 pyramid.events.ApplicationCreated)
275 config.add_subscriber(write_metadata_if_needed,
275 config.add_subscriber(write_metadata_if_needed,
276 pyramid.events.ApplicationCreated)
276 pyramid.events.ApplicationCreated)
277 config.add_subscriber(write_js_routes_if_enabled,
277 config.add_subscriber(write_js_routes_if_enabled,
278 pyramid.events.ApplicationCreated)
278 pyramid.events.ApplicationCreated)
279
279
280 # request custom methods
280 # request custom methods
281 config.add_request_method(
281 config.add_request_method(
282 'rhodecode.lib.partial_renderer.get_partial_renderer',
282 'rhodecode.lib.partial_renderer.get_partial_renderer',
283 'get_partial_renderer')
283 'get_partial_renderer')
284
284
285 # Set the authorization policy.
285 # Set the authorization policy.
286 authz_policy = ACLAuthorizationPolicy()
286 authz_policy = ACLAuthorizationPolicy()
287 config.set_authorization_policy(authz_policy)
287 config.set_authorization_policy(authz_policy)
288
288
289 # Set the default renderer for HTML templates to mako.
289 # Set the default renderer for HTML templates to mako.
290 config.add_mako_renderer('.html')
290 config.add_mako_renderer('.html')
291
291
292 config.add_renderer(
292 config.add_renderer(
293 name='json_ext',
293 name='json_ext',
294 factory='rhodecode.lib.ext_json_renderer.pyramid_ext_json')
294 factory='rhodecode.lib.ext_json_renderer.pyramid_ext_json')
295
295
296 # include RhodeCode plugins
296 # include RhodeCode plugins
297 includes = aslist(settings.get('rhodecode.includes', []))
297 includes = aslist(settings.get('rhodecode.includes', []))
298 for inc in includes:
298 for inc in includes:
299 config.include(inc)
299 config.include(inc)
300
300
301 # custom not found view, if our pyramid app doesn't know how to handle
301 # custom not found view, if our pyramid app doesn't know how to handle
302 # the request pass it to potential VCS handling ap
302 # the request pass it to potential VCS handling ap
303 config.add_notfound_view(not_found_view)
303 config.add_notfound_view(not_found_view)
304 if not settings.get('debugtoolbar.enabled', False):
304 if not settings.get('debugtoolbar.enabled', False):
305 # disabled debugtoolbar handle all exceptions via the error_handlers
305 # disabled debugtoolbar handle all exceptions via the error_handlers
306 config.add_view(error_handler, context=Exception)
306 config.add_view(error_handler, context=Exception)
307
307
308 # all errors including 403/404/50X
308 # all errors including 403/404/50X
309 config.add_view(error_handler, context=HTTPError)
309 config.add_view(error_handler, context=HTTPError)
310
310
311
311
312 def wrap_app_in_wsgi_middlewares(pyramid_app, config):
312 def wrap_app_in_wsgi_middlewares(pyramid_app, config):
313 """
313 """
314 Apply outer WSGI middlewares around the application.
314 Apply outer WSGI middlewares around the application.
315 """
315 """
316 registry = config.registry
316 registry = config.registry
317 settings = registry.settings
317 settings = registry.settings
318
318
319 # enable https redirects based on HTTP_X_URL_SCHEME set by proxy
319 # enable https redirects based on HTTP_X_URL_SCHEME set by proxy
320 pyramid_app = HttpsFixup(pyramid_app, settings)
320 pyramid_app = HttpsFixup(pyramid_app, settings)
321
321
322 pyramid_app, _ae_client = wrap_in_appenlight_if_enabled(
322 pyramid_app, _ae_client = wrap_in_appenlight_if_enabled(
323 pyramid_app, settings)
323 pyramid_app, settings)
324 registry.ae_client = _ae_client
324 registry.ae_client = _ae_client
325
325
326 if settings['gzip_responses']:
326 if settings['gzip_responses']:
327 pyramid_app = make_gzip_middleware(
327 pyramid_app = make_gzip_middleware(
328 pyramid_app, settings, compress_level=1)
328 pyramid_app, settings, compress_level=1)
329
329
330 # this should be the outer most middleware in the wsgi stack since
330 # this should be the outer most middleware in the wsgi stack since
331 # middleware like Routes make database calls
331 # middleware like Routes make database calls
332 def pyramid_app_with_cleanup(environ, start_response):
332 def pyramid_app_with_cleanup(environ, start_response):
333 try:
333 try:
334 return pyramid_app(environ, start_response)
334 return pyramid_app(environ, start_response)
335 finally:
335 finally:
336 # Dispose current database session and rollback uncommitted
336 # Dispose current database session and rollback uncommitted
337 # transactions.
337 # transactions.
338 meta.Session.remove()
338 meta.Session.remove()
339
339
340 # In a single threaded mode server, on non sqlite db we should have
340 # In a single threaded mode server, on non sqlite db we should have
341 # '0 Current Checked out connections' at the end of a request,
341 # '0 Current Checked out connections' at the end of a request,
342 # if not, then something, somewhere is leaving a connection open
342 # if not, then something, somewhere is leaving a connection open
343 pool = meta.Base.metadata.bind.engine.pool
343 pool = meta.Base.metadata.bind.engine.pool
344 log.debug('sa pool status: %s', pool.status())
344 log.debug('sa pool status: %s', pool.status())
345 log.debug('Request processing finalized')
345 log.debug('Request processing finalized')
346
346
347 return pyramid_app_with_cleanup
347 return pyramid_app_with_cleanup
348
348
349
349
350 def sanitize_settings_and_apply_defaults(settings):
350 def sanitize_settings_and_apply_defaults(settings):
351 """
351 """
352 Applies settings defaults and does all type conversion.
352 Applies settings defaults and does all type conversion.
353
353
354 We would move all settings parsing and preparation into this place, so that
354 We would move all settings parsing and preparation into this place, so that
355 we have only one place left which deals with this part. The remaining parts
355 we have only one place left which deals with this part. The remaining parts
356 of the application would start to rely fully on well prepared settings.
356 of the application would start to rely fully on well prepared settings.
357
357
358 This piece would later be split up per topic to avoid a big fat monster
358 This piece would later be split up per topic to avoid a big fat monster
359 function.
359 function.
360 """
360 """
361
361
362 settings.setdefault('rhodecode.edition', 'Community Edition')
362 settings.setdefault('rhodecode.edition', 'Community Edition')
363
363
364 if 'mako.default_filters' not in settings:
364 if 'mako.default_filters' not in settings:
365 # set custom default filters if we don't have it defined
365 # set custom default filters if we don't have it defined
366 settings['mako.imports'] = 'from rhodecode.lib.base import h_filter'
366 settings['mako.imports'] = 'from rhodecode.lib.base import h_filter'
367 settings['mako.default_filters'] = 'h_filter'
367 settings['mako.default_filters'] = 'h_filter'
368
368
369 if 'mako.directories' not in settings:
369 if 'mako.directories' not in settings:
370 mako_directories = settings.setdefault('mako.directories', [
370 mako_directories = settings.setdefault('mako.directories', [
371 # Base templates of the original application
371 # Base templates of the original application
372 'rhodecode:templates',
372 'rhodecode:templates',
373 ])
373 ])
374 log.debug(
374 log.debug(
375 "Using the following Mako template directories: %s",
375 "Using the following Mako template directories: %s",
376 mako_directories)
376 mako_directories)
377
377
378 # Default includes, possible to change as a user
378 # Default includes, possible to change as a user
379 pyramid_includes = settings.setdefault('pyramid.includes', [
379 pyramid_includes = settings.setdefault('pyramid.includes', [
380 'rhodecode.lib.middleware.request_wrapper',
380 'rhodecode.lib.middleware.request_wrapper',
381 ])
381 ])
382 log.debug(
382 log.debug(
383 "Using the following pyramid.includes: %s",
383 "Using the following pyramid.includes: %s",
384 pyramid_includes)
384 pyramid_includes)
385
385
386 # TODO: johbo: Re-think this, usually the call to config.include
386 # TODO: johbo: Re-think this, usually the call to config.include
387 # should allow to pass in a prefix.
387 # should allow to pass in a prefix.
388 settings.setdefault('rhodecode.api.url', '/_admin/api')
388 settings.setdefault('rhodecode.api.url', '/_admin/api')
389
389
390 # Sanitize generic settings.
390 # Sanitize generic settings.
391 _list_setting(settings, 'default_encoding', 'UTF-8')
391 _list_setting(settings, 'default_encoding', 'UTF-8')
392 _bool_setting(settings, 'is_test', 'false')
392 _bool_setting(settings, 'is_test', 'false')
393 _bool_setting(settings, 'gzip_responses', 'false')
393 _bool_setting(settings, 'gzip_responses', 'false')
394
394
395 # Call split out functions that sanitize settings for each topic.
395 # Call split out functions that sanitize settings for each topic.
396 _sanitize_appenlight_settings(settings)
396 _sanitize_appenlight_settings(settings)
397 _sanitize_vcs_settings(settings)
397 _sanitize_vcs_settings(settings)
398 _sanitize_cache_settings(settings)
398 _sanitize_cache_settings(settings)
399
399
400 # configure instance id
400 # configure instance id
401 config_utils.set_instance_id(settings)
401 config_utils.set_instance_id(settings)
402
402
403 return settings
403 return settings
404
404
405
405
406 def _sanitize_appenlight_settings(settings):
406 def _sanitize_appenlight_settings(settings):
407 _bool_setting(settings, 'appenlight', 'false')
407 _bool_setting(settings, 'appenlight', 'false')
408
408
409
409
410 def _sanitize_vcs_settings(settings):
410 def _sanitize_vcs_settings(settings):
411 """
411 """
412 Applies settings defaults and does type conversion for all VCS related
412 Applies settings defaults and does type conversion for all VCS related
413 settings.
413 settings.
414 """
414 """
415 _string_setting(settings, 'vcs.svn.compatible_version', '')
415 _string_setting(settings, 'vcs.svn.compatible_version', '')
416 _string_setting(settings, 'git_rev_filter', '--all')
416 _string_setting(settings, 'git_rev_filter', '--all')
417 _string_setting(settings, 'vcs.hooks.protocol', 'http')
417 _string_setting(settings, 'vcs.hooks.protocol', 'http')
418 _string_setting(settings, 'vcs.hooks.host', '127.0.0.1')
418 _string_setting(settings, 'vcs.hooks.host', '127.0.0.1')
419 _string_setting(settings, 'vcs.scm_app_implementation', 'http')
419 _string_setting(settings, 'vcs.scm_app_implementation', 'http')
420 _string_setting(settings, 'vcs.server', '')
420 _string_setting(settings, 'vcs.server', '')
421 _string_setting(settings, 'vcs.server.log_level', 'debug')
421 _string_setting(settings, 'vcs.server.log_level', 'debug')
422 _string_setting(settings, 'vcs.server.protocol', 'http')
422 _string_setting(settings, 'vcs.server.protocol', 'http')
423 _bool_setting(settings, 'startup.import_repos', 'false')
423 _bool_setting(settings, 'startup.import_repos', 'false')
424 _bool_setting(settings, 'vcs.hooks.direct_calls', 'false')
424 _bool_setting(settings, 'vcs.hooks.direct_calls', 'false')
425 _bool_setting(settings, 'vcs.server.enable', 'true')
425 _bool_setting(settings, 'vcs.server.enable', 'true')
426 _bool_setting(settings, 'vcs.start_server', 'false')
426 _bool_setting(settings, 'vcs.start_server', 'false')
427 _list_setting(settings, 'vcs.backends', 'hg, git, svn')
427 _list_setting(settings, 'vcs.backends', 'hg, git, svn')
428 _int_setting(settings, 'vcs.connection_timeout', 3600)
428 _int_setting(settings, 'vcs.connection_timeout', 3600)
429
429
430 # Support legacy values of vcs.scm_app_implementation. Legacy
430 # Support legacy values of vcs.scm_app_implementation. Legacy
431 # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or
431 # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or
432 # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'.
432 # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'.
433 scm_app_impl = settings['vcs.scm_app_implementation']
433 scm_app_impl = settings['vcs.scm_app_implementation']
434 if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']:
434 if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']:
435 settings['vcs.scm_app_implementation'] = 'http'
435 settings['vcs.scm_app_implementation'] = 'http'
436
436
437
437
438 def _sanitize_cache_settings(settings):
438 def _sanitize_cache_settings(settings):
439
439
440 default_cache_dir = os.path.join(tempfile.gettempdir(), 'rc_cache')
440 default_cache_dir = os.path.join(tempfile.gettempdir(), 'rc_cache')
441
441
442 # save default, cache dir, and use it for all backends later.
442 # save default, cache dir, and use it for all backends later.
443 default_cache_dir = _string_setting(
443 default_cache_dir = _string_setting(
444 settings,
444 settings,
445 'cache_dir',
445 'cache_dir',
446 default_cache_dir, lower=False, default_when_empty=True)
446 default_cache_dir, lower=False, default_when_empty=True)
447
447
448 # ensure we have our dir created
448 # ensure we have our dir created
449 if not os.path.isdir(default_cache_dir):
449 if not os.path.isdir(default_cache_dir):
450 os.makedirs(default_cache_dir, mode=0755)
450 os.makedirs(default_cache_dir, mode=0755)
451
451
452 # exception store cache
452 # exception store cache
453 _string_setting(
453 _string_setting(
454 settings,
454 settings,
455 'exception_store_path',
455 'exception_tracker.store_path',
456 default_cache_dir, lower=False)
456 default_cache_dir, lower=False)
457
457
458 # cache_perms
458 # cache_perms
459 _string_setting(
459 _string_setting(
460 settings,
460 settings,
461 'rc_cache.cache_perms.backend',
461 'rc_cache.cache_perms.backend',
462 'dogpile.cache.rc.file_namespace', lower=False)
462 'dogpile.cache.rc.file_namespace', lower=False)
463 _int_setting(
463 _int_setting(
464 settings,
464 settings,
465 'rc_cache.cache_perms.expiration_time',
465 'rc_cache.cache_perms.expiration_time',
466 60)
466 60)
467 _string_setting(
467 _string_setting(
468 settings,
468 settings,
469 'rc_cache.cache_perms.arguments.filename',
469 'rc_cache.cache_perms.arguments.filename',
470 os.path.join(default_cache_dir, 'rc_cache_1'), lower=False)
470 os.path.join(default_cache_dir, 'rc_cache_1'), lower=False)
471
471
472 # cache_repo
472 # cache_repo
473 _string_setting(
473 _string_setting(
474 settings,
474 settings,
475 'rc_cache.cache_repo.backend',
475 'rc_cache.cache_repo.backend',
476 'dogpile.cache.rc.file_namespace', lower=False)
476 'dogpile.cache.rc.file_namespace', lower=False)
477 _int_setting(
477 _int_setting(
478 settings,
478 settings,
479 'rc_cache.cache_repo.expiration_time',
479 'rc_cache.cache_repo.expiration_time',
480 60)
480 60)
481 _string_setting(
481 _string_setting(
482 settings,
482 settings,
483 'rc_cache.cache_repo.arguments.filename',
483 'rc_cache.cache_repo.arguments.filename',
484 os.path.join(default_cache_dir, 'rc_cache_2'), lower=False)
484 os.path.join(default_cache_dir, 'rc_cache_2'), lower=False)
485
485
486 # cache_license
486 # cache_license
487 _string_setting(
487 _string_setting(
488 settings,
488 settings,
489 'rc_cache.cache_license.backend',
489 'rc_cache.cache_license.backend',
490 'dogpile.cache.rc.file_namespace', lower=False)
490 'dogpile.cache.rc.file_namespace', lower=False)
491 _int_setting(
491 _int_setting(
492 settings,
492 settings,
493 'rc_cache.cache_license.expiration_time',
493 'rc_cache.cache_license.expiration_time',
494 5*60)
494 5*60)
495 _string_setting(
495 _string_setting(
496 settings,
496 settings,
497 'rc_cache.cache_license.arguments.filename',
497 'rc_cache.cache_license.arguments.filename',
498 os.path.join(default_cache_dir, 'rc_cache_3'), lower=False)
498 os.path.join(default_cache_dir, 'rc_cache_3'), lower=False)
499
499
500 # cache_repo_longterm memory, 96H
500 # cache_repo_longterm memory, 96H
501 _string_setting(
501 _string_setting(
502 settings,
502 settings,
503 'rc_cache.cache_repo_longterm.backend',
503 'rc_cache.cache_repo_longterm.backend',
504 'dogpile.cache.rc.memory_lru', lower=False)
504 'dogpile.cache.rc.memory_lru', lower=False)
505 _int_setting(
505 _int_setting(
506 settings,
506 settings,
507 'rc_cache.cache_repo_longterm.expiration_time',
507 'rc_cache.cache_repo_longterm.expiration_time',
508 345600)
508 345600)
509 _int_setting(
509 _int_setting(
510 settings,
510 settings,
511 'rc_cache.cache_repo_longterm.max_size',
511 'rc_cache.cache_repo_longterm.max_size',
512 10000)
512 10000)
513
513
514 # sql_cache_short
514 # sql_cache_short
515 _string_setting(
515 _string_setting(
516 settings,
516 settings,
517 'rc_cache.sql_cache_short.backend',
517 'rc_cache.sql_cache_short.backend',
518 'dogpile.cache.rc.memory_lru', lower=False)
518 'dogpile.cache.rc.memory_lru', lower=False)
519 _int_setting(
519 _int_setting(
520 settings,
520 settings,
521 'rc_cache.sql_cache_short.expiration_time',
521 'rc_cache.sql_cache_short.expiration_time',
522 30)
522 30)
523 _int_setting(
523 _int_setting(
524 settings,
524 settings,
525 'rc_cache.sql_cache_short.max_size',
525 'rc_cache.sql_cache_short.max_size',
526 10000)
526 10000)
527
527
528
528
529 def _int_setting(settings, name, default):
529 def _int_setting(settings, name, default):
530 settings[name] = int(settings.get(name, default))
530 settings[name] = int(settings.get(name, default))
531 return settings[name]
531 return settings[name]
532
532
533
533
534 def _bool_setting(settings, name, default):
534 def _bool_setting(settings, name, default):
535 input_val = settings.get(name, default)
535 input_val = settings.get(name, default)
536 if isinstance(input_val, unicode):
536 if isinstance(input_val, unicode):
537 input_val = input_val.encode('utf8')
537 input_val = input_val.encode('utf8')
538 settings[name] = asbool(input_val)
538 settings[name] = asbool(input_val)
539 return settings[name]
539 return settings[name]
540
540
541
541
542 def _list_setting(settings, name, default):
542 def _list_setting(settings, name, default):
543 raw_value = settings.get(name, default)
543 raw_value = settings.get(name, default)
544
544
545 old_separator = ','
545 old_separator = ','
546 if old_separator in raw_value:
546 if old_separator in raw_value:
547 # If we get a comma separated list, pass it to our own function.
547 # If we get a comma separated list, pass it to our own function.
548 settings[name] = rhodecode_aslist(raw_value, sep=old_separator)
548 settings[name] = rhodecode_aslist(raw_value, sep=old_separator)
549 else:
549 else:
550 # Otherwise we assume it uses pyramids space/newline separation.
550 # Otherwise we assume it uses pyramids space/newline separation.
551 settings[name] = aslist(raw_value)
551 settings[name] = aslist(raw_value)
552 return settings[name]
552 return settings[name]
553
553
554
554
555 def _string_setting(settings, name, default, lower=True, default_when_empty=False):
555 def _string_setting(settings, name, default, lower=True, default_when_empty=False):
556 value = settings.get(name, default)
556 value = settings.get(name, default)
557
557
558 if default_when_empty and not value:
558 if default_when_empty and not value:
559 # use default value when value is empty
559 # use default value when value is empty
560 value = default
560 value = default
561
561
562 if lower:
562 if lower:
563 value = value.lower()
563 value = value.lower()
564 settings[name] = value
564 settings[name] = value
565 return settings[name]
565 return settings[name]
566
566
567
567
568 def _substitute_values(mapping, substitutions):
568 def _substitute_values(mapping, substitutions):
569
569
570 try:
570 try:
571 result = {
571 result = {
572 # Note: Cannot use regular replacements, since they would clash
572 # Note: Cannot use regular replacements, since they would clash
573 # with the implementation of ConfigParser. Using "format" instead.
573 # with the implementation of ConfigParser. Using "format" instead.
574 key: value.format(**substitutions)
574 key: value.format(**substitutions)
575 for key, value in mapping.items()
575 for key, value in mapping.items()
576 }
576 }
577 except KeyError as e:
577 except KeyError as e:
578 raise ValueError(
578 raise ValueError(
579 'Failed to substitute env variable: {}. '
579 'Failed to substitute env variable: {}. '
580 'Make sure you have specified this env variable without ENV_ prefix'.format(e))
580 'Make sure you have specified this env variable without ENV_ prefix'.format(e))
581
581
582 return result
582 return result
@@ -1,151 +1,151 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2018 RhodeCode GmbH
3 # Copyright (C) 2010-2018 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import os
21 import os
22 import time
22 import time
23 import datetime
23 import datetime
24 import msgpack
24 import msgpack
25 import logging
25 import logging
26 import traceback
26 import traceback
27 import tempfile
27 import tempfile
28
28
29
29
30 log = logging.getLogger(__name__)
30 log = logging.getLogger(__name__)
31
31
32 # NOTE: Any changes should be synced with exc_tracking at vcsserver.lib.exc_tracking
32 # NOTE: Any changes should be synced with exc_tracking at vcsserver.lib.exc_tracking
33 global_prefix = 'rhodecode'
33 global_prefix = 'rhodecode'
34 exc_store_dir_name = 'rc_exception_store_v1'
34 exc_store_dir_name = 'rc_exception_store_v1'
35
35
36
36
37 def exc_serialize(exc_id, tb, exc_type):
37 def exc_serialize(exc_id, tb, exc_type):
38
38
39 data = {
39 data = {
40 'version': 'v1',
40 'version': 'v1',
41 'exc_id': exc_id,
41 'exc_id': exc_id,
42 'exc_utc_date': datetime.datetime.utcnow().isoformat(),
42 'exc_utc_date': datetime.datetime.utcnow().isoformat(),
43 'exc_timestamp': repr(time.time()),
43 'exc_timestamp': repr(time.time()),
44 'exc_message': tb,
44 'exc_message': tb,
45 'exc_type': exc_type,
45 'exc_type': exc_type,
46 }
46 }
47 return msgpack.packb(data), data
47 return msgpack.packb(data), data
48
48
49
49
50 def exc_unserialize(tb):
50 def exc_unserialize(tb):
51 return msgpack.unpackb(tb)
51 return msgpack.unpackb(tb)
52
52
53
53
54 def get_exc_store():
54 def get_exc_store():
55 """
55 """
56 Get and create exception store if it's not existing
56 Get and create exception store if it's not existing
57 """
57 """
58 import rhodecode as app
58 import rhodecode as app
59
59
60 exc_store_dir = app.CONFIG.get('exception_store_path', '') or tempfile.gettempdir()
60 exc_store_dir = app.CONFIG.get('exception_tracker.store_path', '') or tempfile.gettempdir()
61 _exc_store_path = os.path.join(exc_store_dir, exc_store_dir_name)
61 _exc_store_path = os.path.join(exc_store_dir, exc_store_dir_name)
62
62
63 _exc_store_path = os.path.abspath(_exc_store_path)
63 _exc_store_path = os.path.abspath(_exc_store_path)
64 if not os.path.isdir(_exc_store_path):
64 if not os.path.isdir(_exc_store_path):
65 os.makedirs(_exc_store_path)
65 os.makedirs(_exc_store_path)
66 log.debug('Initializing exceptions store at %s', _exc_store_path)
66 log.debug('Initializing exceptions store at %s', _exc_store_path)
67 return _exc_store_path
67 return _exc_store_path
68
68
69
69
70 def _store_exception(exc_id, exc_info, prefix):
70 def _store_exception(exc_id, exc_info, prefix):
71 exc_type, exc_value, exc_traceback = exc_info
71 exc_type, exc_value, exc_traceback = exc_info
72 tb = ''.join(traceback.format_exception(
72 tb = ''.join(traceback.format_exception(
73 exc_type, exc_value, exc_traceback, None))
73 exc_type, exc_value, exc_traceback, None))
74
74
75 exc_type_name = exc_type.__name__
75 exc_type_name = exc_type.__name__
76 exc_store_path = get_exc_store()
76 exc_store_path = get_exc_store()
77 exc_data, org_data = exc_serialize(exc_id, tb, exc_type_name)
77 exc_data, org_data = exc_serialize(exc_id, tb, exc_type_name)
78 exc_pref_id = '{}_{}_{}'.format(exc_id, prefix, org_data['exc_timestamp'])
78 exc_pref_id = '{}_{}_{}'.format(exc_id, prefix, org_data['exc_timestamp'])
79 if not os.path.isdir(exc_store_path):
79 if not os.path.isdir(exc_store_path):
80 os.makedirs(exc_store_path)
80 os.makedirs(exc_store_path)
81 stored_exc_path = os.path.join(exc_store_path, exc_pref_id)
81 stored_exc_path = os.path.join(exc_store_path, exc_pref_id)
82 with open(stored_exc_path, 'wb') as f:
82 with open(stored_exc_path, 'wb') as f:
83 f.write(exc_data)
83 f.write(exc_data)
84 log.debug('Stored generated exception %s as: %s', exc_id, stored_exc_path)
84 log.debug('Stored generated exception %s as: %s', exc_id, stored_exc_path)
85
85
86
86
87 def store_exception(exc_id, exc_info, prefix=global_prefix):
87 def store_exception(exc_id, exc_info, prefix=global_prefix):
88 """
88 """
89 Example usage::
89 Example usage::
90
90
91 exc_info = sys.exc_info()
91 exc_info = sys.exc_info()
92 store_exception(id(exc_info), exc_info)
92 store_exception(id(exc_info), exc_info)
93 """
93 """
94
94
95 try:
95 try:
96 _store_exception(exc_id=exc_id, exc_info=exc_info, prefix=prefix)
96 _store_exception(exc_id=exc_id, exc_info=exc_info, prefix=prefix)
97 except Exception:
97 except Exception:
98 log.exception('Failed to store exception `%s` information', exc_id)
98 log.exception('Failed to store exception `%s` information', exc_id)
99 # there's no way this can fail, it will crash server badly if it does.
99 # there's no way this can fail, it will crash server badly if it does.
100 pass
100 pass
101
101
102
102
103 def _find_exc_file(exc_id, prefix=global_prefix):
103 def _find_exc_file(exc_id, prefix=global_prefix):
104 exc_store_path = get_exc_store()
104 exc_store_path = get_exc_store()
105 if prefix:
105 if prefix:
106 exc_id = '{}_{}'.format(exc_id, prefix)
106 exc_id = '{}_{}'.format(exc_id, prefix)
107 else:
107 else:
108 # search without a prefix
108 # search without a prefix
109 exc_id = '{}'.format(exc_id)
109 exc_id = '{}'.format(exc_id)
110
110
111 # we need to search the store for such start pattern as above
111 # we need to search the store for such start pattern as above
112 for fname in os.listdir(exc_store_path):
112 for fname in os.listdir(exc_store_path):
113 if fname.startswith(exc_id):
113 if fname.startswith(exc_id):
114 exc_id = os.path.join(exc_store_path, fname)
114 exc_id = os.path.join(exc_store_path, fname)
115 break
115 break
116 continue
116 continue
117 else:
117 else:
118 exc_id = None
118 exc_id = None
119
119
120 return exc_id
120 return exc_id
121
121
122
122
123 def _read_exception(exc_id, prefix):
123 def _read_exception(exc_id, prefix):
124 exc_id_file_path = _find_exc_file(exc_id=exc_id, prefix=prefix)
124 exc_id_file_path = _find_exc_file(exc_id=exc_id, prefix=prefix)
125 if exc_id_file_path:
125 if exc_id_file_path:
126 with open(exc_id_file_path, 'rb') as f:
126 with open(exc_id_file_path, 'rb') as f:
127 return exc_unserialize(f.read())
127 return exc_unserialize(f.read())
128 else:
128 else:
129 log.debug('Exception File `%s` not found', exc_id_file_path)
129 log.debug('Exception File `%s` not found', exc_id_file_path)
130 return None
130 return None
131
131
132
132
133 def read_exception(exc_id, prefix=global_prefix):
133 def read_exception(exc_id, prefix=global_prefix):
134 try:
134 try:
135 return _read_exception(exc_id=exc_id, prefix=prefix)
135 return _read_exception(exc_id=exc_id, prefix=prefix)
136 except Exception:
136 except Exception:
137 log.exception('Failed to read exception `%s` information', exc_id)
137 log.exception('Failed to read exception `%s` information', exc_id)
138 # there's no way this can fail, it will crash server badly if it does.
138 # there's no way this can fail, it will crash server badly if it does.
139 return None
139 return None
140
140
141
141
142 def delete_exception(exc_id, prefix=global_prefix):
142 def delete_exception(exc_id, prefix=global_prefix):
143 try:
143 try:
144 exc_id_file_path = _find_exc_file(exc_id, prefix=prefix)
144 exc_id_file_path = _find_exc_file(exc_id, prefix=prefix)
145 if exc_id_file_path:
145 if exc_id_file_path:
146 os.remove(exc_id_file_path)
146 os.remove(exc_id_file_path)
147
147
148 except Exception:
148 except Exception:
149 log.exception('Failed to remove exception `%s` information', exc_id)
149 log.exception('Failed to remove exception `%s` information', exc_id)
150 # there's no way this can fail, it will crash server badly if it does.
150 # there's no way this can fail, it will crash server badly if it does.
151 pass
151 pass
General Comments 0
You need to be logged in to leave comments. Login now