##// END OF EJS Templates
merged with beta
marcink -
r3181:efe23d6c merge rhodecode-0.0.1.5.2 default
parent child Browse files
Show More
@@ -1,461 +1,470 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.tests.test_scm_operations
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 Test suite for making push/pull operations.
7 7 Run using::
8 8
9 9 RC_WHOOSH_TEST_DISABLE=1 RC_NO_TMP_PATH=1 nosetests rhodecode/tests/scripts/test_vcs_operations.py
10 10
11 11 :created_on: Dec 30, 2010
12 12 :author: marcink
13 13 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
14 14 :license: GPLv3, see COPYING for more details.
15 15 """
16 16 # This program is free software: you can redistribute it and/or modify
17 17 # it under the terms of the GNU General Public License as published by
18 18 # the Free Software Foundation, either version 3 of the License, or
19 19 # (at your option) any later version.
20 20 #
21 21 # This program is distributed in the hope that it will be useful,
22 22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 24 # GNU General Public License for more details.
25 25 #
26 26 # You should have received a copy of the GNU General Public License
27 27 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28 28
29 29 import os
30 30 import tempfile
31 31 import unittest
32 import time
32 33 from os.path import join as jn
33 34 from os.path import dirname as dn
34 35
35 36 from tempfile import _RandomNameSequence
36 37 from subprocess import Popen, PIPE
37 38
38 39 from rhodecode.tests import *
39 from rhodecode.model.db import User, Repository, UserLog
40 from rhodecode.model.db import User, Repository, UserLog, UserIpMap
40 41 from rhodecode.model.meta import Session
41 42 from rhodecode.model.repo import RepoModel
42 43 from rhodecode.model.user import UserModel
43 44
44 45 DEBUG = True
45 46 HOST = '127.0.0.1:5000' # test host
46 47
47 48
48 49 class Command(object):
49 50
50 51 def __init__(self, cwd):
51 52 self.cwd = cwd
52 53
53 54 def execute(self, cmd, *args):
54 55 """
55 56 Runs command on the system with given ``args``.
56 57 """
57 58
58 59 command = cmd + ' ' + ' '.join(args)
59 60 if DEBUG:
60 61 print '*** CMD %s ***' % command
61 62 p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd)
62 63 stdout, stderr = p.communicate()
63 64 if DEBUG:
64 65 print stdout, stderr
65 66 return stdout, stderr
66 67
67 68
68 69 def _get_tmp_dir():
69 70 return tempfile.mkdtemp(prefix='rc_integration_test')
70 71
71 72
72 73 def _construct_url(repo, dest=None, **kwargs):
73 74 if dest is None:
74 75 #make temp clone
75 76 dest = _get_tmp_dir()
76 77 params = {
77 78 'user': TEST_USER_ADMIN_LOGIN,
78 79 'passwd': TEST_USER_ADMIN_PASS,
79 80 'host': HOST,
80 81 'cloned_repo': repo,
81 82 'dest': dest
82 83 }
83 84 params.update(**kwargs)
84 85 if params['user'] and params['passwd']:
85 86 _url = 'http://%(user)s:%(passwd)s@%(host)s/%(cloned_repo)s %(dest)s' % params
86 87 else:
87 88 _url = 'http://(host)s/%(cloned_repo)s %(dest)s' % params
88 89 return _url
89 90
90 91
91 92 def _add_files_and_push(vcs, DEST, **kwargs):
92 93 """
93 94 Generate some files, add it to DEST repo and push back
94 95 vcs is git or hg and defines what VCS we want to make those files for
95 96
96 97 :param vcs:
97 98 :param DEST:
98 99 """
99 100 # commit some stuff into this repo
100 101 cwd = path = jn(DEST)
101 102 #added_file = jn(path, '%ssetupΔ…ΕΌΕΊΔ‡.py' % _RandomNameSequence().next())
102 103 added_file = jn(path, '%ssetup.py' % _RandomNameSequence().next())
103 104 Command(cwd).execute('touch %s' % added_file)
104 105 Command(cwd).execute('%s add %s' % (vcs, added_file))
105 106
106 107 for i in xrange(3):
107 108 cmd = """echo 'added_line%s' >> %s""" % (i, added_file)
108 109 Command(cwd).execute(cmd)
109 110 if vcs == 'hg':
110 111 cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % (
111 112 i, 'Marcin KuΕΊminski <marcin@python-blog.com>', added_file
112 113 )
113 114 elif vcs == 'git':
114 115 cmd = """git ci -m 'commited new %s' --author '%s' %s """ % (
115 116 i, 'Marcin KuΕΊminski <marcin@python-blog.com>', added_file
116 117 )
117 118 Command(cwd).execute(cmd)
118 119 # PUSH it back
119 120 if vcs == 'hg':
120 121 _REPO = HG_REPO
121 122 elif vcs == 'git':
122 123 _REPO = GIT_REPO
123 124
124 125 kwargs['dest'] = ''
125 126 clone_url = _construct_url(_REPO, **kwargs)
126 127 if 'clone_url' in kwargs:
127 128 clone_url = kwargs['clone_url']
128 129 if vcs == 'hg':
129 130 stdout, stderr = Command(cwd).execute('hg push --verbose', clone_url)
130 131 elif vcs == 'git':
131 132 stdout, stderr = Command(cwd).execute('git push', clone_url + " master")
132 133
133 134 return stdout, stderr
134 135
135 136
136 137 def set_anonymous_access(enable=True):
137 138 user = User.get_by_username(User.DEFAULT_USER)
138 139 user.active = enable
139 140 Session().add(user)
140 141 Session().commit()
141 142 print '\tanonymous access is now:', enable
142 143 if enable != User.get_by_username(User.DEFAULT_USER).active:
143 144 raise Exception('Cannot set anonymous access')
144 145
145 146
146 147 #==============================================================================
147 148 # TESTS
148 149 #==============================================================================
149 150
150 151 class TestVCSOperations(unittest.TestCase):
151 152
152 153 @classmethod
153 154 def setup_class(cls):
154 155 #DISABLE ANONYMOUS ACCESS
155 156 set_anonymous_access(False)
156 157
157 158 def setUp(self):
158 159 r = Repository.get_by_repo_name(GIT_REPO)
159 160 Repository.unlock(r)
160 161 r.enable_locking = False
161 162 Session().add(r)
162 163 Session().commit()
163 164
164 165 r = Repository.get_by_repo_name(HG_REPO)
165 166 Repository.unlock(r)
166 167 r.enable_locking = False
167 168 Session().add(r)
168 169 Session().commit()
169 170
170 171 def test_clone_hg_repo_by_admin(self):
171 172 clone_url = _construct_url(HG_REPO)
172 173 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
173 174
174 175 assert 'requesting all changes' in stdout
175 176 assert 'adding changesets' in stdout
176 177 assert 'adding manifests' in stdout
177 178 assert 'adding file changes' in stdout
178 179
179 180 assert stderr == ''
180 181
181 182 def test_clone_git_repo_by_admin(self):
182 183 clone_url = _construct_url(GIT_REPO)
183 184 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
184 185
185 186 assert 'Cloning into' in stdout
186 187 assert stderr == ''
187 188
188 189 def test_clone_wrong_credentials_hg(self):
189 190 clone_url = _construct_url(HG_REPO, passwd='bad!')
190 191 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
191 192 assert 'abort: authorization failed' in stderr
192 193
193 194 def test_clone_wrong_credentials_git(self):
194 195 clone_url = _construct_url(GIT_REPO, passwd='bad!')
195 196 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
196 197 assert 'fatal: Authentication failed' in stderr
197 198
198 199 def test_clone_git_dir_as_hg(self):
199 200 clone_url = _construct_url(GIT_REPO)
200 201 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
201 202 assert 'HTTP Error 404: Not Found' in stderr
202 203
203 204 def test_clone_hg_repo_as_git(self):
204 205 clone_url = _construct_url(HG_REPO)
205 206 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
206 207 assert 'not found:' in stderr
207 208
208 209 def test_clone_non_existing_path_hg(self):
209 210 clone_url = _construct_url('trololo')
210 211 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
211 212 assert 'HTTP Error 404: Not Found' in stderr
212 213
213 214 def test_clone_non_existing_path_git(self):
214 215 clone_url = _construct_url('trololo')
215 216 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
216 217 assert 'not found:' in stderr
217 218
218 219 def test_push_new_file_hg(self):
219 220 DEST = _get_tmp_dir()
220 221 clone_url = _construct_url(HG_REPO, dest=DEST)
221 222 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
222 223
223 224 stdout, stderr = _add_files_and_push('hg', DEST)
224 225
225 226 assert 'pushing to' in stdout
226 227 assert 'Repository size' in stdout
227 228 assert 'Last revision is now' in stdout
228 229
229 230 def test_push_new_file_git(self):
230 231 DEST = _get_tmp_dir()
231 232 clone_url = _construct_url(GIT_REPO, dest=DEST)
232 233 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
233 234
234 235 # commit some stuff into this repo
235 236 stdout, stderr = _add_files_and_push('git', DEST)
236 237
237 238 #WTF git stderr ?!
238 239 assert 'master -> master' in stderr
239 240
240 241 def test_push_wrong_credentials_hg(self):
241 242 DEST = _get_tmp_dir()
242 243 clone_url = _construct_url(HG_REPO, dest=DEST)
243 244 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
244 245
245 246 stdout, stderr = _add_files_and_push('hg', DEST, user='bad',
246 247 passwd='name')
247 248
248 249 assert 'abort: authorization failed' in stderr
249 250
250 251 def test_push_wrong_credentials_git(self):
251 252 DEST = _get_tmp_dir()
252 253 clone_url = _construct_url(GIT_REPO, dest=DEST)
253 254 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
254 255
255 256 stdout, stderr = _add_files_and_push('git', DEST, user='bad',
256 257 passwd='name')
257 258
258 259 assert 'fatal: Authentication failed' in stderr
259 260
260 261 def test_push_back_to_wrong_url_hg(self):
261 262 DEST = _get_tmp_dir()
262 263 clone_url = _construct_url(HG_REPO, dest=DEST)
263 264 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
264 265
265 266 stdout, stderr = _add_files_and_push('hg', DEST,
266 267 clone_url='http://127.0.0.1:5000/tmp',)
267 268
268 269 assert 'HTTP Error 404: Not Found' in stderr
269 270
270 271 def test_push_back_to_wrong_url_git(self):
271 272 DEST = _get_tmp_dir()
272 273 clone_url = _construct_url(GIT_REPO, dest=DEST)
273 274 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
274 275
275 276 stdout, stderr = _add_files_and_push('git', DEST,
276 277 clone_url='http://127.0.0.1:5000/tmp',)
277 278
278 279 assert 'not found:' in stderr
279 280
280 281 def test_clone_and_create_lock_hg(self):
281 282 # enable locking
282 283 r = Repository.get_by_repo_name(HG_REPO)
283 284 r.enable_locking = True
284 285 Session().add(r)
285 286 Session().commit()
286 287 # clone
287 288 clone_url = _construct_url(HG_REPO)
288 289 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
289 290
290 291 #check if lock was made
291 292 r = Repository.get_by_repo_name(HG_REPO)
292 293 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
293 294
294 295 def test_clone_and_create_lock_git(self):
295 296 # enable locking
296 297 r = Repository.get_by_repo_name(GIT_REPO)
297 298 r.enable_locking = True
298 299 Session().add(r)
299 300 Session().commit()
300 301 # clone
301 302 clone_url = _construct_url(GIT_REPO)
302 303 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
303 304
304 305 #check if lock was made
305 306 r = Repository.get_by_repo_name(GIT_REPO)
306 307 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
307 308
308 309 def test_clone_after_repo_was_locked_hg(self):
309 310 #lock repo
310 311 r = Repository.get_by_repo_name(HG_REPO)
311 312 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
312 313 #pull fails since repo is locked
313 314 clone_url = _construct_url(HG_REPO)
314 315 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
315 316 msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
316 317 % (HG_REPO, TEST_USER_ADMIN_LOGIN))
317 318 assert msg in stderr
318 319
319 320 def test_clone_after_repo_was_locked_git(self):
320 321 #lock repo
321 322 r = Repository.get_by_repo_name(GIT_REPO)
322 323 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
323 324 #pull fails since repo is locked
324 325 clone_url = _construct_url(GIT_REPO)
325 326 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
326 327 msg = ("""423 Repository `%s` locked by user `%s`"""
327 328 % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
328 329 assert msg in stderr
329 330
330 331 def test_push_on_locked_repo_by_other_user_hg(self):
331 332 #clone some temp
332 333 DEST = _get_tmp_dir()
333 334 clone_url = _construct_url(HG_REPO, dest=DEST)
334 335 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
335 336
336 337 #lock repo
337 338 r = Repository.get_by_repo_name(HG_REPO)
338 339 # let this user actually push !
339 340 RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
340 341 perm='repository.write')
341 342 Session().commit()
342 343 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
343 344
344 345 #push fails repo is locked by other user !
345 346 stdout, stderr = _add_files_and_push('hg', DEST,
346 347 user=TEST_USER_REGULAR_LOGIN,
347 348 passwd=TEST_USER_REGULAR_PASS)
348 349 msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
349 350 % (HG_REPO, TEST_USER_ADMIN_LOGIN))
350 351 assert msg in stderr
351 352
352 353 #TODO: fix me ! somehow during tests hooks don't get called on GIT
353 354 # def test_push_on_locked_repo_by_other_user_git(self):
354 355 # #clone some temp
355 356 # DEST = _get_tmp_dir()
356 357 # clone_url = _construct_url(GIT_REPO, dest=DEST)
357 358 # stdout, stderr = Command('/tmp').execute('git clone', clone_url)
358 359 #
359 360 # #lock repo
360 361 # r = Repository.get_by_repo_name(GIT_REPO)
361 362 # # let this user actually push !
362 363 # RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
363 364 # perm='repository.write')
364 365 # Session().commit()
365 366 # Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
366 367 #
367 368 # #push fails repo is locked by other user !
368 369 # stdout, stderr = _add_files_and_push('git', DEST,
369 370 # user=TEST_USER_REGULAR_LOGIN,
370 371 # passwd=TEST_USER_REGULAR_PASS)
371 372 # msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
372 373 # % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
373 374 # #TODO: fix this somehow later on GIT, GIT is stupid and even if we throw
374 375 # # back 423 to it, it makes ANOTHER request and we fail there with 405 :/
375 376 # msg = "405 Method Not Allowed"
376 377 # assert msg in stderr
377 378
378 379 def test_push_unlocks_repository_hg(self):
379 380 # enable locking
380 381 r = Repository.get_by_repo_name(HG_REPO)
381 382 r.enable_locking = True
382 383 Session().add(r)
383 384 Session().commit()
384 385 #clone some temp
385 386 DEST = _get_tmp_dir()
386 387 clone_url = _construct_url(HG_REPO, dest=DEST)
387 388 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
388 389
389 390 #check for lock repo after clone
390 391 r = Repository.get_by_repo_name(HG_REPO)
391 392 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
392 393
393 394 #push is ok and repo is now unlocked
394 395 stdout, stderr = _add_files_and_push('hg', DEST)
395 396 assert ('remote: Released lock on repo `%s`' % HG_REPO) in stdout
396 397 #we need to cleanup the Session Here !
397 398 Session.remove()
398 399 r = Repository.get_by_repo_name(HG_REPO)
399 400 assert r.locked == [None, None]
400 401
401 402 #TODO: fix me ! somehow during tests hooks don't get called on GIT
402 403 # def test_push_unlocks_repository_git(self):
403 404 # # enable locking
404 405 # r = Repository.get_by_repo_name(GIT_REPO)
405 406 # r.enable_locking = True
406 407 # Session().add(r)
407 408 # Session().commit()
408 409 # #clone some temp
409 410 # DEST = _get_tmp_dir()
410 411 # clone_url = _construct_url(GIT_REPO, dest=DEST)
411 412 # stdout, stderr = Command('/tmp').execute('git clone', clone_url)
412 413 #
413 414 # #check for lock repo after clone
414 415 # r = Repository.get_by_repo_name(GIT_REPO)
415 416 # assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
416 417 #
417 418 # #push is ok and repo is now unlocked
418 419 # stdout, stderr = _add_files_and_push('git', DEST)
419 420 # #assert ('remote: Released lock on repo `%s`' % GIT_REPO) in stdout
420 421 # #we need to cleanup the Session Here !
421 422 # Session.remove()
422 423 # r = Repository.get_by_repo_name(GIT_REPO)
423 424 # assert r.locked == [None, None]
424 425
425 426 def test_ip_restriction_hg(self):
426 427 user_model = UserModel()
427 new_ip = user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
428 Session().commit()
428 try:
429 user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
430 Session().commit()
431 clone_url = _construct_url(HG_REPO)
432 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
433 assert 'abort: HTTP Error 403: Forbidden' in stderr
434 finally:
435 #release IP restrictions
436 for ip in UserIpMap.getAll():
437 UserIpMap.delete(ip.ip_id)
438 Session().commit()
439
440 time.sleep(2)
429 441 clone_url = _construct_url(HG_REPO)
430 442 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
431 assert 'abort: HTTP Error 403: Forbidden' in stderr
432
433 #release IP restrictions
434 clone_url = _construct_url(HG_REPO)
435 user_model.delete_extra_ip(TEST_USER_ADMIN_LOGIN, new_ip.ip_id)
436 Session().commit()
437 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
438 443
439 444 assert 'requesting all changes' in stdout
440 445 assert 'adding changesets' in stdout
441 446 assert 'adding manifests' in stdout
442 447 assert 'adding file changes' in stdout
443 448
444 449 assert stderr == ''
445 450
446 451 def test_ip_restriction_git(self):
447 452 user_model = UserModel()
448 new_ip = user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
449 Session().commit()
453 try:
454 user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
455 Session().commit()
456 clone_url = _construct_url(GIT_REPO)
457 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
458 assert 'error: The requested URL returned error: 403 Forbidden' in stderr
459 finally:
460 #release IP restrictions
461 for ip in UserIpMap.getAll():
462 UserIpMap.delete(ip.ip_id)
463 Session().commit()
464
465 time.sleep(2)
450 466 clone_url = _construct_url(GIT_REPO)
451 467 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
452 assert 'error: The requested URL returned error: 403 Forbidden' in stderr
453
454 #release IP restrictions
455 clone_url = _construct_url(GIT_REPO)
456 user_model.delete_extra_ip(TEST_USER_ADMIN_LOGIN, new_ip.ip_id)
457 Session().commit()
458 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
459 468
460 469 assert 'Cloning into' in stdout
461 470 assert stderr == ''
@@ -1,298 +1,298 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # RhodeCode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 pdebug = false
11 11 ################################################################################
12 12 ## Uncomment and replace with the address which should receive ##
13 13 ## any error reports after application crash ##
14 14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 15 ################################################################################
16 16 #email_to = admin@localhost
17 17 #error_email_from = paste_error@localhost
18 18 #app_email_from = rhodecode-noreply@localhost
19 19 #error_message =
20 20 #email_prefix = [RhodeCode]
21 21
22 22 #smtp_server = mail.server.com
23 23 #smtp_username =
24 24 #smtp_password =
25 25 #smtp_port =
26 26 #smtp_use_tls = false
27 27 #smtp_use_ssl = true
28 28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 29 #smtp_auth =
30 30
31 31 [server:main]
32 32 ##nr of threads to spawn
33 #threadpool_workers = 5
33 threadpool_workers = 5
34 34
35 35 ##max request before thread respawn
36 #threadpool_max_requests = 2
36 threadpool_max_requests = 2
37 37
38 38 ##option to use threads of process
39 #use_threadpool = true
39 use_threadpool = true
40 40
41 #use = egg:Paste#http
42 use = egg:waitress#main
41 use = egg:Paste#http
42 #use = egg:waitress#main
43 43 host = 127.0.0.1
44 44 port = 5000
45 45
46 46 [app:main]
47 47 use = egg:rhodecode
48 48 full_stack = true
49 49 static_files = true
50 50 lang=en
51 51 cache_dir = /tmp/rc/data
52 52 index_dir = /tmp/rc/index
53 53 app_instance_uuid = develop-test
54 54 cut_off_limit = 256000
55 55 force_https = false
56 56 commit_parse_limit = 25
57 57 use_gravatar = true
58 58 container_auth_enabled = false
59 59 proxypass_auth_enabled = false
60 60
61 61
62 62 ## overwrite schema of clone url
63 63 ## available vars:
64 64 ## scheme - http/https
65 65 ## user - current user
66 66 ## pass - password
67 67 ## netloc - network location
68 68 ## path - usually repo_name
69 69
70 70 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
71 71
72 72 ## issue tracking mapping for commits messages
73 73 ## comment out issue_pat, issue_server, issue_prefix to enable
74 74
75 75 ## pattern to get the issues from commit messages
76 76 ## default one used here is #<numbers> with a regex passive group for `#`
77 77 ## {id} will be all groups matched from this pattern
78 78
79 79 issue_pat = (?:\s*#)(\d+)
80 80
81 81 ## server url to the issue, each {id} will be replaced with match
82 82 ## fetched from the regex and {repo} is replaced with repository name
83 83
84 84 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
85 85
86 86 ## prefix to add to link to indicate it's an url
87 87 ## #314 will be replaced by <issue_prefix><id>
88 88
89 89 issue_prefix = #
90 90
91 91 ## instance-id prefix
92 92 ## a prefix key for this instance used for cache invalidation when running
93 93 ## multiple instances of rhodecode, make sure it's globally unique for
94 94 ## all running rhodecode instances. Leave empty if you don't use it
95 95 instance_id =
96 96
97 97 ## alternative return HTTP header for failed authentication. Default HTTP
98 98 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
99 99 ## handling that. Set this variable to 403 to return HTTPForbidden
100 100 auth_ret_code =
101 101
102 102 ####################################
103 103 ### CELERY CONFIG ####
104 104 ####################################
105 105 use_celery = false
106 106 broker.host = localhost
107 107 broker.vhost = rabbitmqhost
108 108 broker.port = 5672
109 109 broker.user = rabbitmq
110 110 broker.password = qweqwe
111 111
112 112 celery.imports = rhodecode.lib.celerylib.tasks
113 113
114 114 celery.result.backend = amqp
115 115 celery.result.dburi = amqp://
116 116 celery.result.serialier = json
117 117
118 118 #celery.send.task.error.emails = true
119 119 #celery.amqp.task.result.expires = 18000
120 120
121 121 celeryd.concurrency = 2
122 122 #celeryd.log.file = celeryd.log
123 123 celeryd.log.level = debug
124 124 celeryd.max.tasks.per.child = 1
125 125
126 126 #tasks will never be sent to the queue, but executed locally instead.
127 127 celery.always.eager = false
128 128
129 129 ####################################
130 130 ### BEAKER CACHE ####
131 131 ####################################
132 132 beaker.cache.data_dir=/tmp/rc/data/cache/data
133 133 beaker.cache.lock_dir=/tmp/rc/data/cache/lock
134 134
135 135 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
136 136
137 137 beaker.cache.super_short_term.type=memory
138 138 beaker.cache.super_short_term.expire=1
139 139 beaker.cache.super_short_term.key_length = 256
140 140
141 141 beaker.cache.short_term.type=memory
142 142 beaker.cache.short_term.expire=60
143 143 beaker.cache.short_term.key_length = 256
144 144
145 145 beaker.cache.long_term.type=memory
146 146 beaker.cache.long_term.expire=36000
147 147 beaker.cache.long_term.key_length = 256
148 148
149 149 beaker.cache.sql_cache_short.type=memory
150 150 beaker.cache.sql_cache_short.expire=1
151 151 beaker.cache.sql_cache_short.key_length = 256
152 152
153 153 beaker.cache.sql_cache_med.type=memory
154 154 beaker.cache.sql_cache_med.expire=360
155 155 beaker.cache.sql_cache_med.key_length = 256
156 156
157 157 beaker.cache.sql_cache_long.type=file
158 158 beaker.cache.sql_cache_long.expire=3600
159 159 beaker.cache.sql_cache_long.key_length = 256
160 160
161 161 ####################################
162 162 ### BEAKER SESSION ####
163 163 ####################################
164 164 ## Type of storage used for the session, current types are
165 165 ## dbm, file, memcached, database, and memory.
166 166 ## The storage uses the Container API
167 167 ## that is also used by the cache system.
168 168
169 169 ## db session example
170 170
171 171 #beaker.session.type = ext:database
172 172 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
173 173 #beaker.session.table_name = db_session
174 174
175 175 ## encrypted cookie session, good for many instances
176 176 #beaker.session.type = cookie
177 177
178 178 beaker.session.type = file
179 179 beaker.session.key = rhodecode
180 180 # secure cookie requires AES python libraries
181 181 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
182 182 #beaker.session.validate_key = 9712sds2212c--zxc123
183 183 beaker.session.timeout = 36000
184 184 beaker.session.httponly = true
185 185
186 186 ## uncomment for https secure cookie
187 187 beaker.session.secure = false
188 188
189 189 ##auto save the session to not to use .save()
190 190 beaker.session.auto = False
191 191
192 192 ##true exire at browser close
193 193 #beaker.session.cookie_expires = 3600
194 194
195 195
196 196 ################################################################################
197 197 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
198 198 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
199 199 ## execute malicious code after an exception is raised. ##
200 200 ################################################################################
201 201 #set debug = false
202 202
203 203 ##################################
204 204 ### LOGVIEW CONFIG ###
205 205 ##################################
206 206 logview.sqlalchemy = #faa
207 207 logview.pylons.templating = #bfb
208 208 logview.pylons.util = #eee
209 209
210 210 #########################################################
211 211 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
212 212 #########################################################
213 213 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode_test.sqlite
214 214 #sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_test
215 215 #sqlalchemy.db1.url = mysql://root:qwe@localhost/rhodecode_test
216 216
217 217 sqlalchemy.db1.echo = false
218 218 sqlalchemy.db1.pool_recycle = 3600
219 219 sqlalchemy.db1.convert_unicode = true
220 220
221 221 ################################
222 222 ### LOGGING CONFIGURATION ####
223 223 ################################
224 224 [loggers]
225 225 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
226 226
227 227 [handlers]
228 228 keys = console
229 229
230 230 [formatters]
231 231 keys = generic, color_formatter
232 232
233 233 #############
234 234 ## LOGGERS ##
235 235 #############
236 236 [logger_root]
237 237 level = DEBUG
238 238 handlers = console
239 239
240 240 [logger_routes]
241 241 level = DEBUG
242 242 handlers =
243 243 qualname = routes.middleware
244 244 # "level = DEBUG" logs the route matched and routing variables.
245 245 propagate = 1
246 246
247 247 [logger_beaker]
248 248 level = DEBUG
249 249 handlers =
250 250 qualname = beaker.container
251 251 propagate = 1
252 252
253 253 [logger_templates]
254 254 level = INFO
255 255 handlers =
256 256 qualname = pylons.templating
257 257 propagate = 1
258 258
259 259 [logger_rhodecode]
260 260 level = DEBUG
261 261 handlers =
262 262 qualname = rhodecode
263 263 propagate = 1
264 264
265 265 [logger_sqlalchemy]
266 266 level = ERROR
267 267 handlers = console
268 268 qualname = sqlalchemy.engine
269 269 propagate = 0
270 270
271 271 [logger_whoosh_indexer]
272 272 level = DEBUG
273 273 handlers =
274 274 qualname = whoosh_indexer
275 275 propagate = 1
276 276
277 277 ##############
278 278 ## HANDLERS ##
279 279 ##############
280 280
281 281 [handler_console]
282 282 class = StreamHandler
283 283 args = (sys.stderr,)
284 284 level = NOTSET
285 285 formatter = generic
286 286
287 287 ################
288 288 ## FORMATTERS ##
289 289 ################
290 290
291 291 [formatter_generic]
292 292 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
293 293 datefmt = %Y-%m-%d %H:%M:%S
294 294
295 295 [formatter_color_formatter]
296 296 class=rhodecode.lib.colored_formatter.ColorFormatter
297 297 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
298 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
298 datefmt = %Y-%m-%d %H:%M:%S
General Comments 0
You need to be logged in to leave comments. Login now