##// END OF EJS Templates
changed dev and tests to postgressql for more error proof setup....
marcink -
r964:84bb5b8b beta
parent child Browse files
Show More
@@ -1,216 +1,217 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
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 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25 #smtp_use_ssl = true
25 #smtp_use_ssl = true
26
26
27 [server:main]
27 [server:main]
28 ##nr of threads to spawn
28 ##nr of threads to spawn
29 threadpool_workers = 5
29 threadpool_workers = 5
30
30
31 ##max request before thread respawn
31 ##max request before thread respawn
32 threadpool_max_requests = 6
32 threadpool_max_requests = 6
33
33
34 ##option to use threads of process
34 ##option to use threads of process
35 use_threadpool = false
35 use_threadpool = false
36
36
37 use = egg:Paste#http
37 use = egg:Paste#http
38 host = 0.0.0.0
38 host = 0.0.0.0
39 port = 5000
39 port = 5000
40
40
41 [app:main]
41 [app:main]
42 use = egg:rhodecode
42 use = egg:rhodecode
43 full_stack = true
43 full_stack = true
44 static_files = true
44 static_files = true
45 lang=en
45 lang=en
46 cache_dir = %(here)s/data
46 cache_dir = %(here)s/data
47 index_dir = %(here)s/data/index
47 index_dir = %(here)s/data/index
48 cut_off_limit = 256000
48 cut_off_limit = 256000
49 force_https = false
49 force_https = false
50
50
51 ####################################
51 ####################################
52 ### CELERY CONFIG ####
52 ### CELERY CONFIG ####
53 ####################################
53 ####################################
54 use_celery = false
54 use_celery = false
55 broker.host = localhost
55 broker.host = localhost
56 broker.vhost = rabbitmqhost
56 broker.vhost = rabbitmqhost
57 broker.port = 5672
57 broker.port = 5672
58 broker.user = rabbitmq
58 broker.user = rabbitmq
59 broker.password = qweqwe
59 broker.password = qweqwe
60
60
61 celery.imports = rhodecode.lib.celerylib.tasks
61 celery.imports = rhodecode.lib.celerylib.tasks
62
62
63 celery.result.backend = amqp
63 celery.result.backend = amqp
64 celery.result.dburi = amqp://
64 celery.result.dburi = amqp://
65 celery.result.serialier = json
65 celery.result.serialier = json
66
66
67 #celery.send.task.error.emails = true
67 #celery.send.task.error.emails = true
68 #celery.amqp.task.result.expires = 18000
68 #celery.amqp.task.result.expires = 18000
69
69
70 celeryd.concurrency = 2
70 celeryd.concurrency = 2
71 #celeryd.log.file = celeryd.log
71 #celeryd.log.file = celeryd.log
72 celeryd.log.level = debug
72 celeryd.log.level = debug
73 celeryd.max.tasks.per.child = 3
73 celeryd.max.tasks.per.child = 3
74
74
75 #tasks will never be sent to the queue, but executed locally instead.
75 #tasks will never be sent to the queue, but executed locally instead.
76 celery.always.eager = false
76 celery.always.eager = false
77
77
78 ####################################
78 ####################################
79 ### BEAKER CACHE ####
79 ### BEAKER CACHE ####
80 ####################################
80 ####################################
81 beaker.cache.data_dir=/%(here)s/data/cache/data
81 beaker.cache.data_dir=/%(here)s/data/cache/data
82 beaker.cache.lock_dir=/%(here)s/data/cache/lock
82 beaker.cache.lock_dir=/%(here)s/data/cache/lock
83 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
83 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
84
84
85 beaker.cache.super_short_term.type=memory
85 beaker.cache.super_short_term.type=memory
86 beaker.cache.super_short_term.expire=10
86 beaker.cache.super_short_term.expire=10
87
87
88 beaker.cache.short_term.type=memory
88 beaker.cache.short_term.type=memory
89 beaker.cache.short_term.expire=60
89 beaker.cache.short_term.expire=60
90
90
91 beaker.cache.long_term.type=memory
91 beaker.cache.long_term.type=memory
92 beaker.cache.long_term.expire=36000
92 beaker.cache.long_term.expire=36000
93
93
94 beaker.cache.sql_cache_short.type=memory
94 beaker.cache.sql_cache_short.type=memory
95 beaker.cache.sql_cache_short.expire=10
95 beaker.cache.sql_cache_short.expire=10
96
96
97 beaker.cache.sql_cache_med.type=memory
97 beaker.cache.sql_cache_med.type=memory
98 beaker.cache.sql_cache_med.expire=360
98 beaker.cache.sql_cache_med.expire=360
99
99
100 beaker.cache.sql_cache_long.type=file
100 beaker.cache.sql_cache_long.type=file
101 beaker.cache.sql_cache_long.expire=3600
101 beaker.cache.sql_cache_long.expire=3600
102
102
103 ####################################
103 ####################################
104 ### BEAKER SESSION ####
104 ### BEAKER SESSION ####
105 ####################################
105 ####################################
106 ## Type of storage used for the session, current types are
106 ## Type of storage used for the session, current types are
107 ## dbm, file, memcached, database, and memory.
107 ## dbm, file, memcached, database, and memory.
108 ## The storage uses the Container API
108 ## The storage uses the Container API
109 ##that is also used by the cache system.
109 ##that is also used by the cache system.
110 beaker.session.type = file
110 beaker.session.type = file
111
111
112 beaker.session.key = rhodecode
112 beaker.session.key = rhodecode
113 beaker.session.secret = g654dcno0-9873jhgfreyu
113 beaker.session.secret = g654dcno0-9873jhgfreyu
114 beaker.session.timeout = 36000
114 beaker.session.timeout = 36000
115
115
116 ##auto save the session to not to use .save()
116 ##auto save the session to not to use .save()
117 beaker.session.auto = False
117 beaker.session.auto = False
118
118
119 ##true exire at browser close
119 ##true exire at browser close
120 #beaker.session.cookie_expires = 3600
120 #beaker.session.cookie_expires = 3600
121
121
122
122
123 ################################################################################
123 ################################################################################
124 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
124 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
125 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
125 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
126 ## execute malicious code after an exception is raised. ##
126 ## execute malicious code after an exception is raised. ##
127 ################################################################################
127 ################################################################################
128 #set debug = false
128 #set debug = false
129
129
130 ##################################
130 ##################################
131 ### LOGVIEW CONFIG ###
131 ### LOGVIEW CONFIG ###
132 ##################################
132 ##################################
133 logview.sqlalchemy = #faa
133 logview.sqlalchemy = #faa
134 logview.pylons.templating = #bfb
134 logview.pylons.templating = #bfb
135 logview.pylons.util = #eee
135 logview.pylons.util = #eee
136
136
137 #########################################################
137 #########################################################
138 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
138 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
139 #########################################################
139 #########################################################
140 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
140 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
141 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
141 #sqlalchemy.db1.echo = False
142 #sqlalchemy.db1.echo = False
142 #sqlalchemy.db1.pool_recycle = 3600
143 #sqlalchemy.db1.pool_recycle = 3600
143 sqlalchemy.convert_unicode = true
144 sqlalchemy.convert_unicode = true
144
145
145 ################################
146 ################################
146 ### LOGGING CONFIGURATION ####
147 ### LOGGING CONFIGURATION ####
147 ################################
148 ################################
148 [loggers]
149 [loggers]
149 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
150 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
150
151
151 [handlers]
152 [handlers]
152 keys = console
153 keys = console
153
154
154 [formatters]
155 [formatters]
155 keys = generic,color_formatter
156 keys = generic,color_formatter
156
157
157 #############
158 #############
158 ## LOGGERS ##
159 ## LOGGERS ##
159 #############
160 #############
160 [logger_root]
161 [logger_root]
161 level = NOTSET
162 level = NOTSET
162 handlers = console
163 handlers = console
163
164
164 [logger_routes]
165 [logger_routes]
165 level = DEBUG
166 level = DEBUG
166 handlers = console
167 handlers = console
167 qualname = routes.middleware
168 qualname = routes.middleware
168 # "level = DEBUG" logs the route matched and routing variables.
169 # "level = DEBUG" logs the route matched and routing variables.
169 propagate = 0
170 propagate = 0
170
171
171 [logger_beaker]
172 [logger_beaker]
172 level = ERROR
173 level = ERROR
173 handlers = console
174 handlers = console
174 qualname = beaker.container
175 qualname = beaker.container
175 propagate = 0
176 propagate = 0
176
177
177 [logger_templates]
178 [logger_templates]
178 level = INFO
179 level = INFO
179 handlers = console
180 handlers = console
180 qualname = pylons.templating
181 qualname = pylons.templating
181 propagate = 0
182 propagate = 0
182
183
183 [logger_rhodecode]
184 [logger_rhodecode]
184 level = DEBUG
185 level = DEBUG
185 handlers = console
186 handlers = console
186 qualname = rhodecode
187 qualname = rhodecode
187 propagate = 0
188 propagate = 0
188
189
189 [logger_sqlalchemy]
190 [logger_sqlalchemy]
190 level = ERROR
191 level = ERROR
191 handlers = console
192 handlers = console
192 qualname = sqlalchemy.engine
193 qualname = sqlalchemy.engine
193 propagate = 0
194 propagate = 0
194
195
195 ##############
196 ##############
196 ## HANDLERS ##
197 ## HANDLERS ##
197 ##############
198 ##############
198
199
199 [handler_console]
200 [handler_console]
200 class = StreamHandler
201 class = StreamHandler
201 args = (sys.stderr,)
202 args = (sys.stderr,)
202 level = NOTSET
203 level = NOTSET
203 formatter = color_formatter
204 formatter = color_formatter
204
205
205 ################
206 ################
206 ## FORMATTERS ##
207 ## FORMATTERS ##
207 ################
208 ################
208
209
209 [formatter_generic]
210 [formatter_generic]
210 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
211 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
211 datefmt = %Y-%m-%d %H:%M:%S
212 datefmt = %Y-%m-%d %H:%M:%S
212
213
213 [formatter_color_formatter]
214 [formatter_color_formatter]
214 class=rhodecode.lib.colored_formatter.ColorFormatter
215 class=rhodecode.lib.colored_formatter.ColorFormatter
215 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
216 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
216 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
217 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,499 +1,508 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.lib.db_manage
3 rhodecode.lib.db_manage
4 ~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Database creation, and setup module for RhodeCode. Used for creation
6 Database creation, and setup module for RhodeCode. Used for creation
7 of database as well as for migration operations
7 of database as well as for migration operations
8
8
9 :created_on: Apr 10, 2010
9 :created_on: Apr 10, 2010
10 :author: marcink
10 :author: marcink
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
12 :license: GPLv3, see COPYING for more details.
13 """
13 """
14 # This program is free software; you can redistribute it and/or
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; version 2
16 # as published by the Free Software Foundation; version 2
17 # of the License or (at your opinion) any later version of the license.
17 # of the License or (at your opinion) any later version of the license.
18 #
18 #
19 # This program is distributed in the hope that it will be useful,
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
22 # GNU General Public License for more details.
23 #
23 #
24 # You should have received a copy of the GNU General Public License
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 # MA 02110-1301, USA.
27 # MA 02110-1301, USA.
28
28
29 import os
29 import os
30 import sys
30 import sys
31 import uuid
31 import uuid
32 import logging
32 import logging
33 from os.path import dirname as dn, join as jn
33 from os.path import dirname as dn, join as jn
34
34
35 from rhodecode import __dbversion__
35 from rhodecode import __dbversion__
36 from rhodecode.model import meta
36 from rhodecode.model import meta
37
37
38 from rhodecode.lib.auth import get_crypt_password
38 from rhodecode.lib.auth import get_crypt_password
39 from rhodecode.lib.utils import ask_ok
39 from rhodecode.lib.utils import ask_ok
40 from rhodecode.model import init_model
40 from rhodecode.model import init_model
41 from rhodecode.model.db import User, Permission, RhodeCodeUi, RhodeCodeSettings, \
41 from rhodecode.model.db import User, Permission, RhodeCodeUi, RhodeCodeSettings, \
42 UserToPerm, DbMigrateVersion
42 UserToPerm, DbMigrateVersion
43
43
44 from sqlalchemy.engine import create_engine
44 from sqlalchemy.engine import create_engine
45
45
46 log = logging.getLogger(__name__)
46 log = logging.getLogger(__name__)
47
47
48 class DbManage(object):
48 class DbManage(object):
49 def __init__(self, log_sql, dbconf, root, tests=False):
49 def __init__(self, log_sql, dbconf, root, tests=False):
50 self.dbname = dbconf.split('/')[-1]
50 self.dbname = dbconf.split('/')[-1]
51 self.tests = tests
51 self.tests = tests
52 self.root = root
52 self.root = root
53 self.dburi = dbconf
53 self.dburi = dbconf
54 self.log_sql = log_sql
54 self.log_sql = log_sql
55 self.db_exists = False
55 self.db_exists = False
56 self.init_db()
56 self.init_db()
57
57
58 def init_db(self):
58 def init_db(self):
59 engine = create_engine(self.dburi, echo=self.log_sql)
59 engine = create_engine(self.dburi, echo=self.log_sql)
60 init_model(engine)
60 init_model(engine)
61 self.sa = meta.Session()
61 self.sa = meta.Session()
62
62
63 def check_for_db(self, override):
63 def check_for_db(self, override):
64 db_path = jn(self.root, self.dbname)
64 db_path = jn(self.root, self.dbname)
65 if self.dburi.startswith('sqlite'):
65 if self.dburi.startswith('sqlite'):
66 log.info('checking for existing db in %s', db_path)
66 log.info('checking for existing db in %s', db_path)
67 if os.path.isfile(db_path):
67 if os.path.isfile(db_path):
68
68
69 self.db_exists = True
69 self.db_exists = True
70 if not override:
70 if not override:
71 raise Exception('database already exists')
71 raise Exception('database already exists')
72 return 'sqlite'
73 if self.dburi.startswith('postgresql'):
74 self.db_exists = True
75 return 'postgresql'
76
72
77
73 def create_tables(self, override=False):
78 def create_tables(self, override=False):
74 """Create a auth database
79 """Create a auth database
75 """
80 """
76
81
77 self.check_for_db(override)
82 db_type = self.check_for_db(override)
78 if self.db_exists:
83 if self.db_exists:
79 log.info("database exist and it's going to be destroyed")
84 log.info("database exist and it's going to be destroyed")
80 if self.tests:
85 if self.tests:
81 destroy = True
86 destroy = True
82 else:
87 else:
83 destroy = ask_ok('Are you sure to destroy old database ? [y/n]')
88 destroy = ask_ok('Are you sure to destroy old database ? [y/n]')
84 if not destroy:
89 if not destroy:
85 sys.exit()
90 sys.exit()
86 if self.db_exists and destroy:
91 if self.db_exists and destroy:
92 if db_type == 'sqlite':
87 os.remove(jn(self.root, self.dbname))
93 os.remove(jn(self.root, self.dbname))
94 if db_type == 'postgresql':
95 meta.Base.metadata.drop_all()
96
88 checkfirst = not override
97 checkfirst = not override
89 meta.Base.metadata.create_all(checkfirst=checkfirst)
98 meta.Base.metadata.create_all(checkfirst=checkfirst)
90 log.info('Created tables for %s', self.dbname)
99 log.info('Created tables for %s', self.dbname)
91
100
92
101
93
102
94 def set_db_version(self):
103 def set_db_version(self):
95 try:
104 try:
96 ver = DbMigrateVersion()
105 ver = DbMigrateVersion()
97 ver.version = __dbversion__
106 ver.version = __dbversion__
98 ver.repository_id = 'rhodecode_db_migrations'
107 ver.repository_id = 'rhodecode_db_migrations'
99 ver.repository_path = 'versions'
108 ver.repository_path = 'versions'
100 self.sa.add(ver)
109 self.sa.add(ver)
101 self.sa.commit()
110 self.sa.commit()
102 except:
111 except:
103 self.sa.rollback()
112 self.sa.rollback()
104 raise
113 raise
105 log.info('db version set to: %s', __dbversion__)
114 log.info('db version set to: %s', __dbversion__)
106
115
107
116
108 def upgrade(self):
117 def upgrade(self):
109 """Upgrades given database schema to given revision following
118 """Upgrades given database schema to given revision following
110 all needed steps, to perform the upgrade
119 all needed steps, to perform the upgrade
111
120
112 """
121 """
113
122
114 from rhodecode.lib.dbmigrate.migrate.versioning import api
123 from rhodecode.lib.dbmigrate.migrate.versioning import api
115 from rhodecode.lib.dbmigrate.migrate.exceptions import \
124 from rhodecode.lib.dbmigrate.migrate.exceptions import \
116 DatabaseNotControlledError
125 DatabaseNotControlledError
117
126
118 upgrade = ask_ok('You are about to perform database upgrade, make '
127 upgrade = ask_ok('You are about to perform database upgrade, make '
119 'sure You backed up your database before. '
128 'sure You backed up your database before. '
120 'Continue ? [y/n]')
129 'Continue ? [y/n]')
121 if not upgrade:
130 if not upgrade:
122 sys.exit('Nothing done')
131 sys.exit('Nothing done')
123
132
124 repository_path = jn(dn(dn(dn(os.path.realpath(__file__)))),
133 repository_path = jn(dn(dn(dn(os.path.realpath(__file__)))),
125 'rhodecode/lib/dbmigrate')
134 'rhodecode/lib/dbmigrate')
126 db_uri = self.dburi
135 db_uri = self.dburi
127
136
128 try:
137 try:
129 curr_version = api.db_version(db_uri, repository_path)
138 curr_version = api.db_version(db_uri, repository_path)
130 msg = ('Found current database under version'
139 msg = ('Found current database under version'
131 ' control with version %s' % curr_version)
140 ' control with version %s' % curr_version)
132
141
133 except (RuntimeError, DatabaseNotControlledError), e:
142 except (RuntimeError, DatabaseNotControlledError), e:
134 curr_version = 1
143 curr_version = 1
135 msg = ('Current database is not under version control. Setting'
144 msg = ('Current database is not under version control. Setting'
136 ' as version %s' % curr_version)
145 ' as version %s' % curr_version)
137 api.version_control(db_uri, repository_path, curr_version)
146 api.version_control(db_uri, repository_path, curr_version)
138
147
139 print (msg)
148 print (msg)
140
149
141 if curr_version == __dbversion__:
150 if curr_version == __dbversion__:
142 sys.exit('This database is already at the newest version')
151 sys.exit('This database is already at the newest version')
143
152
144 #======================================================================
153 #======================================================================
145 # UPGRADE STEPS
154 # UPGRADE STEPS
146 #======================================================================
155 #======================================================================
147 class UpgradeSteps(object):
156 class UpgradeSteps(object):
148 """Those steps follow schema versions so for example schema
157 """Those steps follow schema versions so for example schema
149 for example schema with seq 002 == step_2 and so on.
158 for example schema with seq 002 == step_2 and so on.
150 """
159 """
151
160
152 def __init__(self, klass):
161 def __init__(self, klass):
153 self.klass = klass
162 self.klass = klass
154
163
155 def step_0(self):
164 def step_0(self):
156 #step 0 is the schema upgrade, and than follow proper upgrades
165 #step 0 is the schema upgrade, and than follow proper upgrades
157 print ('attempting to do database upgrade to version %s' \
166 print ('attempting to do database upgrade to version %s' \
158 % __dbversion__)
167 % __dbversion__)
159 api.upgrade(db_uri, repository_path, __dbversion__)
168 api.upgrade(db_uri, repository_path, __dbversion__)
160 print ('Schema upgrade completed')
169 print ('Schema upgrade completed')
161
170
162 def step_1(self):
171 def step_1(self):
163 pass
172 pass
164
173
165 def step_2(self):
174 def step_2(self):
166 print ('Patching repo paths for newer version of RhodeCode')
175 print ('Patching repo paths for newer version of RhodeCode')
167 self.klass.fix_repo_paths()
176 self.klass.fix_repo_paths()
168
177
169 print ('Patching default user of RhodeCode')
178 print ('Patching default user of RhodeCode')
170 self.klass.fix_default_user()
179 self.klass.fix_default_user()
171
180
172 log.info('Changing ui settings')
181 log.info('Changing ui settings')
173 self.klass.create_ui_settings()
182 self.klass.create_ui_settings()
174
183
175 def step_3(self):
184 def step_3(self):
176 print ('Adding additional settings into RhodeCode db')
185 print ('Adding additional settings into RhodeCode db')
177 self.klass.fix_settings()
186 self.klass.fix_settings()
178
187
179 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
188 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
180
189
181 #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
190 #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
182 for step in upgrade_steps:
191 for step in upgrade_steps:
183 print ('performing upgrade step %s' % step)
192 print ('performing upgrade step %s' % step)
184 callable = getattr(UpgradeSteps(self), 'step_%s' % step)()
193 callable = getattr(UpgradeSteps(self), 'step_%s' % step)()
185
194
186
195
187
196
188 def fix_repo_paths(self):
197 def fix_repo_paths(self):
189 """Fixes a old rhodecode version path into new one without a '*'
198 """Fixes a old rhodecode version path into new one without a '*'
190 """
199 """
191
200
192 paths = self.sa.query(RhodeCodeUi)\
201 paths = self.sa.query(RhodeCodeUi)\
193 .filter(RhodeCodeUi.ui_key == '/')\
202 .filter(RhodeCodeUi.ui_key == '/')\
194 .scalar()
203 .scalar()
195
204
196 paths.ui_value = paths.ui_value.replace('*', '')
205 paths.ui_value = paths.ui_value.replace('*', '')
197
206
198 try:
207 try:
199 self.sa.add(paths)
208 self.sa.add(paths)
200 self.sa.commit()
209 self.sa.commit()
201 except:
210 except:
202 self.sa.rollback()
211 self.sa.rollback()
203 raise
212 raise
204
213
205 def fix_default_user(self):
214 def fix_default_user(self):
206 """Fixes a old default user with some 'nicer' default values,
215 """Fixes a old default user with some 'nicer' default values,
207 used mostly for anonymous access
216 used mostly for anonymous access
208 """
217 """
209 def_user = self.sa.query(User)\
218 def_user = self.sa.query(User)\
210 .filter(User.username == 'default')\
219 .filter(User.username == 'default')\
211 .one()
220 .one()
212
221
213 def_user.name = 'Anonymous'
222 def_user.name = 'Anonymous'
214 def_user.lastname = 'User'
223 def_user.lastname = 'User'
215 def_user.email = 'anonymous@rhodecode.org'
224 def_user.email = 'anonymous@rhodecode.org'
216
225
217 try:
226 try:
218 self.sa.add(def_user)
227 self.sa.add(def_user)
219 self.sa.commit()
228 self.sa.commit()
220 except:
229 except:
221 self.sa.rollback()
230 self.sa.rollback()
222 raise
231 raise
223
232
224 def fix_settings(self):
233 def fix_settings(self):
225 """Fixes rhodecode settings adds ga_code key for google analytics
234 """Fixes rhodecode settings adds ga_code key for google analytics
226 """
235 """
227
236
228 hgsettings3 = RhodeCodeSettings('ga_code', '')
237 hgsettings3 = RhodeCodeSettings('ga_code', '')
229
238
230 try:
239 try:
231 self.sa.add(hgsettings3)
240 self.sa.add(hgsettings3)
232 self.sa.commit()
241 self.sa.commit()
233 except:
242 except:
234 self.sa.rollback()
243 self.sa.rollback()
235 raise
244 raise
236
245
237 def admin_prompt(self, second=False):
246 def admin_prompt(self, second=False):
238 if not self.tests:
247 if not self.tests:
239 import getpass
248 import getpass
240
249
241
250
242 def get_password():
251 def get_password():
243 password = getpass.getpass('Specify admin password (min 6 chars):')
252 password = getpass.getpass('Specify admin password (min 6 chars):')
244 confirm = getpass.getpass('Confirm password:')
253 confirm = getpass.getpass('Confirm password:')
245
254
246 if password != confirm:
255 if password != confirm:
247 log.error('passwords mismatch')
256 log.error('passwords mismatch')
248 return False
257 return False
249 if len(password) < 6:
258 if len(password) < 6:
250 log.error('password is to short use at least 6 characters')
259 log.error('password is to short use at least 6 characters')
251 return False
260 return False
252
261
253 return password
262 return password
254
263
255 username = raw_input('Specify admin username:')
264 username = raw_input('Specify admin username:')
256
265
257 password = get_password()
266 password = get_password()
258 if not password:
267 if not password:
259 #second try
268 #second try
260 password = get_password()
269 password = get_password()
261 if not password:
270 if not password:
262 sys.exit()
271 sys.exit()
263
272
264 email = raw_input('Specify admin email:')
273 email = raw_input('Specify admin email:')
265 self.create_user(username, password, email, True)
274 self.create_user(username, password, email, True)
266 else:
275 else:
267 log.info('creating admin and regular test users')
276 log.info('creating admin and regular test users')
268 self.create_user('test_admin', 'test12', 'test_admin@mail.com', True)
277 self.create_user('test_admin', 'test12', 'test_admin@mail.com', True)
269 self.create_user('test_regular', 'test12', 'test_regular@mail.com', False)
278 self.create_user('test_regular', 'test12', 'test_regular@mail.com', False)
270 self.create_user('test_regular2', 'test12', 'test_regular2@mail.com', False)
279 self.create_user('test_regular2', 'test12', 'test_regular2@mail.com', False)
271
280
272 def create_ui_settings(self):
281 def create_ui_settings(self):
273 """Creates ui settings, fills out hooks
282 """Creates ui settings, fills out hooks
274 and disables dotencode
283 and disables dotencode
275
284
276 """
285 """
277 #HOOKS
286 #HOOKS
278 hooks1_key = 'changegroup.update'
287 hooks1_key = 'changegroup.update'
279 hooks1_ = self.sa.query(RhodeCodeUi)\
288 hooks1_ = self.sa.query(RhodeCodeUi)\
280 .filter(RhodeCodeUi.ui_key == hooks1_key).scalar()
289 .filter(RhodeCodeUi.ui_key == hooks1_key).scalar()
281
290
282 hooks1 = RhodeCodeUi() if hooks1_ is None else hooks1_
291 hooks1 = RhodeCodeUi() if hooks1_ is None else hooks1_
283 hooks1.ui_section = 'hooks'
292 hooks1.ui_section = 'hooks'
284 hooks1.ui_key = hooks1_key
293 hooks1.ui_key = hooks1_key
285 hooks1.ui_value = 'hg update >&2'
294 hooks1.ui_value = 'hg update >&2'
286 hooks1.ui_active = False
295 hooks1.ui_active = False
287
296
288 hooks2_key = 'changegroup.repo_size'
297 hooks2_key = 'changegroup.repo_size'
289 hooks2_ = self.sa.query(RhodeCodeUi)\
298 hooks2_ = self.sa.query(RhodeCodeUi)\
290 .filter(RhodeCodeUi.ui_key == hooks2_key).scalar()
299 .filter(RhodeCodeUi.ui_key == hooks2_key).scalar()
291
300
292 hooks2 = RhodeCodeUi() if hooks2_ is None else hooks2_
301 hooks2 = RhodeCodeUi() if hooks2_ is None else hooks2_
293 hooks2.ui_section = 'hooks'
302 hooks2.ui_section = 'hooks'
294 hooks2.ui_key = hooks2_key
303 hooks2.ui_key = hooks2_key
295 hooks2.ui_value = 'python:rhodecode.lib.hooks.repo_size'
304 hooks2.ui_value = 'python:rhodecode.lib.hooks.repo_size'
296
305
297 hooks3 = RhodeCodeUi()
306 hooks3 = RhodeCodeUi()
298 hooks3.ui_section = 'hooks'
307 hooks3.ui_section = 'hooks'
299 hooks3.ui_key = 'pretxnchangegroup.push_logger'
308 hooks3.ui_key = 'pretxnchangegroup.push_logger'
300 hooks3.ui_value = 'python:rhodecode.lib.hooks.log_push_action'
309 hooks3.ui_value = 'python:rhodecode.lib.hooks.log_push_action'
301
310
302 hooks4 = RhodeCodeUi()
311 hooks4 = RhodeCodeUi()
303 hooks4.ui_section = 'hooks'
312 hooks4.ui_section = 'hooks'
304 hooks4.ui_key = 'preoutgoing.pull_logger'
313 hooks4.ui_key = 'preoutgoing.pull_logger'
305 hooks4.ui_value = 'python:rhodecode.lib.hooks.log_pull_action'
314 hooks4.ui_value = 'python:rhodecode.lib.hooks.log_pull_action'
306
315
307 #For mercurial 1.7 set backward comapatibility with format
316 #For mercurial 1.7 set backward comapatibility with format
308 dotencode_disable = RhodeCodeUi()
317 dotencode_disable = RhodeCodeUi()
309 dotencode_disable.ui_section = 'format'
318 dotencode_disable.ui_section = 'format'
310 dotencode_disable.ui_key = 'dotencode'
319 dotencode_disable.ui_key = 'dotencode'
311 dotencode_disable.ui_value = 'false'
320 dotencode_disable.ui_value = 'false'
312
321
313 try:
322 try:
314 self.sa.add(hooks1)
323 self.sa.add(hooks1)
315 self.sa.add(hooks2)
324 self.sa.add(hooks2)
316 self.sa.add(hooks3)
325 self.sa.add(hooks3)
317 self.sa.add(hooks4)
326 self.sa.add(hooks4)
318 self.sa.add(dotencode_disable)
327 self.sa.add(dotencode_disable)
319 self.sa.commit()
328 self.sa.commit()
320 except:
329 except:
321 self.sa.rollback()
330 self.sa.rollback()
322 raise
331 raise
323
332
324
333
325 def create_ldap_options(self):
334 def create_ldap_options(self):
326 """Creates ldap settings"""
335 """Creates ldap settings"""
327
336
328 try:
337 try:
329 for k in ['ldap_active', 'ldap_host', 'ldap_port', 'ldap_ldaps',
338 for k in ['ldap_active', 'ldap_host', 'ldap_port', 'ldap_ldaps',
330 'ldap_dn_user', 'ldap_dn_pass', 'ldap_base_dn']:
339 'ldap_dn_user', 'ldap_dn_pass', 'ldap_base_dn']:
331
340
332 setting = RhodeCodeSettings(k, '')
341 setting = RhodeCodeSettings(k, '')
333 self.sa.add(setting)
342 self.sa.add(setting)
334 self.sa.commit()
343 self.sa.commit()
335 except:
344 except:
336 self.sa.rollback()
345 self.sa.rollback()
337 raise
346 raise
338
347
339 def config_prompt(self, test_repo_path=''):
348 def config_prompt(self, test_repo_path=''):
340 log.info('Setting up repositories config')
349 log.info('Setting up repositories config')
341
350
342 if not self.tests and not test_repo_path:
351 if not self.tests and not test_repo_path:
343 path = raw_input('Specify valid full path to your repositories'
352 path = raw_input('Specify valid full path to your repositories'
344 ' you can change this later in application settings:')
353 ' you can change this later in application settings:')
345 else:
354 else:
346 path = test_repo_path
355 path = test_repo_path
347
356
348 if not os.path.isdir(path):
357 if not os.path.isdir(path):
349 log.error('You entered wrong path: %s', path)
358 log.error('You entered wrong path: %s', path)
350 sys.exit()
359 sys.exit()
351
360
352 self.create_ui_settings()
361 self.create_ui_settings()
353
362
354 #HG UI OPTIONS
363 #HG UI OPTIONS
355 web1 = RhodeCodeUi()
364 web1 = RhodeCodeUi()
356 web1.ui_section = 'web'
365 web1.ui_section = 'web'
357 web1.ui_key = 'push_ssl'
366 web1.ui_key = 'push_ssl'
358 web1.ui_value = 'false'
367 web1.ui_value = 'false'
359
368
360 web2 = RhodeCodeUi()
369 web2 = RhodeCodeUi()
361 web2.ui_section = 'web'
370 web2.ui_section = 'web'
362 web2.ui_key = 'allow_archive'
371 web2.ui_key = 'allow_archive'
363 web2.ui_value = 'gz zip bz2'
372 web2.ui_value = 'gz zip bz2'
364
373
365 web3 = RhodeCodeUi()
374 web3 = RhodeCodeUi()
366 web3.ui_section = 'web'
375 web3.ui_section = 'web'
367 web3.ui_key = 'allow_push'
376 web3.ui_key = 'allow_push'
368 web3.ui_value = '*'
377 web3.ui_value = '*'
369
378
370 web4 = RhodeCodeUi()
379 web4 = RhodeCodeUi()
371 web4.ui_section = 'web'
380 web4.ui_section = 'web'
372 web4.ui_key = 'baseurl'
381 web4.ui_key = 'baseurl'
373 web4.ui_value = '/'
382 web4.ui_value = '/'
374
383
375 paths = RhodeCodeUi()
384 paths = RhodeCodeUi()
376 paths.ui_section = 'paths'
385 paths.ui_section = 'paths'
377 paths.ui_key = '/'
386 paths.ui_key = '/'
378 paths.ui_value = path
387 paths.ui_value = path
379
388
380
389
381 hgsettings1 = RhodeCodeSettings('realm', 'RhodeCode authentication')
390 hgsettings1 = RhodeCodeSettings('realm', 'RhodeCode authentication')
382 hgsettings2 = RhodeCodeSettings('title', 'RhodeCode')
391 hgsettings2 = RhodeCodeSettings('title', 'RhodeCode')
383 hgsettings3 = RhodeCodeSettings('ga_code', '')
392 hgsettings3 = RhodeCodeSettings('ga_code', '')
384
393
385
394
386 try:
395 try:
387 self.sa.add(web1)
396 self.sa.add(web1)
388 self.sa.add(web2)
397 self.sa.add(web2)
389 self.sa.add(web3)
398 self.sa.add(web3)
390 self.sa.add(web4)
399 self.sa.add(web4)
391 self.sa.add(paths)
400 self.sa.add(paths)
392 self.sa.add(hgsettings1)
401 self.sa.add(hgsettings1)
393 self.sa.add(hgsettings2)
402 self.sa.add(hgsettings2)
394 self.sa.add(hgsettings3)
403 self.sa.add(hgsettings3)
395
404
396 self.sa.commit()
405 self.sa.commit()
397 except:
406 except:
398 self.sa.rollback()
407 self.sa.rollback()
399 raise
408 raise
400
409
401 self.create_ldap_options()
410 self.create_ldap_options()
402
411
403 log.info('created ui config')
412 log.info('created ui config')
404
413
405 def create_user(self, username, password, email='', admin=False):
414 def create_user(self, username, password, email='', admin=False):
406 log.info('creating administrator user %s', username)
415 log.info('creating administrator user %s', username)
407 new_user = User()
416 new_user = User()
408 new_user.username = username
417 new_user.username = username
409 new_user.password = get_crypt_password(password)
418 new_user.password = get_crypt_password(password)
410 new_user.name = 'RhodeCode'
419 new_user.name = 'RhodeCode'
411 new_user.lastname = 'Admin'
420 new_user.lastname = 'Admin'
412 new_user.email = email
421 new_user.email = email
413 new_user.admin = admin
422 new_user.admin = admin
414 new_user.active = True
423 new_user.active = True
415
424
416 try:
425 try:
417 self.sa.add(new_user)
426 self.sa.add(new_user)
418 self.sa.commit()
427 self.sa.commit()
419 except:
428 except:
420 self.sa.rollback()
429 self.sa.rollback()
421 raise
430 raise
422
431
423 def create_default_user(self):
432 def create_default_user(self):
424 log.info('creating default user')
433 log.info('creating default user')
425 #create default user for handling default permissions.
434 #create default user for handling default permissions.
426 def_user = User()
435 def_user = User()
427 def_user.username = 'default'
436 def_user.username = 'default'
428 def_user.password = get_crypt_password(str(uuid.uuid1())[:8])
437 def_user.password = get_crypt_password(str(uuid.uuid1())[:8])
429 def_user.name = 'Anonymous'
438 def_user.name = 'Anonymous'
430 def_user.lastname = 'User'
439 def_user.lastname = 'User'
431 def_user.email = 'anonymous@rhodecode.org'
440 def_user.email = 'anonymous@rhodecode.org'
432 def_user.admin = False
441 def_user.admin = False
433 def_user.active = False
442 def_user.active = False
434 try:
443 try:
435 self.sa.add(def_user)
444 self.sa.add(def_user)
436 self.sa.commit()
445 self.sa.commit()
437 except:
446 except:
438 self.sa.rollback()
447 self.sa.rollback()
439 raise
448 raise
440
449
441 def create_permissions(self):
450 def create_permissions(self):
442 #module.(access|create|change|delete)_[name]
451 #module.(access|create|change|delete)_[name]
443 #module.(read|write|owner)
452 #module.(read|write|owner)
444 perms = [('repository.none', 'Repository no access'),
453 perms = [('repository.none', 'Repository no access'),
445 ('repository.read', 'Repository read access'),
454 ('repository.read', 'Repository read access'),
446 ('repository.write', 'Repository write access'),
455 ('repository.write', 'Repository write access'),
447 ('repository.admin', 'Repository admin access'),
456 ('repository.admin', 'Repository admin access'),
448 ('hg.admin', 'Hg Administrator'),
457 ('hg.admin', 'Hg Administrator'),
449 ('hg.create.repository', 'Repository create'),
458 ('hg.create.repository', 'Repository create'),
450 ('hg.create.none', 'Repository creation disabled'),
459 ('hg.create.none', 'Repository creation disabled'),
451 ('hg.register.none', 'Register disabled'),
460 ('hg.register.none', 'Register disabled'),
452 ('hg.register.manual_activate', 'Register new user with rhodecode without manual activation'),
461 ('hg.register.manual_activate', 'Register new user with rhodecode without manual activation'),
453 ('hg.register.auto_activate', 'Register new user with rhodecode without auto activation'),
462 ('hg.register.auto_activate', 'Register new user with rhodecode without auto activation'),
454 ]
463 ]
455
464
456 for p in perms:
465 for p in perms:
457 new_perm = Permission()
466 new_perm = Permission()
458 new_perm.permission_name = p[0]
467 new_perm.permission_name = p[0]
459 new_perm.permission_longname = p[1]
468 new_perm.permission_longname = p[1]
460 try:
469 try:
461 self.sa.add(new_perm)
470 self.sa.add(new_perm)
462 self.sa.commit()
471 self.sa.commit()
463 except:
472 except:
464 self.sa.rollback()
473 self.sa.rollback()
465 raise
474 raise
466
475
467 def populate_default_permissions(self):
476 def populate_default_permissions(self):
468 log.info('creating default user permissions')
477 log.info('creating default user permissions')
469
478
470 default_user = self.sa.query(User)\
479 default_user = self.sa.query(User)\
471 .filter(User.username == 'default').scalar()
480 .filter(User.username == 'default').scalar()
472
481
473 reg_perm = UserToPerm()
482 reg_perm = UserToPerm()
474 reg_perm.user = default_user
483 reg_perm.user = default_user
475 reg_perm.permission = self.sa.query(Permission)\
484 reg_perm.permission = self.sa.query(Permission)\
476 .filter(Permission.permission_name == 'hg.register.manual_activate')\
485 .filter(Permission.permission_name == 'hg.register.manual_activate')\
477 .scalar()
486 .scalar()
478
487
479 create_repo_perm = UserToPerm()
488 create_repo_perm = UserToPerm()
480 create_repo_perm.user = default_user
489 create_repo_perm.user = default_user
481 create_repo_perm.permission = self.sa.query(Permission)\
490 create_repo_perm.permission = self.sa.query(Permission)\
482 .filter(Permission.permission_name == 'hg.create.repository')\
491 .filter(Permission.permission_name == 'hg.create.repository')\
483 .scalar()
492 .scalar()
484
493
485 default_repo_perm = UserToPerm()
494 default_repo_perm = UserToPerm()
486 default_repo_perm.user = default_user
495 default_repo_perm.user = default_user
487 default_repo_perm.permission = self.sa.query(Permission)\
496 default_repo_perm.permission = self.sa.query(Permission)\
488 .filter(Permission.permission_name == 'repository.read')\
497 .filter(Permission.permission_name == 'repository.read')\
489 .scalar()
498 .scalar()
490
499
491 try:
500 try:
492 self.sa.add(reg_perm)
501 self.sa.add(reg_perm)
493 self.sa.add(create_repo_perm)
502 self.sa.add(create_repo_perm)
494 self.sa.add(default_repo_perm)
503 self.sa.add(default_repo_perm)
495 self.sa.commit()
504 self.sa.commit()
496 except:
505 except:
497 self.sa.rollback()
506 self.sa.rollback()
498 raise
507 raise
499
508
@@ -1,203 +1,204 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # rhodecode - Pylons environment configuration #
3 # rhodecode - Pylons environment configuration #
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 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25
25
26 [server:main]
26 [server:main]
27 ##nr of threads to spawn
27 ##nr of threads to spawn
28 threadpool_workers = 5
28 threadpool_workers = 5
29
29
30 ##max request before thread respawn
30 ##max request before thread respawn
31 threadpool_max_requests = 2
31 threadpool_max_requests = 2
32
32
33 ##option to use threads of process
33 ##option to use threads of process
34 use_threadpool = true
34 use_threadpool = true
35
35
36 use = egg:Paste#http
36 use = egg:Paste#http
37 host = 127.0.0.1
37 host = 127.0.0.1
38 port = 5000
38 port = 5000
39
39
40 [app:main]
40 [app:main]
41 use = egg:rhodecode
41 use = egg:rhodecode
42 full_stack = true
42 full_stack = true
43 static_files = true
43 static_files = true
44 lang=en
44 lang=en
45 cache_dir = %(here)s/data
45 cache_dir = %(here)s/data
46 index_dir = /tmp/index
46 index_dir = /tmp/index
47 cut_off_limit = 256000
47 cut_off_limit = 256000
48 force_https = false
48 force_https = false
49
49
50 ####################################
50 ####################################
51 ### CELERY CONFIG ####
51 ### CELERY CONFIG ####
52 ####################################
52 ####################################
53 use_celery = false
53 use_celery = false
54 broker.host = localhost
54 broker.host = localhost
55 broker.vhost = rabbitmqhost
55 broker.vhost = rabbitmqhost
56 broker.port = 5672
56 broker.port = 5672
57 broker.user = rabbitmq
57 broker.user = rabbitmq
58 broker.password = qweqwe
58 broker.password = qweqwe
59
59
60 celery.imports = rhodecode.lib.celerylib.tasks
60 celery.imports = rhodecode.lib.celerylib.tasks
61
61
62 celery.result.backend = amqp
62 celery.result.backend = amqp
63 celery.result.dburi = amqp://
63 celery.result.dburi = amqp://
64 celery.result.serialier = json
64 celery.result.serialier = json
65
65
66 #celery.send.task.error.emails = true
66 #celery.send.task.error.emails = true
67 #celery.amqp.task.result.expires = 18000
67 #celery.amqp.task.result.expires = 18000
68
68
69 celeryd.concurrency = 2
69 celeryd.concurrency = 2
70 #celeryd.log.file = celeryd.log
70 #celeryd.log.file = celeryd.log
71 celeryd.log.level = debug
71 celeryd.log.level = debug
72 celeryd.max.tasks.per.child = 3
72 celeryd.max.tasks.per.child = 3
73
73
74 #tasks will never be sent to the queue, but executed locally instead.
74 #tasks will never be sent to the queue, but executed locally instead.
75 celery.always.eager = false
75 celery.always.eager = false
76
76
77 ####################################
77 ####################################
78 ### BEAKER CACHE ####
78 ### BEAKER CACHE ####
79 ####################################
79 ####################################
80 beaker.cache.data_dir=/%(here)s/data/cache/data
80 beaker.cache.data_dir=/%(here)s/data/cache/data
81 beaker.cache.lock_dir=/%(here)s/data/cache/lock
81 beaker.cache.lock_dir=/%(here)s/data/cache/lock
82 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
82 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
83
83
84 beaker.cache.super_short_term.type=memory
84 beaker.cache.super_short_term.type=memory
85 beaker.cache.super_short_term.expire=10
85 beaker.cache.super_short_term.expire=10
86
86
87 beaker.cache.short_term.type=memory
87 beaker.cache.short_term.type=memory
88 beaker.cache.short_term.expire=60
88 beaker.cache.short_term.expire=60
89
89
90 beaker.cache.long_term.type=memory
90 beaker.cache.long_term.type=memory
91 beaker.cache.long_term.expire=36000
91 beaker.cache.long_term.expire=36000
92
92
93
93
94 beaker.cache.sql_cache_short.type=memory
94 beaker.cache.sql_cache_short.type=memory
95 beaker.cache.sql_cache_short.expire=5
95 beaker.cache.sql_cache_short.expire=5
96
96
97 beaker.cache.sql_cache_med.type=memory
97 beaker.cache.sql_cache_med.type=memory
98 beaker.cache.sql_cache_med.expire=360
98 beaker.cache.sql_cache_med.expire=360
99
99
100 beaker.cache.sql_cache_long.type=file
100 beaker.cache.sql_cache_long.type=file
101 beaker.cache.sql_cache_long.expire=3600
101 beaker.cache.sql_cache_long.expire=3600
102
102
103 ####################################
103 ####################################
104 ### BEAKER SESSION ####
104 ### BEAKER SESSION ####
105 ####################################
105 ####################################
106 ## Type of storage used for the session, current types are
106 ## Type of storage used for the session, current types are
107 ## dbm, file, memcached, database, and memory.
107 ## dbm, file, memcached, database, and memory.
108 ## The storage uses the Container API
108 ## The storage uses the Container API
109 ##that is also used by the cache system.
109 ##that is also used by the cache system.
110 beaker.session.type = file
110 beaker.session.type = file
111
111
112 beaker.session.key = rhodecode
112 beaker.session.key = rhodecode
113 beaker.session.secret = g654dcno0-9873jhgfreyu
113 beaker.session.secret = g654dcno0-9873jhgfreyu
114 beaker.session.timeout = 36000
114 beaker.session.timeout = 36000
115
115
116 ##auto save the session to not to use .save()
116 ##auto save the session to not to use .save()
117 beaker.session.auto = False
117 beaker.session.auto = False
118
118
119 ##true exire at browser close
119 ##true exire at browser close
120 #beaker.session.cookie_expires = 3600
120 #beaker.session.cookie_expires = 3600
121
121
122
122
123 ################################################################################
123 ################################################################################
124 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
124 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
125 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
125 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
126 ## execute malicious code after an exception is raised. ##
126 ## execute malicious code after an exception is raised. ##
127 ################################################################################
127 ################################################################################
128 #set debug = false
128 #set debug = false
129
129
130 ##################################
130 ##################################
131 ### LOGVIEW CONFIG ###
131 ### LOGVIEW CONFIG ###
132 ##################################
132 ##################################
133 logview.sqlalchemy = #faa
133 logview.sqlalchemy = #faa
134 logview.pylons.templating = #bfb
134 logview.pylons.templating = #bfb
135 logview.pylons.util = #eee
135 logview.pylons.util = #eee
136
136
137 #########################################################
137 #########################################################
138 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
138 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
139 #########################################################
139 #########################################################
140 sqlalchemy.db1.url = sqlite:///%(here)s/test.db
140 #sqlalchemy.db1.url = sqlite:///%(here)s/test.db
141 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_tests
141 #sqlalchemy.db1.echo = False
142 #sqlalchemy.db1.echo = False
142 #sqlalchemy.db1.pool_recycle = 3600
143 #sqlalchemy.db1.pool_recycle = 3600
143 sqlalchemy.convert_unicode = true
144 sqlalchemy.convert_unicode = true
144
145
145 ################################
146 ################################
146 ### LOGGING CONFIGURATION ####
147 ### LOGGING CONFIGURATION ####
147 ################################
148 ################################
148 [loggers]
149 [loggers]
149 keys = root, routes, rhodecode, sqlalchemy
150 keys = root, routes, rhodecode, sqlalchemy
150
151
151 [handlers]
152 [handlers]
152 keys = console
153 keys = console
153
154
154 [formatters]
155 [formatters]
155 keys = generic,color_formatter
156 keys = generic,color_formatter
156
157
157 #############
158 #############
158 ## LOGGERS ##
159 ## LOGGERS ##
159 #############
160 #############
160 [logger_root]
161 [logger_root]
161 level = ERROR
162 level = ERROR
162 handlers = console
163 handlers = console
163
164
164 [logger_routes]
165 [logger_routes]
165 level = ERROR
166 level = ERROR
166 handlers = console
167 handlers = console
167 qualname = routes.middleware
168 qualname = routes.middleware
168 # "level = DEBUG" logs the route matched and routing variables.
169 # "level = DEBUG" logs the route matched and routing variables.
169
170
170 [logger_rhodecode]
171 [logger_rhodecode]
171 level = ERROR
172 level = ERROR
172 handlers = console
173 handlers = console
173 qualname = rhodecode
174 qualname = rhodecode
174 propagate = 0
175 propagate = 0
175
176
176 [logger_sqlalchemy]
177 [logger_sqlalchemy]
177 level = ERROR
178 level = ERROR
178 handlers = console
179 handlers = console
179 qualname = sqlalchemy.engine
180 qualname = sqlalchemy.engine
180 propagate = 0
181 propagate = 0
181
182
182 ##############
183 ##############
183 ## HANDLERS ##
184 ## HANDLERS ##
184 ##############
185 ##############
185
186
186 [handler_console]
187 [handler_console]
187 class = StreamHandler
188 class = StreamHandler
188 args = (sys.stderr,)
189 args = (sys.stderr,)
189 level = NOTSET
190 level = NOTSET
190 formatter = color_formatter
191 formatter = color_formatter
191
192
192 ################
193 ################
193 ## FORMATTERS ##
194 ## FORMATTERS ##
194 ################
195 ################
195
196
196 [formatter_generic]
197 [formatter_generic]
197 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
198 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
198 datefmt = %Y-%m-%d %H:%M:%S
199 datefmt = %Y-%m-%d %H:%M:%S
199
200
200 [formatter_color_formatter]
201 [formatter_color_formatter]
201 class=rhodecode.lib.colored_formatter.ColorFormatter
202 class=rhodecode.lib.colored_formatter.ColorFormatter
202 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
203 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
203 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
204 datefmt = %Y-%m-%d %H:%M:%S
General Comments 0
You need to be logged in to leave comments. Login now