##// END OF EJS Templates
docs: improve documentation of beaker session configuration...
Mads Kiilerich -
r5400:6257de12 default
parent child Browse files
Show More
@@ -1,602 +1,591 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # Kallithea - Development config: #
3 # Kallithea - Development config: #
4 # listening on *:5000 #
4 # listening on *:5000 #
5 # sqlite and kallithea.db #
5 # sqlite and kallithea.db #
6 # initial_repo_scan = true #
6 # initial_repo_scan = true #
7 # set debug = true #
7 # set debug = true #
8 # verbose and colorful logging #
8 # verbose and colorful logging #
9 # #
9 # #
10 # The %(here)s variable will be replaced with the parent directory of this file#
10 # The %(here)s variable will be replaced with the parent directory of this file#
11 ################################################################################
11 ################################################################################
12 ################################################################################
12 ################################################################################
13
13
14 [DEFAULT]
14 [DEFAULT]
15 debug = true
15 debug = true
16 pdebug = false
16 pdebug = false
17
17
18 ################################################################################
18 ################################################################################
19 ## E-mail settings ##
19 ## E-mail settings ##
20 ## ##
20 ## ##
21 ## Refer to the documentation ("E-mail settings") for more details. ##
21 ## Refer to the documentation ("E-mail settings") for more details. ##
22 ## ##
22 ## ##
23 ## It is recommended to use a valid sender address that passes access ##
23 ## It is recommended to use a valid sender address that passes access ##
24 ## validation and spam filtering in mail servers. ##
24 ## validation and spam filtering in mail servers. ##
25 ################################################################################
25 ################################################################################
26
26
27 ## 'From' header for application e-mails. You can optionally add a name.
27 ## 'From' header for application e-mails. You can optionally add a name.
28 ## Default:
28 ## Default:
29 #app_email_from = Kallithea
29 #app_email_from = Kallithea
30 ## Examples:
30 ## Examples:
31 #app_email_from = Kallithea <kallithea-noreply@example.com>
31 #app_email_from = Kallithea <kallithea-noreply@example.com>
32 #app_email_from = kallithea-noreply@example.com
32 #app_email_from = kallithea-noreply@example.com
33
33
34 ## Subject prefix for application e-mails.
34 ## Subject prefix for application e-mails.
35 ## A space between this prefix and the real subject is automatically added.
35 ## A space between this prefix and the real subject is automatically added.
36 ## Default:
36 ## Default:
37 #email_prefix =
37 #email_prefix =
38 ## Example:
38 ## Example:
39 #email_prefix = [Kallithea]
39 #email_prefix = [Kallithea]
40
40
41 ## Recipients for error e-mails and fallback recipients of application mails.
41 ## Recipients for error e-mails and fallback recipients of application mails.
42 ## Multiple addresses can be specified, space-separated.
42 ## Multiple addresses can be specified, space-separated.
43 ## Only addresses are allowed, do not add any name part.
43 ## Only addresses are allowed, do not add any name part.
44 ## Default:
44 ## Default:
45 #email_to =
45 #email_to =
46 ## Examples:
46 ## Examples:
47 #email_to = admin@example.com
47 #email_to = admin@example.com
48 #email_to = admin@example.com another_admin@example.com
48 #email_to = admin@example.com another_admin@example.com
49
49
50 ## 'From' header for error e-mails. You can optionally add a name.
50 ## 'From' header for error e-mails. You can optionally add a name.
51 ## Default:
51 ## Default:
52 #error_email_from = pylons@yourapp.com
52 #error_email_from = pylons@yourapp.com
53 ## Examples:
53 ## Examples:
54 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
54 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
55 #error_email_from = paste_error@example.com
55 #error_email_from = paste_error@example.com
56
56
57 ## SMTP server settings
57 ## SMTP server settings
58 ## Only smtp_server is mandatory. All other settings take the specified default
58 ## Only smtp_server is mandatory. All other settings take the specified default
59 ## values.
59 ## values.
60 #smtp_server = mail.server.com
60 #smtp_server = mail.server.com
61 #smtp_username =
61 #smtp_username =
62 #smtp_password =
62 #smtp_password =
63 #smtp_port = 25
63 #smtp_port = 25
64 #smtp_use_tls = false
64 #smtp_use_tls = false
65 #smtp_use_ssl = false
65 #smtp_use_ssl = false
66 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
66 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
67 ## If empty, use any of the authentication parameters supported by the server.
67 ## If empty, use any of the authentication parameters supported by the server.
68 #smtp_auth =
68 #smtp_auth =
69
69
70 [server:main]
70 [server:main]
71 ## PASTE ##
71 ## PASTE ##
72 #use = egg:Paste#http
72 #use = egg:Paste#http
73 ## nr of worker threads to spawn
73 ## nr of worker threads to spawn
74 #threadpool_workers = 5
74 #threadpool_workers = 5
75 ## max request before thread respawn
75 ## max request before thread respawn
76 #threadpool_max_requests = 10
76 #threadpool_max_requests = 10
77 ## option to use threads of process
77 ## option to use threads of process
78 #use_threadpool = true
78 #use_threadpool = true
79
79
80 ## WAITRESS ##
80 ## WAITRESS ##
81 use = egg:waitress#main
81 use = egg:waitress#main
82 ## number of worker threads
82 ## number of worker threads
83 threads = 5
83 threads = 5
84 ## MAX BODY SIZE 100GB
84 ## MAX BODY SIZE 100GB
85 max_request_body_size = 107374182400
85 max_request_body_size = 107374182400
86 ## use poll instead of select, fixes fd limits, may not work on old
86 ## use poll instead of select, fixes fd limits, may not work on old
87 ## windows systems.
87 ## windows systems.
88 #asyncore_use_poll = True
88 #asyncore_use_poll = True
89
89
90 ## GUNICORN ##
90 ## GUNICORN ##
91 #use = egg:gunicorn#main
91 #use = egg:gunicorn#main
92 ## number of process workers. You must set `instance_id = *` when this option
92 ## number of process workers. You must set `instance_id = *` when this option
93 ## is set to more than one worker
93 ## is set to more than one worker
94 #workers = 1
94 #workers = 1
95 ## process name
95 ## process name
96 #proc_name = kallithea
96 #proc_name = kallithea
97 ## type of worker class, one of sync, eventlet, gevent, tornado
97 ## type of worker class, one of sync, eventlet, gevent, tornado
98 ## recommended for bigger setup is using of of other than sync one
98 ## recommended for bigger setup is using of of other than sync one
99 #worker_class = sync
99 #worker_class = sync
100 #max_requests = 1000
100 #max_requests = 1000
101 ## ammount of time a worker can handle request before it gets killed and
101 ## ammount of time a worker can handle request before it gets killed and
102 ## restarted
102 ## restarted
103 #timeout = 3600
103 #timeout = 3600
104
104
105 ## UWSGI ##
105 ## UWSGI ##
106 ## run with uwsgi --ini-paste-logged <inifile.ini>
106 ## run with uwsgi --ini-paste-logged <inifile.ini>
107 #[uwsgi]
107 #[uwsgi]
108 #socket = /tmp/uwsgi.sock
108 #socket = /tmp/uwsgi.sock
109 #master = true
109 #master = true
110 #http = 127.0.0.1:5000
110 #http = 127.0.0.1:5000
111
111
112 ## set as deamon and redirect all output to file
112 ## set as deamon and redirect all output to file
113 #daemonize = ./uwsgi_kallithea.log
113 #daemonize = ./uwsgi_kallithea.log
114
114
115 ## master process PID
115 ## master process PID
116 #pidfile = ./uwsgi_kallithea.pid
116 #pidfile = ./uwsgi_kallithea.pid
117
117
118 ## stats server with workers statistics, use uwsgitop
118 ## stats server with workers statistics, use uwsgitop
119 ## for monitoring, `uwsgitop 127.0.0.1:1717`
119 ## for monitoring, `uwsgitop 127.0.0.1:1717`
120 #stats = 127.0.0.1:1717
120 #stats = 127.0.0.1:1717
121 #memory-report = true
121 #memory-report = true
122
122
123 ## log 5XX errors
123 ## log 5XX errors
124 #log-5xx = true
124 #log-5xx = true
125
125
126 ## Set the socket listen queue size.
126 ## Set the socket listen queue size.
127 #listen = 256
127 #listen = 256
128
128
129 ## Gracefully Reload workers after the specified amount of managed requests
129 ## Gracefully Reload workers after the specified amount of managed requests
130 ## (avoid memory leaks).
130 ## (avoid memory leaks).
131 #max-requests = 1000
131 #max-requests = 1000
132
132
133 ## enable large buffers
133 ## enable large buffers
134 #buffer-size = 65535
134 #buffer-size = 65535
135
135
136 ## socket and http timeouts ##
136 ## socket and http timeouts ##
137 #http-timeout = 3600
137 #http-timeout = 3600
138 #socket-timeout = 3600
138 #socket-timeout = 3600
139
139
140 ## Log requests slower than the specified number of milliseconds.
140 ## Log requests slower than the specified number of milliseconds.
141 #log-slow = 10
141 #log-slow = 10
142
142
143 ## Exit if no app can be loaded.
143 ## Exit if no app can be loaded.
144 #need-app = true
144 #need-app = true
145
145
146 ## Set lazy mode (load apps in workers instead of master).
146 ## Set lazy mode (load apps in workers instead of master).
147 #lazy = true
147 #lazy = true
148
148
149 ## scaling ##
149 ## scaling ##
150 ## set cheaper algorithm to use, if not set default will be used
150 ## set cheaper algorithm to use, if not set default will be used
151 #cheaper-algo = spare
151 #cheaper-algo = spare
152
152
153 ## minimum number of workers to keep at all times
153 ## minimum number of workers to keep at all times
154 #cheaper = 1
154 #cheaper = 1
155
155
156 ## number of workers to spawn at startup
156 ## number of workers to spawn at startup
157 #cheaper-initial = 1
157 #cheaper-initial = 1
158
158
159 ## maximum number of workers that can be spawned
159 ## maximum number of workers that can be spawned
160 #workers = 4
160 #workers = 4
161
161
162 ## how many workers should be spawned at a time
162 ## how many workers should be spawned at a time
163 #cheaper-step = 1
163 #cheaper-step = 1
164
164
165 ## COMMON ##
165 ## COMMON ##
166 host = 0.0.0.0
166 host = 0.0.0.0
167 port = 5000
167 port = 5000
168
168
169 ## middleware for hosting the WSGI application under a URL prefix
169 ## middleware for hosting the WSGI application under a URL prefix
170 #[filter:proxy-prefix]
170 #[filter:proxy-prefix]
171 #use = egg:PasteDeploy#prefix
171 #use = egg:PasteDeploy#prefix
172 #prefix = /<your-prefix>
172 #prefix = /<your-prefix>
173
173
174 [app:main]
174 [app:main]
175 use = egg:kallithea
175 use = egg:kallithea
176 ## enable proxy prefix middleware
176 ## enable proxy prefix middleware
177 #filter-with = proxy-prefix
177 #filter-with = proxy-prefix
178
178
179 full_stack = true
179 full_stack = true
180 static_files = true
180 static_files = true
181 ## Available Languages:
181 ## Available Languages:
182 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
182 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
183 lang =
183 lang =
184 cache_dir = %(here)s/data
184 cache_dir = %(here)s/data
185 index_dir = %(here)s/data/index
185 index_dir = %(here)s/data/index
186
186
187 ## perform a full repository scan on each server start, this should be
187 ## perform a full repository scan on each server start, this should be
188 ## set to false after first startup, to allow faster server restarts.
188 ## set to false after first startup, to allow faster server restarts.
189 #initial_repo_scan = false
189 #initial_repo_scan = false
190 initial_repo_scan = true
190 initial_repo_scan = true
191
191
192 ## uncomment and set this path to use archive download cache
192 ## uncomment and set this path to use archive download cache
193 archive_cache_dir = %(here)s/tarballcache
193 archive_cache_dir = %(here)s/tarballcache
194
194
195 ## change this to unique ID for security
195 ## change this to unique ID for security
196 app_instance_uuid = development-not-secret
196 app_instance_uuid = development-not-secret
197
197
198 ## cut off limit for large diffs (size in bytes)
198 ## cut off limit for large diffs (size in bytes)
199 cut_off_limit = 256000
199 cut_off_limit = 256000
200
200
201 ## use cache version of scm repo everywhere
201 ## use cache version of scm repo everywhere
202 vcs_full_cache = true
202 vcs_full_cache = true
203
203
204 ## force https in Kallithea, fixes https redirects, assumes it's always https
204 ## force https in Kallithea, fixes https redirects, assumes it's always https
205 force_https = false
205 force_https = false
206
206
207 ## use Strict-Transport-Security headers
207 ## use Strict-Transport-Security headers
208 use_htsts = false
208 use_htsts = false
209
209
210 ## number of commits stats will parse on each iteration
210 ## number of commits stats will parse on each iteration
211 commit_parse_limit = 25
211 commit_parse_limit = 25
212
212
213 ## path to git executable
213 ## path to git executable
214 git_path = git
214 git_path = git
215
215
216 ## git rev filter option, --all is the default filter, if you need to
216 ## git rev filter option, --all is the default filter, if you need to
217 ## hide all refs in changelog switch this to --branches --tags
217 ## hide all refs in changelog switch this to --branches --tags
218 #git_rev_filter = --branches --tags
218 #git_rev_filter = --branches --tags
219
219
220 ## RSS feed options
220 ## RSS feed options
221 rss_cut_off_limit = 256000
221 rss_cut_off_limit = 256000
222 rss_items_per_page = 10
222 rss_items_per_page = 10
223 rss_include_diff = false
223 rss_include_diff = false
224
224
225 ## options for showing and identifying changesets
225 ## options for showing and identifying changesets
226 show_sha_length = 12
226 show_sha_length = 12
227 show_revision_number = false
227 show_revision_number = false
228
228
229 ## gist URL alias, used to create nicer urls for gist. This should be an
229 ## gist URL alias, used to create nicer urls for gist. This should be an
230 ## url that does rewrites to _admin/gists/<gistid>.
230 ## url that does rewrites to _admin/gists/<gistid>.
231 ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal
231 ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal
232 ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid>
232 ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid>
233 gist_alias_url =
233 gist_alias_url =
234
234
235 ## white list of API enabled controllers. This allows to add list of
235 ## white list of API enabled controllers. This allows to add list of
236 ## controllers to which access will be enabled by api_key. eg: to enable
236 ## controllers to which access will be enabled by api_key. eg: to enable
237 ## api access to raw_files put `FilesController:raw`, to enable access to patches
237 ## api access to raw_files put `FilesController:raw`, to enable access to patches
238 ## add `ChangesetController:changeset_patch`. This list should be "," separated
238 ## add `ChangesetController:changeset_patch`. This list should be "," separated
239 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
239 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
240 ## Recommended settings below are commented out:
240 ## Recommended settings below are commented out:
241 api_access_controllers_whitelist =
241 api_access_controllers_whitelist =
242 # ChangesetController:changeset_patch,
242 # ChangesetController:changeset_patch,
243 # ChangesetController:changeset_raw,
243 # ChangesetController:changeset_raw,
244 # FilesController:raw,
244 # FilesController:raw,
245 # FilesController:archivefile
245 # FilesController:archivefile
246
246
247 ## default encoding used to convert from and to unicode
247 ## default encoding used to convert from and to unicode
248 ## can be also a comma seperated list of encoding in case of mixed encodings
248 ## can be also a comma seperated list of encoding in case of mixed encodings
249 default_encoding = utf8
249 default_encoding = utf8
250
250
251 ## issue tracker for Kallithea (leave blank to disable, absent for default)
251 ## issue tracker for Kallithea (leave blank to disable, absent for default)
252 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
252 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
253
253
254 ## issue tracking mapping for commits messages
254 ## issue tracking mapping for commits messages
255 ## comment out issue_pat, issue_server, issue_prefix to enable
255 ## comment out issue_pat, issue_server, issue_prefix to enable
256
256
257 ## pattern to get the issues from commit messages
257 ## pattern to get the issues from commit messages
258 ## default one used here is #<numbers> with a regex passive group for `#`
258 ## default one used here is #<numbers> with a regex passive group for `#`
259 ## {id} will be all groups matched from this pattern
259 ## {id} will be all groups matched from this pattern
260
260
261 issue_pat = (?:\s*#)(\d+)
261 issue_pat = (?:\s*#)(\d+)
262
262
263 ## server url to the issue, each {id} will be replaced with match
263 ## server url to the issue, each {id} will be replaced with match
264 ## fetched from the regex and {repo} is replaced with full repository name
264 ## fetched from the regex and {repo} is replaced with full repository name
265 ## including groups {repo_name} is replaced with just name of repo
265 ## including groups {repo_name} is replaced with just name of repo
266
266
267 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
267 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
268
268
269 ## prefix to add to link to indicate it's an url
269 ## prefix to add to link to indicate it's an url
270 ## #314 will be replaced by <issue_prefix><id>
270 ## #314 will be replaced by <issue_prefix><id>
271
271
272 issue_prefix = #
272 issue_prefix = #
273
273
274 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
274 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
275 ## multiple patterns, to other issues server, wiki or others
275 ## multiple patterns, to other issues server, wiki or others
276 ## below an example how to create a wiki pattern
276 ## below an example how to create a wiki pattern
277 # wiki-some-id -> https://mywiki.com/some-id
277 # wiki-some-id -> https://mywiki.com/some-id
278
278
279 #issue_pat_wiki = (?:wiki-)(.+)
279 #issue_pat_wiki = (?:wiki-)(.+)
280 #issue_server_link_wiki = https://mywiki.com/{id}
280 #issue_server_link_wiki = https://mywiki.com/{id}
281 #issue_prefix_wiki = WIKI-
281 #issue_prefix_wiki = WIKI-
282
282
283 ## instance-id prefix
283 ## instance-id prefix
284 ## a prefix key for this instance used for cache invalidation when running
284 ## a prefix key for this instance used for cache invalidation when running
285 ## multiple instances of kallithea, make sure it's globally unique for
285 ## multiple instances of kallithea, make sure it's globally unique for
286 ## all running kallithea instances. Leave empty if you don't use it
286 ## all running kallithea instances. Leave empty if you don't use it
287 instance_id =
287 instance_id =
288
288
289 ## alternative return HTTP header for failed authentication. Default HTTP
289 ## alternative return HTTP header for failed authentication. Default HTTP
290 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
290 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
291 ## handling that. Set this variable to 403 to return HTTPForbidden
291 ## handling that. Set this variable to 403 to return HTTPForbidden
292 auth_ret_code =
292 auth_ret_code =
293
293
294 ## locking return code. When repository is locked return this HTTP code. 2XX
294 ## locking return code. When repository is locked return this HTTP code. 2XX
295 ## codes don't break the transactions while 4XX codes do
295 ## codes don't break the transactions while 4XX codes do
296 lock_ret_code = 423
296 lock_ret_code = 423
297
297
298 ## allows to change the repository location in settings page
298 ## allows to change the repository location in settings page
299 allow_repo_location_change = True
299 allow_repo_location_change = True
300
300
301 ## allows to setup custom hooks in settings page
301 ## allows to setup custom hooks in settings page
302 allow_custom_hooks_settings = True
302 allow_custom_hooks_settings = True
303
303
304 ####################################
304 ####################################
305 ### CELERY CONFIG ####
305 ### CELERY CONFIG ####
306 ####################################
306 ####################################
307
307
308 use_celery = false
308 use_celery = false
309 broker.host = localhost
309 broker.host = localhost
310 broker.vhost = rabbitmqhost
310 broker.vhost = rabbitmqhost
311 broker.port = 5672
311 broker.port = 5672
312 broker.user = rabbitmq
312 broker.user = rabbitmq
313 broker.password = qweqwe
313 broker.password = qweqwe
314
314
315 celery.imports = kallithea.lib.celerylib.tasks
315 celery.imports = kallithea.lib.celerylib.tasks
316
316
317 celery.result.backend = amqp
317 celery.result.backend = amqp
318 celery.result.dburi = amqp://
318 celery.result.dburi = amqp://
319 celery.result.serialier = json
319 celery.result.serialier = json
320
320
321 #celery.send.task.error.emails = true
321 #celery.send.task.error.emails = true
322 #celery.amqp.task.result.expires = 18000
322 #celery.amqp.task.result.expires = 18000
323
323
324 celeryd.concurrency = 2
324 celeryd.concurrency = 2
325 #celeryd.log.file = celeryd.log
325 #celeryd.log.file = celeryd.log
326 celeryd.log.level = DEBUG
326 celeryd.log.level = DEBUG
327 celeryd.max.tasks.per.child = 1
327 celeryd.max.tasks.per.child = 1
328
328
329 ## tasks will never be sent to the queue, but executed locally instead.
329 ## tasks will never be sent to the queue, but executed locally instead.
330 celery.always.eager = false
330 celery.always.eager = false
331
331
332 ####################################
332 ####################################
333 ### BEAKER CACHE ####
333 ### BEAKER CACHE ####
334 ####################################
334 ####################################
335
335
336 beaker.cache.data_dir = %(here)s/data/cache/data
336 beaker.cache.data_dir = %(here)s/data/cache/data
337 beaker.cache.lock_dir = %(here)s/data/cache/lock
337 beaker.cache.lock_dir = %(here)s/data/cache/lock
338
338
339 beaker.cache.regions = short_term,long_term,sql_cache_short
339 beaker.cache.regions = short_term,long_term,sql_cache_short
340
340
341 beaker.cache.short_term.type = memory
341 beaker.cache.short_term.type = memory
342 beaker.cache.short_term.expire = 60
342 beaker.cache.short_term.expire = 60
343 beaker.cache.short_term.key_length = 256
343 beaker.cache.short_term.key_length = 256
344
344
345 beaker.cache.long_term.type = memory
345 beaker.cache.long_term.type = memory
346 beaker.cache.long_term.expire = 36000
346 beaker.cache.long_term.expire = 36000
347 beaker.cache.long_term.key_length = 256
347 beaker.cache.long_term.key_length = 256
348
348
349 beaker.cache.sql_cache_short.type = memory
349 beaker.cache.sql_cache_short.type = memory
350 beaker.cache.sql_cache_short.expire = 10
350 beaker.cache.sql_cache_short.expire = 10
351 beaker.cache.sql_cache_short.key_length = 256
351 beaker.cache.sql_cache_short.key_length = 256
352
352
353 ####################################
353 ####################################
354 ### BEAKER SESSION ####
354 ### BEAKER SESSION ####
355 ####################################
355 ####################################
356
357 ## Name of session cookie. Should be unique for a given host and path, even when running
358 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
359 beaker.session.key = kallithea
360 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
361 beaker.session.httponly = true
362 ## Session lifetime. 2592000 seconds is 30 days.
363 beaker.session.timeout = 2592000
364
365 ## Server secret used with HMAC to ensure integrity of cookies.
366 beaker.session.secret = development-not-secret
367 ## Further, encrypt the data with AES.
368 #beaker.session.encrypt_key = <key_for_encryption>
369 #beaker.session.validate_key = <validation_key>
370
356 ## Type of storage used for the session, current types are
371 ## Type of storage used for the session, current types are
357 ## dbm, file, memcached, database, and memory.
372 ## dbm, file, memcached, database, and memory.
358 ## The storage uses the Container API
373
359 ## that is also used by the cache system.
374 ## File system storage of session data. (default)
375 #beaker.session.type = file
360
376
361 ## db session ##
377 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
378 #beaker.session.type = cookie
379
380 ## Database storage of session data.
362 #beaker.session.type = ext:database
381 #beaker.session.type = ext:database
363 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
382 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
364 #beaker.session.table_name = db_session
383 #beaker.session.table_name = db_session
365
384
366 ## encrypted cookie client side session, good for many instances ##
367 #beaker.session.type = cookie
368
369 ## file based cookies (default) ##
370 #beaker.session.type = file
371
372 ## beaker.session.key should be unique for a given host, even when running
373 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
374 beaker.session.key = kallithea
375 beaker.session.secret = development-not-secret
376
377 ## Secure encrypted cookie. Requires AES and AES python libraries
378 ## you must disable beaker.session.secret to use this
379 #beaker.session.encrypt_key = <key_for_encryption>
380 #beaker.session.validate_key = <validation_key>
381
382 ## sets session as invalid if it haven't been accessed for given amount of time
383 beaker.session.timeout = 2592000
384 beaker.session.httponly = true
385 #beaker.session.cookie_path = /<your-prefix>
386
387 ## uncomment for https secure cookie
388 beaker.session.secure = false
389
390 ## auto save the session to not to use .save()
391 beaker.session.auto = False
392
393 ## default cookie expiration time in seconds `true` expire at browser close ##
394 #beaker.session.cookie_expires = 3600
395
396 ############################
385 ############################
397 ## ERROR HANDLING SYSTEMS ##
386 ## ERROR HANDLING SYSTEMS ##
398 ############################
387 ############################
399
388
400 ####################
389 ####################
401 ### [errormator] ###
390 ### [errormator] ###
402 ####################
391 ####################
403
392
404 ## Errormator is tailored to work with Kallithea, see
393 ## Errormator is tailored to work with Kallithea, see
405 ## http://errormator.com for details how to obtain an account
394 ## http://errormator.com for details how to obtain an account
406 ## you must install python package `errormator_client` to make it work
395 ## you must install python package `errormator_client` to make it work
407
396
408 ## errormator enabled
397 ## errormator enabled
409 errormator = false
398 errormator = false
410
399
411 errormator.server_url = https://api.errormator.com
400 errormator.server_url = https://api.errormator.com
412 errormator.api_key = YOUR_API_KEY
401 errormator.api_key = YOUR_API_KEY
413
402
414 ## TWEAK AMOUNT OF INFO SENT HERE
403 ## TWEAK AMOUNT OF INFO SENT HERE
415
404
416 ## enables 404 error logging (default False)
405 ## enables 404 error logging (default False)
417 errormator.report_404 = false
406 errormator.report_404 = false
418
407
419 ## time in seconds after request is considered being slow (default 1)
408 ## time in seconds after request is considered being slow (default 1)
420 errormator.slow_request_time = 1
409 errormator.slow_request_time = 1
421
410
422 ## record slow requests in application
411 ## record slow requests in application
423 ## (needs to be enabled for slow datastore recording and time tracking)
412 ## (needs to be enabled for slow datastore recording and time tracking)
424 errormator.slow_requests = true
413 errormator.slow_requests = true
425
414
426 ## enable hooking to application loggers
415 ## enable hooking to application loggers
427 #errormator.logging = true
416 #errormator.logging = true
428
417
429 ## minimum log level for log capture
418 ## minimum log level for log capture
430 #errormator.logging.level = WARNING
419 #errormator.logging.level = WARNING
431
420
432 ## send logs only from erroneous/slow requests
421 ## send logs only from erroneous/slow requests
433 ## (saves API quota for intensive logging)
422 ## (saves API quota for intensive logging)
434 errormator.logging_on_error = false
423 errormator.logging_on_error = false
435
424
436 ## list of additonal keywords that should be grabbed from environ object
425 ## list of additonal keywords that should be grabbed from environ object
437 ## can be string with comma separated list of words in lowercase
426 ## can be string with comma separated list of words in lowercase
438 ## (by default client will always send following info:
427 ## (by default client will always send following info:
439 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
428 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
440 ## start with HTTP* this list be extended with additional keywords here
429 ## start with HTTP* this list be extended with additional keywords here
441 errormator.environ_keys_whitelist =
430 errormator.environ_keys_whitelist =
442
431
443 ## list of keywords that should be blanked from request object
432 ## list of keywords that should be blanked from request object
444 ## can be string with comma separated list of words in lowercase
433 ## can be string with comma separated list of words in lowercase
445 ## (by default client will always blank keys that contain following words
434 ## (by default client will always blank keys that contain following words
446 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
435 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
447 ## this list be extended with additional keywords set here
436 ## this list be extended with additional keywords set here
448 errormator.request_keys_blacklist =
437 errormator.request_keys_blacklist =
449
438
450 ## list of namespaces that should be ignores when gathering log entries
439 ## list of namespaces that should be ignores when gathering log entries
451 ## can be string with comma separated list of namespaces
440 ## can be string with comma separated list of namespaces
452 ## (by default the client ignores own entries: errormator_client.client)
441 ## (by default the client ignores own entries: errormator_client.client)
453 errormator.log_namespace_blacklist =
442 errormator.log_namespace_blacklist =
454
443
455 ################
444 ################
456 ### [sentry] ###
445 ### [sentry] ###
457 ################
446 ################
458
447
459 ## sentry is a alternative open source error aggregator
448 ## sentry is a alternative open source error aggregator
460 ## you must install python packages `sentry` and `raven` to enable
449 ## you must install python packages `sentry` and `raven` to enable
461
450
462 sentry.dsn = YOUR_DNS
451 sentry.dsn = YOUR_DNS
463 sentry.servers =
452 sentry.servers =
464 sentry.name =
453 sentry.name =
465 sentry.key =
454 sentry.key =
466 sentry.public_key =
455 sentry.public_key =
467 sentry.secret_key =
456 sentry.secret_key =
468 sentry.project =
457 sentry.project =
469 sentry.site =
458 sentry.site =
470 sentry.include_paths =
459 sentry.include_paths =
471 sentry.exclude_paths =
460 sentry.exclude_paths =
472
461
473 ################################################################################
462 ################################################################################
474 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
463 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
475 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
464 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
476 ## execute malicious code after an exception is raised. ##
465 ## execute malicious code after an exception is raised. ##
477 ################################################################################
466 ################################################################################
478 #set debug = false
467 #set debug = false
479 set debug = true
468 set debug = true
480
469
481 ##################################
470 ##################################
482 ### LOGVIEW CONFIG ###
471 ### LOGVIEW CONFIG ###
483 ##################################
472 ##################################
484
473
485 logview.sqlalchemy = #faa
474 logview.sqlalchemy = #faa
486 logview.pylons.templating = #bfb
475 logview.pylons.templating = #bfb
487 logview.pylons.util = #eee
476 logview.pylons.util = #eee
488
477
489 #########################################################
478 #########################################################
490 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
479 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
491 #########################################################
480 #########################################################
492
481
493 # SQLITE [default]
482 # SQLITE [default]
494 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
483 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
495
484
496 # POSTGRESQL
485 # POSTGRESQL
497 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
486 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
498
487
499 # MySQL
488 # MySQL
500 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
489 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
501
490
502 # see sqlalchemy docs for others
491 # see sqlalchemy docs for others
503
492
504 sqlalchemy.db1.echo = false
493 sqlalchemy.db1.echo = false
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 ################################
497 ################################
509 ### LOGGING CONFIGURATION ####
498 ### LOGGING CONFIGURATION ####
510 ################################
499 ################################
511
500
512 [loggers]
501 [loggers]
513 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
502 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
514
503
515 [handlers]
504 [handlers]
516 keys = console, console_sql
505 keys = console, console_sql
517
506
518 [formatters]
507 [formatters]
519 keys = generic, color_formatter, color_formatter_sql
508 keys = generic, color_formatter, color_formatter_sql
520
509
521 #############
510 #############
522 ## LOGGERS ##
511 ## LOGGERS ##
523 #############
512 #############
524
513
525 [logger_root]
514 [logger_root]
526 level = NOTSET
515 level = NOTSET
527 handlers = console
516 handlers = console
528
517
529 [logger_routes]
518 [logger_routes]
530 level = DEBUG
519 level = DEBUG
531 handlers =
520 handlers =
532 qualname = routes.middleware
521 qualname = routes.middleware
533 ## "level = DEBUG" logs the route matched and routing variables.
522 ## "level = DEBUG" logs the route matched and routing variables.
534 propagate = 1
523 propagate = 1
535
524
536 [logger_beaker]
525 [logger_beaker]
537 level = DEBUG
526 level = DEBUG
538 handlers =
527 handlers =
539 qualname = beaker.container
528 qualname = beaker.container
540 propagate = 1
529 propagate = 1
541
530
542 [logger_templates]
531 [logger_templates]
543 level = INFO
532 level = INFO
544 handlers =
533 handlers =
545 qualname = pylons.templating
534 qualname = pylons.templating
546 propagate = 1
535 propagate = 1
547
536
548 [logger_kallithea]
537 [logger_kallithea]
549 level = DEBUG
538 level = DEBUG
550 handlers =
539 handlers =
551 qualname = kallithea
540 qualname = kallithea
552 propagate = 1
541 propagate = 1
553
542
554 [logger_sqlalchemy]
543 [logger_sqlalchemy]
555 level = INFO
544 level = INFO
556 handlers = console_sql
545 handlers = console_sql
557 qualname = sqlalchemy.engine
546 qualname = sqlalchemy.engine
558 propagate = 0
547 propagate = 0
559
548
560 [logger_whoosh_indexer]
549 [logger_whoosh_indexer]
561 level = DEBUG
550 level = DEBUG
562 handlers =
551 handlers =
563 qualname = whoosh_indexer
552 qualname = whoosh_indexer
564 propagate = 1
553 propagate = 1
565
554
566 ##############
555 ##############
567 ## HANDLERS ##
556 ## HANDLERS ##
568 ##############
557 ##############
569
558
570 [handler_console]
559 [handler_console]
571 class = StreamHandler
560 class = StreamHandler
572 args = (sys.stderr,)
561 args = (sys.stderr,)
573 #level = INFO
562 #level = INFO
574 #formatter = generic
563 #formatter = generic
575 level = DEBUG
564 level = DEBUG
576 formatter = color_formatter
565 formatter = color_formatter
577
566
578 [handler_console_sql]
567 [handler_console_sql]
579 class = StreamHandler
568 class = StreamHandler
580 args = (sys.stderr,)
569 args = (sys.stderr,)
581 #level = WARN
570 #level = WARN
582 #formatter = generic
571 #formatter = generic
583 level = DEBUG
572 level = DEBUG
584 formatter = color_formatter_sql
573 formatter = color_formatter_sql
585
574
586 ################
575 ################
587 ## FORMATTERS ##
576 ## FORMATTERS ##
588 ################
577 ################
589
578
590 [formatter_generic]
579 [formatter_generic]
591 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
580 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
592 datefmt = %Y-%m-%d %H:%M:%S
581 datefmt = %Y-%m-%d %H:%M:%S
593
582
594 [formatter_color_formatter]
583 [formatter_color_formatter]
595 class = kallithea.lib.colored_formatter.ColorFormatter
584 class = kallithea.lib.colored_formatter.ColorFormatter
596 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
585 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
597 datefmt = %Y-%m-%d %H:%M:%S
586 datefmt = %Y-%m-%d %H:%M:%S
598
587
599 [formatter_color_formatter_sql]
588 [formatter_color_formatter_sql]
600 class = kallithea.lib.colored_formatter.ColorFormatterSql
589 class = kallithea.lib.colored_formatter.ColorFormatterSql
601 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
590 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
602 datefmt = %Y-%m-%d %H:%M:%S
591 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,57 +1,57 b''
1 .. _performance:
1 .. _performance:
2
2
3 ================================
3 ================================
4 Optimizing Kallithea Performance
4 Optimizing Kallithea Performance
5 ================================
5 ================================
6
6
7 When serving a large amount of big repositories, Kallithea can start
7 When serving a large amount of big repositories, Kallithea can start
8 performing slower than expected. Because of the demanding nature of handling large
8 performing slower than expected. Because of the demanding nature of handling large
9 amounts of data from version control systems, here are some tips on how to get
9 amounts of data from version control systems, here are some tips on how to get
10 the best performance.
10 the best performance.
11
11
12 * Kallithea will perform better on machines with faster disks (SSD/SAN). It's
12 * Kallithea will perform better on machines with faster disks (SSD/SAN). It's
13 more important to have a faster disk than a faster CPU.
13 more important to have a faster disk than a faster CPU.
14
14
15 * Slowness on initial page can be easily fixed by grouping repositories, and/or
15 * Slowness on initial page can be easily fixed by grouping repositories, and/or
16 increasing cache size (see below). This includes using the lightweight dashboard
16 increasing cache size (see below). This includes using the lightweight dashboard
17 option and ``vcs_full_cache`` setting in .ini file
17 option and ``vcs_full_cache`` setting in .ini file
18
18
19
19
20 Follow these few steps to improve performance of Kallithea system.
20 Follow these few steps to improve performance of Kallithea system.
21
21
22
22
23 1. Increase cache
23 1. Increase cache
24
24
25 Tweak beaker cache settings in the ini file. That actual effect of that
25 Tweak beaker cache settings in the ini file. The actual effect of that
26 is questionable.
26 is questionable.
27
27
28 2. Switch from sqlite to postgres or mysql
28 2. Switch from sqlite to postgres or mysql
29
29
30 sqlite is a good option when having a small load on the system. But due to
30 sqlite is a good option when having a small load on the system. But due to
31 locking issues with sqlite, it is not recommended to use it for larger
31 locking issues with sqlite, it is not recommended to use it for larger
32 deployments. Switching to mysql or postgres will result in an immediate
32 deployments. Switching to mysql or postgres will result in an immediate
33 performance increase. A tool like SQLAlchemyGrate_ can be used for
33 performance increase. A tool like SQLAlchemyGrate_ can be used for
34 migrating to another database platform.
34 migrating to another database platform.
35
35
36 3. Scale Kallithea horizontally
36 3. Scale Kallithea horizontally
37
37
38 Scaling horizontally can give huge performance increases when dealing with
38 Scaling horizontally can give huge performance increases when dealing with
39 large traffic (large amount of users, CI servers etc). Kallithea can be
39 large traffic (large amount of users, CI servers etc). Kallithea can be
40 scaled horizontally on one (recommended) or multiple machines. In order
40 scaled horizontally on one (recommended) or multiple machines. In order
41 to scale horizontally you need to do the following:
41 to scale horizontally you need to do the following:
42
42
43 - Each instance needs its own .ini file and unique ``instance_id`` set.
43 - Each instance needs its own .ini file and unique ``instance_id`` set.
44 - Each instance's ``data`` storage needs to be configured to be stored on a
44 - Each instance's ``data`` storage needs to be configured to be stored on a
45 shared disk storage, preferably together with repositories. This ``data``
45 shared disk storage, preferably together with repositories. This ``data``
46 dir contains template caches, sessions, whoosh index and is used for
46 dir contains template caches, sessions, whoosh index and is used for
47 task locking (so it is safe across multiple instances). Set the
47 task locking (so it is safe across multiple instances). Set the
48 ``cache_dir``, ``index_dir``, ``beaker.cache.data_dir``, ``beaker.cache.lock_dir``
48 ``cache_dir``, ``index_dir``, ``beaker.cache.data_dir``, ``beaker.cache.lock_dir``
49 variables in each .ini file to a shared location across Kallithea instances
49 variables in each .ini file to a shared location across Kallithea instances
50 - If celery is used each instance should run a separate Celery instance, but
50 - If celery is used each instance should run a separate Celery instance, but
51 the message broker should be common to all of them (e.g., one
51 the message broker should be common to all of them (e.g., one
52 shared RabbitMQ server)
52 shared RabbitMQ server)
53 - Load balance using round robin or IP hash, recommended is writing LB rules
53 - Load balance using round robin or IP hash, recommended is writing LB rules
54 that will separate regular user traffic from automated processes like CI
54 that will separate regular user traffic from automated processes like CI
55 servers or build bots.
55 servers or build bots.
56
56
57 .. _SQLAlchemyGrate: https://github.com/shazow/sqlalchemygrate
57 .. _SQLAlchemyGrate: https://github.com/shazow/sqlalchemygrate
@@ -1,602 +1,591 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%text>################################################################################</%text>
2 <%text>################################################################################</%text>
3 <%text>################################################################################</%text>
3 <%text>################################################################################</%text>
4 # Kallithea - config file generated with kallithea-config #
4 # Kallithea - config file generated with kallithea-config #
5 <%text>################################################################################</%text>
5 <%text>################################################################################</%text>
6 <%text>################################################################################</%text>
6 <%text>################################################################################</%text>
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11
11
12 <%text>################################################################################</%text>
12 <%text>################################################################################</%text>
13 <%text>## E-mail settings ##</%text>
13 <%text>## E-mail settings ##</%text>
14 <%text>## ##</%text>
14 <%text>## ##</%text>
15 <%text>## Refer to the documentation ("E-mail settings") for more details. ##</%text>
15 <%text>## Refer to the documentation ("E-mail settings") for more details. ##</%text>
16 <%text>## ##</%text>
16 <%text>## ##</%text>
17 <%text>## It is recommended to use a valid sender address that passes access ##</%text>
17 <%text>## It is recommended to use a valid sender address that passes access ##</%text>
18 <%text>## validation and spam filtering in mail servers. ##</%text>
18 <%text>## validation and spam filtering in mail servers. ##</%text>
19 <%text>################################################################################</%text>
19 <%text>################################################################################</%text>
20
20
21 <%text>## 'From' header for application e-mails. You can optionally add a name.</%text>
21 <%text>## 'From' header for application e-mails. You can optionally add a name.</%text>
22 <%text>## Default:</%text>
22 <%text>## Default:</%text>
23 #app_email_from = Kallithea
23 #app_email_from = Kallithea
24 <%text>## Examples:</%text>
24 <%text>## Examples:</%text>
25 #app_email_from = Kallithea <kallithea-noreply@example.com>
25 #app_email_from = Kallithea <kallithea-noreply@example.com>
26 #app_email_from = kallithea-noreply@example.com
26 #app_email_from = kallithea-noreply@example.com
27
27
28 <%text>## Subject prefix for application e-mails.</%text>
28 <%text>## Subject prefix for application e-mails.</%text>
29 <%text>## A space between this prefix and the real subject is automatically added.</%text>
29 <%text>## A space between this prefix and the real subject is automatically added.</%text>
30 <%text>## Default:</%text>
30 <%text>## Default:</%text>
31 #email_prefix =
31 #email_prefix =
32 <%text>## Example:</%text>
32 <%text>## Example:</%text>
33 #email_prefix = [Kallithea]
33 #email_prefix = [Kallithea]
34
34
35 <%text>## Recipients for error e-mails and fallback recipients of application mails.</%text>
35 <%text>## Recipients for error e-mails and fallback recipients of application mails.</%text>
36 <%text>## Multiple addresses can be specified, space-separated.</%text>
36 <%text>## Multiple addresses can be specified, space-separated.</%text>
37 <%text>## Only addresses are allowed, do not add any name part.</%text>
37 <%text>## Only addresses are allowed, do not add any name part.</%text>
38 <%text>## Default:</%text>
38 <%text>## Default:</%text>
39 #email_to =
39 #email_to =
40 <%text>## Examples:</%text>
40 <%text>## Examples:</%text>
41 #email_to = admin@example.com
41 #email_to = admin@example.com
42 #email_to = admin@example.com another_admin@example.com
42 #email_to = admin@example.com another_admin@example.com
43
43
44 <%text>## 'From' header for error e-mails. You can optionally add a name.</%text>
44 <%text>## 'From' header for error e-mails. You can optionally add a name.</%text>
45 <%text>## Default:</%text>
45 <%text>## Default:</%text>
46 #error_email_from = pylons@yourapp.com
46 #error_email_from = pylons@yourapp.com
47 <%text>## Examples:</%text>
47 <%text>## Examples:</%text>
48 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
48 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
49 #error_email_from = paste_error@example.com
49 #error_email_from = paste_error@example.com
50
50
51 <%text>## SMTP server settings</%text>
51 <%text>## SMTP server settings</%text>
52 <%text>## Only smtp_server is mandatory. All other settings take the specified default</%text>
52 <%text>## Only smtp_server is mandatory. All other settings take the specified default</%text>
53 <%text>## values.</%text>
53 <%text>## values.</%text>
54 #smtp_server = mail.server.com
54 #smtp_server = mail.server.com
55 #smtp_username =
55 #smtp_username =
56 #smtp_password =
56 #smtp_password =
57 #smtp_port = 25
57 #smtp_port = 25
58 #smtp_use_tls = false
58 #smtp_use_tls = false
59 #smtp_use_ssl = false
59 #smtp_use_ssl = false
60 <%text>## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).</%text>
60 <%text>## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).</%text>
61 <%text>## If empty, use any of the authentication parameters supported by the server.</%text>
61 <%text>## If empty, use any of the authentication parameters supported by the server.</%text>
62 #smtp_auth =
62 #smtp_auth =
63
63
64 [server:main]
64 [server:main]
65 %if http_server == 'paste':
65 %if http_server == 'paste':
66 <%text>## PASTE ##</%text>
66 <%text>## PASTE ##</%text>
67 use = egg:Paste#http
67 use = egg:Paste#http
68 <%text>## nr of worker threads to spawn</%text>
68 <%text>## nr of worker threads to spawn</%text>
69 threadpool_workers = 5
69 threadpool_workers = 5
70 <%text>## max request before thread respawn</%text>
70 <%text>## max request before thread respawn</%text>
71 threadpool_max_requests = 10
71 threadpool_max_requests = 10
72 <%text>## option to use threads of process</%text>
72 <%text>## option to use threads of process</%text>
73 use_threadpool = true
73 use_threadpool = true
74
74
75 %elif http_server == 'waitress':
75 %elif http_server == 'waitress':
76 <%text>## WAITRESS ##</%text>
76 <%text>## WAITRESS ##</%text>
77 use = egg:waitress#main
77 use = egg:waitress#main
78 <%text>## number of worker threads</%text>
78 <%text>## number of worker threads</%text>
79 threads = 5
79 threads = 5
80 <%text>## MAX BODY SIZE 100GB</%text>
80 <%text>## MAX BODY SIZE 100GB</%text>
81 max_request_body_size = 107374182400
81 max_request_body_size = 107374182400
82 <%text>## use poll instead of select, fixes fd limits, may not work on old</%text>
82 <%text>## use poll instead of select, fixes fd limits, may not work on old</%text>
83 <%text>## windows systems.</%text>
83 <%text>## windows systems.</%text>
84 #asyncore_use_poll = True
84 #asyncore_use_poll = True
85
85
86 %elif http_server == 'gunicorn':
86 %elif http_server == 'gunicorn':
87 <%text>## GUNICORN ##</%text>
87 <%text>## GUNICORN ##</%text>
88 use = egg:gunicorn#main
88 use = egg:gunicorn#main
89 <%text>## number of process workers. You must set `instance_id = *` when this option</%text>
89 <%text>## number of process workers. You must set `instance_id = *` when this option</%text>
90 <%text>## is set to more than one worker</%text>
90 <%text>## is set to more than one worker</%text>
91 workers = 1
91 workers = 1
92 <%text>## process name</%text>
92 <%text>## process name</%text>
93 proc_name = kallithea
93 proc_name = kallithea
94 <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text>
94 <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text>
95 <%text>## recommended for bigger setup is using of of other than sync one</%text>
95 <%text>## recommended for bigger setup is using of of other than sync one</%text>
96 worker_class = sync
96 worker_class = sync
97 max_requests = 1000
97 max_requests = 1000
98 <%text>## ammount of time a worker can handle request before it gets killed and</%text>
98 <%text>## ammount of time a worker can handle request before it gets killed and</%text>
99 <%text>## restarted</%text>
99 <%text>## restarted</%text>
100 timeout = 3600
100 timeout = 3600
101
101
102 %elif http_server == 'uwsgi':
102 %elif http_server == 'uwsgi':
103 <%text>## UWSGI ##</%text>
103 <%text>## UWSGI ##</%text>
104 <%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text>
104 <%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text>
105 [uwsgi]
105 [uwsgi]
106 socket = /tmp/uwsgi.sock
106 socket = /tmp/uwsgi.sock
107 master = true
107 master = true
108 http = 127.0.0.1:5000
108 http = 127.0.0.1:5000
109
109
110 <%text>## set as deamon and redirect all output to file</%text>
110 <%text>## set as deamon and redirect all output to file</%text>
111 #daemonize = ./uwsgi_kallithea.log
111 #daemonize = ./uwsgi_kallithea.log
112
112
113 <%text>## master process PID</%text>
113 <%text>## master process PID</%text>
114 pidfile = ./uwsgi_kallithea.pid
114 pidfile = ./uwsgi_kallithea.pid
115
115
116 <%text>## stats server with workers statistics, use uwsgitop</%text>
116 <%text>## stats server with workers statistics, use uwsgitop</%text>
117 <%text>## for monitoring, `uwsgitop 127.0.0.1:1717`</%text>
117 <%text>## for monitoring, `uwsgitop 127.0.0.1:1717`</%text>
118 stats = 127.0.0.1:1717
118 stats = 127.0.0.1:1717
119 memory-report = true
119 memory-report = true
120
120
121 <%text>## log 5XX errors</%text>
121 <%text>## log 5XX errors</%text>
122 log-5xx = true
122 log-5xx = true
123
123
124 <%text>## Set the socket listen queue size.</%text>
124 <%text>## Set the socket listen queue size.</%text>
125 listen = 256
125 listen = 256
126
126
127 <%text>## Gracefully Reload workers after the specified amount of managed requests</%text>
127 <%text>## Gracefully Reload workers after the specified amount of managed requests</%text>
128 <%text>## (avoid memory leaks).</%text>
128 <%text>## (avoid memory leaks).</%text>
129 max-requests = 1000
129 max-requests = 1000
130
130
131 <%text>## enable large buffers</%text>
131 <%text>## enable large buffers</%text>
132 buffer-size = 65535
132 buffer-size = 65535
133
133
134 <%text>## socket and http timeouts ##</%text>
134 <%text>## socket and http timeouts ##</%text>
135 http-timeout = 3600
135 http-timeout = 3600
136 socket-timeout = 3600
136 socket-timeout = 3600
137
137
138 <%text>## Log requests slower than the specified number of milliseconds.</%text>
138 <%text>## Log requests slower than the specified number of milliseconds.</%text>
139 log-slow = 10
139 log-slow = 10
140
140
141 <%text>## Exit if no app can be loaded.</%text>
141 <%text>## Exit if no app can be loaded.</%text>
142 need-app = true
142 need-app = true
143
143
144 <%text>## Set lazy mode (load apps in workers instead of master).</%text>
144 <%text>## Set lazy mode (load apps in workers instead of master).</%text>
145 lazy = true
145 lazy = true
146
146
147 <%text>## scaling ##</%text>
147 <%text>## scaling ##</%text>
148 <%text>## set cheaper algorithm to use, if not set default will be used</%text>
148 <%text>## set cheaper algorithm to use, if not set default will be used</%text>
149 cheaper-algo = spare
149 cheaper-algo = spare
150
150
151 <%text>## minimum number of workers to keep at all times</%text>
151 <%text>## minimum number of workers to keep at all times</%text>
152 cheaper = 1
152 cheaper = 1
153
153
154 <%text>## number of workers to spawn at startup</%text>
154 <%text>## number of workers to spawn at startup</%text>
155 cheaper-initial = 1
155 cheaper-initial = 1
156
156
157 <%text>## maximum number of workers that can be spawned</%text>
157 <%text>## maximum number of workers that can be spawned</%text>
158 workers = 4
158 workers = 4
159
159
160 <%text>## how many workers should be spawned at a time</%text>
160 <%text>## how many workers should be spawned at a time</%text>
161 cheaper-step = 1
161 cheaper-step = 1
162
162
163 %endif
163 %endif
164 <%text>## COMMON ##</%text>
164 <%text>## COMMON ##</%text>
165 host = ${host}
165 host = ${host}
166 port = ${port}
166 port = ${port}
167
167
168 <%text>## middleware for hosting the WSGI application under a URL prefix</%text>
168 <%text>## middleware for hosting the WSGI application under a URL prefix</%text>
169 #[filter:proxy-prefix]
169 #[filter:proxy-prefix]
170 #use = egg:PasteDeploy#prefix
170 #use = egg:PasteDeploy#prefix
171 #prefix = /<your-prefix>
171 #prefix = /<your-prefix>
172
172
173 [app:main]
173 [app:main]
174 use = egg:kallithea
174 use = egg:kallithea
175 <%text>## enable proxy prefix middleware</%text>
175 <%text>## enable proxy prefix middleware</%text>
176 #filter-with = proxy-prefix
176 #filter-with = proxy-prefix
177
177
178 full_stack = true
178 full_stack = true
179 static_files = true
179 static_files = true
180 <%text>## Available Languages:</%text>
180 <%text>## Available Languages:</%text>
181 <%text>## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW</%text>
181 <%text>## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW</%text>
182 lang =
182 lang =
183 cache_dir = ${here}/data
183 cache_dir = ${here}/data
184 index_dir = ${here}/data/index
184 index_dir = ${here}/data/index
185
185
186 <%text>## perform a full repository scan on each server start, this should be</%text>
186 <%text>## perform a full repository scan on each server start, this should be</%text>
187 <%text>## set to false after first startup, to allow faster server restarts.</%text>
187 <%text>## set to false after first startup, to allow faster server restarts.</%text>
188 initial_repo_scan = false
188 initial_repo_scan = false
189
189
190 <%text>## uncomment and set this path to use archive download cache</%text>
190 <%text>## uncomment and set this path to use archive download cache</%text>
191 archive_cache_dir = ${here}/tarballcache
191 archive_cache_dir = ${here}/tarballcache
192
192
193 <%text>## change this to unique ID for security</%text>
193 <%text>## change this to unique ID for security</%text>
194 app_instance_uuid = ${uuid()}
194 app_instance_uuid = ${uuid()}
195
195
196 <%text>## cut off limit for large diffs (size in bytes)</%text>
196 <%text>## cut off limit for large diffs (size in bytes)</%text>
197 cut_off_limit = 256000
197 cut_off_limit = 256000
198
198
199 <%text>## use cache version of scm repo everywhere</%text>
199 <%text>## use cache version of scm repo everywhere</%text>
200 vcs_full_cache = true
200 vcs_full_cache = true
201
201
202 <%text>## force https in Kallithea, fixes https redirects, assumes it's always https</%text>
202 <%text>## force https in Kallithea, fixes https redirects, assumes it's always https</%text>
203 force_https = false
203 force_https = false
204
204
205 <%text>## use Strict-Transport-Security headers</%text>
205 <%text>## use Strict-Transport-Security headers</%text>
206 use_htsts = false
206 use_htsts = false
207
207
208 <%text>## number of commits stats will parse on each iteration</%text>
208 <%text>## number of commits stats will parse on each iteration</%text>
209 commit_parse_limit = 25
209 commit_parse_limit = 25
210
210
211 <%text>## path to git executable</%text>
211 <%text>## path to git executable</%text>
212 git_path = git
212 git_path = git
213
213
214 <%text>## git rev filter option, --all is the default filter, if you need to</%text>
214 <%text>## git rev filter option, --all is the default filter, if you need to</%text>
215 <%text>## hide all refs in changelog switch this to --branches --tags</%text>
215 <%text>## hide all refs in changelog switch this to --branches --tags</%text>
216 #git_rev_filter = --branches --tags
216 #git_rev_filter = --branches --tags
217
217
218 <%text>## RSS feed options</%text>
218 <%text>## RSS feed options</%text>
219 rss_cut_off_limit = 256000
219 rss_cut_off_limit = 256000
220 rss_items_per_page = 10
220 rss_items_per_page = 10
221 rss_include_diff = false
221 rss_include_diff = false
222
222
223 <%text>## options for showing and identifying changesets</%text>
223 <%text>## options for showing and identifying changesets</%text>
224 show_sha_length = 12
224 show_sha_length = 12
225 show_revision_number = false
225 show_revision_number = false
226
226
227 <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text>
227 <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text>
228 <%text>## url that does rewrites to _admin/gists/<gistid>.</%text>
228 <%text>## url that does rewrites to _admin/gists/<gistid>.</%text>
229 <%text>## example: http://gist.kallithea.server/{gistid}. Empty means use the internal</%text>
229 <%text>## example: http://gist.kallithea.server/{gistid}. Empty means use the internal</%text>
230 <%text>## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid></%text>
230 <%text>## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid></%text>
231 gist_alias_url =
231 gist_alias_url =
232
232
233 <%text>## white list of API enabled controllers. This allows to add list of</%text>
233 <%text>## white list of API enabled controllers. This allows to add list of</%text>
234 <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text>
234 <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text>
235 <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text>
235 <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text>
236 <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text>
236 <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text>
237 <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text>
237 <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text>
238 <%text>## Recommended settings below are commented out:</%text>
238 <%text>## Recommended settings below are commented out:</%text>
239 api_access_controllers_whitelist =
239 api_access_controllers_whitelist =
240 # ChangesetController:changeset_patch,
240 # ChangesetController:changeset_patch,
241 # ChangesetController:changeset_raw,
241 # ChangesetController:changeset_raw,
242 # FilesController:raw,
242 # FilesController:raw,
243 # FilesController:archivefile
243 # FilesController:archivefile
244
244
245 <%text>## default encoding used to convert from and to unicode</%text>
245 <%text>## default encoding used to convert from and to unicode</%text>
246 <%text>## can be also a comma seperated list of encoding in case of mixed encodings</%text>
246 <%text>## can be also a comma seperated list of encoding in case of mixed encodings</%text>
247 default_encoding = utf8
247 default_encoding = utf8
248
248
249 <%text>## issue tracker for Kallithea (leave blank to disable, absent for default)</%text>
249 <%text>## issue tracker for Kallithea (leave blank to disable, absent for default)</%text>
250 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
250 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
251
251
252 <%text>## issue tracking mapping for commits messages</%text>
252 <%text>## issue tracking mapping for commits messages</%text>
253 <%text>## comment out issue_pat, issue_server, issue_prefix to enable</%text>
253 <%text>## comment out issue_pat, issue_server, issue_prefix to enable</%text>
254
254
255 <%text>## pattern to get the issues from commit messages</%text>
255 <%text>## pattern to get the issues from commit messages</%text>
256 <%text>## default one used here is #<numbers> with a regex passive group for `#`</%text>
256 <%text>## default one used here is #<numbers> with a regex passive group for `#`</%text>
257 <%text>## {id} will be all groups matched from this pattern</%text>
257 <%text>## {id} will be all groups matched from this pattern</%text>
258
258
259 issue_pat = (?:\s*#)(\d+)
259 issue_pat = (?:\s*#)(\d+)
260
260
261 <%text>## server url to the issue, each {id} will be replaced with match</%text>
261 <%text>## server url to the issue, each {id} will be replaced with match</%text>
262 <%text>## fetched from the regex and {repo} is replaced with full repository name</%text>
262 <%text>## fetched from the regex and {repo} is replaced with full repository name</%text>
263 <%text>## including groups {repo_name} is replaced with just name of repo</%text>
263 <%text>## including groups {repo_name} is replaced with just name of repo</%text>
264
264
265 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
265 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
266
266
267 <%text>## prefix to add to link to indicate it's an url</%text>
267 <%text>## prefix to add to link to indicate it's an url</%text>
268 <%text>## #314 will be replaced by <issue_prefix><id></%text>
268 <%text>## #314 will be replaced by <issue_prefix><id></%text>
269
269
270 issue_prefix = #
270 issue_prefix = #
271
271
272 <%text>## issue_pat, issue_server_link, issue_prefix can have suffixes to specify</%text>
272 <%text>## issue_pat, issue_server_link, issue_prefix can have suffixes to specify</%text>
273 <%text>## multiple patterns, to other issues server, wiki or others</%text>
273 <%text>## multiple patterns, to other issues server, wiki or others</%text>
274 <%text>## below an example how to create a wiki pattern</%text>
274 <%text>## below an example how to create a wiki pattern</%text>
275 # wiki-some-id -> https://mywiki.com/some-id
275 # wiki-some-id -> https://mywiki.com/some-id
276
276
277 #issue_pat_wiki = (?:wiki-)(.+)
277 #issue_pat_wiki = (?:wiki-)(.+)
278 #issue_server_link_wiki = https://mywiki.com/{id}
278 #issue_server_link_wiki = https://mywiki.com/{id}
279 #issue_prefix_wiki = WIKI-
279 #issue_prefix_wiki = WIKI-
280
280
281 <%text>## instance-id prefix</%text>
281 <%text>## instance-id prefix</%text>
282 <%text>## a prefix key for this instance used for cache invalidation when running</%text>
282 <%text>## a prefix key for this instance used for cache invalidation when running</%text>
283 <%text>## multiple instances of kallithea, make sure it's globally unique for</%text>
283 <%text>## multiple instances of kallithea, make sure it's globally unique for</%text>
284 <%text>## all running kallithea instances. Leave empty if you don't use it</%text>
284 <%text>## all running kallithea instances. Leave empty if you don't use it</%text>
285 instance_id =
285 instance_id =
286
286
287 <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text>
287 <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text>
288 <%text>## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with</%text>
288 <%text>## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with</%text>
289 <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text>
289 <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text>
290 auth_ret_code =
290 auth_ret_code =
291
291
292 <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text>
292 <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text>
293 <%text>## codes don't break the transactions while 4XX codes do</%text>
293 <%text>## codes don't break the transactions while 4XX codes do</%text>
294 lock_ret_code = 423
294 lock_ret_code = 423
295
295
296 <%text>## allows to change the repository location in settings page</%text>
296 <%text>## allows to change the repository location in settings page</%text>
297 allow_repo_location_change = True
297 allow_repo_location_change = True
298
298
299 <%text>## allows to setup custom hooks in settings page</%text>
299 <%text>## allows to setup custom hooks in settings page</%text>
300 allow_custom_hooks_settings = True
300 allow_custom_hooks_settings = True
301
301
302 <%text>####################################</%text>
302 <%text>####################################</%text>
303 <%text>### CELERY CONFIG ####</%text>
303 <%text>### CELERY CONFIG ####</%text>
304 <%text>####################################</%text>
304 <%text>####################################</%text>
305
305
306 use_celery = false
306 use_celery = false
307 broker.host = localhost
307 broker.host = localhost
308 broker.vhost = rabbitmqhost
308 broker.vhost = rabbitmqhost
309 broker.port = 5672
309 broker.port = 5672
310 broker.user = rabbitmq
310 broker.user = rabbitmq
311 broker.password = qweqwe
311 broker.password = qweqwe
312
312
313 celery.imports = kallithea.lib.celerylib.tasks
313 celery.imports = kallithea.lib.celerylib.tasks
314
314
315 celery.result.backend = amqp
315 celery.result.backend = amqp
316 celery.result.dburi = amqp://
316 celery.result.dburi = amqp://
317 celery.result.serialier = json
317 celery.result.serialier = json
318
318
319 #celery.send.task.error.emails = true
319 #celery.send.task.error.emails = true
320 #celery.amqp.task.result.expires = 18000
320 #celery.amqp.task.result.expires = 18000
321
321
322 celeryd.concurrency = 2
322 celeryd.concurrency = 2
323 #celeryd.log.file = celeryd.log
323 #celeryd.log.file = celeryd.log
324 celeryd.log.level = DEBUG
324 celeryd.log.level = DEBUG
325 celeryd.max.tasks.per.child = 1
325 celeryd.max.tasks.per.child = 1
326
326
327 <%text>## tasks will never be sent to the queue, but executed locally instead.</%text>
327 <%text>## tasks will never be sent to the queue, but executed locally instead.</%text>
328 celery.always.eager = false
328 celery.always.eager = false
329
329
330 <%text>####################################</%text>
330 <%text>####################################</%text>
331 <%text>### BEAKER CACHE ####</%text>
331 <%text>### BEAKER CACHE ####</%text>
332 <%text>####################################</%text>
332 <%text>####################################</%text>
333
333
334 beaker.cache.data_dir = ${here}/data/cache/data
334 beaker.cache.data_dir = ${here}/data/cache/data
335 beaker.cache.lock_dir = ${here}/data/cache/lock
335 beaker.cache.lock_dir = ${here}/data/cache/lock
336
336
337 beaker.cache.regions = short_term,long_term,sql_cache_short
337 beaker.cache.regions = short_term,long_term,sql_cache_short
338
338
339 beaker.cache.short_term.type = memory
339 beaker.cache.short_term.type = memory
340 beaker.cache.short_term.expire = 60
340 beaker.cache.short_term.expire = 60
341 beaker.cache.short_term.key_length = 256
341 beaker.cache.short_term.key_length = 256
342
342
343 beaker.cache.long_term.type = memory
343 beaker.cache.long_term.type = memory
344 beaker.cache.long_term.expire = 36000
344 beaker.cache.long_term.expire = 36000
345 beaker.cache.long_term.key_length = 256
345 beaker.cache.long_term.key_length = 256
346
346
347 beaker.cache.sql_cache_short.type = memory
347 beaker.cache.sql_cache_short.type = memory
348 beaker.cache.sql_cache_short.expire = 10
348 beaker.cache.sql_cache_short.expire = 10
349 beaker.cache.sql_cache_short.key_length = 256
349 beaker.cache.sql_cache_short.key_length = 256
350
350
351 <%text>####################################</%text>
351 <%text>####################################</%text>
352 <%text>### BEAKER SESSION ####</%text>
352 <%text>### BEAKER SESSION ####</%text>
353 <%text>####################################</%text>
353 <%text>####################################</%text>
354
355 <%text>## Name of session cookie. Should be unique for a given host and path, even when running</%text>
356 <%text>## on different ports. Otherwise, cookie sessions will be shared and messed up.</%text>
357 beaker.session.key = kallithea
358 <%text>## Sessions should always only be accessible by the browser, not directly by JavaScript.</%text>
359 beaker.session.httponly = true
360 <%text>## Session lifetime. 2592000 seconds is 30 days.</%text>
361 beaker.session.timeout = 2592000
362
363 <%text>## Server secret used with HMAC to ensure integrity of cookies.</%text>
364 beaker.session.secret = ${uuid()}
365 <%text>## Further, encrypt the data with AES.</%text>
366 #beaker.session.encrypt_key = <key_for_encryption>
367 #beaker.session.validate_key = <validation_key>
368
354 <%text>## Type of storage used for the session, current types are</%text>
369 <%text>## Type of storage used for the session, current types are</%text>
355 <%text>## dbm, file, memcached, database, and memory.</%text>
370 <%text>## dbm, file, memcached, database, and memory.</%text>
356 <%text>## The storage uses the Container API</%text>
371
357 <%text>## that is also used by the cache system.</%text>
372 <%text>## File system storage of session data. (default)</%text>
373 #beaker.session.type = file
358
374
359 <%text>## db session ##</%text>
375 <%text>## Cookie only, store all session data inside the cookie. Requires secure secrets.</%text>
376 #beaker.session.type = cookie
377
378 <%text>## Database storage of session data.</%text>
360 #beaker.session.type = ext:database
379 #beaker.session.type = ext:database
361 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
380 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
362 #beaker.session.table_name = db_session
381 #beaker.session.table_name = db_session
363
382
364 <%text>## encrypted cookie client side session, good for many instances ##</%text>
365 #beaker.session.type = cookie
366
367 <%text>## file based cookies (default) ##</%text>
368 #beaker.session.type = file
369
370 <%text>## beaker.session.key should be unique for a given host, even when running</%text>
371 <%text>## on different ports. Otherwise, cookie sessions will be shared and messed up.</%text>
372 beaker.session.key = kallithea
373 beaker.session.secret = ${uuid()}
374
375 <%text>## Secure encrypted cookie. Requires AES and AES python libraries</%text>
376 <%text>## you must disable beaker.session.secret to use this</%text>
377 #beaker.session.encrypt_key = <key_for_encryption>
378 #beaker.session.validate_key = <validation_key>
379
380 <%text>## sets session as invalid if it haven't been accessed for given amount of time</%text>
381 beaker.session.timeout = 2592000
382 beaker.session.httponly = true
383 #beaker.session.cookie_path = /<your-prefix>
384
385 <%text>## uncomment for https secure cookie</%text>
386 beaker.session.secure = false
387
388 <%text>## auto save the session to not to use .save()</%text>
389 beaker.session.auto = False
390
391 <%text>## default cookie expiration time in seconds `true` expire at browser close ##</%text>
392 #beaker.session.cookie_expires = 3600
393
394 %if error_aggregation_service == 'errormator':
383 %if error_aggregation_service == 'errormator':
395 <%text>############################</%text>
384 <%text>############################</%text>
396 <%text>## ERROR HANDLING SYSTEMS ##</%text>
385 <%text>## ERROR HANDLING SYSTEMS ##</%text>
397 <%text>############################</%text>
386 <%text>############################</%text>
398
387
399 <%text>####################</%text>
388 <%text>####################</%text>
400 <%text>### [errormator] ###</%text>
389 <%text>### [errormator] ###</%text>
401 <%text>####################</%text>
390 <%text>####################</%text>
402
391
403 <%text>## Errormator is tailored to work with Kallithea, see</%text>
392 <%text>## Errormator is tailored to work with Kallithea, see</%text>
404 <%text>## http://errormator.com for details how to obtain an account</%text>
393 <%text>## http://errormator.com for details how to obtain an account</%text>
405 <%text>## you must install python package `errormator_client` to make it work</%text>
394 <%text>## you must install python package `errormator_client` to make it work</%text>
406
395
407 <%text>## errormator enabled</%text>
396 <%text>## errormator enabled</%text>
408 errormator = false
397 errormator = false
409
398
410 errormator.server_url = https://api.errormator.com
399 errormator.server_url = https://api.errormator.com
411 errormator.api_key = YOUR_API_KEY
400 errormator.api_key = YOUR_API_KEY
412
401
413 <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text>
402 <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text>
414
403
415 <%text>## enables 404 error logging (default False)</%text>
404 <%text>## enables 404 error logging (default False)</%text>
416 errormator.report_404 = false
405 errormator.report_404 = false
417
406
418 <%text>## time in seconds after request is considered being slow (default 1)</%text>
407 <%text>## time in seconds after request is considered being slow (default 1)</%text>
419 errormator.slow_request_time = 1
408 errormator.slow_request_time = 1
420
409
421 <%text>## record slow requests in application</%text>
410 <%text>## record slow requests in application</%text>
422 <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text>
411 <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text>
423 errormator.slow_requests = true
412 errormator.slow_requests = true
424
413
425 <%text>## enable hooking to application loggers</%text>
414 <%text>## enable hooking to application loggers</%text>
426 #errormator.logging = true
415 #errormator.logging = true
427
416
428 <%text>## minimum log level for log capture</%text>
417 <%text>## minimum log level for log capture</%text>
429 #errormator.logging.level = WARNING
418 #errormator.logging.level = WARNING
430
419
431 <%text>## send logs only from erroneous/slow requests</%text>
420 <%text>## send logs only from erroneous/slow requests</%text>
432 <%text>## (saves API quota for intensive logging)</%text>
421 <%text>## (saves API quota for intensive logging)</%text>
433 errormator.logging_on_error = false
422 errormator.logging_on_error = false
434
423
435 <%text>## list of additonal keywords that should be grabbed from environ object</%text>
424 <%text>## list of additonal keywords that should be grabbed from environ object</%text>
436 <%text>## can be string with comma separated list of words in lowercase</%text>
425 <%text>## can be string with comma separated list of words in lowercase</%text>
437 <%text>## (by default client will always send following info:</%text>
426 <%text>## (by default client will always send following info:</%text>
438 <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text>
427 <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text>
439 <%text>## start with HTTP* this list be extended with additional keywords here</%text>
428 <%text>## start with HTTP* this list be extended with additional keywords here</%text>
440 errormator.environ_keys_whitelist =
429 errormator.environ_keys_whitelist =
441
430
442 <%text>## list of keywords that should be blanked from request object</%text>
431 <%text>## list of keywords that should be blanked from request object</%text>
443 <%text>## can be string with comma separated list of words in lowercase</%text>
432 <%text>## can be string with comma separated list of words in lowercase</%text>
444 <%text>## (by default client will always blank keys that contain following words</%text>
433 <%text>## (by default client will always blank keys that contain following words</%text>
445 <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text>
434 <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text>
446 <%text>## this list be extended with additional keywords set here</%text>
435 <%text>## this list be extended with additional keywords set here</%text>
447 errormator.request_keys_blacklist =
436 errormator.request_keys_blacklist =
448
437
449 <%text>## list of namespaces that should be ignores when gathering log entries</%text>
438 <%text>## list of namespaces that should be ignores when gathering log entries</%text>
450 <%text>## can be string with comma separated list of namespaces</%text>
439 <%text>## can be string with comma separated list of namespaces</%text>
451 <%text>## (by default the client ignores own entries: errormator_client.client)</%text>
440 <%text>## (by default the client ignores own entries: errormator_client.client)</%text>
452 errormator.log_namespace_blacklist =
441 errormator.log_namespace_blacklist =
453
442
454 %elif error_aggregation_service == 'sentry':
443 %elif error_aggregation_service == 'sentry':
455 <%text>################</%text>
444 <%text>################</%text>
456 <%text>### [sentry] ###</%text>
445 <%text>### [sentry] ###</%text>
457 <%text>################</%text>
446 <%text>################</%text>
458
447
459 <%text>## sentry is a alternative open source error aggregator</%text>
448 <%text>## sentry is a alternative open source error aggregator</%text>
460 <%text>## you must install python packages `sentry` and `raven` to enable</%text>
449 <%text>## you must install python packages `sentry` and `raven` to enable</%text>
461
450
462 sentry.dsn = YOUR_DNS
451 sentry.dsn = YOUR_DNS
463 sentry.servers =
452 sentry.servers =
464 sentry.name =
453 sentry.name =
465 sentry.key =
454 sentry.key =
466 sentry.public_key =
455 sentry.public_key =
467 sentry.secret_key =
456 sentry.secret_key =
468 sentry.project =
457 sentry.project =
469 sentry.site =
458 sentry.site =
470 sentry.include_paths =
459 sentry.include_paths =
471 sentry.exclude_paths =
460 sentry.exclude_paths =
472
461
473 %endif
462 %endif
474 <%text>################################################################################</%text>
463 <%text>################################################################################</%text>
475 <%text>## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##</%text>
464 <%text>## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##</%text>
476 <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##</%text>
465 <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##</%text>
477 <%text>## execute malicious code after an exception is raised. ##</%text>
466 <%text>## execute malicious code after an exception is raised. ##</%text>
478 <%text>################################################################################</%text>
467 <%text>################################################################################</%text>
479 set debug = false
468 set debug = false
480
469
481 <%text>##################################</%text>
470 <%text>##################################</%text>
482 <%text>### LOGVIEW CONFIG ###</%text>
471 <%text>### LOGVIEW CONFIG ###</%text>
483 <%text>##################################</%text>
472 <%text>##################################</%text>
484
473
485 logview.sqlalchemy = #faa
474 logview.sqlalchemy = #faa
486 logview.pylons.templating = #bfb
475 logview.pylons.templating = #bfb
487 logview.pylons.util = #eee
476 logview.pylons.util = #eee
488
477
489 <%text>#########################################################</%text>
478 <%text>#########################################################</%text>
490 <%text>### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###</%text>
479 <%text>### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###</%text>
491 <%text>#########################################################</%text>
480 <%text>#########################################################</%text>
492
481
493 %if database_engine == 'sqlite':
482 %if database_engine == 'sqlite':
494 # SQLITE [default]
483 # SQLITE [default]
495 sqlalchemy.db1.url = sqlite:///${here}/kallithea.db?timeout=60
484 sqlalchemy.db1.url = sqlite:///${here}/kallithea.db?timeout=60
496
485
497 %elif database_engine == 'postgres':
486 %elif database_engine == 'postgres':
498 # POSTGRESQL
487 # POSTGRESQL
499 sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
488 sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
500
489
501 %elif database_engine == 'mysql':
490 %elif database_engine == 'mysql':
502 # MySQL
491 # MySQL
503 sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
492 sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
504
493
505 %endif
494 %endif
506 # see sqlalchemy docs for others
495 # see sqlalchemy docs for others
507
496
508 sqlalchemy.db1.echo = false
497 sqlalchemy.db1.echo = false
509 sqlalchemy.db1.pool_recycle = 3600
498 sqlalchemy.db1.pool_recycle = 3600
510 sqlalchemy.db1.convert_unicode = true
499 sqlalchemy.db1.convert_unicode = true
511
500
512 <%text>################################</%text>
501 <%text>################################</%text>
513 <%text>### LOGGING CONFIGURATION ####</%text>
502 <%text>### LOGGING CONFIGURATION ####</%text>
514 <%text>################################</%text>
503 <%text>################################</%text>
515
504
516 [loggers]
505 [loggers]
517 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
506 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
518
507
519 [handlers]
508 [handlers]
520 keys = console, console_sql
509 keys = console, console_sql
521
510
522 [formatters]
511 [formatters]
523 keys = generic, color_formatter, color_formatter_sql
512 keys = generic, color_formatter, color_formatter_sql
524
513
525 <%text>#############</%text>
514 <%text>#############</%text>
526 <%text>## LOGGERS ##</%text>
515 <%text>## LOGGERS ##</%text>
527 <%text>#############</%text>
516 <%text>#############</%text>
528
517
529 [logger_root]
518 [logger_root]
530 level = NOTSET
519 level = NOTSET
531 handlers = console
520 handlers = console
532
521
533 [logger_routes]
522 [logger_routes]
534 level = DEBUG
523 level = DEBUG
535 handlers =
524 handlers =
536 qualname = routes.middleware
525 qualname = routes.middleware
537 <%text>## "level = DEBUG" logs the route matched and routing variables.</%text>
526 <%text>## "level = DEBUG" logs the route matched and routing variables.</%text>
538 propagate = 1
527 propagate = 1
539
528
540 [logger_beaker]
529 [logger_beaker]
541 level = DEBUG
530 level = DEBUG
542 handlers =
531 handlers =
543 qualname = beaker.container
532 qualname = beaker.container
544 propagate = 1
533 propagate = 1
545
534
546 [logger_templates]
535 [logger_templates]
547 level = INFO
536 level = INFO
548 handlers =
537 handlers =
549 qualname = pylons.templating
538 qualname = pylons.templating
550 propagate = 1
539 propagate = 1
551
540
552 [logger_kallithea]
541 [logger_kallithea]
553 level = DEBUG
542 level = DEBUG
554 handlers =
543 handlers =
555 qualname = kallithea
544 qualname = kallithea
556 propagate = 1
545 propagate = 1
557
546
558 [logger_sqlalchemy]
547 [logger_sqlalchemy]
559 level = INFO
548 level = INFO
560 handlers = console_sql
549 handlers = console_sql
561 qualname = sqlalchemy.engine
550 qualname = sqlalchemy.engine
562 propagate = 0
551 propagate = 0
563
552
564 [logger_whoosh_indexer]
553 [logger_whoosh_indexer]
565 level = DEBUG
554 level = DEBUG
566 handlers =
555 handlers =
567 qualname = whoosh_indexer
556 qualname = whoosh_indexer
568 propagate = 1
557 propagate = 1
569
558
570 <%text>##############</%text>
559 <%text>##############</%text>
571 <%text>## HANDLERS ##</%text>
560 <%text>## HANDLERS ##</%text>
572 <%text>##############</%text>
561 <%text>##############</%text>
573
562
574 [handler_console]
563 [handler_console]
575 class = StreamHandler
564 class = StreamHandler
576 args = (sys.stderr,)
565 args = (sys.stderr,)
577 level = INFO
566 level = INFO
578 formatter = generic
567 formatter = generic
579
568
580 [handler_console_sql]
569 [handler_console_sql]
581 class = StreamHandler
570 class = StreamHandler
582 args = (sys.stderr,)
571 args = (sys.stderr,)
583 level = WARN
572 level = WARN
584 formatter = generic
573 formatter = generic
585
574
586 <%text>################</%text>
575 <%text>################</%text>
587 <%text>## FORMATTERS ##</%text>
576 <%text>## FORMATTERS ##</%text>
588 <%text>################</%text>
577 <%text>################</%text>
589
578
590 [formatter_generic]
579 [formatter_generic]
591 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
580 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
592 datefmt = %Y-%m-%d %H:%M:%S
581 datefmt = %Y-%m-%d %H:%M:%S
593
582
594 [formatter_color_formatter]
583 [formatter_color_formatter]
595 class = kallithea.lib.colored_formatter.ColorFormatter
584 class = kallithea.lib.colored_formatter.ColorFormatter
596 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
585 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
597 datefmt = %Y-%m-%d %H:%M:%S
586 datefmt = %Y-%m-%d %H:%M:%S
598
587
599 [formatter_color_formatter_sql]
588 [formatter_color_formatter_sql]
600 class = kallithea.lib.colored_formatter.ColorFormatterSql
589 class = kallithea.lib.colored_formatter.ColorFormatterSql
601 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
590 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
602 datefmt = %Y-%m-%d %H:%M:%S
591 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,591 +1,580 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # Kallithea - Example config #
3 # Kallithea - Example config #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7 ################################################################################
7 ################################################################################
8
8
9 [DEFAULT]
9 [DEFAULT]
10 debug = true
10 debug = true
11 pdebug = false
11 pdebug = false
12
12
13 ################################################################################
13 ################################################################################
14 ## E-mail settings ##
14 ## E-mail settings ##
15 ## ##
15 ## ##
16 ## Refer to the documentation ("E-mail settings") for more details. ##
16 ## Refer to the documentation ("E-mail settings") for more details. ##
17 ## ##
17 ## ##
18 ## It is recommended to use a valid sender address that passes access ##
18 ## It is recommended to use a valid sender address that passes access ##
19 ## validation and spam filtering in mail servers. ##
19 ## validation and spam filtering in mail servers. ##
20 ################################################################################
20 ################################################################################
21
21
22 ## 'From' header for application e-mails. You can optionally add a name.
22 ## 'From' header for application e-mails. You can optionally add a name.
23 ## Default:
23 ## Default:
24 #app_email_from = Kallithea
24 #app_email_from = Kallithea
25 ## Examples:
25 ## Examples:
26 #app_email_from = Kallithea <kallithea-noreply@example.com>
26 #app_email_from = Kallithea <kallithea-noreply@example.com>
27 #app_email_from = kallithea-noreply@example.com
27 #app_email_from = kallithea-noreply@example.com
28
28
29 ## Subject prefix for application e-mails.
29 ## Subject prefix for application e-mails.
30 ## A space between this prefix and the real subject is automatically added.
30 ## A space between this prefix and the real subject is automatically added.
31 ## Default:
31 ## Default:
32 #email_prefix =
32 #email_prefix =
33 ## Example:
33 ## Example:
34 #email_prefix = [Kallithea]
34 #email_prefix = [Kallithea]
35
35
36 ## Recipients for error e-mails and fallback recipients of application mails.
36 ## Recipients for error e-mails and fallback recipients of application mails.
37 ## Multiple addresses can be specified, space-separated.
37 ## Multiple addresses can be specified, space-separated.
38 ## Only addresses are allowed, do not add any name part.
38 ## Only addresses are allowed, do not add any name part.
39 ## Default:
39 ## Default:
40 #email_to =
40 #email_to =
41 ## Examples:
41 ## Examples:
42 #email_to = admin@example.com
42 #email_to = admin@example.com
43 #email_to = admin@example.com another_admin@example.com
43 #email_to = admin@example.com another_admin@example.com
44
44
45 ## 'From' header for error e-mails. You can optionally add a name.
45 ## 'From' header for error e-mails. You can optionally add a name.
46 ## Default:
46 ## Default:
47 #error_email_from = pylons@yourapp.com
47 #error_email_from = pylons@yourapp.com
48 ## Examples:
48 ## Examples:
49 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
49 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
50 #error_email_from = paste_error@example.com
50 #error_email_from = paste_error@example.com
51
51
52 ## SMTP server settings
52 ## SMTP server settings
53 ## Only smtp_server is mandatory. All other settings take the specified default
53 ## Only smtp_server is mandatory. All other settings take the specified default
54 ## values.
54 ## values.
55 #smtp_server = mail.server.com
55 #smtp_server = mail.server.com
56 #smtp_username =
56 #smtp_username =
57 #smtp_password =
57 #smtp_password =
58 #smtp_port = 25
58 #smtp_port = 25
59 #smtp_use_tls = false
59 #smtp_use_tls = false
60 #smtp_use_ssl = false
60 #smtp_use_ssl = false
61 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
61 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
62 ## If empty, use any of the authentication parameters supported by the server.
62 ## If empty, use any of the authentication parameters supported by the server.
63 #smtp_auth =
63 #smtp_auth =
64
64
65 [server:main]
65 [server:main]
66 ## PASTE ##
66 ## PASTE ##
67 #use = egg:Paste#http
67 #use = egg:Paste#http
68 ## nr of worker threads to spawn
68 ## nr of worker threads to spawn
69 #threadpool_workers = 5
69 #threadpool_workers = 5
70 ## max request before thread respawn
70 ## max request before thread respawn
71 #threadpool_max_requests = 10
71 #threadpool_max_requests = 10
72 ## option to use threads of process
72 ## option to use threads of process
73 #use_threadpool = true
73 #use_threadpool = true
74
74
75 ## WAITRESS ##
75 ## WAITRESS ##
76 use = egg:waitress#main
76 use = egg:waitress#main
77 ## number of worker threads
77 ## number of worker threads
78 threads = 5
78 threads = 5
79 ## MAX BODY SIZE 100GB
79 ## MAX BODY SIZE 100GB
80 max_request_body_size = 107374182400
80 max_request_body_size = 107374182400
81 ## use poll instead of select, fixes fd limits, may not work on old
81 ## use poll instead of select, fixes fd limits, may not work on old
82 ## windows systems.
82 ## windows systems.
83 #asyncore_use_poll = True
83 #asyncore_use_poll = True
84
84
85 ## GUNICORN ##
85 ## GUNICORN ##
86 #use = egg:gunicorn#main
86 #use = egg:gunicorn#main
87 ## number of process workers. You must set `instance_id = *` when this option
87 ## number of process workers. You must set `instance_id = *` when this option
88 ## is set to more than one worker
88 ## is set to more than one worker
89 #workers = 1
89 #workers = 1
90 ## process name
90 ## process name
91 #proc_name = kallithea
91 #proc_name = kallithea
92 ## type of worker class, one of sync, eventlet, gevent, tornado
92 ## type of worker class, one of sync, eventlet, gevent, tornado
93 ## recommended for bigger setup is using of of other than sync one
93 ## recommended for bigger setup is using of of other than sync one
94 #worker_class = sync
94 #worker_class = sync
95 #max_requests = 1000
95 #max_requests = 1000
96 ## ammount of time a worker can handle request before it gets killed and
96 ## ammount of time a worker can handle request before it gets killed and
97 ## restarted
97 ## restarted
98 #timeout = 3600
98 #timeout = 3600
99
99
100 ## UWSGI ##
100 ## UWSGI ##
101 ## run with uwsgi --ini-paste-logged <inifile.ini>
101 ## run with uwsgi --ini-paste-logged <inifile.ini>
102 #[uwsgi]
102 #[uwsgi]
103 #socket = /tmp/uwsgi.sock
103 #socket = /tmp/uwsgi.sock
104 #master = true
104 #master = true
105 #http = 127.0.0.1:5000
105 #http = 127.0.0.1:5000
106
106
107 ## set as deamon and redirect all output to file
107 ## set as deamon and redirect all output to file
108 #daemonize = ./uwsgi_kallithea.log
108 #daemonize = ./uwsgi_kallithea.log
109
109
110 ## master process PID
110 ## master process PID
111 #pidfile = ./uwsgi_kallithea.pid
111 #pidfile = ./uwsgi_kallithea.pid
112
112
113 ## stats server with workers statistics, use uwsgitop
113 ## stats server with workers statistics, use uwsgitop
114 ## for monitoring, `uwsgitop 127.0.0.1:1717`
114 ## for monitoring, `uwsgitop 127.0.0.1:1717`
115 #stats = 127.0.0.1:1717
115 #stats = 127.0.0.1:1717
116 #memory-report = true
116 #memory-report = true
117
117
118 ## log 5XX errors
118 ## log 5XX errors
119 #log-5xx = true
119 #log-5xx = true
120
120
121 ## Set the socket listen queue size.
121 ## Set the socket listen queue size.
122 #listen = 256
122 #listen = 256
123
123
124 ## Gracefully Reload workers after the specified amount of managed requests
124 ## Gracefully Reload workers after the specified amount of managed requests
125 ## (avoid memory leaks).
125 ## (avoid memory leaks).
126 #max-requests = 1000
126 #max-requests = 1000
127
127
128 ## enable large buffers
128 ## enable large buffers
129 #buffer-size = 65535
129 #buffer-size = 65535
130
130
131 ## socket and http timeouts ##
131 ## socket and http timeouts ##
132 #http-timeout = 3600
132 #http-timeout = 3600
133 #socket-timeout = 3600
133 #socket-timeout = 3600
134
134
135 ## Log requests slower than the specified number of milliseconds.
135 ## Log requests slower than the specified number of milliseconds.
136 #log-slow = 10
136 #log-slow = 10
137
137
138 ## Exit if no app can be loaded.
138 ## Exit if no app can be loaded.
139 #need-app = true
139 #need-app = true
140
140
141 ## Set lazy mode (load apps in workers instead of master).
141 ## Set lazy mode (load apps in workers instead of master).
142 #lazy = true
142 #lazy = true
143
143
144 ## scaling ##
144 ## scaling ##
145 ## set cheaper algorithm to use, if not set default will be used
145 ## set cheaper algorithm to use, if not set default will be used
146 #cheaper-algo = spare
146 #cheaper-algo = spare
147
147
148 ## minimum number of workers to keep at all times
148 ## minimum number of workers to keep at all times
149 #cheaper = 1
149 #cheaper = 1
150
150
151 ## number of workers to spawn at startup
151 ## number of workers to spawn at startup
152 #cheaper-initial = 1
152 #cheaper-initial = 1
153
153
154 ## maximum number of workers that can be spawned
154 ## maximum number of workers that can be spawned
155 #workers = 4
155 #workers = 4
156
156
157 ## how many workers should be spawned at a time
157 ## how many workers should be spawned at a time
158 #cheaper-step = 1
158 #cheaper-step = 1
159
159
160 ## COMMON ##
160 ## COMMON ##
161 host = 127.0.0.1
161 host = 127.0.0.1
162 port = 5000
162 port = 5000
163
163
164 ## middleware for hosting the WSGI application under a URL prefix
164 ## middleware for hosting the WSGI application under a URL prefix
165 #[filter:proxy-prefix]
165 #[filter:proxy-prefix]
166 #use = egg:PasteDeploy#prefix
166 #use = egg:PasteDeploy#prefix
167 #prefix = /<your-prefix>
167 #prefix = /<your-prefix>
168
168
169 [app:main]
169 [app:main]
170 use = egg:kallithea
170 use = egg:kallithea
171 ## enable proxy prefix middleware
171 ## enable proxy prefix middleware
172 #filter-with = proxy-prefix
172 #filter-with = proxy-prefix
173
173
174 full_stack = true
174 full_stack = true
175 static_files = true
175 static_files = true
176 ## Available Languages:
176 ## Available Languages:
177 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
177 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
178 lang =
178 lang =
179 cache_dir = %(here)s/data
179 cache_dir = %(here)s/data
180 index_dir = %(here)s/data/index
180 index_dir = %(here)s/data/index
181
181
182 ## perform a full repository scan on each server start, this should be
182 ## perform a full repository scan on each server start, this should be
183 ## set to false after first startup, to allow faster server restarts.
183 ## set to false after first startup, to allow faster server restarts.
184 initial_repo_scan = false
184 initial_repo_scan = false
185
185
186 ## uncomment and set this path to use archive download cache
186 ## uncomment and set this path to use archive download cache
187 archive_cache_dir = %(here)s/tarballcache
187 archive_cache_dir = %(here)s/tarballcache
188
188
189 ## change this to unique ID for security
189 ## change this to unique ID for security
190 app_instance_uuid = ${app_instance_uuid}
190 app_instance_uuid = ${app_instance_uuid}
191
191
192 ## cut off limit for large diffs (size in bytes)
192 ## cut off limit for large diffs (size in bytes)
193 cut_off_limit = 256000
193 cut_off_limit = 256000
194
194
195 ## use cache version of scm repo everywhere
195 ## use cache version of scm repo everywhere
196 vcs_full_cache = true
196 vcs_full_cache = true
197
197
198 ## force https in Kallithea, fixes https redirects, assumes it's always https
198 ## force https in Kallithea, fixes https redirects, assumes it's always https
199 force_https = false
199 force_https = false
200
200
201 ## use Strict-Transport-Security headers
201 ## use Strict-Transport-Security headers
202 use_htsts = false
202 use_htsts = false
203
203
204 ## number of commits stats will parse on each iteration
204 ## number of commits stats will parse on each iteration
205 commit_parse_limit = 25
205 commit_parse_limit = 25
206
206
207 ## path to git executable
207 ## path to git executable
208 git_path = git
208 git_path = git
209
209
210 ## git rev filter option, --all is the default filter, if you need to
210 ## git rev filter option, --all is the default filter, if you need to
211 ## hide all refs in changelog switch this to --branches --tags
211 ## hide all refs in changelog switch this to --branches --tags
212 #git_rev_filter = --branches --tags
212 #git_rev_filter = --branches --tags
213
213
214 ## RSS feed options
214 ## RSS feed options
215 rss_cut_off_limit = 256000
215 rss_cut_off_limit = 256000
216 rss_items_per_page = 10
216 rss_items_per_page = 10
217 rss_include_diff = false
217 rss_include_diff = false
218
218
219 ## options for showing and identifying changesets
219 ## options for showing and identifying changesets
220 show_sha_length = 12
220 show_sha_length = 12
221 show_revision_number = false
221 show_revision_number = false
222
222
223 ## gist URL alias, used to create nicer urls for gist. This should be an
223 ## gist URL alias, used to create nicer urls for gist. This should be an
224 ## url that does rewrites to _admin/gists/<gistid>.
224 ## url that does rewrites to _admin/gists/<gistid>.
225 ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal
225 ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal
226 ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid>
226 ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid>
227 gist_alias_url =
227 gist_alias_url =
228
228
229 ## white list of API enabled controllers. This allows to add list of
229 ## white list of API enabled controllers. This allows to add list of
230 ## controllers to which access will be enabled by api_key. eg: to enable
230 ## controllers to which access will be enabled by api_key. eg: to enable
231 ## api access to raw_files put `FilesController:raw`, to enable access to patches
231 ## api access to raw_files put `FilesController:raw`, to enable access to patches
232 ## add `ChangesetController:changeset_patch`. This list should be "," separated
232 ## add `ChangesetController:changeset_patch`. This list should be "," separated
233 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
233 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
234 ## Recommended settings below are commented out:
234 ## Recommended settings below are commented out:
235 api_access_controllers_whitelist =
235 api_access_controllers_whitelist =
236 # ChangesetController:changeset_patch,
236 # ChangesetController:changeset_patch,
237 # ChangesetController:changeset_raw,
237 # ChangesetController:changeset_raw,
238 # FilesController:raw,
238 # FilesController:raw,
239 # FilesController:archivefile
239 # FilesController:archivefile
240
240
241 ## default encoding used to convert from and to unicode
241 ## default encoding used to convert from and to unicode
242 ## can be also a comma seperated list of encoding in case of mixed encodings
242 ## can be also a comma seperated list of encoding in case of mixed encodings
243 default_encoding = utf8
243 default_encoding = utf8
244
244
245 ## issue tracker for Kallithea (leave blank to disable, absent for default)
245 ## issue tracker for Kallithea (leave blank to disable, absent for default)
246 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
246 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
247
247
248 ## issue tracking mapping for commits messages
248 ## issue tracking mapping for commits messages
249 ## comment out issue_pat, issue_server, issue_prefix to enable
249 ## comment out issue_pat, issue_server, issue_prefix to enable
250
250
251 ## pattern to get the issues from commit messages
251 ## pattern to get the issues from commit messages
252 ## default one used here is #<numbers> with a regex passive group for `#`
252 ## default one used here is #<numbers> with a regex passive group for `#`
253 ## {id} will be all groups matched from this pattern
253 ## {id} will be all groups matched from this pattern
254
254
255 issue_pat = (?:\s*#)(\d+)
255 issue_pat = (?:\s*#)(\d+)
256
256
257 ## server url to the issue, each {id} will be replaced with match
257 ## server url to the issue, each {id} will be replaced with match
258 ## fetched from the regex and {repo} is replaced with full repository name
258 ## fetched from the regex and {repo} is replaced with full repository name
259 ## including groups {repo_name} is replaced with just name of repo
259 ## including groups {repo_name} is replaced with just name of repo
260
260
261 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
261 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
262
262
263 ## prefix to add to link to indicate it's an url
263 ## prefix to add to link to indicate it's an url
264 ## #314 will be replaced by <issue_prefix><id>
264 ## #314 will be replaced by <issue_prefix><id>
265
265
266 issue_prefix = #
266 issue_prefix = #
267
267
268 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
268 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
269 ## multiple patterns, to other issues server, wiki or others
269 ## multiple patterns, to other issues server, wiki or others
270 ## below an example how to create a wiki pattern
270 ## below an example how to create a wiki pattern
271 # wiki-some-id -> https://mywiki.com/some-id
271 # wiki-some-id -> https://mywiki.com/some-id
272
272
273 #issue_pat_wiki = (?:wiki-)(.+)
273 #issue_pat_wiki = (?:wiki-)(.+)
274 #issue_server_link_wiki = https://mywiki.com/{id}
274 #issue_server_link_wiki = https://mywiki.com/{id}
275 #issue_prefix_wiki = WIKI-
275 #issue_prefix_wiki = WIKI-
276
276
277 ## instance-id prefix
277 ## instance-id prefix
278 ## a prefix key for this instance used for cache invalidation when running
278 ## a prefix key for this instance used for cache invalidation when running
279 ## multiple instances of kallithea, make sure it's globally unique for
279 ## multiple instances of kallithea, make sure it's globally unique for
280 ## all running kallithea instances. Leave empty if you don't use it
280 ## all running kallithea instances. Leave empty if you don't use it
281 instance_id =
281 instance_id =
282
282
283 ## alternative return HTTP header for failed authentication. Default HTTP
283 ## alternative return HTTP header for failed authentication. Default HTTP
284 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
284 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
285 ## handling that. Set this variable to 403 to return HTTPForbidden
285 ## handling that. Set this variable to 403 to return HTTPForbidden
286 auth_ret_code =
286 auth_ret_code =
287
287
288 ## locking return code. When repository is locked return this HTTP code. 2XX
288 ## locking return code. When repository is locked return this HTTP code. 2XX
289 ## codes don't break the transactions while 4XX codes do
289 ## codes don't break the transactions while 4XX codes do
290 lock_ret_code = 423
290 lock_ret_code = 423
291
291
292 ## allows to change the repository location in settings page
292 ## allows to change the repository location in settings page
293 allow_repo_location_change = True
293 allow_repo_location_change = True
294
294
295 ## allows to setup custom hooks in settings page
295 ## allows to setup custom hooks in settings page
296 allow_custom_hooks_settings = True
296 allow_custom_hooks_settings = True
297
297
298 ####################################
298 ####################################
299 ### CELERY CONFIG ####
299 ### CELERY CONFIG ####
300 ####################################
300 ####################################
301
301
302 use_celery = false
302 use_celery = false
303 broker.host = localhost
303 broker.host = localhost
304 broker.vhost = rabbitmqhost
304 broker.vhost = rabbitmqhost
305 broker.port = 5672
305 broker.port = 5672
306 broker.user = rabbitmq
306 broker.user = rabbitmq
307 broker.password = qweqwe
307 broker.password = qweqwe
308
308
309 celery.imports = kallithea.lib.celerylib.tasks
309 celery.imports = kallithea.lib.celerylib.tasks
310
310
311 celery.result.backend = amqp
311 celery.result.backend = amqp
312 celery.result.dburi = amqp://
312 celery.result.dburi = amqp://
313 celery.result.serialier = json
313 celery.result.serialier = json
314
314
315 #celery.send.task.error.emails = true
315 #celery.send.task.error.emails = true
316 #celery.amqp.task.result.expires = 18000
316 #celery.amqp.task.result.expires = 18000
317
317
318 celeryd.concurrency = 2
318 celeryd.concurrency = 2
319 #celeryd.log.file = celeryd.log
319 #celeryd.log.file = celeryd.log
320 celeryd.log.level = DEBUG
320 celeryd.log.level = DEBUG
321 celeryd.max.tasks.per.child = 1
321 celeryd.max.tasks.per.child = 1
322
322
323 ## tasks will never be sent to the queue, but executed locally instead.
323 ## tasks will never be sent to the queue, but executed locally instead.
324 celery.always.eager = false
324 celery.always.eager = false
325
325
326 ####################################
326 ####################################
327 ### BEAKER CACHE ####
327 ### BEAKER CACHE ####
328 ####################################
328 ####################################
329
329
330 beaker.cache.data_dir = %(here)s/data/cache/data
330 beaker.cache.data_dir = %(here)s/data/cache/data
331 beaker.cache.lock_dir = %(here)s/data/cache/lock
331 beaker.cache.lock_dir = %(here)s/data/cache/lock
332
332
333 beaker.cache.regions = short_term,long_term,sql_cache_short
333 beaker.cache.regions = short_term,long_term,sql_cache_short
334
334
335 beaker.cache.short_term.type = memory
335 beaker.cache.short_term.type = memory
336 beaker.cache.short_term.expire = 60
336 beaker.cache.short_term.expire = 60
337 beaker.cache.short_term.key_length = 256
337 beaker.cache.short_term.key_length = 256
338
338
339 beaker.cache.long_term.type = memory
339 beaker.cache.long_term.type = memory
340 beaker.cache.long_term.expire = 36000
340 beaker.cache.long_term.expire = 36000
341 beaker.cache.long_term.key_length = 256
341 beaker.cache.long_term.key_length = 256
342
342
343 beaker.cache.sql_cache_short.type = memory
343 beaker.cache.sql_cache_short.type = memory
344 beaker.cache.sql_cache_short.expire = 10
344 beaker.cache.sql_cache_short.expire = 10
345 beaker.cache.sql_cache_short.key_length = 256
345 beaker.cache.sql_cache_short.key_length = 256
346
346
347 ####################################
347 ####################################
348 ### BEAKER SESSION ####
348 ### BEAKER SESSION ####
349 ####################################
349 ####################################
350
351 ## Name of session cookie. Should be unique for a given host and path, even when running
352 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
353 beaker.session.key = kallithea
354 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
355 beaker.session.httponly = true
356 ## Session lifetime. 2592000 seconds is 30 days.
357 beaker.session.timeout = 2592000
358
359 ## Server secret used with HMAC to ensure integrity of cookies.
360 beaker.session.secret = ${app_instance_uuid}
361 ## Further, encrypt the data with AES.
362 #beaker.session.encrypt_key = <key_for_encryption>
363 #beaker.session.validate_key = <validation_key>
364
350 ## Type of storage used for the session, current types are
365 ## Type of storage used for the session, current types are
351 ## dbm, file, memcached, database, and memory.
366 ## dbm, file, memcached, database, and memory.
352 ## The storage uses the Container API
367
353 ## that is also used by the cache system.
368 ## File system storage of session data. (default)
369 #beaker.session.type = file
354
370
355 ## db session ##
371 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
372 #beaker.session.type = cookie
373
374 ## Database storage of session data.
356 #beaker.session.type = ext:database
375 #beaker.session.type = ext:database
357 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
376 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
358 #beaker.session.table_name = db_session
377 #beaker.session.table_name = db_session
359
378
360 ## encrypted cookie client side session, good for many instances ##
361 #beaker.session.type = cookie
362
363 ## file based cookies (default) ##
364 #beaker.session.type = file
365
366 ## beaker.session.key should be unique for a given host, even when running
367 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
368 beaker.session.key = kallithea
369 beaker.session.secret = ${app_instance_uuid}
370
371 ## Secure encrypted cookie. Requires AES and AES python libraries
372 ## you must disable beaker.session.secret to use this
373 #beaker.session.encrypt_key = <key_for_encryption>
374 #beaker.session.validate_key = <validation_key>
375
376 ## sets session as invalid if it haven't been accessed for given amount of time
377 beaker.session.timeout = 2592000
378 beaker.session.httponly = true
379 #beaker.session.cookie_path = /<your-prefix>
380
381 ## uncomment for https secure cookie
382 beaker.session.secure = false
383
384 ## auto save the session to not to use .save()
385 beaker.session.auto = False
386
387 ## default cookie expiration time in seconds `true` expire at browser close ##
388 #beaker.session.cookie_expires = 3600
389
390 ############################
379 ############################
391 ## ERROR HANDLING SYSTEMS ##
380 ## ERROR HANDLING SYSTEMS ##
392 ############################
381 ############################
393
382
394 ####################
383 ####################
395 ### [errormator] ###
384 ### [errormator] ###
396 ####################
385 ####################
397
386
398 ## Errormator is tailored to work with Kallithea, see
387 ## Errormator is tailored to work with Kallithea, see
399 ## http://errormator.com for details how to obtain an account
388 ## http://errormator.com for details how to obtain an account
400 ## you must install python package `errormator_client` to make it work
389 ## you must install python package `errormator_client` to make it work
401
390
402 ## errormator enabled
391 ## errormator enabled
403 errormator = false
392 errormator = false
404
393
405 errormator.server_url = https://api.errormator.com
394 errormator.server_url = https://api.errormator.com
406 errormator.api_key = YOUR_API_KEY
395 errormator.api_key = YOUR_API_KEY
407
396
408 ## TWEAK AMOUNT OF INFO SENT HERE
397 ## TWEAK AMOUNT OF INFO SENT HERE
409
398
410 ## enables 404 error logging (default False)
399 ## enables 404 error logging (default False)
411 errormator.report_404 = false
400 errormator.report_404 = false
412
401
413 ## time in seconds after request is considered being slow (default 1)
402 ## time in seconds after request is considered being slow (default 1)
414 errormator.slow_request_time = 1
403 errormator.slow_request_time = 1
415
404
416 ## record slow requests in application
405 ## record slow requests in application
417 ## (needs to be enabled for slow datastore recording and time tracking)
406 ## (needs to be enabled for slow datastore recording and time tracking)
418 errormator.slow_requests = true
407 errormator.slow_requests = true
419
408
420 ## enable hooking to application loggers
409 ## enable hooking to application loggers
421 #errormator.logging = true
410 #errormator.logging = true
422
411
423 ## minimum log level for log capture
412 ## minimum log level for log capture
424 #errormator.logging.level = WARNING
413 #errormator.logging.level = WARNING
425
414
426 ## send logs only from erroneous/slow requests
415 ## send logs only from erroneous/slow requests
427 ## (saves API quota for intensive logging)
416 ## (saves API quota for intensive logging)
428 errormator.logging_on_error = false
417 errormator.logging_on_error = false
429
418
430 ## list of additonal keywords that should be grabbed from environ object
419 ## list of additonal keywords that should be grabbed from environ object
431 ## can be string with comma separated list of words in lowercase
420 ## can be string with comma separated list of words in lowercase
432 ## (by default client will always send following info:
421 ## (by default client will always send following info:
433 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
422 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
434 ## start with HTTP* this list be extended with additional keywords here
423 ## start with HTTP* this list be extended with additional keywords here
435 errormator.environ_keys_whitelist =
424 errormator.environ_keys_whitelist =
436
425
437 ## list of keywords that should be blanked from request object
426 ## list of keywords that should be blanked from request object
438 ## can be string with comma separated list of words in lowercase
427 ## can be string with comma separated list of words in lowercase
439 ## (by default client will always blank keys that contain following words
428 ## (by default client will always blank keys that contain following words
440 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
429 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
441 ## this list be extended with additional keywords set here
430 ## this list be extended with additional keywords set here
442 errormator.request_keys_blacklist =
431 errormator.request_keys_blacklist =
443
432
444 ## list of namespaces that should be ignores when gathering log entries
433 ## list of namespaces that should be ignores when gathering log entries
445 ## can be string with comma separated list of namespaces
434 ## can be string with comma separated list of namespaces
446 ## (by default the client ignores own entries: errormator_client.client)
435 ## (by default the client ignores own entries: errormator_client.client)
447 errormator.log_namespace_blacklist =
436 errormator.log_namespace_blacklist =
448
437
449 ################
438 ################
450 ### [sentry] ###
439 ### [sentry] ###
451 ################
440 ################
452
441
453 ## sentry is a alternative open source error aggregator
442 ## sentry is a alternative open source error aggregator
454 ## you must install python packages `sentry` and `raven` to enable
443 ## you must install python packages `sentry` and `raven` to enable
455
444
456 sentry.dsn = YOUR_DNS
445 sentry.dsn = YOUR_DNS
457 sentry.servers =
446 sentry.servers =
458 sentry.name =
447 sentry.name =
459 sentry.key =
448 sentry.key =
460 sentry.public_key =
449 sentry.public_key =
461 sentry.secret_key =
450 sentry.secret_key =
462 sentry.project =
451 sentry.project =
463 sentry.site =
452 sentry.site =
464 sentry.include_paths =
453 sentry.include_paths =
465 sentry.exclude_paths =
454 sentry.exclude_paths =
466
455
467 ################################################################################
456 ################################################################################
468 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
457 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
469 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
458 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
470 ## execute malicious code after an exception is raised. ##
459 ## execute malicious code after an exception is raised. ##
471 ################################################################################
460 ################################################################################
472 set debug = false
461 set debug = false
473
462
474 ##################################
463 ##################################
475 ### LOGVIEW CONFIG ###
464 ### LOGVIEW CONFIG ###
476 ##################################
465 ##################################
477
466
478 logview.sqlalchemy = #faa
467 logview.sqlalchemy = #faa
479 logview.pylons.templating = #bfb
468 logview.pylons.templating = #bfb
480 logview.pylons.util = #eee
469 logview.pylons.util = #eee
481
470
482 #########################################################
471 #########################################################
483 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
472 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
484 #########################################################
473 #########################################################
485
474
486 # SQLITE [default]
475 # SQLITE [default]
487 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
476 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
488
477
489 # POSTGRESQL
478 # POSTGRESQL
490 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
479 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
491
480
492 # MySQL
481 # MySQL
493 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
482 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
494
483
495 # see sqlalchemy docs for others
484 # see sqlalchemy docs for others
496
485
497 sqlalchemy.db1.echo = false
486 sqlalchemy.db1.echo = false
498 sqlalchemy.db1.pool_recycle = 3600
487 sqlalchemy.db1.pool_recycle = 3600
499 sqlalchemy.db1.convert_unicode = true
488 sqlalchemy.db1.convert_unicode = true
500
489
501 ################################
490 ################################
502 ### LOGGING CONFIGURATION ####
491 ### LOGGING CONFIGURATION ####
503 ################################
492 ################################
504
493
505 [loggers]
494 [loggers]
506 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
495 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
507
496
508 [handlers]
497 [handlers]
509 keys = console, console_sql
498 keys = console, console_sql
510
499
511 [formatters]
500 [formatters]
512 keys = generic, color_formatter, color_formatter_sql
501 keys = generic, color_formatter, color_formatter_sql
513
502
514 #############
503 #############
515 ## LOGGERS ##
504 ## LOGGERS ##
516 #############
505 #############
517
506
518 [logger_root]
507 [logger_root]
519 level = NOTSET
508 level = NOTSET
520 handlers = console
509 handlers = console
521
510
522 [logger_routes]
511 [logger_routes]
523 level = DEBUG
512 level = DEBUG
524 handlers =
513 handlers =
525 qualname = routes.middleware
514 qualname = routes.middleware
526 ## "level = DEBUG" logs the route matched and routing variables.
515 ## "level = DEBUG" logs the route matched and routing variables.
527 propagate = 1
516 propagate = 1
528
517
529 [logger_beaker]
518 [logger_beaker]
530 level = DEBUG
519 level = DEBUG
531 handlers =
520 handlers =
532 qualname = beaker.container
521 qualname = beaker.container
533 propagate = 1
522 propagate = 1
534
523
535 [logger_templates]
524 [logger_templates]
536 level = INFO
525 level = INFO
537 handlers =
526 handlers =
538 qualname = pylons.templating
527 qualname = pylons.templating
539 propagate = 1
528 propagate = 1
540
529
541 [logger_kallithea]
530 [logger_kallithea]
542 level = DEBUG
531 level = DEBUG
543 handlers =
532 handlers =
544 qualname = kallithea
533 qualname = kallithea
545 propagate = 1
534 propagate = 1
546
535
547 [logger_sqlalchemy]
536 [logger_sqlalchemy]
548 level = INFO
537 level = INFO
549 handlers = console_sql
538 handlers = console_sql
550 qualname = sqlalchemy.engine
539 qualname = sqlalchemy.engine
551 propagate = 0
540 propagate = 0
552
541
553 [logger_whoosh_indexer]
542 [logger_whoosh_indexer]
554 level = DEBUG
543 level = DEBUG
555 handlers =
544 handlers =
556 qualname = whoosh_indexer
545 qualname = whoosh_indexer
557 propagate = 1
546 propagate = 1
558
547
559 ##############
548 ##############
560 ## HANDLERS ##
549 ## HANDLERS ##
561 ##############
550 ##############
562
551
563 [handler_console]
552 [handler_console]
564 class = StreamHandler
553 class = StreamHandler
565 args = (sys.stderr,)
554 args = (sys.stderr,)
566 level = INFO
555 level = INFO
567 formatter = generic
556 formatter = generic
568
557
569 [handler_console_sql]
558 [handler_console_sql]
570 class = StreamHandler
559 class = StreamHandler
571 args = (sys.stderr,)
560 args = (sys.stderr,)
572 level = WARN
561 level = WARN
573 formatter = generic
562 formatter = generic
574
563
575 ################
564 ################
576 ## FORMATTERS ##
565 ## FORMATTERS ##
577 ################
566 ################
578
567
579 [formatter_generic]
568 [formatter_generic]
580 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
569 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
581 datefmt = %Y-%m-%d %H:%M:%S
570 datefmt = %Y-%m-%d %H:%M:%S
582
571
583 [formatter_color_formatter]
572 [formatter_color_formatter]
584 class = kallithea.lib.colored_formatter.ColorFormatter
573 class = kallithea.lib.colored_formatter.ColorFormatter
585 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
574 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
586 datefmt = %Y-%m-%d %H:%M:%S
575 datefmt = %Y-%m-%d %H:%M:%S
587
576
588 [formatter_color_formatter_sql]
577 [formatter_color_formatter_sql]
589 class = kallithea.lib.colored_formatter.ColorFormatterSql
578 class = kallithea.lib.colored_formatter.ColorFormatterSql
590 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
579 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
591 datefmt = %Y-%m-%d %H:%M:%S
580 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,521 +1,522 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 # This program is free software: you can redistribute it and/or modify
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
5 # (at your option) any later version.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
14
15 """
15 """
16 kallithea.lib.base
16 kallithea.lib.base
17 ~~~~~~~~~~~~~~~~~~
17 ~~~~~~~~~~~~~~~~~~
18
18
19 The base Controller API
19 The base Controller API
20 Provides the BaseController class for subclassing. And usage in different
20 Provides the BaseController class for subclassing. And usage in different
21 controllers
21 controllers
22
22
23 This file was forked by the Kallithea project in July 2014.
23 This file was forked by the Kallithea project in July 2014.
24 Original author and date, and relevant copyright and licensing information is below:
24 Original author and date, and relevant copyright and licensing information is below:
25 :created_on: Oct 06, 2010
25 :created_on: Oct 06, 2010
26 :author: marcink
26 :author: marcink
27 :copyright: (c) 2013 RhodeCode GmbH, and others.
27 :copyright: (c) 2013 RhodeCode GmbH, and others.
28 :license: GPLv3, see LICENSE.md for more details.
28 :license: GPLv3, see LICENSE.md for more details.
29 """
29 """
30
30
31 import datetime
31 import datetime
32 import logging
32 import logging
33 import time
33 import time
34 import traceback
34 import traceback
35
35
36 import webob.exc
36 import webob.exc
37 import paste.httpexceptions
37 import paste.httpexceptions
38 import paste.auth.basic
38 import paste.auth.basic
39 import paste.httpheaders
39 import paste.httpheaders
40
40
41 from pylons import config, tmpl_context as c, request, session, url
41 from pylons import config, tmpl_context as c, request, session, url
42 from pylons.controllers import WSGIController
42 from pylons.controllers import WSGIController
43 from pylons.controllers.util import redirect
43 from pylons.controllers.util import redirect
44 from pylons.templating import render_mako as render # don't remove this import
44 from pylons.templating import render_mako as render # don't remove this import
45 from pylons.i18n.translation import _
45 from pylons.i18n.translation import _
46
46
47 from kallithea import __version__, BACKENDS
47 from kallithea import __version__, BACKENDS
48
48
49 from kallithea.lib.utils2 import str2bool, safe_unicode, AttributeDict,\
49 from kallithea.lib.utils2 import str2bool, safe_unicode, AttributeDict,\
50 safe_str, safe_int
50 safe_str, safe_int
51 from kallithea.lib import auth_modules
51 from kallithea.lib import auth_modules
52 from kallithea.lib.auth import AuthUser, HasPermissionAnyMiddleware
52 from kallithea.lib.auth import AuthUser, HasPermissionAnyMiddleware
53 from kallithea.lib.utils import get_repo_slug
53 from kallithea.lib.utils import get_repo_slug
54 from kallithea.lib.exceptions import UserCreationError
54 from kallithea.lib.exceptions import UserCreationError
55 from kallithea.lib.vcs.exceptions import RepositoryError, EmptyRepositoryError, ChangesetDoesNotExistError
55 from kallithea.lib.vcs.exceptions import RepositoryError, EmptyRepositoryError, ChangesetDoesNotExistError
56 from kallithea.model import meta
56 from kallithea.model import meta
57
57
58 from kallithea.model.db import Repository, Ui, User, Setting
58 from kallithea.model.db import Repository, Ui, User, Setting
59 from kallithea.model.notification import NotificationModel
59 from kallithea.model.notification import NotificationModel
60 from kallithea.model.scm import ScmModel
60 from kallithea.model.scm import ScmModel
61 from kallithea.model.pull_request import PullRequestModel
61 from kallithea.model.pull_request import PullRequestModel
62
62
63 log = logging.getLogger(__name__)
63 log = logging.getLogger(__name__)
64
64
65
65
66 def _filter_proxy(ip):
66 def _filter_proxy(ip):
67 """
67 """
68 HEADERS can have multiple ips inside the left-most being the original
68 HEADERS can have multiple ips inside the left-most being the original
69 client, and each successive proxy that passed the request adding the IP
69 client, and each successive proxy that passed the request adding the IP
70 address where it received the request from.
70 address where it received the request from.
71
71
72 :param ip:
72 :param ip:
73 """
73 """
74 if ',' in ip:
74 if ',' in ip:
75 _ips = ip.split(',')
75 _ips = ip.split(',')
76 _first_ip = _ips[0].strip()
76 _first_ip = _ips[0].strip()
77 log.debug('Got multiple IPs %s, using %s', ','.join(_ips), _first_ip)
77 log.debug('Got multiple IPs %s, using %s', ','.join(_ips), _first_ip)
78 return _first_ip
78 return _first_ip
79 return ip
79 return ip
80
80
81
81
82 def _get_ip_addr(environ):
82 def _get_ip_addr(environ):
83 proxy_key = 'HTTP_X_REAL_IP'
83 proxy_key = 'HTTP_X_REAL_IP'
84 proxy_key2 = 'HTTP_X_FORWARDED_FOR'
84 proxy_key2 = 'HTTP_X_FORWARDED_FOR'
85 def_key = 'REMOTE_ADDR'
85 def_key = 'REMOTE_ADDR'
86
86
87 ip = environ.get(proxy_key)
87 ip = environ.get(proxy_key)
88 if ip:
88 if ip:
89 return _filter_proxy(ip)
89 return _filter_proxy(ip)
90
90
91 ip = environ.get(proxy_key2)
91 ip = environ.get(proxy_key2)
92 if ip:
92 if ip:
93 return _filter_proxy(ip)
93 return _filter_proxy(ip)
94
94
95 ip = environ.get(def_key, '0.0.0.0')
95 ip = environ.get(def_key, '0.0.0.0')
96 return _filter_proxy(ip)
96 return _filter_proxy(ip)
97
97
98
98
99 def _get_access_path(environ):
99 def _get_access_path(environ):
100 path = environ.get('PATH_INFO')
100 path = environ.get('PATH_INFO')
101 org_req = environ.get('pylons.original_request')
101 org_req = environ.get('pylons.original_request')
102 if org_req:
102 if org_req:
103 path = org_req.environ.get('PATH_INFO')
103 path = org_req.environ.get('PATH_INFO')
104 return path
104 return path
105
105
106
106
107 def log_in_user(user, remember, is_external_auth):
107 def log_in_user(user, remember, is_external_auth):
108 """
108 """
109 Log a `User` in and update session and cookies. If `remember` is True,
109 Log a `User` in and update session and cookies. If `remember` is True,
110 the session cookie is set to expire in a year; otherwise, it expires at
110 the session cookie is set to expire in a year; otherwise, it expires at
111 the end of the browser session.
111 the end of the browser session.
112
112
113 Returns populated `AuthUser` object.
113 Returns populated `AuthUser` object.
114 """
114 """
115 user.update_lastlogin()
115 user.update_lastlogin()
116 meta.Session().commit()
116 meta.Session().commit()
117
117
118 auth_user = AuthUser(dbuser=user,
118 auth_user = AuthUser(dbuser=user,
119 is_external_auth=is_external_auth)
119 is_external_auth=is_external_auth)
120 auth_user.set_authenticated()
120 auth_user.set_authenticated()
121
121
122 # Start new session to prevent session fixation attacks.
122 # Start new session to prevent session fixation attacks.
123 session.invalidate()
123 session.invalidate()
124 session['authuser'] = cookie = auth_user.to_cookie()
124 session['authuser'] = cookie = auth_user.to_cookie()
125
125
126 # If they want to be remembered, update the cookie
126 # If they want to be remembered, update the cookie.
127 # NOTE: Assumes that beaker defaults to browser session cookie.
127 if remember:
128 if remember:
128 t = datetime.datetime.now() + datetime.timedelta(days=365)
129 t = datetime.datetime.now() + datetime.timedelta(days=365)
129 session._set_cookie_expires(t)
130 session._set_cookie_expires(t)
130
131
131 session.save()
132 session.save()
132
133
133 log.info('user %s is now authenticated and stored in '
134 log.info('user %s is now authenticated and stored in '
134 'session, session attrs %s', user.username, cookie)
135 'session, session attrs %s', user.username, cookie)
135
136
136 # dumps session attrs back to cookie
137 # dumps session attrs back to cookie
137 session._update_cookie_out()
138 session._update_cookie_out()
138
139
139 return auth_user
140 return auth_user
140
141
141
142
142 class BasicAuth(paste.auth.basic.AuthBasicAuthenticator):
143 class BasicAuth(paste.auth.basic.AuthBasicAuthenticator):
143
144
144 def __init__(self, realm, authfunc, auth_http_code=None):
145 def __init__(self, realm, authfunc, auth_http_code=None):
145 self.realm = realm
146 self.realm = realm
146 self.authfunc = authfunc
147 self.authfunc = authfunc
147 self._rc_auth_http_code = auth_http_code
148 self._rc_auth_http_code = auth_http_code
148
149
149 def build_authentication(self):
150 def build_authentication(self):
150 head = paste.httpheaders.WWW_AUTHENTICATE.tuples('Basic realm="%s"' % self.realm)
151 head = paste.httpheaders.WWW_AUTHENTICATE.tuples('Basic realm="%s"' % self.realm)
151 if self._rc_auth_http_code and self._rc_auth_http_code == '403':
152 if self._rc_auth_http_code and self._rc_auth_http_code == '403':
152 # return 403 if alternative http return code is specified in
153 # return 403 if alternative http return code is specified in
153 # Kallithea config
154 # Kallithea config
154 return paste.httpexceptions.HTTPForbidden(headers=head)
155 return paste.httpexceptions.HTTPForbidden(headers=head)
155 return paste.httpexceptions.HTTPUnauthorized(headers=head)
156 return paste.httpexceptions.HTTPUnauthorized(headers=head)
156
157
157 def authenticate(self, environ):
158 def authenticate(self, environ):
158 authorization = paste.httpheaders.AUTHORIZATION(environ)
159 authorization = paste.httpheaders.AUTHORIZATION(environ)
159 if not authorization:
160 if not authorization:
160 return self.build_authentication()
161 return self.build_authentication()
161 (authmeth, auth) = authorization.split(' ', 1)
162 (authmeth, auth) = authorization.split(' ', 1)
162 if 'basic' != authmeth.lower():
163 if 'basic' != authmeth.lower():
163 return self.build_authentication()
164 return self.build_authentication()
164 auth = auth.strip().decode('base64')
165 auth = auth.strip().decode('base64')
165 _parts = auth.split(':', 1)
166 _parts = auth.split(':', 1)
166 if len(_parts) == 2:
167 if len(_parts) == 2:
167 username, password = _parts
168 username, password = _parts
168 if self.authfunc(username, password, environ) is not None:
169 if self.authfunc(username, password, environ) is not None:
169 return username
170 return username
170 return self.build_authentication()
171 return self.build_authentication()
171
172
172 __call__ = authenticate
173 __call__ = authenticate
173
174
174
175
175 class BaseVCSController(object):
176 class BaseVCSController(object):
176
177
177 def __init__(self, application, config):
178 def __init__(self, application, config):
178 self.application = application
179 self.application = application
179 self.config = config
180 self.config = config
180 # base path of repo locations
181 # base path of repo locations
181 self.basepath = self.config['base_path']
182 self.basepath = self.config['base_path']
182 # authenticate this VCS request using the authentication modules
183 # authenticate this VCS request using the authentication modules
183 self.authenticate = BasicAuth('', auth_modules.authenticate,
184 self.authenticate = BasicAuth('', auth_modules.authenticate,
184 config.get('auth_ret_code'))
185 config.get('auth_ret_code'))
185 self.ip_addr = '0.0.0.0'
186 self.ip_addr = '0.0.0.0'
186
187
187 def _handle_request(self, environ, start_response):
188 def _handle_request(self, environ, start_response):
188 raise NotImplementedError()
189 raise NotImplementedError()
189
190
190 def _get_by_id(self, repo_name):
191 def _get_by_id(self, repo_name):
191 """
192 """
192 Gets a special pattern _<ID> from clone url and tries to replace it
193 Gets a special pattern _<ID> from clone url and tries to replace it
193 with a repository_name for support of _<ID> permanent URLs
194 with a repository_name for support of _<ID> permanent URLs
194
195
195 :param repo_name:
196 :param repo_name:
196 """
197 """
197
198
198 data = repo_name.split('/')
199 data = repo_name.split('/')
199 if len(data) >= 2:
200 if len(data) >= 2:
200 from kallithea.lib.utils import get_repo_by_id
201 from kallithea.lib.utils import get_repo_by_id
201 by_id_match = get_repo_by_id(repo_name)
202 by_id_match = get_repo_by_id(repo_name)
202 if by_id_match:
203 if by_id_match:
203 data[1] = by_id_match
204 data[1] = by_id_match
204
205
205 return '/'.join(data)
206 return '/'.join(data)
206
207
207 def _invalidate_cache(self, repo_name):
208 def _invalidate_cache(self, repo_name):
208 """
209 """
209 Sets cache for this repository for invalidation on next access
210 Sets cache for this repository for invalidation on next access
210
211
211 :param repo_name: full repo name, also a cache key
212 :param repo_name: full repo name, also a cache key
212 """
213 """
213 ScmModel().mark_for_invalidation(repo_name)
214 ScmModel().mark_for_invalidation(repo_name)
214
215
215 def _check_permission(self, action, user, repo_name, ip_addr=None):
216 def _check_permission(self, action, user, repo_name, ip_addr=None):
216 """
217 """
217 Checks permissions using action (push/pull) user and repository
218 Checks permissions using action (push/pull) user and repository
218 name
219 name
219
220
220 :param action: push or pull action
221 :param action: push or pull action
221 :param user: `User` instance
222 :param user: `User` instance
222 :param repo_name: repository name
223 :param repo_name: repository name
223 """
224 """
224 # check IP
225 # check IP
225 ip_allowed = AuthUser.check_ip_allowed(user, ip_addr)
226 ip_allowed = AuthUser.check_ip_allowed(user, ip_addr)
226 if ip_allowed:
227 if ip_allowed:
227 log.info('Access for IP:%s allowed', ip_addr)
228 log.info('Access for IP:%s allowed', ip_addr)
228 else:
229 else:
229 return False
230 return False
230
231
231 if action == 'push':
232 if action == 'push':
232 if not HasPermissionAnyMiddleware('repository.write',
233 if not HasPermissionAnyMiddleware('repository.write',
233 'repository.admin')(user,
234 'repository.admin')(user,
234 repo_name):
235 repo_name):
235 return False
236 return False
236
237
237 else:
238 else:
238 #any other action need at least read permission
239 #any other action need at least read permission
239 if not HasPermissionAnyMiddleware('repository.read',
240 if not HasPermissionAnyMiddleware('repository.read',
240 'repository.write',
241 'repository.write',
241 'repository.admin')(user,
242 'repository.admin')(user,
242 repo_name):
243 repo_name):
243 return False
244 return False
244
245
245 return True
246 return True
246
247
247 def _get_ip_addr(self, environ):
248 def _get_ip_addr(self, environ):
248 return _get_ip_addr(environ)
249 return _get_ip_addr(environ)
249
250
250 def _check_ssl(self, environ):
251 def _check_ssl(self, environ):
251 """
252 """
252 Checks the SSL check flag and returns False if SSL is not present
253 Checks the SSL check flag and returns False if SSL is not present
253 and required True otherwise
254 and required True otherwise
254 """
255 """
255 #check if we have SSL required ! if not it's a bad request !
256 #check if we have SSL required ! if not it's a bad request !
256 if str2bool(Ui.get_by_key('push_ssl').ui_value):
257 if str2bool(Ui.get_by_key('push_ssl').ui_value):
257 org_proto = environ.get('wsgi._org_proto', environ['wsgi.url_scheme'])
258 org_proto = environ.get('wsgi._org_proto', environ['wsgi.url_scheme'])
258 if org_proto != 'https':
259 if org_proto != 'https':
259 log.debug('proto is %s and SSL is required BAD REQUEST !',
260 log.debug('proto is %s and SSL is required BAD REQUEST !',
260 org_proto)
261 org_proto)
261 return False
262 return False
262 return True
263 return True
263
264
264 def _check_locking_state(self, environ, action, repo, user_id):
265 def _check_locking_state(self, environ, action, repo, user_id):
265 """
266 """
266 Checks locking on this repository, if locking is enabled and lock is
267 Checks locking on this repository, if locking is enabled and lock is
267 present returns a tuple of make_lock, locked, locked_by.
268 present returns a tuple of make_lock, locked, locked_by.
268 make_lock can have 3 states None (do nothing) True, make lock
269 make_lock can have 3 states None (do nothing) True, make lock
269 False release lock, This value is later propagated to hooks, which
270 False release lock, This value is later propagated to hooks, which
270 do the locking. Think about this as signals passed to hooks what to do.
271 do the locking. Think about this as signals passed to hooks what to do.
271
272
272 """
273 """
273 locked = False # defines that locked error should be thrown to user
274 locked = False # defines that locked error should be thrown to user
274 make_lock = None
275 make_lock = None
275 repo = Repository.get_by_repo_name(repo)
276 repo = Repository.get_by_repo_name(repo)
276 user = User.get(user_id)
277 user = User.get(user_id)
277
278
278 # this is kind of hacky, but due to how mercurial handles client-server
279 # this is kind of hacky, but due to how mercurial handles client-server
279 # server see all operation on changeset; bookmarks, phases and
280 # server see all operation on changeset; bookmarks, phases and
280 # obsolescence marker in different transaction, we don't want to check
281 # obsolescence marker in different transaction, we don't want to check
281 # locking on those
282 # locking on those
282 obsolete_call = environ['QUERY_STRING'] in ['cmd=listkeys',]
283 obsolete_call = environ['QUERY_STRING'] in ['cmd=listkeys',]
283 locked_by = repo.locked
284 locked_by = repo.locked
284 if repo and repo.enable_locking and not obsolete_call:
285 if repo and repo.enable_locking and not obsolete_call:
285 if action == 'push':
286 if action == 'push':
286 #check if it's already locked !, if it is compare users
287 #check if it's already locked !, if it is compare users
287 user_id, _date = repo.locked
288 user_id, _date = repo.locked
288 if user.user_id == user_id:
289 if user.user_id == user_id:
289 log.debug('Got push from user %s, now unlocking', user)
290 log.debug('Got push from user %s, now unlocking', user)
290 # unlock if we have push from user who locked
291 # unlock if we have push from user who locked
291 make_lock = False
292 make_lock = False
292 else:
293 else:
293 # we're not the same user who locked, ban with 423 !
294 # we're not the same user who locked, ban with 423 !
294 locked = True
295 locked = True
295 if action == 'pull':
296 if action == 'pull':
296 if repo.locked[0] and repo.locked[1]:
297 if repo.locked[0] and repo.locked[1]:
297 locked = True
298 locked = True
298 else:
299 else:
299 log.debug('Setting lock on repo %s by %s', repo, user)
300 log.debug('Setting lock on repo %s by %s', repo, user)
300 make_lock = True
301 make_lock = True
301
302
302 else:
303 else:
303 log.debug('Repository %s do not have locking enabled', repo)
304 log.debug('Repository %s do not have locking enabled', repo)
304 log.debug('FINAL locking values make_lock:%s,locked:%s,locked_by:%s',
305 log.debug('FINAL locking values make_lock:%s,locked:%s,locked_by:%s',
305 make_lock, locked, locked_by)
306 make_lock, locked, locked_by)
306 return make_lock, locked, locked_by
307 return make_lock, locked, locked_by
307
308
308 def __call__(self, environ, start_response):
309 def __call__(self, environ, start_response):
309 start = time.time()
310 start = time.time()
310 try:
311 try:
311 return self._handle_request(environ, start_response)
312 return self._handle_request(environ, start_response)
312 finally:
313 finally:
313 log = logging.getLogger('kallithea.' + self.__class__.__name__)
314 log = logging.getLogger('kallithea.' + self.__class__.__name__)
314 log.debug('Request time: %.3fs', time.time() - start)
315 log.debug('Request time: %.3fs', time.time() - start)
315 meta.Session.remove()
316 meta.Session.remove()
316
317
317
318
318 class BaseController(WSGIController):
319 class BaseController(WSGIController):
319
320
320 def __before__(self):
321 def __before__(self):
321 """
322 """
322 __before__ is called before controller methods and after __call__
323 __before__ is called before controller methods and after __call__
323 """
324 """
324 c.kallithea_version = __version__
325 c.kallithea_version = __version__
325 rc_config = Setting.get_app_settings()
326 rc_config = Setting.get_app_settings()
326
327
327 # Visual options
328 # Visual options
328 c.visual = AttributeDict({})
329 c.visual = AttributeDict({})
329
330
330 ## DB stored
331 ## DB stored
331 c.visual.show_public_icon = str2bool(rc_config.get('show_public_icon'))
332 c.visual.show_public_icon = str2bool(rc_config.get('show_public_icon'))
332 c.visual.show_private_icon = str2bool(rc_config.get('show_private_icon'))
333 c.visual.show_private_icon = str2bool(rc_config.get('show_private_icon'))
333 c.visual.stylify_metatags = str2bool(rc_config.get('stylify_metatags'))
334 c.visual.stylify_metatags = str2bool(rc_config.get('stylify_metatags'))
334 c.visual.dashboard_items = safe_int(rc_config.get('dashboard_items', 100))
335 c.visual.dashboard_items = safe_int(rc_config.get('dashboard_items', 100))
335 c.visual.admin_grid_items = safe_int(rc_config.get('admin_grid_items', 100))
336 c.visual.admin_grid_items = safe_int(rc_config.get('admin_grid_items', 100))
336 c.visual.repository_fields = str2bool(rc_config.get('repository_fields'))
337 c.visual.repository_fields = str2bool(rc_config.get('repository_fields'))
337 c.visual.show_version = str2bool(rc_config.get('show_version'))
338 c.visual.show_version = str2bool(rc_config.get('show_version'))
338 c.visual.use_gravatar = str2bool(rc_config.get('use_gravatar'))
339 c.visual.use_gravatar = str2bool(rc_config.get('use_gravatar'))
339 c.visual.gravatar_url = rc_config.get('gravatar_url')
340 c.visual.gravatar_url = rc_config.get('gravatar_url')
340
341
341 c.ga_code = rc_config.get('ga_code')
342 c.ga_code = rc_config.get('ga_code')
342 # TODO: replace undocumented backwards compatibility hack with db upgrade and rename ga_code
343 # TODO: replace undocumented backwards compatibility hack with db upgrade and rename ga_code
343 if c.ga_code and '<' not in c.ga_code:
344 if c.ga_code and '<' not in c.ga_code:
344 c.ga_code = '''<script type="text/javascript">
345 c.ga_code = '''<script type="text/javascript">
345 var _gaq = _gaq || [];
346 var _gaq = _gaq || [];
346 _gaq.push(['_setAccount', '%s']);
347 _gaq.push(['_setAccount', '%s']);
347 _gaq.push(['_trackPageview']);
348 _gaq.push(['_trackPageview']);
348
349
349 (function() {
350 (function() {
350 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
351 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
351 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
352 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
352 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
353 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
353 })();
354 })();
354 </script>''' % c.ga_code
355 </script>''' % c.ga_code
355 c.site_name = rc_config.get('title')
356 c.site_name = rc_config.get('title')
356 c.clone_uri_tmpl = rc_config.get('clone_uri_tmpl')
357 c.clone_uri_tmpl = rc_config.get('clone_uri_tmpl')
357
358
358 ## INI stored
359 ## INI stored
359 c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True))
360 c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True))
360 c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True))
361 c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True))
361
362
362 c.instance_id = config.get('instance_id')
363 c.instance_id = config.get('instance_id')
363 c.issues_url = config.get('bugtracker', url('issues_url'))
364 c.issues_url = config.get('bugtracker', url('issues_url'))
364 # END CONFIG VARS
365 # END CONFIG VARS
365
366
366 c.repo_name = get_repo_slug(request) # can be empty
367 c.repo_name = get_repo_slug(request) # can be empty
367 c.backends = BACKENDS.keys()
368 c.backends = BACKENDS.keys()
368 c.unread_notifications = NotificationModel()\
369 c.unread_notifications = NotificationModel()\
369 .get_unread_cnt_for_user(c.authuser.user_id)
370 .get_unread_cnt_for_user(c.authuser.user_id)
370
371
371 self.cut_off_limit = safe_int(config.get('cut_off_limit'))
372 self.cut_off_limit = safe_int(config.get('cut_off_limit'))
372
373
373 c.my_pr_count = PullRequestModel().get_pullrequest_cnt_for_user(c.authuser.user_id)
374 c.my_pr_count = PullRequestModel().get_pullrequest_cnt_for_user(c.authuser.user_id)
374
375
375 self.sa = meta.Session
376 self.sa = meta.Session
376 self.scm_model = ScmModel(self.sa)
377 self.scm_model = ScmModel(self.sa)
377
378
378 @staticmethod
379 @staticmethod
379 def _determine_auth_user(api_key, session_authuser):
380 def _determine_auth_user(api_key, session_authuser):
380 """
381 """
381 Create an `AuthUser` object given the API key (if any) and the
382 Create an `AuthUser` object given the API key (if any) and the
382 value of the authuser session cookie.
383 value of the authuser session cookie.
383 """
384 """
384
385
385 # Authenticate by API key
386 # Authenticate by API key
386 if api_key:
387 if api_key:
387 # when using API_KEY we are sure user exists.
388 # when using API_KEY we are sure user exists.
388 return AuthUser(dbuser=User.get_by_api_key(api_key),
389 return AuthUser(dbuser=User.get_by_api_key(api_key),
389 is_external_auth=True)
390 is_external_auth=True)
390
391
391 # Authenticate by session cookie
392 # Authenticate by session cookie
392 # In ancient login sessions, 'authuser' may not be a dict.
393 # In ancient login sessions, 'authuser' may not be a dict.
393 # In that case, the user will have to log in again.
394 # In that case, the user will have to log in again.
394 if isinstance(session_authuser, dict):
395 if isinstance(session_authuser, dict):
395 try:
396 try:
396 return AuthUser.from_cookie(session_authuser)
397 return AuthUser.from_cookie(session_authuser)
397 except UserCreationError as e:
398 except UserCreationError as e:
398 # container auth or other auth functions that create users on
399 # container auth or other auth functions that create users on
399 # the fly can throw UserCreationError to signal issues with
400 # the fly can throw UserCreationError to signal issues with
400 # user creation. Explanation should be provided in the
401 # user creation. Explanation should be provided in the
401 # exception object.
402 # exception object.
402 from kallithea.lib import helpers as h
403 from kallithea.lib import helpers as h
403 h.flash(e, 'error', logf=log.error)
404 h.flash(e, 'error', logf=log.error)
404
405
405 # Authenticate by auth_container plugin (if enabled)
406 # Authenticate by auth_container plugin (if enabled)
406 if any(
407 if any(
407 auth_modules.importplugin(name).is_container_auth
408 auth_modules.importplugin(name).is_container_auth
408 for name in Setting.get_auth_plugins()
409 for name in Setting.get_auth_plugins()
409 ):
410 ):
410 try:
411 try:
411 user_info = auth_modules.authenticate('', '', request.environ)
412 user_info = auth_modules.authenticate('', '', request.environ)
412 except UserCreationError as e:
413 except UserCreationError as e:
413 from kallithea.lib import helpers as h
414 from kallithea.lib import helpers as h
414 h.flash(e, 'error', logf=log.error)
415 h.flash(e, 'error', logf=log.error)
415 else:
416 else:
416 if user_info is not None:
417 if user_info is not None:
417 username = user_info['username']
418 username = user_info['username']
418 user = User.get_by_username(username, case_insensitive=True)
419 user = User.get_by_username(username, case_insensitive=True)
419 return log_in_user(user, remember=False,
420 return log_in_user(user, remember=False,
420 is_external_auth=True)
421 is_external_auth=True)
421
422
422 # User is anonymous
423 # User is anonymous
423 return AuthUser()
424 return AuthUser()
424
425
425 def __call__(self, environ, start_response):
426 def __call__(self, environ, start_response):
426 """Invoke the Controller"""
427 """Invoke the Controller"""
427
428
428 # WSGIController.__call__ dispatches to the Controller method
429 # WSGIController.__call__ dispatches to the Controller method
429 # the request is routed to. This routing information is
430 # the request is routed to. This routing information is
430 # available in environ['pylons.routes_dict']
431 # available in environ['pylons.routes_dict']
431 try:
432 try:
432 self.ip_addr = _get_ip_addr(environ)
433 self.ip_addr = _get_ip_addr(environ)
433 # make sure that we update permissions each time we call controller
434 # make sure that we update permissions each time we call controller
434
435
435 #set globals for auth user
436 #set globals for auth user
436 self.authuser = c.authuser = request.user = self._determine_auth_user(
437 self.authuser = c.authuser = request.user = self._determine_auth_user(
437 request.GET.get('api_key'),
438 request.GET.get('api_key'),
438 session.get('authuser'),
439 session.get('authuser'),
439 )
440 )
440
441
441 log.info('IP: %s User: %s accessed %s',
442 log.info('IP: %s User: %s accessed %s',
442 self.ip_addr, self.authuser,
443 self.ip_addr, self.authuser,
443 safe_unicode(_get_access_path(environ)),
444 safe_unicode(_get_access_path(environ)),
444 )
445 )
445 return WSGIController.__call__(self, environ, start_response)
446 return WSGIController.__call__(self, environ, start_response)
446 finally:
447 finally:
447 meta.Session.remove()
448 meta.Session.remove()
448
449
449
450
450 class BaseRepoController(BaseController):
451 class BaseRepoController(BaseController):
451 """
452 """
452 Base class for controllers responsible for loading all needed data for
453 Base class for controllers responsible for loading all needed data for
453 repository loaded items are
454 repository loaded items are
454
455
455 c.db_repo_scm_instance: instance of scm repository
456 c.db_repo_scm_instance: instance of scm repository
456 c.db_repo: instance of db
457 c.db_repo: instance of db
457 c.repository_followers: number of followers
458 c.repository_followers: number of followers
458 c.repository_forks: number of forks
459 c.repository_forks: number of forks
459 c.repository_following: weather the current user is following the current repo
460 c.repository_following: weather the current user is following the current repo
460 """
461 """
461
462
462 def __before__(self):
463 def __before__(self):
463 super(BaseRepoController, self).__before__()
464 super(BaseRepoController, self).__before__()
464 if c.repo_name: # extracted from routes
465 if c.repo_name: # extracted from routes
465 _dbr = Repository.get_by_repo_name(c.repo_name)
466 _dbr = Repository.get_by_repo_name(c.repo_name)
466 if not _dbr:
467 if not _dbr:
467 return
468 return
468
469
469 log.debug('Found repository in database %s with state `%s`',
470 log.debug('Found repository in database %s with state `%s`',
470 safe_unicode(_dbr), safe_unicode(_dbr.repo_state))
471 safe_unicode(_dbr), safe_unicode(_dbr.repo_state))
471 route = getattr(request.environ.get('routes.route'), 'name', '')
472 route = getattr(request.environ.get('routes.route'), 'name', '')
472
473
473 # allow to delete repos that are somehow damages in filesystem
474 # allow to delete repos that are somehow damages in filesystem
474 if route in ['delete_repo']:
475 if route in ['delete_repo']:
475 return
476 return
476
477
477 if _dbr.repo_state in [Repository.STATE_PENDING]:
478 if _dbr.repo_state in [Repository.STATE_PENDING]:
478 if route in ['repo_creating_home']:
479 if route in ['repo_creating_home']:
479 return
480 return
480 check_url = url('repo_creating_home', repo_name=c.repo_name)
481 check_url = url('repo_creating_home', repo_name=c.repo_name)
481 return redirect(check_url)
482 return redirect(check_url)
482
483
483 dbr = c.db_repo = _dbr
484 dbr = c.db_repo = _dbr
484 c.db_repo_scm_instance = c.db_repo.scm_instance
485 c.db_repo_scm_instance = c.db_repo.scm_instance
485 if c.db_repo_scm_instance is None:
486 if c.db_repo_scm_instance is None:
486 log.error('%s this repository is present in database but it '
487 log.error('%s this repository is present in database but it '
487 'cannot be created as an scm instance', c.repo_name)
488 'cannot be created as an scm instance', c.repo_name)
488 from kallithea.lib import helpers as h
489 from kallithea.lib import helpers as h
489 h.flash(h.literal(_('Repository not found in the filesystem')),
490 h.flash(h.literal(_('Repository not found in the filesystem')),
490 category='error')
491 category='error')
491 raise paste.httpexceptions.HTTPNotFound()
492 raise paste.httpexceptions.HTTPNotFound()
492
493
493 # some globals counter for menu
494 # some globals counter for menu
494 c.repository_followers = self.scm_model.get_followers(dbr)
495 c.repository_followers = self.scm_model.get_followers(dbr)
495 c.repository_forks = self.scm_model.get_forks(dbr)
496 c.repository_forks = self.scm_model.get_forks(dbr)
496 c.repository_pull_requests = self.scm_model.get_pull_requests(dbr)
497 c.repository_pull_requests = self.scm_model.get_pull_requests(dbr)
497 c.repository_following = self.scm_model.is_following_repo(
498 c.repository_following = self.scm_model.is_following_repo(
498 c.repo_name, self.authuser.user_id)
499 c.repo_name, self.authuser.user_id)
499
500
500 @staticmethod
501 @staticmethod
501 def _get_ref_rev(repo, ref_type, ref_name, returnempty=False):
502 def _get_ref_rev(repo, ref_type, ref_name, returnempty=False):
502 """
503 """
503 Safe way to get changeset. If error occurs show error.
504 Safe way to get changeset. If error occurs show error.
504 """
505 """
505 from kallithea.lib import helpers as h
506 from kallithea.lib import helpers as h
506 try:
507 try:
507 return repo.scm_instance.get_ref_revision(ref_type, ref_name)
508 return repo.scm_instance.get_ref_revision(ref_type, ref_name)
508 except EmptyRepositoryError as e:
509 except EmptyRepositoryError as e:
509 if returnempty:
510 if returnempty:
510 return repo.scm_instance.EMPTY_CHANGESET
511 return repo.scm_instance.EMPTY_CHANGESET
511 h.flash(h.literal(_('There are no changesets yet')),
512 h.flash(h.literal(_('There are no changesets yet')),
512 category='error')
513 category='error')
513 raise webob.exc.HTTPNotFound()
514 raise webob.exc.HTTPNotFound()
514 except ChangesetDoesNotExistError as e:
515 except ChangesetDoesNotExistError as e:
515 h.flash(h.literal(_('Changeset not found')),
516 h.flash(h.literal(_('Changeset not found')),
516 category='error')
517 category='error')
517 raise webob.exc.HTTPNotFound()
518 raise webob.exc.HTTPNotFound()
518 except RepositoryError as e:
519 except RepositoryError as e:
519 log.error(traceback.format_exc())
520 log.error(traceback.format_exc())
520 h.flash(safe_str(e), category='error')
521 h.flash(safe_str(e), category='error')
521 raise webob.exc.HTTPBadRequest()
522 raise webob.exc.HTTPBadRequest()
@@ -1,602 +1,591 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # Kallithea - config for tests: #
3 # Kallithea - config for tests: #
4 # initial_repo_scan = true #
4 # initial_repo_scan = true #
5 # vcs_full_cache = false #
5 # vcs_full_cache = false #
6 # sqlalchemy and kallithea_test.sqlite #
6 # sqlalchemy and kallithea_test.sqlite #
7 # custom logging #
7 # custom logging #
8 # #
8 # #
9 # The %(here)s variable will be replaced with the parent directory of this file#
9 # The %(here)s variable will be replaced with the parent directory of this file#
10 ################################################################################
10 ################################################################################
11 ################################################################################
11 ################################################################################
12
12
13 [DEFAULT]
13 [DEFAULT]
14 debug = true
14 debug = true
15 pdebug = false
15 pdebug = false
16
16
17 ################################################################################
17 ################################################################################
18 ## E-mail settings ##
18 ## E-mail settings ##
19 ## ##
19 ## ##
20 ## Refer to the documentation ("E-mail settings") for more details. ##
20 ## Refer to the documentation ("E-mail settings") for more details. ##
21 ## ##
21 ## ##
22 ## It is recommended to use a valid sender address that passes access ##
22 ## It is recommended to use a valid sender address that passes access ##
23 ## validation and spam filtering in mail servers. ##
23 ## validation and spam filtering in mail servers. ##
24 ################################################################################
24 ################################################################################
25
25
26 ## 'From' header for application e-mails. You can optionally add a name.
26 ## 'From' header for application e-mails. You can optionally add a name.
27 ## Default:
27 ## Default:
28 #app_email_from = Kallithea
28 #app_email_from = Kallithea
29 ## Examples:
29 ## Examples:
30 #app_email_from = Kallithea <kallithea-noreply@example.com>
30 #app_email_from = Kallithea <kallithea-noreply@example.com>
31 #app_email_from = kallithea-noreply@example.com
31 #app_email_from = kallithea-noreply@example.com
32
32
33 ## Subject prefix for application e-mails.
33 ## Subject prefix for application e-mails.
34 ## A space between this prefix and the real subject is automatically added.
34 ## A space between this prefix and the real subject is automatically added.
35 ## Default:
35 ## Default:
36 #email_prefix =
36 #email_prefix =
37 ## Example:
37 ## Example:
38 #email_prefix = [Kallithea]
38 #email_prefix = [Kallithea]
39
39
40 ## Recipients for error e-mails and fallback recipients of application mails.
40 ## Recipients for error e-mails and fallback recipients of application mails.
41 ## Multiple addresses can be specified, space-separated.
41 ## Multiple addresses can be specified, space-separated.
42 ## Only addresses are allowed, do not add any name part.
42 ## Only addresses are allowed, do not add any name part.
43 ## Default:
43 ## Default:
44 #email_to =
44 #email_to =
45 ## Examples:
45 ## Examples:
46 #email_to = admin@example.com
46 #email_to = admin@example.com
47 #email_to = admin@example.com another_admin@example.com
47 #email_to = admin@example.com another_admin@example.com
48
48
49 ## 'From' header for error e-mails. You can optionally add a name.
49 ## 'From' header for error e-mails. You can optionally add a name.
50 ## Default:
50 ## Default:
51 #error_email_from = pylons@yourapp.com
51 #error_email_from = pylons@yourapp.com
52 ## Examples:
52 ## Examples:
53 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
53 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
54 #error_email_from = paste_error@example.com
54 #error_email_from = paste_error@example.com
55
55
56 ## SMTP server settings
56 ## SMTP server settings
57 ## Only smtp_server is mandatory. All other settings take the specified default
57 ## Only smtp_server is mandatory. All other settings take the specified default
58 ## values.
58 ## values.
59 #smtp_server = mail.server.com
59 #smtp_server = mail.server.com
60 #smtp_username =
60 #smtp_username =
61 #smtp_password =
61 #smtp_password =
62 #smtp_port = 25
62 #smtp_port = 25
63 #smtp_use_tls = false
63 #smtp_use_tls = false
64 #smtp_use_ssl = false
64 #smtp_use_ssl = false
65 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
65 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
66 ## If empty, use any of the authentication parameters supported by the server.
66 ## If empty, use any of the authentication parameters supported by the server.
67 #smtp_auth =
67 #smtp_auth =
68
68
69 [server:main]
69 [server:main]
70 ## PASTE ##
70 ## PASTE ##
71 #use = egg:Paste#http
71 #use = egg:Paste#http
72 ## nr of worker threads to spawn
72 ## nr of worker threads to spawn
73 #threadpool_workers = 5
73 #threadpool_workers = 5
74 ## max request before thread respawn
74 ## max request before thread respawn
75 #threadpool_max_requests = 10
75 #threadpool_max_requests = 10
76 ## option to use threads of process
76 ## option to use threads of process
77 #use_threadpool = true
77 #use_threadpool = true
78
78
79 ## WAITRESS ##
79 ## WAITRESS ##
80 use = egg:waitress#main
80 use = egg:waitress#main
81 ## number of worker threads
81 ## number of worker threads
82 threads = 5
82 threads = 5
83 ## MAX BODY SIZE 100GB
83 ## MAX BODY SIZE 100GB
84 max_request_body_size = 107374182400
84 max_request_body_size = 107374182400
85 ## use poll instead of select, fixes fd limits, may not work on old
85 ## use poll instead of select, fixes fd limits, may not work on old
86 ## windows systems.
86 ## windows systems.
87 #asyncore_use_poll = True
87 #asyncore_use_poll = True
88
88
89 ## GUNICORN ##
89 ## GUNICORN ##
90 #use = egg:gunicorn#main
90 #use = egg:gunicorn#main
91 ## number of process workers. You must set `instance_id = *` when this option
91 ## number of process workers. You must set `instance_id = *` when this option
92 ## is set to more than one worker
92 ## is set to more than one worker
93 #workers = 1
93 #workers = 1
94 ## process name
94 ## process name
95 #proc_name = kallithea
95 #proc_name = kallithea
96 ## type of worker class, one of sync, eventlet, gevent, tornado
96 ## type of worker class, one of sync, eventlet, gevent, tornado
97 ## recommended for bigger setup is using of of other than sync one
97 ## recommended for bigger setup is using of of other than sync one
98 #worker_class = sync
98 #worker_class = sync
99 #max_requests = 1000
99 #max_requests = 1000
100 ## ammount of time a worker can handle request before it gets killed and
100 ## ammount of time a worker can handle request before it gets killed and
101 ## restarted
101 ## restarted
102 #timeout = 3600
102 #timeout = 3600
103
103
104 ## UWSGI ##
104 ## UWSGI ##
105 ## run with uwsgi --ini-paste-logged <inifile.ini>
105 ## run with uwsgi --ini-paste-logged <inifile.ini>
106 #[uwsgi]
106 #[uwsgi]
107 #socket = /tmp/uwsgi.sock
107 #socket = /tmp/uwsgi.sock
108 #master = true
108 #master = true
109 #http = 127.0.0.1:5000
109 #http = 127.0.0.1:5000
110
110
111 ## set as deamon and redirect all output to file
111 ## set as deamon and redirect all output to file
112 #daemonize = ./uwsgi_kallithea.log
112 #daemonize = ./uwsgi_kallithea.log
113
113
114 ## master process PID
114 ## master process PID
115 #pidfile = ./uwsgi_kallithea.pid
115 #pidfile = ./uwsgi_kallithea.pid
116
116
117 ## stats server with workers statistics, use uwsgitop
117 ## stats server with workers statistics, use uwsgitop
118 ## for monitoring, `uwsgitop 127.0.0.1:1717`
118 ## for monitoring, `uwsgitop 127.0.0.1:1717`
119 #stats = 127.0.0.1:1717
119 #stats = 127.0.0.1:1717
120 #memory-report = true
120 #memory-report = true
121
121
122 ## log 5XX errors
122 ## log 5XX errors
123 #log-5xx = true
123 #log-5xx = true
124
124
125 ## Set the socket listen queue size.
125 ## Set the socket listen queue size.
126 #listen = 256
126 #listen = 256
127
127
128 ## Gracefully Reload workers after the specified amount of managed requests
128 ## Gracefully Reload workers after the specified amount of managed requests
129 ## (avoid memory leaks).
129 ## (avoid memory leaks).
130 #max-requests = 1000
130 #max-requests = 1000
131
131
132 ## enable large buffers
132 ## enable large buffers
133 #buffer-size = 65535
133 #buffer-size = 65535
134
134
135 ## socket and http timeouts ##
135 ## socket and http timeouts ##
136 #http-timeout = 3600
136 #http-timeout = 3600
137 #socket-timeout = 3600
137 #socket-timeout = 3600
138
138
139 ## Log requests slower than the specified number of milliseconds.
139 ## Log requests slower than the specified number of milliseconds.
140 #log-slow = 10
140 #log-slow = 10
141
141
142 ## Exit if no app can be loaded.
142 ## Exit if no app can be loaded.
143 #need-app = true
143 #need-app = true
144
144
145 ## Set lazy mode (load apps in workers instead of master).
145 ## Set lazy mode (load apps in workers instead of master).
146 #lazy = true
146 #lazy = true
147
147
148 ## scaling ##
148 ## scaling ##
149 ## set cheaper algorithm to use, if not set default will be used
149 ## set cheaper algorithm to use, if not set default will be used
150 #cheaper-algo = spare
150 #cheaper-algo = spare
151
151
152 ## minimum number of workers to keep at all times
152 ## minimum number of workers to keep at all times
153 #cheaper = 1
153 #cheaper = 1
154
154
155 ## number of workers to spawn at startup
155 ## number of workers to spawn at startup
156 #cheaper-initial = 1
156 #cheaper-initial = 1
157
157
158 ## maximum number of workers that can be spawned
158 ## maximum number of workers that can be spawned
159 #workers = 4
159 #workers = 4
160
160
161 ## how many workers should be spawned at a time
161 ## how many workers should be spawned at a time
162 #cheaper-step = 1
162 #cheaper-step = 1
163
163
164 ## COMMON ##
164 ## COMMON ##
165 host = 127.0.0.1
165 host = 127.0.0.1
166 port = 4999
166 port = 4999
167
167
168 ## middleware for hosting the WSGI application under a URL prefix
168 ## middleware for hosting the WSGI application under a URL prefix
169 #[filter:proxy-prefix]
169 #[filter:proxy-prefix]
170 #use = egg:PasteDeploy#prefix
170 #use = egg:PasteDeploy#prefix
171 #prefix = /<your-prefix>
171 #prefix = /<your-prefix>
172
172
173 [app:main]
173 [app:main]
174 use = egg:kallithea
174 use = egg:kallithea
175 ## enable proxy prefix middleware
175 ## enable proxy prefix middleware
176 #filter-with = proxy-prefix
176 #filter-with = proxy-prefix
177
177
178 full_stack = true
178 full_stack = true
179 static_files = true
179 static_files = true
180 ## Available Languages:
180 ## Available Languages:
181 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
181 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
182 lang =
182 lang =
183 cache_dir = %(here)s/data
183 cache_dir = %(here)s/data
184 index_dir = %(here)s/data/index
184 index_dir = %(here)s/data/index
185
185
186 ## perform a full repository scan on each server start, this should be
186 ## perform a full repository scan on each server start, this should be
187 ## set to false after first startup, to allow faster server restarts.
187 ## set to false after first startup, to allow faster server restarts.
188 #initial_repo_scan = false
188 #initial_repo_scan = false
189 initial_repo_scan = true
189 initial_repo_scan = true
190
190
191 ## uncomment and set this path to use archive download cache
191 ## uncomment and set this path to use archive download cache
192 archive_cache_dir = %(here)s/tarballcache
192 archive_cache_dir = %(here)s/tarballcache
193
193
194 ## change this to unique ID for security
194 ## change this to unique ID for security
195 app_instance_uuid = test
195 app_instance_uuid = test
196
196
197 ## cut off limit for large diffs (size in bytes)
197 ## cut off limit for large diffs (size in bytes)
198 cut_off_limit = 256000
198 cut_off_limit = 256000
199
199
200 ## use cache version of scm repo everywhere
200 ## use cache version of scm repo everywhere
201 #vcs_full_cache = true
201 #vcs_full_cache = true
202 vcs_full_cache = false
202 vcs_full_cache = false
203
203
204 ## force https in Kallithea, fixes https redirects, assumes it's always https
204 ## force https in Kallithea, fixes https redirects, assumes it's always https
205 force_https = false
205 force_https = false
206
206
207 ## use Strict-Transport-Security headers
207 ## use Strict-Transport-Security headers
208 use_htsts = false
208 use_htsts = false
209
209
210 ## number of commits stats will parse on each iteration
210 ## number of commits stats will parse on each iteration
211 commit_parse_limit = 25
211 commit_parse_limit = 25
212
212
213 ## path to git executable
213 ## path to git executable
214 git_path = git
214 git_path = git
215
215
216 ## git rev filter option, --all is the default filter, if you need to
216 ## git rev filter option, --all is the default filter, if you need to
217 ## hide all refs in changelog switch this to --branches --tags
217 ## hide all refs in changelog switch this to --branches --tags
218 #git_rev_filter = --branches --tags
218 #git_rev_filter = --branches --tags
219
219
220 ## RSS feed options
220 ## RSS feed options
221 rss_cut_off_limit = 256000
221 rss_cut_off_limit = 256000
222 rss_items_per_page = 10
222 rss_items_per_page = 10
223 rss_include_diff = false
223 rss_include_diff = false
224
224
225 ## options for showing and identifying changesets
225 ## options for showing and identifying changesets
226 show_sha_length = 12
226 show_sha_length = 12
227 show_revision_number = true
227 show_revision_number = true
228
228
229 ## gist URL alias, used to create nicer urls for gist. This should be an
229 ## gist URL alias, used to create nicer urls for gist. This should be an
230 ## url that does rewrites to _admin/gists/<gistid>.
230 ## url that does rewrites to _admin/gists/<gistid>.
231 ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal
231 ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal
232 ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid>
232 ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid>
233 gist_alias_url =
233 gist_alias_url =
234
234
235 ## white list of API enabled controllers. This allows to add list of
235 ## white list of API enabled controllers. This allows to add list of
236 ## controllers to which access will be enabled by api_key. eg: to enable
236 ## controllers to which access will be enabled by api_key. eg: to enable
237 ## api access to raw_files put `FilesController:raw`, to enable access to patches
237 ## api access to raw_files put `FilesController:raw`, to enable access to patches
238 ## add `ChangesetController:changeset_patch`. This list should be "," separated
238 ## add `ChangesetController:changeset_patch`. This list should be "," separated
239 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
239 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
240 ## Recommended settings below are commented out:
240 ## Recommended settings below are commented out:
241 api_access_controllers_whitelist =
241 api_access_controllers_whitelist =
242 # ChangesetController:changeset_patch,
242 # ChangesetController:changeset_patch,
243 # ChangesetController:changeset_raw,
243 # ChangesetController:changeset_raw,
244 # FilesController:raw,
244 # FilesController:raw,
245 # FilesController:archivefile
245 # FilesController:archivefile
246
246
247 ## default encoding used to convert from and to unicode
247 ## default encoding used to convert from and to unicode
248 ## can be also a comma seperated list of encoding in case of mixed encodings
248 ## can be also a comma seperated list of encoding in case of mixed encodings
249 default_encoding = utf8
249 default_encoding = utf8
250
250
251 ## issue tracker for Kallithea (leave blank to disable, absent for default)
251 ## issue tracker for Kallithea (leave blank to disable, absent for default)
252 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
252 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
253
253
254 ## issue tracking mapping for commits messages
254 ## issue tracking mapping for commits messages
255 ## comment out issue_pat, issue_server, issue_prefix to enable
255 ## comment out issue_pat, issue_server, issue_prefix to enable
256
256
257 ## pattern to get the issues from commit messages
257 ## pattern to get the issues from commit messages
258 ## default one used here is #<numbers> with a regex passive group for `#`
258 ## default one used here is #<numbers> with a regex passive group for `#`
259 ## {id} will be all groups matched from this pattern
259 ## {id} will be all groups matched from this pattern
260
260
261 issue_pat = (?:\s*#)(\d+)
261 issue_pat = (?:\s*#)(\d+)
262
262
263 ## server url to the issue, each {id} will be replaced with match
263 ## server url to the issue, each {id} will be replaced with match
264 ## fetched from the regex and {repo} is replaced with full repository name
264 ## fetched from the regex and {repo} is replaced with full repository name
265 ## including groups {repo_name} is replaced with just name of repo
265 ## including groups {repo_name} is replaced with just name of repo
266
266
267 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
267 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
268
268
269 ## prefix to add to link to indicate it's an url
269 ## prefix to add to link to indicate it's an url
270 ## #314 will be replaced by <issue_prefix><id>
270 ## #314 will be replaced by <issue_prefix><id>
271
271
272 issue_prefix = #
272 issue_prefix = #
273
273
274 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
274 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
275 ## multiple patterns, to other issues server, wiki or others
275 ## multiple patterns, to other issues server, wiki or others
276 ## below an example how to create a wiki pattern
276 ## below an example how to create a wiki pattern
277 # wiki-some-id -> https://mywiki.com/some-id
277 # wiki-some-id -> https://mywiki.com/some-id
278
278
279 #issue_pat_wiki = (?:wiki-)(.+)
279 #issue_pat_wiki = (?:wiki-)(.+)
280 #issue_server_link_wiki = https://mywiki.com/{id}
280 #issue_server_link_wiki = https://mywiki.com/{id}
281 #issue_prefix_wiki = WIKI-
281 #issue_prefix_wiki = WIKI-
282
282
283 ## instance-id prefix
283 ## instance-id prefix
284 ## a prefix key for this instance used for cache invalidation when running
284 ## a prefix key for this instance used for cache invalidation when running
285 ## multiple instances of kallithea, make sure it's globally unique for
285 ## multiple instances of kallithea, make sure it's globally unique for
286 ## all running kallithea instances. Leave empty if you don't use it
286 ## all running kallithea instances. Leave empty if you don't use it
287 instance_id =
287 instance_id =
288
288
289 ## alternative return HTTP header for failed authentication. Default HTTP
289 ## alternative return HTTP header for failed authentication. Default HTTP
290 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
290 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
291 ## handling that. Set this variable to 403 to return HTTPForbidden
291 ## handling that. Set this variable to 403 to return HTTPForbidden
292 auth_ret_code =
292 auth_ret_code =
293
293
294 ## locking return code. When repository is locked return this HTTP code. 2XX
294 ## locking return code. When repository is locked return this HTTP code. 2XX
295 ## codes don't break the transactions while 4XX codes do
295 ## codes don't break the transactions while 4XX codes do
296 lock_ret_code = 423
296 lock_ret_code = 423
297
297
298 ## allows to change the repository location in settings page
298 ## allows to change the repository location in settings page
299 allow_repo_location_change = True
299 allow_repo_location_change = True
300
300
301 ## allows to setup custom hooks in settings page
301 ## allows to setup custom hooks in settings page
302 allow_custom_hooks_settings = True
302 allow_custom_hooks_settings = True
303
303
304 ####################################
304 ####################################
305 ### CELERY CONFIG ####
305 ### CELERY CONFIG ####
306 ####################################
306 ####################################
307
307
308 use_celery = false
308 use_celery = false
309 broker.host = localhost
309 broker.host = localhost
310 broker.vhost = rabbitmqhost
310 broker.vhost = rabbitmqhost
311 broker.port = 5672
311 broker.port = 5672
312 broker.user = rabbitmq
312 broker.user = rabbitmq
313 broker.password = qweqwe
313 broker.password = qweqwe
314
314
315 celery.imports = kallithea.lib.celerylib.tasks
315 celery.imports = kallithea.lib.celerylib.tasks
316
316
317 celery.result.backend = amqp
317 celery.result.backend = amqp
318 celery.result.dburi = amqp://
318 celery.result.dburi = amqp://
319 celery.result.serialier = json
319 celery.result.serialier = json
320
320
321 #celery.send.task.error.emails = true
321 #celery.send.task.error.emails = true
322 #celery.amqp.task.result.expires = 18000
322 #celery.amqp.task.result.expires = 18000
323
323
324 celeryd.concurrency = 2
324 celeryd.concurrency = 2
325 #celeryd.log.file = celeryd.log
325 #celeryd.log.file = celeryd.log
326 celeryd.log.level = DEBUG
326 celeryd.log.level = DEBUG
327 celeryd.max.tasks.per.child = 1
327 celeryd.max.tasks.per.child = 1
328
328
329 ## tasks will never be sent to the queue, but executed locally instead.
329 ## tasks will never be sent to the queue, but executed locally instead.
330 celery.always.eager = false
330 celery.always.eager = false
331
331
332 ####################################
332 ####################################
333 ### BEAKER CACHE ####
333 ### BEAKER CACHE ####
334 ####################################
334 ####################################
335
335
336 beaker.cache.data_dir = %(here)s/data/cache/data
336 beaker.cache.data_dir = %(here)s/data/cache/data
337 beaker.cache.lock_dir = %(here)s/data/cache/lock
337 beaker.cache.lock_dir = %(here)s/data/cache/lock
338
338
339 beaker.cache.regions = short_term,long_term,sql_cache_short
339 beaker.cache.regions = short_term,long_term,sql_cache_short
340
340
341 beaker.cache.short_term.type = memory
341 beaker.cache.short_term.type = memory
342 beaker.cache.short_term.expire = 60
342 beaker.cache.short_term.expire = 60
343 beaker.cache.short_term.key_length = 256
343 beaker.cache.short_term.key_length = 256
344
344
345 beaker.cache.long_term.type = memory
345 beaker.cache.long_term.type = memory
346 beaker.cache.long_term.expire = 36000
346 beaker.cache.long_term.expire = 36000
347 beaker.cache.long_term.key_length = 256
347 beaker.cache.long_term.key_length = 256
348
348
349 beaker.cache.sql_cache_short.type = memory
349 beaker.cache.sql_cache_short.type = memory
350 beaker.cache.sql_cache_short.expire = 1
350 beaker.cache.sql_cache_short.expire = 1
351 beaker.cache.sql_cache_short.key_length = 256
351 beaker.cache.sql_cache_short.key_length = 256
352
352
353 ####################################
353 ####################################
354 ### BEAKER SESSION ####
354 ### BEAKER SESSION ####
355 ####################################
355 ####################################
356
357 ## Name of session cookie. Should be unique for a given host and path, even when running
358 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
359 beaker.session.key = kallithea
360 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
361 beaker.session.httponly = true
362 ## Session lifetime. 2592000 seconds is 30 days.
363 beaker.session.timeout = 2592000
364
365 ## Server secret used with HMAC to ensure integrity of cookies.
366 beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f}
367 ## Further, encrypt the data with AES.
368 #beaker.session.encrypt_key = <key_for_encryption>
369 #beaker.session.validate_key = <validation_key>
370
356 ## Type of storage used for the session, current types are
371 ## Type of storage used for the session, current types are
357 ## dbm, file, memcached, database, and memory.
372 ## dbm, file, memcached, database, and memory.
358 ## The storage uses the Container API
373
359 ## that is also used by the cache system.
374 ## File system storage of session data. (default)
375 #beaker.session.type = file
360
376
361 ## db session ##
377 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
378 #beaker.session.type = cookie
379
380 ## Database storage of session data.
362 #beaker.session.type = ext:database
381 #beaker.session.type = ext:database
363 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
382 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
364 #beaker.session.table_name = db_session
383 #beaker.session.table_name = db_session
365
384
366 ## encrypted cookie client side session, good for many instances ##
367 #beaker.session.type = cookie
368
369 ## file based cookies (default) ##
370 #beaker.session.type = file
371
372 ## beaker.session.key should be unique for a given host, even when running
373 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
374 beaker.session.key = kallithea
375 beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f}
376
377 ## Secure encrypted cookie. Requires AES and AES python libraries
378 ## you must disable beaker.session.secret to use this
379 #beaker.session.encrypt_key = <key_for_encryption>
380 #beaker.session.validate_key = <validation_key>
381
382 ## sets session as invalid if it haven't been accessed for given amount of time
383 beaker.session.timeout = 2592000
384 beaker.session.httponly = true
385 #beaker.session.cookie_path = /<your-prefix>
386
387 ## uncomment for https secure cookie
388 beaker.session.secure = false
389
390 ## auto save the session to not to use .save()
391 beaker.session.auto = False
392
393 ## default cookie expiration time in seconds `true` expire at browser close ##
394 #beaker.session.cookie_expires = 3600
395
396 ############################
385 ############################
397 ## ERROR HANDLING SYSTEMS ##
386 ## ERROR HANDLING SYSTEMS ##
398 ############################
387 ############################
399
388
400 ####################
389 ####################
401 ### [errormator] ###
390 ### [errormator] ###
402 ####################
391 ####################
403
392
404 ## Errormator is tailored to work with Kallithea, see
393 ## Errormator is tailored to work with Kallithea, see
405 ## http://errormator.com for details how to obtain an account
394 ## http://errormator.com for details how to obtain an account
406 ## you must install python package `errormator_client` to make it work
395 ## you must install python package `errormator_client` to make it work
407
396
408 ## errormator enabled
397 ## errormator enabled
409 errormator = false
398 errormator = false
410
399
411 errormator.server_url = https://api.errormator.com
400 errormator.server_url = https://api.errormator.com
412 errormator.api_key = YOUR_API_KEY
401 errormator.api_key = YOUR_API_KEY
413
402
414 ## TWEAK AMOUNT OF INFO SENT HERE
403 ## TWEAK AMOUNT OF INFO SENT HERE
415
404
416 ## enables 404 error logging (default False)
405 ## enables 404 error logging (default False)
417 errormator.report_404 = false
406 errormator.report_404 = false
418
407
419 ## time in seconds after request is considered being slow (default 1)
408 ## time in seconds after request is considered being slow (default 1)
420 errormator.slow_request_time = 1
409 errormator.slow_request_time = 1
421
410
422 ## record slow requests in application
411 ## record slow requests in application
423 ## (needs to be enabled for slow datastore recording and time tracking)
412 ## (needs to be enabled for slow datastore recording and time tracking)
424 errormator.slow_requests = true
413 errormator.slow_requests = true
425
414
426 ## enable hooking to application loggers
415 ## enable hooking to application loggers
427 #errormator.logging = true
416 #errormator.logging = true
428
417
429 ## minimum log level for log capture
418 ## minimum log level for log capture
430 #errormator.logging.level = WARNING
419 #errormator.logging.level = WARNING
431
420
432 ## send logs only from erroneous/slow requests
421 ## send logs only from erroneous/slow requests
433 ## (saves API quota for intensive logging)
422 ## (saves API quota for intensive logging)
434 errormator.logging_on_error = false
423 errormator.logging_on_error = false
435
424
436 ## list of additonal keywords that should be grabbed from environ object
425 ## list of additonal keywords that should be grabbed from environ object
437 ## can be string with comma separated list of words in lowercase
426 ## can be string with comma separated list of words in lowercase
438 ## (by default client will always send following info:
427 ## (by default client will always send following info:
439 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
428 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
440 ## start with HTTP* this list be extended with additional keywords here
429 ## start with HTTP* this list be extended with additional keywords here
441 errormator.environ_keys_whitelist =
430 errormator.environ_keys_whitelist =
442
431
443 ## list of keywords that should be blanked from request object
432 ## list of keywords that should be blanked from request object
444 ## can be string with comma separated list of words in lowercase
433 ## can be string with comma separated list of words in lowercase
445 ## (by default client will always blank keys that contain following words
434 ## (by default client will always blank keys that contain following words
446 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
435 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
447 ## this list be extended with additional keywords set here
436 ## this list be extended with additional keywords set here
448 errormator.request_keys_blacklist =
437 errormator.request_keys_blacklist =
449
438
450 ## list of namespaces that should be ignores when gathering log entries
439 ## list of namespaces that should be ignores when gathering log entries
451 ## can be string with comma separated list of namespaces
440 ## can be string with comma separated list of namespaces
452 ## (by default the client ignores own entries: errormator_client.client)
441 ## (by default the client ignores own entries: errormator_client.client)
453 errormator.log_namespace_blacklist =
442 errormator.log_namespace_blacklist =
454
443
455 ################
444 ################
456 ### [sentry] ###
445 ### [sentry] ###
457 ################
446 ################
458
447
459 ## sentry is a alternative open source error aggregator
448 ## sentry is a alternative open source error aggregator
460 ## you must install python packages `sentry` and `raven` to enable
449 ## you must install python packages `sentry` and `raven` to enable
461
450
462 sentry.dsn = YOUR_DNS
451 sentry.dsn = YOUR_DNS
463 sentry.servers =
452 sentry.servers =
464 sentry.name =
453 sentry.name =
465 sentry.key =
454 sentry.key =
466 sentry.public_key =
455 sentry.public_key =
467 sentry.secret_key =
456 sentry.secret_key =
468 sentry.project =
457 sentry.project =
469 sentry.site =
458 sentry.site =
470 sentry.include_paths =
459 sentry.include_paths =
471 sentry.exclude_paths =
460 sentry.exclude_paths =
472
461
473 ################################################################################
462 ################################################################################
474 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
463 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
475 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
464 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
476 ## execute malicious code after an exception is raised. ##
465 ## execute malicious code after an exception is raised. ##
477 ################################################################################
466 ################################################################################
478 set debug = false
467 set debug = false
479
468
480 ##################################
469 ##################################
481 ### LOGVIEW CONFIG ###
470 ### LOGVIEW CONFIG ###
482 ##################################
471 ##################################
483
472
484 logview.sqlalchemy = #faa
473 logview.sqlalchemy = #faa
485 logview.pylons.templating = #bfb
474 logview.pylons.templating = #bfb
486 logview.pylons.util = #eee
475 logview.pylons.util = #eee
487
476
488 #########################################################
477 #########################################################
489 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
478 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
490 #########################################################
479 #########################################################
491
480
492 # SQLITE [default]
481 # SQLITE [default]
493 #sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
482 #sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
494 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea_test.sqlite
483 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea_test.sqlite
495
484
496 # POSTGRESQL
485 # POSTGRESQL
497 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
486 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
498
487
499 # MySQL
488 # MySQL
500 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
489 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
501
490
502 # see sqlalchemy docs for others
491 # see sqlalchemy docs for others
503
492
504 sqlalchemy.db1.echo = false
493 sqlalchemy.db1.echo = false
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 ################################
497 ################################
509 ### LOGGING CONFIGURATION ####
498 ### LOGGING CONFIGURATION ####
510 ################################
499 ################################
511
500
512 [loggers]
501 [loggers]
513 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
502 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
514
503
515 [handlers]
504 [handlers]
516 keys = console, console_sql
505 keys = console, console_sql
517
506
518 [formatters]
507 [formatters]
519 keys = generic, color_formatter, color_formatter_sql
508 keys = generic, color_formatter, color_formatter_sql
520
509
521 #############
510 #############
522 ## LOGGERS ##
511 ## LOGGERS ##
523 #############
512 #############
524
513
525 [logger_root]
514 [logger_root]
526 #level = NOTSET
515 #level = NOTSET
527 level = DEBUG
516 level = DEBUG
528 handlers = console
517 handlers = console
529
518
530 [logger_routes]
519 [logger_routes]
531 level = DEBUG
520 level = DEBUG
532 handlers =
521 handlers =
533 qualname = routes.middleware
522 qualname = routes.middleware
534 ## "level = DEBUG" logs the route matched and routing variables.
523 ## "level = DEBUG" logs the route matched and routing variables.
535 propagate = 1
524 propagate = 1
536
525
537 [logger_beaker]
526 [logger_beaker]
538 level = DEBUG
527 level = DEBUG
539 handlers =
528 handlers =
540 qualname = beaker.container
529 qualname = beaker.container
541 propagate = 1
530 propagate = 1
542
531
543 [logger_templates]
532 [logger_templates]
544 level = INFO
533 level = INFO
545 handlers =
534 handlers =
546 qualname = pylons.templating
535 qualname = pylons.templating
547 propagate = 1
536 propagate = 1
548
537
549 [logger_kallithea]
538 [logger_kallithea]
550 level = DEBUG
539 level = DEBUG
551 handlers =
540 handlers =
552 qualname = kallithea
541 qualname = kallithea
553 propagate = 1
542 propagate = 1
554
543
555 [logger_sqlalchemy]
544 [logger_sqlalchemy]
556 #level = INFO
545 #level = INFO
557 #handlers = console_sql
546 #handlers = console_sql
558 level = ERROR
547 level = ERROR
559 handlers = console
548 handlers = console
560 qualname = sqlalchemy.engine
549 qualname = sqlalchemy.engine
561 propagate = 0
550 propagate = 0
562
551
563 [logger_whoosh_indexer]
552 [logger_whoosh_indexer]
564 level = DEBUG
553 level = DEBUG
565 handlers =
554 handlers =
566 qualname = whoosh_indexer
555 qualname = whoosh_indexer
567 propagate = 1
556 propagate = 1
568
557
569 ##############
558 ##############
570 ## HANDLERS ##
559 ## HANDLERS ##
571 ##############
560 ##############
572
561
573 [handler_console]
562 [handler_console]
574 class = StreamHandler
563 class = StreamHandler
575 args = (sys.stderr,)
564 args = (sys.stderr,)
576 #level = INFO
565 #level = INFO
577 level = NOTSET
566 level = NOTSET
578 formatter = generic
567 formatter = generic
579
568
580 [handler_console_sql]
569 [handler_console_sql]
581 class = StreamHandler
570 class = StreamHandler
582 args = (sys.stderr,)
571 args = (sys.stderr,)
583 level = WARN
572 level = WARN
584 formatter = generic
573 formatter = generic
585
574
586 ################
575 ################
587 ## FORMATTERS ##
576 ## FORMATTERS ##
588 ################
577 ################
589
578
590 [formatter_generic]
579 [formatter_generic]
591 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
580 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
592 datefmt = %Y-%m-%d %H:%M:%S
581 datefmt = %Y-%m-%d %H:%M:%S
593
582
594 [formatter_color_formatter]
583 [formatter_color_formatter]
595 class = kallithea.lib.colored_formatter.ColorFormatter
584 class = kallithea.lib.colored_formatter.ColorFormatter
596 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
585 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
597 datefmt = %Y-%m-%d %H:%M:%S
586 datefmt = %Y-%m-%d %H:%M:%S
598
587
599 [formatter_color_formatter_sql]
588 [formatter_color_formatter_sql]
600 class = kallithea.lib.colored_formatter.ColorFormatterSql
589 class = kallithea.lib.colored_formatter.ColorFormatterSql
601 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
590 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
602 datefmt = %Y-%m-%d %H:%M:%S
591 datefmt = %Y-%m-%d %H:%M:%S
General Comments 0
You need to be logged in to leave comments. Login now