Show More
@@ -0,0 +1,16 b'' | |||||
|
1 | """ | |||
|
2 | Automatically sets the environment variable `CELERY_LOADER` to | |||
|
3 | `celerypylons.loader:PylonsLoader`. This ensures the loader is | |||
|
4 | specified when accessing the rest of this package, and allows celery | |||
|
5 | to be installed in a webapp just by importing celerypylons:: | |||
|
6 | ||||
|
7 | import celerypylons | |||
|
8 | ||||
|
9 | """ | |||
|
10 | import os | |||
|
11 | import warnings | |||
|
12 | ||||
|
13 | CELERYPYLONS_LOADER = 'rhodecode.lib.celerypylons.loader.PylonsLoader' | |||
|
14 | if os.environ.get('CELERY_LOADER', CELERYPYLONS_LOADER) != CELERYPYLONS_LOADER: | |||
|
15 | warnings.warn("'CELERY_LOADER' environment variable will be overridden by celery-pylons.") | |||
|
16 | os.environ['CELERY_LOADER'] = CELERYPYLONS_LOADER |
@@ -0,0 +1,143 b'' | |||||
|
1 | import os | |||
|
2 | from paste.script.command import Command, BadCommand | |||
|
3 | import paste.deploy | |||
|
4 | from pylons import config | |||
|
5 | ||||
|
6 | ||||
|
7 | __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', | |||
|
8 | 'CAMQPAdminCommand', 'CeleryEventCommand'] | |||
|
9 | ||||
|
10 | ||||
|
11 | class CeleryCommand(Command): | |||
|
12 | """ | |||
|
13 | Abstract Base Class for celery commands. | |||
|
14 | ||||
|
15 | The celery commands are somewhat aggressive about loading | |||
|
16 | celery.conf, and since our module sets the `CELERY_LOADER` | |||
|
17 | environment variable to our loader, we have to bootstrap a bit and | |||
|
18 | make sure we've had a chance to load the pylons config off of the | |||
|
19 | command line, otherwise everything fails. | |||
|
20 | """ | |||
|
21 | min_args = 1 | |||
|
22 | min_args_error = "Please provide a paster config file as an argument." | |||
|
23 | takes_config_file = 1 | |||
|
24 | requires_config_file = True | |||
|
25 | ||||
|
26 | def run(self, args): | |||
|
27 | """ | |||
|
28 | Overrides Command.run | |||
|
29 | ||||
|
30 | Checks for a config file argument and loads it. | |||
|
31 | """ | |||
|
32 | if len(args) < self.min_args: | |||
|
33 | raise BadCommand( | |||
|
34 | self.min_args_error % {'min_args': self.min_args, | |||
|
35 | 'actual_args': len(args)}) | |||
|
36 | # Decrement because we're going to lob off the first argument. | |||
|
37 | # @@ This is hacky | |||
|
38 | self.min_args -= 1 | |||
|
39 | self.bootstrap_config(args[0]) | |||
|
40 | self.update_parser() | |||
|
41 | return super(CeleryCommand, self).run(args[1:]) | |||
|
42 | ||||
|
43 | def update_parser(self): | |||
|
44 | """ | |||
|
45 | Abstract method. Allows for the class's parser to be updated | |||
|
46 | before the superclass's `run` method is called. Necessary to | |||
|
47 | allow options/arguments to be passed through to the underlying | |||
|
48 | celery command. | |||
|
49 | """ | |||
|
50 | raise NotImplementedError("Abstract Method.") | |||
|
51 | ||||
|
52 | def bootstrap_config(self, conf): | |||
|
53 | """ | |||
|
54 | Loads the pylons configuration. | |||
|
55 | """ | |||
|
56 | path_to_ini_file = os.path.realpath(conf) | |||
|
57 | conf = paste.deploy.appconfig('config:' + path_to_ini_file) | |||
|
58 | config.init_app(conf.global_conf, conf.local_conf) | |||
|
59 | ||||
|
60 | ||||
|
61 | class CeleryDaemonCommand(CeleryCommand): | |||
|
62 | """Start the celery worker | |||
|
63 | ||||
|
64 | Starts the celery worker that uses a paste.deploy configuration | |||
|
65 | file. | |||
|
66 | """ | |||
|
67 | usage = 'CONFIG_FILE [celeryd options...]' | |||
|
68 | summary = __doc__.splitlines()[0] | |||
|
69 | description = "".join(__doc__.splitlines()[2:]) | |||
|
70 | ||||
|
71 | parser = Command.standard_parser(quiet=True) | |||
|
72 | ||||
|
73 | def update_parser(self): | |||
|
74 | from celery.bin import celeryd | |||
|
75 | for x in celeryd.WorkerCommand().get_options(): | |||
|
76 | self.parser.add_option(x) | |||
|
77 | ||||
|
78 | def command(self): | |||
|
79 | from celery.bin import celeryd | |||
|
80 | return celeryd.WorkerCommand().run(**vars(self.options)) | |||
|
81 | ||||
|
82 | ||||
|
83 | class CeleryBeatCommand(CeleryCommand): | |||
|
84 | """Start the celery beat server | |||
|
85 | ||||
|
86 | Starts the celery beat server using a paste.deploy configuration | |||
|
87 | file. | |||
|
88 | """ | |||
|
89 | usage = 'CONFIG_FILE [celerybeat options...]' | |||
|
90 | summary = __doc__.splitlines()[0] | |||
|
91 | description = "".join(__doc__.splitlines()[2:]) | |||
|
92 | ||||
|
93 | parser = Command.standard_parser(quiet=True) | |||
|
94 | ||||
|
95 | def update_parser(self): | |||
|
96 | from celery.bin import celerybeat | |||
|
97 | for x in celerybeat.BeatCommand().get_options(): | |||
|
98 | self.parser.add_option(x) | |||
|
99 | ||||
|
100 | def command(self): | |||
|
101 | from celery.bin import celerybeat | |||
|
102 | return celerybeat.BeatCommand(**vars(self.options)) | |||
|
103 | ||||
|
104 | class CAMQPAdminCommand(CeleryCommand): | |||
|
105 | """CAMQP Admin | |||
|
106 | ||||
|
107 | CAMQP celery admin tool. | |||
|
108 | """ | |||
|
109 | usage = 'CONFIG_FILE [camqadm options...]' | |||
|
110 | summary = __doc__.splitlines()[0] | |||
|
111 | description = "".join(__doc__.splitlines()[2:]) | |||
|
112 | ||||
|
113 | parser = Command.standard_parser(quiet=True) | |||
|
114 | ||||
|
115 | def update_parser(self): | |||
|
116 | from celery.bin import camqadm | |||
|
117 | for x in camqadm.OPTION_LIST: | |||
|
118 | self.parser.add_option(x) | |||
|
119 | ||||
|
120 | def command(self): | |||
|
121 | from celery.bin import camqadm | |||
|
122 | return camqadm.camqadm(*self.args, **vars(self.options)) | |||
|
123 | ||||
|
124 | ||||
|
125 | class CeleryEventCommand(CeleryCommand): | |||
|
126 | """Celery event commandd. | |||
|
127 | ||||
|
128 | Capture celery events. | |||
|
129 | """ | |||
|
130 | usage = 'CONFIG_FILE [celeryev options...]' | |||
|
131 | summary = __doc__.splitlines()[0] | |||
|
132 | description = "".join(__doc__.splitlines()[2:]) | |||
|
133 | ||||
|
134 | parser = Command.standard_parser(quiet=True) | |||
|
135 | ||||
|
136 | def update_parser(self): | |||
|
137 | from celery.bin import celeryev | |||
|
138 | for x in celeryev.OPTION_LIST: | |||
|
139 | self.parser.add_option(x) | |||
|
140 | ||||
|
141 | def command(self): | |||
|
142 | from celery.bin import celeryev | |||
|
143 | return celeryev.run_celeryev(**vars(self.options)) |
@@ -0,0 +1,55 b'' | |||||
|
1 | from celery.loaders.base import BaseLoader | |||
|
2 | from pylons import config | |||
|
3 | ||||
|
4 | to_pylons = lambda x: x.replace('_', '.').lower() | |||
|
5 | to_celery = lambda x: x.replace('.', '_').upper() | |||
|
6 | ||||
|
7 | LIST_PARAMS = """CELERY_IMPORTS ADMINS ROUTES""".split() | |||
|
8 | ||||
|
9 | ||||
|
10 | class PylonsSettingsProxy(object): | |||
|
11 | """Pylons Settings Proxy | |||
|
12 | ||||
|
13 | Proxies settings from pylons.config | |||
|
14 | ||||
|
15 | """ | |||
|
16 | def __getattr__(self, key): | |||
|
17 | pylons_key = to_pylons(key) | |||
|
18 | try: | |||
|
19 | value = config[pylons_key] | |||
|
20 | if key in LIST_PARAMS: return value.split() | |||
|
21 | return self.type_converter(value) | |||
|
22 | except KeyError: | |||
|
23 | raise AttributeError(pylons_key) | |||
|
24 | ||||
|
25 | def __setattr__(self, key, value): | |||
|
26 | pylons_key = to_pylons(key) | |||
|
27 | config[pylons_key] = value | |||
|
28 | ||||
|
29 | ||||
|
30 | def type_converter(self, value): | |||
|
31 | #cast to int | |||
|
32 | if value.isdigit(): | |||
|
33 | return int(value) | |||
|
34 | ||||
|
35 | #cast to bool | |||
|
36 | if value.lower() in ['true', 'false']: | |||
|
37 | return value.lower() == 'true' | |||
|
38 | ||||
|
39 | return value | |||
|
40 | ||||
|
41 | class PylonsLoader(BaseLoader): | |||
|
42 | """Pylons celery loader | |||
|
43 | ||||
|
44 | Maps the celery config onto pylons.config | |||
|
45 | ||||
|
46 | """ | |||
|
47 | def read_configuration(self): | |||
|
48 | self.configured = True | |||
|
49 | return PylonsSettingsProxy() | |||
|
50 | ||||
|
51 | def on_worker_init(self): | |||
|
52 | """ | |||
|
53 | Import task modules. | |||
|
54 | """ | |||
|
55 | self.import_default_modules() |
@@ -1,187 +1,214 b'' | |||||
1 | ################################################################################ |
|
1 | ################################################################################ | |
2 | ################################################################################ |
|
2 | ################################################################################ | |
3 |
# |
|
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 |
|
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 = |
|
24 | #smtp_use_tls = false | |
|
25 | #smtp_use_ssl = true | |||
25 |
|
26 | |||
26 | [server:main] |
|
27 | [server:main] | |
27 | ##nr of threads to spawn |
|
28 | ##nr of threads to spawn | |
28 | threadpool_workers = 5 |
|
29 | threadpool_workers = 5 | |
29 |
|
30 | |||
30 | ##max request before |
|
31 | ##max request before thread respawn | |
31 | threadpool_max_requests = 6 |
|
32 | threadpool_max_requests = 6 | |
32 |
|
33 | |||
33 | ##option to use threads of process |
|
34 | ##option to use threads of process | |
34 | use_threadpool = false |
|
35 | use_threadpool = false | |
35 |
|
36 | |||
36 | use = egg:Paste#http |
|
37 | use = egg:Paste#http | |
37 | host = 0.0.0.0 |
|
38 | host = 0.0.0.0 | |
38 | port = 5000 |
|
39 | port = 5000 | |
39 |
|
40 | |||
40 | [app:main] |
|
41 | [app:main] | |
41 | use = egg:rhodecode |
|
42 | use = egg:rhodecode | |
42 | full_stack = true |
|
43 | full_stack = true | |
43 | static_files = true |
|
44 | static_files = true | |
44 | lang=en |
|
45 | lang=en | |
45 | cache_dir = %(here)s/data |
|
46 | cache_dir = %(here)s/data | |
46 | index_dir = %(here)s/data/index |
|
47 | index_dir = %(here)s/data/index | |
47 |
|
48 | |||
48 | #################################### |
|
49 | #################################### | |
|
50 | ### CELERY CONFIG #### | |||
|
51 | #################################### | |||
|
52 | use_celery = false | |||
|
53 | broker.host = localhost | |||
|
54 | broker.vhost = rabbitmqhost | |||
|
55 | broker.port = 5672 | |||
|
56 | broker.user = rabbitmq | |||
|
57 | broker.password = qweqwe | |||
|
58 | ||||
|
59 | celery.imports = rhodecode.lib.celerylib.tasks | |||
|
60 | ||||
|
61 | celery.result.backend = amqp | |||
|
62 | celery.result.dburi = amqp:// | |||
|
63 | celery.result.serialier = json | |||
|
64 | ||||
|
65 | #celery.send.task.error.emails = true | |||
|
66 | #celery.amqp.task.result.expires = 18000 | |||
|
67 | ||||
|
68 | celeryd.concurrency = 2 | |||
|
69 | #celeryd.log.file = celeryd.log | |||
|
70 | celeryd.log.level = debug | |||
|
71 | celeryd.max.tasks.per.child = 3 | |||
|
72 | ||||
|
73 | #tasks will never be sent to the queue, but executed locally instead. | |||
|
74 | celery.always.eager = false | |||
|
75 | ||||
|
76 | #################################### | |||
49 | ### BEAKER CACHE #### |
|
77 | ### BEAKER CACHE #### | |
50 | #################################### |
|
78 | #################################### | |
51 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
79 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
52 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
80 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
53 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
81 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
54 |
|
82 | |||
55 | beaker.cache.super_short_term.type=memory |
|
83 | beaker.cache.super_short_term.type=memory | |
56 | beaker.cache.super_short_term.expire=10 |
|
84 | beaker.cache.super_short_term.expire=10 | |
57 |
|
85 | |||
58 | beaker.cache.short_term.type=memory |
|
86 | beaker.cache.short_term.type=memory | |
59 | beaker.cache.short_term.expire=60 |
|
87 | beaker.cache.short_term.expire=60 | |
60 |
|
88 | |||
61 | beaker.cache.long_term.type=memory |
|
89 | beaker.cache.long_term.type=memory | |
62 | beaker.cache.long_term.expire=36000 |
|
90 | beaker.cache.long_term.expire=36000 | |
63 |
|
91 | |||
64 |
|
||||
65 | beaker.cache.sql_cache_short.type=memory |
|
92 | beaker.cache.sql_cache_short.type=memory | |
66 |
beaker.cache.sql_cache_short.expire= |
|
93 | beaker.cache.sql_cache_short.expire=10 | |
67 |
|
94 | |||
68 | beaker.cache.sql_cache_med.type=memory |
|
95 | beaker.cache.sql_cache_med.type=memory | |
69 | beaker.cache.sql_cache_med.expire=360 |
|
96 | beaker.cache.sql_cache_med.expire=360 | |
70 |
|
97 | |||
71 | beaker.cache.sql_cache_long.type=file |
|
98 | beaker.cache.sql_cache_long.type=file | |
72 | beaker.cache.sql_cache_long.expire=3600 |
|
99 | beaker.cache.sql_cache_long.expire=3600 | |
73 |
|
100 | |||
74 | #################################### |
|
101 | #################################### | |
75 | ### BEAKER SESSION #### |
|
102 | ### BEAKER SESSION #### | |
76 | #################################### |
|
103 | #################################### | |
77 | ## Type of storage used for the session, current types are |
|
104 | ## Type of storage used for the session, current types are | |
78 |
## |
|
105 | ## dbm, file, memcached, database, and memory. | |
79 | ## The storage uses the Container API |
|
106 | ## The storage uses the Container API | |
80 | ##that is also used by the cache system. |
|
107 | ##that is also used by the cache system. | |
81 | beaker.session.type = file |
|
108 | beaker.session.type = file | |
82 |
|
109 | |||
83 | beaker.session.key = rhodecode |
|
110 | beaker.session.key = rhodecode | |
84 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
111 | beaker.session.secret = g654dcno0-9873jhgfreyu | |
85 | beaker.session.timeout = 36000 |
|
112 | beaker.session.timeout = 36000 | |
86 |
|
113 | |||
87 | ##auto save the session to not to use .save() |
|
114 | ##auto save the session to not to use .save() | |
88 | beaker.session.auto = False |
|
115 | beaker.session.auto = False | |
89 |
|
116 | |||
90 | ##true exire at browser close |
|
117 | ##true exire at browser close | |
91 | #beaker.session.cookie_expires = 3600 |
|
118 | #beaker.session.cookie_expires = 3600 | |
92 |
|
119 | |||
93 |
|
120 | |||
94 | ################################################################################ |
|
121 | ################################################################################ | |
95 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
122 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
96 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
123 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
97 | ## execute malicious code after an exception is raised. ## |
|
124 | ## execute malicious code after an exception is raised. ## | |
98 | ################################################################################ |
|
125 | ################################################################################ | |
99 | #set debug = false |
|
126 | #set debug = false | |
100 |
|
127 | |||
101 | ################################## |
|
128 | ################################## | |
102 | ### LOGVIEW CONFIG ### |
|
129 | ### LOGVIEW CONFIG ### | |
103 | ################################## |
|
130 | ################################## | |
104 | logview.sqlalchemy = #faa |
|
131 | logview.sqlalchemy = #faa | |
105 | logview.pylons.templating = #bfb |
|
132 | logview.pylons.templating = #bfb | |
106 | logview.pylons.util = #eee |
|
133 | logview.pylons.util = #eee | |
107 |
|
134 | |||
108 | ######################################################### |
|
135 | ######################################################### | |
109 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
136 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
110 | ######################################################### |
|
137 | ######################################################### | |
111 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
138 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
112 | #sqlalchemy.db1.echo = False |
|
139 | #sqlalchemy.db1.echo = False | |
113 | #sqlalchemy.db1.pool_recycle = 3600 |
|
140 | #sqlalchemy.db1.pool_recycle = 3600 | |
114 | sqlalchemy.convert_unicode = true |
|
141 | sqlalchemy.convert_unicode = true | |
115 |
|
142 | |||
116 | ################################ |
|
143 | ################################ | |
117 | ### LOGGING CONFIGURATION #### |
|
144 | ### LOGGING CONFIGURATION #### | |
118 | ################################ |
|
145 | ################################ | |
119 | [loggers] |
|
146 | [loggers] | |
120 | keys = root, routes, rhodecode, sqlalchemy,beaker,templates |
|
147 | keys = root, routes, rhodecode, sqlalchemy,beaker,templates | |
121 |
|
148 | |||
122 | [handlers] |
|
149 | [handlers] | |
123 | keys = console |
|
150 | keys = console | |
124 |
|
151 | |||
125 | [formatters] |
|
152 | [formatters] | |
126 | keys = generic,color_formatter |
|
153 | keys = generic,color_formatter | |
127 |
|
154 | |||
128 | ############# |
|
155 | ############# | |
129 | ## LOGGERS ## |
|
156 | ## LOGGERS ## | |
130 | ############# |
|
157 | ############# | |
131 | [logger_root] |
|
158 | [logger_root] | |
132 | level = NOTSET |
|
159 | level = NOTSET | |
133 | handlers = console |
|
160 | handlers = console | |
134 |
|
161 | |||
135 | [logger_routes] |
|
162 | [logger_routes] | |
136 | level = DEBUG |
|
163 | level = DEBUG | |
137 | handlers = console |
|
164 | handlers = console | |
138 | qualname = routes.middleware |
|
165 | qualname = routes.middleware | |
139 | # "level = DEBUG" logs the route matched and routing variables. |
|
166 | # "level = DEBUG" logs the route matched and routing variables. | |
140 | propagate = 0 |
|
167 | propagate = 0 | |
141 |
|
168 | |||
142 | [logger_beaker] |
|
169 | [logger_beaker] | |
143 | level = ERROR |
|
170 | level = ERROR | |
144 | handlers = console |
|
171 | handlers = console | |
145 | qualname = beaker.container |
|
172 | qualname = beaker.container | |
146 | propagate = 0 |
|
173 | propagate = 0 | |
147 |
|
174 | |||
148 | [logger_templates] |
|
175 | [logger_templates] | |
149 | level = INFO |
|
176 | level = INFO | |
150 | handlers = console |
|
177 | handlers = console | |
151 | qualname = pylons.templating |
|
178 | qualname = pylons.templating | |
152 | propagate = 0 |
|
179 | propagate = 0 | |
153 |
|
180 | |||
154 | [logger_rhodecode] |
|
181 | [logger_rhodecode] | |
155 | level = DEBUG |
|
182 | level = DEBUG | |
156 | handlers = console |
|
183 | handlers = console | |
157 | qualname = rhodecode |
|
184 | qualname = rhodecode | |
158 | propagate = 0 |
|
185 | propagate = 0 | |
159 |
|
186 | |||
160 | [logger_sqlalchemy] |
|
187 | [logger_sqlalchemy] | |
161 | level = ERROR |
|
188 | level = ERROR | |
162 | handlers = console |
|
189 | handlers = console | |
163 | qualname = sqlalchemy.engine |
|
190 | qualname = sqlalchemy.engine | |
164 | propagate = 0 |
|
191 | propagate = 0 | |
165 |
|
192 | |||
166 | ############## |
|
193 | ############## | |
167 | ## HANDLERS ## |
|
194 | ## HANDLERS ## | |
168 | ############## |
|
195 | ############## | |
169 |
|
196 | |||
170 | [handler_console] |
|
197 | [handler_console] | |
171 | class = StreamHandler |
|
198 | class = StreamHandler | |
172 | args = (sys.stderr,) |
|
199 | args = (sys.stderr,) | |
173 | level = NOTSET |
|
200 | level = NOTSET | |
174 | formatter = color_formatter |
|
201 | formatter = color_formatter | |
175 |
|
202 | |||
176 | ################ |
|
203 | ################ | |
177 | ## FORMATTERS ## |
|
204 | ## FORMATTERS ## | |
178 | ################ |
|
205 | ################ | |
179 |
|
206 | |||
180 | [formatter_generic] |
|
207 | [formatter_generic] | |
181 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
208 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
182 | datefmt = %Y-%m-%d %H:%M:%S |
|
209 | datefmt = %Y-%m-%d %H:%M:%S | |
183 |
|
210 | |||
184 | [formatter_color_formatter] |
|
211 | [formatter_color_formatter] | |
185 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
212 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
186 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
213 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
187 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
214 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,176 +1,203 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 = 2 |
|
32 | threadpool_max_requests = 2 | |
33 |
|
33 | |||
34 | ##option to use threads of process |
|
34 | ##option to use threads of process | |
35 | use_threadpool = true |
|
35 | use_threadpool = true | |
36 |
|
36 | |||
37 | use = egg:Paste#http |
|
37 | use = egg:Paste#http | |
38 | host = 127.0.0.1 |
|
38 | host = 127.0.0.1 | |
39 | port = 8001 |
|
39 | port = 8001 | |
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 = false |
|
44 | static_files = false | |
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 |
|
48 | |||
49 | #################################### |
|
49 | #################################### | |
|
50 | ### CELERY CONFIG #### | |||
|
51 | #################################### | |||
|
52 | use_celery = false | |||
|
53 | broker.host = localhost | |||
|
54 | broker.vhost = rabbitmqhost | |||
|
55 | broker.port = 5672 | |||
|
56 | broker.user = rabbitmq | |||
|
57 | broker.password = qweqwe | |||
|
58 | ||||
|
59 | celery.imports = rhodecode.lib.celerylib.tasks | |||
|
60 | ||||
|
61 | celery.result.backend = amqp | |||
|
62 | celery.result.dburi = amqp:// | |||
|
63 | celery.result.serialier = json | |||
|
64 | ||||
|
65 | #celery.send.task.error.emails = true | |||
|
66 | #celery.amqp.task.result.expires = 18000 | |||
|
67 | ||||
|
68 | celeryd.concurrency = 2 | |||
|
69 | #celeryd.log.file = celeryd.log | |||
|
70 | celeryd.log.level = debug | |||
|
71 | celeryd.max.tasks.per.child = 3 | |||
|
72 | ||||
|
73 | #tasks will never be sent to the queue, but executed locally instead. | |||
|
74 | celery.always.eager = false | |||
|
75 | ||||
|
76 | #################################### | |||
50 | ### BEAKER CACHE #### |
|
77 | ### BEAKER CACHE #### | |
51 | #################################### |
|
78 | #################################### | |
52 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
79 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
53 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
80 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
54 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
81 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
55 |
|
82 | |||
56 | beaker.cache.super_short_term.type=memory |
|
83 | beaker.cache.super_short_term.type=memory | |
57 | beaker.cache.super_short_term.expire=10 |
|
84 | beaker.cache.super_short_term.expire=10 | |
58 |
|
85 | |||
59 | beaker.cache.short_term.type=memory |
|
86 | beaker.cache.short_term.type=memory | |
60 | beaker.cache.short_term.expire=60 |
|
87 | beaker.cache.short_term.expire=60 | |
61 |
|
88 | |||
62 | beaker.cache.long_term.type=memory |
|
89 | beaker.cache.long_term.type=memory | |
63 | beaker.cache.long_term.expire=36000 |
|
90 | beaker.cache.long_term.expire=36000 | |
64 |
|
91 | |||
65 |
|
92 | |||
66 | beaker.cache.sql_cache_short.type=memory |
|
93 | beaker.cache.sql_cache_short.type=memory | |
67 | beaker.cache.sql_cache_short.expire=5 |
|
94 | beaker.cache.sql_cache_short.expire=5 | |
68 |
|
95 | |||
69 | beaker.cache.sql_cache_med.type=memory |
|
96 | beaker.cache.sql_cache_med.type=memory | |
70 | beaker.cache.sql_cache_med.expire=360 |
|
97 | beaker.cache.sql_cache_med.expire=360 | |
71 |
|
98 | |||
72 | beaker.cache.sql_cache_long.type=file |
|
99 | beaker.cache.sql_cache_long.type=file | |
73 | beaker.cache.sql_cache_long.expire=3600 |
|
100 | beaker.cache.sql_cache_long.expire=3600 | |
74 |
|
101 | |||
75 | #################################### |
|
102 | #################################### | |
76 | ### BEAKER SESSION #### |
|
103 | ### BEAKER SESSION #### | |
77 | #################################### |
|
104 | #################################### | |
78 | ## Type of storage used for the session, current types are |
|
105 | ## Type of storage used for the session, current types are | |
79 | ## dbm, file, memcached, database, and memory. |
|
106 | ## dbm, file, memcached, database, and memory. | |
80 | ## The storage uses the Container API |
|
107 | ## The storage uses the Container API | |
81 | ##that is also used by the cache system. |
|
108 | ##that is also used by the cache system. | |
82 | beaker.session.type = file |
|
109 | beaker.session.type = file | |
83 |
|
110 | |||
84 | beaker.session.key = rhodecode |
|
111 | beaker.session.key = rhodecode | |
85 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
112 | beaker.session.secret = g654dcno0-9873jhgfreyu | |
86 | beaker.session.timeout = 36000 |
|
113 | beaker.session.timeout = 36000 | |
87 |
|
114 | |||
88 | ##auto save the session to not to use .save() |
|
115 | ##auto save the session to not to use .save() | |
89 | beaker.session.auto = False |
|
116 | beaker.session.auto = False | |
90 |
|
117 | |||
91 | ##true exire at browser close |
|
118 | ##true exire at browser close | |
92 | #beaker.session.cookie_expires = 3600 |
|
119 | #beaker.session.cookie_expires = 3600 | |
93 |
|
120 | |||
94 |
|
121 | |||
95 | ################################################################################ |
|
122 | ################################################################################ | |
96 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
123 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
97 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
124 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
98 | ## execute malicious code after an exception is raised. ## |
|
125 | ## execute malicious code after an exception is raised. ## | |
99 | ################################################################################ |
|
126 | ################################################################################ | |
100 | set debug = false |
|
127 | set debug = false | |
101 |
|
128 | |||
102 | ################################## |
|
129 | ################################## | |
103 | ### LOGVIEW CONFIG ### |
|
130 | ### LOGVIEW CONFIG ### | |
104 | ################################## |
|
131 | ################################## | |
105 | logview.sqlalchemy = #faa |
|
132 | logview.sqlalchemy = #faa | |
106 | logview.pylons.templating = #bfb |
|
133 | logview.pylons.templating = #bfb | |
107 | logview.pylons.util = #eee |
|
134 | logview.pylons.util = #eee | |
108 |
|
135 | |||
109 | ######################################################### |
|
136 | ######################################################### | |
110 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
137 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
111 | ######################################################### |
|
138 | ######################################################### | |
112 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
139 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
113 | #sqlalchemy.db1.echo = False |
|
140 | #sqlalchemy.db1.echo = False | |
114 | #sqlalchemy.db1.pool_recycle = 3600 |
|
141 | #sqlalchemy.db1.pool_recycle = 3600 | |
115 | sqlalchemy.convert_unicode = true |
|
142 | sqlalchemy.convert_unicode = true | |
116 |
|
143 | |||
117 | ################################ |
|
144 | ################################ | |
118 | ### LOGGING CONFIGURATION #### |
|
145 | ### LOGGING CONFIGURATION #### | |
119 | ################################ |
|
146 | ################################ | |
120 | [loggers] |
|
147 | [loggers] | |
121 | keys = root, routes, rhodecode, sqlalchemy |
|
148 | keys = root, routes, rhodecode, sqlalchemy | |
122 |
|
149 | |||
123 | [handlers] |
|
150 | [handlers] | |
124 | keys = console |
|
151 | keys = console | |
125 |
|
152 | |||
126 | [formatters] |
|
153 | [formatters] | |
127 | keys = generic,color_formatter |
|
154 | keys = generic,color_formatter | |
128 |
|
155 | |||
129 | ############# |
|
156 | ############# | |
130 | ## LOGGERS ## |
|
157 | ## LOGGERS ## | |
131 | ############# |
|
158 | ############# | |
132 | [logger_root] |
|
159 | [logger_root] | |
133 | level = INFO |
|
160 | level = INFO | |
134 | handlers = console |
|
161 | handlers = console | |
135 |
|
162 | |||
136 | [logger_routes] |
|
163 | [logger_routes] | |
137 | level = INFO |
|
164 | level = INFO | |
138 | handlers = console |
|
165 | handlers = console | |
139 | qualname = routes.middleware |
|
166 | qualname = routes.middleware | |
140 | # "level = DEBUG" logs the route matched and routing variables. |
|
167 | # "level = DEBUG" logs the route matched and routing variables. | |
141 | propagate = 0 |
|
168 | propagate = 0 | |
142 |
|
169 | |||
143 | [logger_rhodecode] |
|
170 | [logger_rhodecode] | |
144 | level = DEBUG |
|
171 | level = DEBUG | |
145 | handlers = console |
|
172 | handlers = console | |
146 | qualname = rhodecode |
|
173 | qualname = rhodecode | |
147 | propagate = 0 |
|
174 | propagate = 0 | |
148 |
|
175 | |||
149 | [logger_sqlalchemy] |
|
176 | [logger_sqlalchemy] | |
150 | level = ERROR |
|
177 | level = ERROR | |
151 | handlers = console |
|
178 | handlers = console | |
152 | qualname = sqlalchemy.engine |
|
179 | qualname = sqlalchemy.engine | |
153 | propagate = 0 |
|
180 | propagate = 0 | |
154 |
|
181 | |||
155 | ############## |
|
182 | ############## | |
156 | ## HANDLERS ## |
|
183 | ## HANDLERS ## | |
157 | ############## |
|
184 | ############## | |
158 |
|
185 | |||
159 | [handler_console] |
|
186 | [handler_console] | |
160 | class = StreamHandler |
|
187 | class = StreamHandler | |
161 | args = (sys.stderr,) |
|
188 | args = (sys.stderr,) | |
162 | level = NOTSET |
|
189 | level = NOTSET | |
163 | formatter = color_formatter |
|
190 | formatter = color_formatter | |
164 |
|
191 | |||
165 | ################ |
|
192 | ################ | |
166 | ## FORMATTERS ## |
|
193 | ## FORMATTERS ## | |
167 | ################ |
|
194 | ################ | |
168 |
|
195 | |||
169 | [formatter_generic] |
|
196 | [formatter_generic] | |
170 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
197 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
171 | datefmt = %Y-%m-%d %H:%M:%S |
|
198 | datefmt = %Y-%m-%d %H:%M:%S | |
172 |
|
199 | |||
173 | [formatter_color_formatter] |
|
200 | [formatter_color_formatter] | |
174 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
201 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
175 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
202 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
176 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
203 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,176 +1,203 b'' | |||||
1 | ################################################################################ |
|
1 | ################################################################################ | |
2 | ################################################################################ |
|
2 | ################################################################################ | |
3 |
# |
|
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 |
|
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 = 10 |
|
32 | threadpool_max_requests = 10 | |
33 |
|
33 | |||
34 | ##option to use threads of process |
|
34 | ##option to use threads of process | |
35 | use_threadpool = true |
|
35 | use_threadpool = true | |
36 |
|
36 | |||
37 | use = egg:Paste#http |
|
37 | use = egg:Paste#http | |
38 | host = 127.0.0.1 |
|
38 | host = 127.0.0.1 | |
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 | app_instance_uuid = ${app_instance_uuid} |
|
48 | app_instance_uuid = ${app_instance_uuid} | |
49 |
|
49 | |||
50 | #################################### |
|
50 | #################################### | |
|
51 | ### CELERY CONFIG #### | |||
|
52 | #################################### | |||
|
53 | use_celery = false | |||
|
54 | broker.host = localhost | |||
|
55 | broker.vhost = rabbitmqhost | |||
|
56 | broker.port = 5672 | |||
|
57 | broker.user = rabbitmq | |||
|
58 | broker.password = qweqwe | |||
|
59 | ||||
|
60 | celery.imports = rhodecode.lib.celerylib.tasks | |||
|
61 | ||||
|
62 | celery.result.backend = amqp | |||
|
63 | celery.result.dburi = amqp:// | |||
|
64 | celery.result.serialier = json | |||
|
65 | ||||
|
66 | #celery.send.task.error.emails = true | |||
|
67 | #celery.amqp.task.result.expires = 18000 | |||
|
68 | ||||
|
69 | celeryd.concurrency = 2 | |||
|
70 | #celeryd.log.file = celeryd.log | |||
|
71 | celeryd.log.level = debug | |||
|
72 | celeryd.max.tasks.per.child = 3 | |||
|
73 | ||||
|
74 | #tasks will never be sent to the queue, but executed locally instead. | |||
|
75 | celery.always.eager = false | |||
|
76 | ||||
|
77 | #################################### | |||
51 | ### BEAKER CACHE #### |
|
78 | ### BEAKER CACHE #### | |
52 | #################################### |
|
79 | #################################### | |
53 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
80 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
54 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
81 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
55 | 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 | |
56 |
|
83 | |||
57 | beaker.cache.super_short_term.type=memory |
|
84 | beaker.cache.super_short_term.type=memory | |
58 | beaker.cache.super_short_term.expire=10 |
|
85 | beaker.cache.super_short_term.expire=10 | |
59 |
|
86 | |||
60 | beaker.cache.short_term.type=memory |
|
87 | beaker.cache.short_term.type=memory | |
61 | beaker.cache.short_term.expire=60 |
|
88 | beaker.cache.short_term.expire=60 | |
62 |
|
89 | |||
63 | beaker.cache.long_term.type=memory |
|
90 | beaker.cache.long_term.type=memory | |
64 | beaker.cache.long_term.expire=36000 |
|
91 | beaker.cache.long_term.expire=36000 | |
65 |
|
92 | |||
66 | beaker.cache.sql_cache_short.type=memory |
|
93 | beaker.cache.sql_cache_short.type=memory | |
67 |
beaker.cache.sql_cache_short.expire= |
|
94 | beaker.cache.sql_cache_short.expire=10 | |
68 |
|
95 | |||
69 | beaker.cache.sql_cache_med.type=memory |
|
96 | beaker.cache.sql_cache_med.type=memory | |
70 | beaker.cache.sql_cache_med.expire=360 |
|
97 | beaker.cache.sql_cache_med.expire=360 | |
71 |
|
98 | |||
72 | beaker.cache.sql_cache_long.type=file |
|
99 | beaker.cache.sql_cache_long.type=file | |
73 | beaker.cache.sql_cache_long.expire=3600 |
|
100 | beaker.cache.sql_cache_long.expire=3600 | |
74 |
|
101 | |||
75 | #################################### |
|
102 | #################################### | |
76 | ### BEAKER SESSION #### |
|
103 | ### BEAKER SESSION #### | |
77 | #################################### |
|
104 | #################################### | |
78 | ## Type of storage used for the session, current types are |
|
105 | ## Type of storage used for the session, current types are | |
79 | ## dbm, file, memcached, database, and memory. |
|
106 | ## dbm, file, memcached, database, and memory. | |
80 | ## The storage uses the Container API |
|
107 | ## The storage uses the Container API | |
81 | ##that is also used by the cache system. |
|
108 | ##that is also used by the cache system. | |
82 | beaker.session.type = file |
|
109 | beaker.session.type = file | |
83 |
|
110 | |||
84 | beaker.session.key = rhodecode |
|
111 | beaker.session.key = rhodecode | |
85 | beaker.session.secret = ${app_instance_secret} |
|
112 | beaker.session.secret = ${app_instance_secret} | |
86 | beaker.session.timeout = 36000 |
|
113 | beaker.session.timeout = 36000 | |
87 |
|
114 | |||
88 | ##auto save the session to not to use .save() |
|
115 | ##auto save the session to not to use .save() | |
89 | beaker.session.auto = False |
|
116 | beaker.session.auto = False | |
90 |
|
117 | |||
91 | ##true exire at browser close |
|
118 | ##true exire at browser close | |
92 | #beaker.session.cookie_expires = 3600 |
|
119 | #beaker.session.cookie_expires = 3600 | |
93 |
|
120 | |||
94 |
|
121 | |||
95 | ################################################################################ |
|
122 | ################################################################################ | |
96 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
123 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
97 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
124 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
98 | ## execute malicious code after an exception is raised. ## |
|
125 | ## execute malicious code after an exception is raised. ## | |
99 | ################################################################################ |
|
126 | ################################################################################ | |
100 | set debug = false |
|
127 | set debug = false | |
101 |
|
128 | |||
102 | ################################## |
|
129 | ################################## | |
103 | ### LOGVIEW CONFIG ### |
|
130 | ### LOGVIEW CONFIG ### | |
104 | ################################## |
|
131 | ################################## | |
105 | logview.sqlalchemy = #faa |
|
132 | logview.sqlalchemy = #faa | |
106 | logview.pylons.templating = #bfb |
|
133 | logview.pylons.templating = #bfb | |
107 | logview.pylons.util = #eee |
|
134 | logview.pylons.util = #eee | |
108 |
|
135 | |||
109 | ######################################################### |
|
136 | ######################################################### | |
110 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
137 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
111 | ######################################################### |
|
138 | ######################################################### | |
112 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
139 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
113 | #sqlalchemy.db1.echo = False |
|
140 | #sqlalchemy.db1.echo = False | |
114 | #sqlalchemy.db1.pool_recycle = 3600 |
|
141 | #sqlalchemy.db1.pool_recycle = 3600 | |
115 | sqlalchemy.convert_unicode = true |
|
142 | sqlalchemy.convert_unicode = true | |
116 |
|
143 | |||
117 | ################################ |
|
144 | ################################ | |
118 | ### LOGGING CONFIGURATION #### |
|
145 | ### LOGGING CONFIGURATION #### | |
119 | ################################ |
|
146 | ################################ | |
120 | [loggers] |
|
147 | [loggers] | |
121 | keys = root, routes, rhodecode, sqlalchemy |
|
148 | keys = root, routes, rhodecode, sqlalchemy | |
122 |
|
149 | |||
123 | [handlers] |
|
150 | [handlers] | |
124 | keys = console |
|
151 | keys = console | |
125 |
|
152 | |||
126 | [formatters] |
|
153 | [formatters] | |
127 | keys = generic,color_formatter |
|
154 | keys = generic,color_formatter | |
128 |
|
155 | |||
129 | ############# |
|
156 | ############# | |
130 | ## LOGGERS ## |
|
157 | ## LOGGERS ## | |
131 | ############# |
|
158 | ############# | |
132 | [logger_root] |
|
159 | [logger_root] | |
133 | level = INFO |
|
160 | level = INFO | |
134 | handlers = console |
|
161 | handlers = console | |
135 |
|
162 | |||
136 | [logger_routes] |
|
163 | [logger_routes] | |
137 | level = INFO |
|
164 | level = INFO | |
138 | handlers = console |
|
165 | handlers = console | |
139 | qualname = routes.middleware |
|
166 | qualname = routes.middleware | |
140 | # "level = DEBUG" logs the route matched and routing variables. |
|
167 | # "level = DEBUG" logs the route matched and routing variables. | |
141 | propagate = 0 |
|
168 | propagate = 0 | |
142 |
|
169 | |||
143 | [logger_rhodecode] |
|
170 | [logger_rhodecode] | |
144 | level = DEBUG |
|
171 | level = DEBUG | |
145 | handlers = console |
|
172 | handlers = console | |
146 | qualname = rhodecode |
|
173 | qualname = rhodecode | |
147 | propagate = 0 |
|
174 | propagate = 0 | |
148 |
|
175 | |||
149 | [logger_sqlalchemy] |
|
176 | [logger_sqlalchemy] | |
150 | level = ERROR |
|
177 | level = ERROR | |
151 | handlers = console |
|
178 | handlers = console | |
152 | qualname = sqlalchemy.engine |
|
179 | qualname = sqlalchemy.engine | |
153 | propagate = 0 |
|
180 | propagate = 0 | |
154 |
|
181 | |||
155 | ############## |
|
182 | ############## | |
156 | ## HANDLERS ## |
|
183 | ## HANDLERS ## | |
157 | ############## |
|
184 | ############## | |
158 |
|
185 | |||
159 | [handler_console] |
|
186 | [handler_console] | |
160 | class = StreamHandler |
|
187 | class = StreamHandler | |
161 | args = (sys.stderr,) |
|
188 | args = (sys.stderr,) | |
162 | level = NOTSET |
|
189 | level = NOTSET | |
163 | formatter = color_formatter |
|
190 | formatter = color_formatter | |
164 |
|
191 | |||
165 | ################ |
|
192 | ################ | |
166 | ## FORMATTERS ## |
|
193 | ## FORMATTERS ## | |
167 | ################ |
|
194 | ################ | |
168 |
|
195 | |||
169 | [formatter_generic] |
|
196 | [formatter_generic] | |
170 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
197 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
171 | datefmt = %Y-%m-%d %H:%M:%S |
|
198 | datefmt = %Y-%m-%d %H:%M:%S | |
172 |
|
199 | |||
173 | [formatter_color_formatter] |
|
200 | [formatter_color_formatter] | |
174 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
201 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
175 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
202 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
176 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
203 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,64 +1,74 b'' | |||||
|
1 | import os | |||
|
2 | import sys | |||
|
3 | import socket | |||
|
4 | import traceback | |||
|
5 | import logging | |||
|
6 | ||||
1 | from rhodecode.lib.pidlock import DaemonLock, LockHeld |
|
7 | from rhodecode.lib.pidlock import DaemonLock, LockHeld | |
2 | from vcs.utils.lazy import LazyProperty |
|
8 | from vcs.utils.lazy import LazyProperty | |
3 | from decorator import decorator |
|
9 | from decorator import decorator | |
4 | import logging |
|
|||
5 | import os |
|
|||
6 | import sys |
|
|||
7 | import traceback |
|
|||
8 | from hashlib import md5 |
|
10 | from hashlib import md5 | |
9 | import socket |
|
11 | from pylons import config | |
|
12 | ||||
10 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
11 |
|
14 | |||
|
15 | def str2bool(v): | |||
|
16 | return v.lower() in ["yes", "true", "t", "1"] if v else None | |||
|
17 | ||||
|
18 | CELERY_ON = str2bool(config['app_conf'].get('use_celery')) | |||
|
19 | ||||
12 | class ResultWrapper(object): |
|
20 | class ResultWrapper(object): | |
13 | def __init__(self, task): |
|
21 | def __init__(self, task): | |
14 | self.task = task |
|
22 | self.task = task | |
15 |
|
23 | |||
16 | @LazyProperty |
|
24 | @LazyProperty | |
17 | def result(self): |
|
25 | def result(self): | |
18 | return self.task |
|
26 | return self.task | |
19 |
|
27 | |||
20 | def run_task(task, *args, **kwargs): |
|
28 | def run_task(task, *args, **kwargs): | |
|
29 | if CELERY_ON: | |||
21 | try: |
|
30 | try: | |
22 | t = task.delay(*args, **kwargs) |
|
31 | t = task.delay(*args, **kwargs) | |
23 | log.info('running task %s', t.task_id) |
|
32 | log.info('running task %s:%s', t.task_id, task) | |
24 | return t |
|
33 | return t | |
25 | except socket.error, e: |
|
34 | except socket.error, e: | |
26 | if e.errno == 111: |
|
35 | if e.errno == 111: | |
27 | log.debug('Unable to connect to celeryd. Sync execution') |
|
36 | log.debug('Unable to connect to celeryd. Sync execution') | |
28 | else: |
|
37 | else: | |
29 |
log.error(traceback.format_exc()) |
|
38 | log.error(traceback.format_exc()) | |
30 | except KeyError, e: |
|
39 | except KeyError, e: | |
31 | log.debug('Unable to connect to celeryd. Sync execution') |
|
40 | log.debug('Unable to connect to celeryd. Sync execution') | |
32 | except Exception, e: |
|
41 | except Exception, e: | |
33 | log.error(traceback.format_exc()) |
|
42 | log.error(traceback.format_exc()) | |
34 |
|
43 | |||
|
44 | log.debug('executing task %s in sync mode', task) | |||
35 | return ResultWrapper(task(*args, **kwargs)) |
|
45 | return ResultWrapper(task(*args, **kwargs)) | |
36 |
|
46 | |||
37 |
|
47 | |||
38 | def locked_task(func): |
|
48 | def locked_task(func): | |
39 | def __wrapper(func, *fargs, **fkwargs): |
|
49 | def __wrapper(func, *fargs, **fkwargs): | |
40 | params = list(fargs) |
|
50 | params = list(fargs) | |
41 | params.extend(['%s-%s' % ar for ar in fkwargs.items()]) |
|
51 | params.extend(['%s-%s' % ar for ar in fkwargs.items()]) | |
42 |
|
52 | |||
43 | lockkey = 'task_%s' % \ |
|
53 | lockkey = 'task_%s' % \ | |
44 | md5(str(func.__name__) + '-' + \ |
|
54 | md5(str(func.__name__) + '-' + \ | |
45 | '-'.join(map(str, params))).hexdigest() |
|
55 | '-'.join(map(str, params))).hexdigest() | |
46 | log.info('running task with lockkey %s', lockkey) |
|
56 | log.info('running task with lockkey %s', lockkey) | |
47 | try: |
|
57 | try: | |
48 | l = DaemonLock(lockkey) |
|
58 | l = DaemonLock(lockkey) | |
49 | ret = func(*fargs, **fkwargs) |
|
59 | ret = func(*fargs, **fkwargs) | |
50 | l.release() |
|
60 | l.release() | |
51 | return ret |
|
61 | return ret | |
52 | except LockHeld: |
|
62 | except LockHeld: | |
53 | log.info('LockHeld') |
|
63 | log.info('LockHeld') | |
54 |
return 'Task with key %s already running' % lockkey |
|
64 | return 'Task with key %s already running' % lockkey | |
55 |
|
65 | |||
56 |
return decorator(__wrapper, func) |
|
66 | return decorator(__wrapper, func) | |
57 |
|
67 | |||
58 |
|
68 | |||
59 |
|
69 | |||
60 |
|
70 | |||
61 |
|
71 | |||
62 |
|
72 | |||
63 |
|
73 | |||
64 |
|
74 |
@@ -1,324 +1,363 b'' | |||||
1 | from celery.decorators import task |
|
1 | from celery.decorators import task | |
2 |
|
2 | |||
3 | import os |
|
3 | import os | |
4 | import traceback |
|
4 | import traceback | |
|
5 | import beaker | |||
5 | from time import mktime |
|
6 | from time import mktime | |
6 |
|
||||
7 | from operator import itemgetter |
|
7 | from operator import itemgetter | |
|
8 | ||||
|
9 | from pylons import config | |||
8 | from pylons.i18n.translation import _ |
|
10 | from pylons.i18n.translation import _ | |
9 | from rhodecode.lib.celerylib import run_task, locked_task |
|
11 | ||
|
12 | from rhodecode.lib.celerylib import run_task, locked_task, str2bool | |||
10 | from rhodecode.lib.helpers import person |
|
13 | from rhodecode.lib.helpers import person | |
11 | from rhodecode.lib.smtp_mailer import SmtpMailer |
|
14 | from rhodecode.lib.smtp_mailer import SmtpMailer | |
12 | from rhodecode.lib.utils import OrderedDict |
|
15 | from rhodecode.lib.utils import OrderedDict | |
|
16 | from rhodecode.model import init_model | |||
|
17 | from rhodecode.model import meta | |||
|
18 | from rhodecode.model.db import RhodeCodeUi | |||
|
19 | ||||
13 | from vcs.backends import get_repo |
|
20 | from vcs.backends import get_repo | |
14 | from rhodecode.model.db import RhodeCodeUi |
|
21 | ||
|
22 | from sqlalchemy import engine_from_config | |||
15 |
|
23 | |||
16 | try: |
|
24 | try: | |
17 | import json |
|
25 | import json | |
18 | except ImportError: |
|
26 | except ImportError: | |
19 | #python 2.5 compatibility |
|
27 | #python 2.5 compatibility | |
20 | import simplejson as json |
|
28 | import simplejson as json | |
21 |
|
29 | |||
22 | try: |
|
|||
23 | from celeryconfig import PYLONS_CONFIG as config |
|
|||
24 | celery_on = True |
|
|||
25 | except ImportError: |
|
|||
26 | #if celeryconfig is not present let's just load our pylons |
|
|||
27 | #config instead |
|
|||
28 | from pylons import config |
|
|||
29 | celery_on = False |
|
|||
30 |
|
||||
31 |
|
||||
32 | __all__ = ['whoosh_index', 'get_commits_stats', |
|
30 | __all__ = ['whoosh_index', 'get_commits_stats', | |
33 | 'reset_user_password', 'send_email'] |
|
31 | 'reset_user_password', 'send_email'] | |
34 |
|
32 | |||
|
33 | CELERY_ON = str2bool(config['app_conf'].get('use_celery')) | |||
|
34 | ||||
35 | def get_session(): |
|
35 | def get_session(): | |
36 | if celery_on: |
|
36 | if CELERY_ON: | |
37 | from sqlalchemy import engine_from_config |
|
37 | engine = engine_from_config(config, 'sqlalchemy.db1.') | |
38 | from sqlalchemy.orm import sessionmaker, scoped_session |
|
38 | init_model(engine) | |
39 | engine = engine_from_config(dict(config.items('app:main')), |
|
39 | sa = meta.Session() | |
40 | 'sqlalchemy.db1.') |
|
|||
41 | sa = scoped_session(sessionmaker(bind=engine)) |
|
|||
42 | else: |
|
|||
43 | #If we don't use celery reuse our current application Session |
|
|||
44 | from rhodecode.model.meta import Session |
|
|||
45 | sa = Session() |
|
|||
46 |
|
||||
47 | return sa |
|
40 | return sa | |
48 |
|
41 | |||
49 | def get_repos_path(): |
|
42 | def get_repos_path(): | |
50 | sa = get_session() |
|
43 | sa = get_session() | |
51 | q = sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one() |
|
44 | q = sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one() | |
52 | return q.ui_value |
|
45 | return q.ui_value | |
53 |
|
46 | |||
54 | @task |
|
47 | @task | |
55 | @locked_task |
|
48 | @locked_task | |
56 | def whoosh_index(repo_location, full_index): |
|
49 | def whoosh_index(repo_location, full_index): | |
57 | log = whoosh_index.get_logger() |
|
50 | log = whoosh_index.get_logger() | |
58 | from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon |
|
51 | from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon | |
59 |
index_location = |
|
52 | index_location = config['index_dir'] | |
60 | WhooshIndexingDaemon(index_location=index_location, |
|
53 | WhooshIndexingDaemon(index_location=index_location, | |
61 | repo_location=repo_location).run(full_index=full_index) |
|
54 | repo_location=repo_location).run(full_index=full_index) | |
62 |
|
55 | |||
63 | @task |
|
56 | @task | |
64 | @locked_task |
|
57 | @locked_task | |
65 | def get_commits_stats(repo_name, ts_min_y, ts_max_y): |
|
58 | def get_commits_stats(repo_name, ts_min_y, ts_max_y): | |
66 | from rhodecode.model.db import Statistics, Repository |
|
59 | from rhodecode.model.db import Statistics, Repository | |
67 | log = get_commits_stats.get_logger() |
|
60 | log = get_commits_stats.get_logger() | |
68 |
|
61 | |||
69 | #for js data compatibilty |
|
62 | #for js data compatibilty | |
70 | author_key_cleaner = lambda k: person(k).replace('"', "") |
|
63 | author_key_cleaner = lambda k: person(k).replace('"', "") | |
71 |
|
64 | |||
72 | commits_by_day_author_aggregate = {} |
|
65 | commits_by_day_author_aggregate = {} | |
73 | commits_by_day_aggregate = {} |
|
66 | commits_by_day_aggregate = {} | |
74 | repos_path = get_repos_path() |
|
67 | repos_path = get_repos_path() | |
75 | p = os.path.join(repos_path, repo_name) |
|
68 | p = os.path.join(repos_path, repo_name) | |
76 | repo = get_repo(p) |
|
69 | repo = get_repo(p) | |
77 |
|
70 | |||
78 | skip_date_limit = True |
|
71 | skip_date_limit = True | |
79 | parse_limit = 250 #limit for single task changeset parsing optimal for |
|
72 | parse_limit = 250 #limit for single task changeset parsing optimal for | |
80 | last_rev = 0 |
|
73 | last_rev = 0 | |
81 | last_cs = None |
|
74 | last_cs = None | |
82 | timegetter = itemgetter('time') |
|
75 | timegetter = itemgetter('time') | |
83 |
|
76 | |||
84 | sa = get_session() |
|
77 | sa = get_session() | |
85 |
|
78 | |||
86 | dbrepo = sa.query(Repository)\ |
|
79 | dbrepo = sa.query(Repository)\ | |
87 | .filter(Repository.repo_name == repo_name).scalar() |
|
80 | .filter(Repository.repo_name == repo_name).scalar() | |
88 | cur_stats = sa.query(Statistics)\ |
|
81 | cur_stats = sa.query(Statistics)\ | |
89 | .filter(Statistics.repository == dbrepo).scalar() |
|
82 | .filter(Statistics.repository == dbrepo).scalar() | |
90 | if cur_stats: |
|
83 | if cur_stats: | |
91 | last_rev = cur_stats.stat_on_revision |
|
84 | last_rev = cur_stats.stat_on_revision | |
92 | if not repo.revisions: |
|
85 | if not repo.revisions: | |
93 | return True |
|
86 | return True | |
94 |
|
87 | |||
95 | if last_rev == repo.revisions[-1] and len(repo.revisions) > 1: |
|
88 | if last_rev == repo.revisions[-1] and len(repo.revisions) > 1: | |
96 | #pass silently without any work if we're not on first revision or |
|
89 | #pass silently without any work if we're not on first revision or | |
97 | #current state of parsing revision(from db marker) is the last revision |
|
90 | #current state of parsing revision(from db marker) is the last revision | |
98 | return True |
|
91 | return True | |
99 |
|
92 | |||
100 | if cur_stats: |
|
93 | if cur_stats: | |
101 | commits_by_day_aggregate = OrderedDict( |
|
94 | commits_by_day_aggregate = OrderedDict( | |
102 | json.loads( |
|
95 | json.loads( | |
103 | cur_stats.commit_activity_combined)) |
|
96 | cur_stats.commit_activity_combined)) | |
104 | commits_by_day_author_aggregate = json.loads(cur_stats.commit_activity) |
|
97 | commits_by_day_author_aggregate = json.loads(cur_stats.commit_activity) | |
105 |
|
98 | |||
106 | log.debug('starting parsing %s', parse_limit) |
|
99 | log.debug('starting parsing %s', parse_limit) | |
107 | lmktime = mktime |
|
100 | lmktime = mktime | |
108 |
|
101 | |||
109 | for cnt, rev in enumerate(repo.revisions[last_rev:]): |
|
102 | for cnt, rev in enumerate(repo.revisions[last_rev:]): | |
110 | last_cs = cs = repo.get_changeset(rev) |
|
103 | last_cs = cs = repo.get_changeset(rev) | |
111 | k = '%s-%s-%s' % (cs.date.timetuple()[0], cs.date.timetuple()[1], |
|
104 | k = '%s-%s-%s' % (cs.date.timetuple()[0], cs.date.timetuple()[1], | |
112 | cs.date.timetuple()[2]) |
|
105 | cs.date.timetuple()[2]) | |
113 | timetupple = [int(x) for x in k.split('-')] |
|
106 | timetupple = [int(x) for x in k.split('-')] | |
114 | timetupple.extend([0 for _ in xrange(6)]) |
|
107 | timetupple.extend([0 for _ in xrange(6)]) | |
115 | k = lmktime(timetupple) |
|
108 | k = lmktime(timetupple) | |
116 | if commits_by_day_author_aggregate.has_key(author_key_cleaner(cs.author)): |
|
109 | if commits_by_day_author_aggregate.has_key(author_key_cleaner(cs.author)): | |
117 | try: |
|
110 | try: | |
118 | l = [timegetter(x) for x in commits_by_day_author_aggregate\ |
|
111 | l = [timegetter(x) for x in commits_by_day_author_aggregate\ | |
119 | [author_key_cleaner(cs.author)]['data']] |
|
112 | [author_key_cleaner(cs.author)]['data']] | |
120 | time_pos = l.index(k) |
|
113 | time_pos = l.index(k) | |
121 | except ValueError: |
|
114 | except ValueError: | |
122 | time_pos = False |
|
115 | time_pos = False | |
123 |
|
116 | |||
124 | if time_pos >= 0 and time_pos is not False: |
|
117 | if time_pos >= 0 and time_pos is not False: | |
125 |
|
118 | |||
126 | datadict = commits_by_day_author_aggregate\ |
|
119 | datadict = commits_by_day_author_aggregate\ | |
127 | [author_key_cleaner(cs.author)]['data'][time_pos] |
|
120 | [author_key_cleaner(cs.author)]['data'][time_pos] | |
128 |
|
121 | |||
129 | datadict["commits"] += 1 |
|
122 | datadict["commits"] += 1 | |
130 | datadict["added"] += len(cs.added) |
|
123 | datadict["added"] += len(cs.added) | |
131 | datadict["changed"] += len(cs.changed) |
|
124 | datadict["changed"] += len(cs.changed) | |
132 | datadict["removed"] += len(cs.removed) |
|
125 | datadict["removed"] += len(cs.removed) | |
133 |
|
126 | |||
134 | else: |
|
127 | else: | |
135 | if k >= ts_min_y and k <= ts_max_y or skip_date_limit: |
|
128 | if k >= ts_min_y and k <= ts_max_y or skip_date_limit: | |
136 |
|
129 | |||
137 | datadict = {"time":k, |
|
130 | datadict = {"time":k, | |
138 | "commits":1, |
|
131 | "commits":1, | |
139 | "added":len(cs.added), |
|
132 | "added":len(cs.added), | |
140 | "changed":len(cs.changed), |
|
133 | "changed":len(cs.changed), | |
141 | "removed":len(cs.removed), |
|
134 | "removed":len(cs.removed), | |
142 | } |
|
135 | } | |
143 | commits_by_day_author_aggregate\ |
|
136 | commits_by_day_author_aggregate\ | |
144 | [author_key_cleaner(cs.author)]['data'].append(datadict) |
|
137 | [author_key_cleaner(cs.author)]['data'].append(datadict) | |
145 |
|
138 | |||
146 | else: |
|
139 | else: | |
147 | if k >= ts_min_y and k <= ts_max_y or skip_date_limit: |
|
140 | if k >= ts_min_y and k <= ts_max_y or skip_date_limit: | |
148 | commits_by_day_author_aggregate[author_key_cleaner(cs.author)] = { |
|
141 | commits_by_day_author_aggregate[author_key_cleaner(cs.author)] = { | |
149 | "label":author_key_cleaner(cs.author), |
|
142 | "label":author_key_cleaner(cs.author), | |
150 | "data":[{"time":k, |
|
143 | "data":[{"time":k, | |
151 | "commits":1, |
|
144 | "commits":1, | |
152 | "added":len(cs.added), |
|
145 | "added":len(cs.added), | |
153 | "changed":len(cs.changed), |
|
146 | "changed":len(cs.changed), | |
154 | "removed":len(cs.removed), |
|
147 | "removed":len(cs.removed), | |
155 | }], |
|
148 | }], | |
156 | "schema":["commits"], |
|
149 | "schema":["commits"], | |
157 | } |
|
150 | } | |
158 |
|
151 | |||
159 | #gather all data by day |
|
152 | #gather all data by day | |
160 | if commits_by_day_aggregate.has_key(k): |
|
153 | if commits_by_day_aggregate.has_key(k): | |
161 | commits_by_day_aggregate[k] += 1 |
|
154 | commits_by_day_aggregate[k] += 1 | |
162 | else: |
|
155 | else: | |
163 | commits_by_day_aggregate[k] = 1 |
|
156 | commits_by_day_aggregate[k] = 1 | |
164 |
|
157 | |||
165 | if cnt >= parse_limit: |
|
158 | if cnt >= parse_limit: | |
166 | #don't fetch to much data since we can freeze application |
|
159 | #don't fetch to much data since we can freeze application | |
167 | break |
|
160 | break | |
168 | overview_data = [] |
|
161 | overview_data = [] | |
169 | for k, v in commits_by_day_aggregate.items(): |
|
162 | for k, v in commits_by_day_aggregate.items(): | |
170 | overview_data.append([k, v]) |
|
163 | overview_data.append([k, v]) | |
171 | overview_data = sorted(overview_data, key=itemgetter(0)) |
|
164 | overview_data = sorted(overview_data, key=itemgetter(0)) | |
172 | if not commits_by_day_author_aggregate: |
|
165 | if not commits_by_day_author_aggregate: | |
173 | commits_by_day_author_aggregate[author_key_cleaner(repo.contact)] = { |
|
166 | commits_by_day_author_aggregate[author_key_cleaner(repo.contact)] = { | |
174 | "label":author_key_cleaner(repo.contact), |
|
167 | "label":author_key_cleaner(repo.contact), | |
175 | "data":[0, 1], |
|
168 | "data":[0, 1], | |
176 | "schema":["commits"], |
|
169 | "schema":["commits"], | |
177 | } |
|
170 | } | |
178 |
|
171 | |||
179 | stats = cur_stats if cur_stats else Statistics() |
|
172 | stats = cur_stats if cur_stats else Statistics() | |
180 | stats.commit_activity = json.dumps(commits_by_day_author_aggregate) |
|
173 | stats.commit_activity = json.dumps(commits_by_day_author_aggregate) | |
181 | stats.commit_activity_combined = json.dumps(overview_data) |
|
174 | stats.commit_activity_combined = json.dumps(overview_data) | |
182 |
|
175 | |||
183 | log.debug('last revison %s', last_rev) |
|
176 | log.debug('last revison %s', last_rev) | |
184 | leftovers = len(repo.revisions[last_rev:]) |
|
177 | leftovers = len(repo.revisions[last_rev:]) | |
185 | log.debug('revisions to parse %s', leftovers) |
|
178 | log.debug('revisions to parse %s', leftovers) | |
186 |
|
179 | |||
187 | if last_rev == 0 or leftovers < parse_limit: |
|
180 | if last_rev == 0 or leftovers < parse_limit: | |
188 | stats.languages = json.dumps(__get_codes_stats(repo_name)) |
|
181 | stats.languages = json.dumps(__get_codes_stats(repo_name)) | |
189 |
|
182 | |||
190 | stats.repository = dbrepo |
|
183 | stats.repository = dbrepo | |
191 | stats.stat_on_revision = last_cs.revision |
|
184 | stats.stat_on_revision = last_cs.revision | |
192 |
|
185 | |||
193 | try: |
|
186 | try: | |
194 | sa.add(stats) |
|
187 | sa.add(stats) | |
195 | sa.commit() |
|
188 | sa.commit() | |
196 | except: |
|
189 | except: | |
197 | log.error(traceback.format_exc()) |
|
190 | log.error(traceback.format_exc()) | |
198 | sa.rollback() |
|
191 | sa.rollback() | |
199 | return False |
|
192 | return False | |
200 | if len(repo.revisions) > 1: |
|
193 | if len(repo.revisions) > 1: | |
201 | run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y) |
|
194 | run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y) | |
202 |
|
195 | |||
203 | return True |
|
196 | return True | |
204 |
|
197 | |||
205 | @task |
|
198 | @task | |
206 | def reset_user_password(user_email): |
|
199 | def reset_user_password(user_email): | |
207 | log = reset_user_password.get_logger() |
|
200 | log = reset_user_password.get_logger() | |
208 | from rhodecode.lib import auth |
|
201 | from rhodecode.lib import auth | |
209 | from rhodecode.model.db import User |
|
202 | from rhodecode.model.db import User | |
210 |
|
203 | |||
211 | try: |
|
204 | try: | |
212 | try: |
|
205 | try: | |
213 | sa = get_session() |
|
206 | sa = get_session() | |
214 | user = sa.query(User).filter(User.email == user_email).scalar() |
|
207 | user = sa.query(User).filter(User.email == user_email).scalar() | |
215 | new_passwd = auth.PasswordGenerator().gen_password(8, |
|
208 | new_passwd = auth.PasswordGenerator().gen_password(8, | |
216 | auth.PasswordGenerator.ALPHABETS_BIG_SMALL) |
|
209 | auth.PasswordGenerator.ALPHABETS_BIG_SMALL) | |
217 | if user: |
|
210 | if user: | |
218 | user.password = auth.get_crypt_password(new_passwd) |
|
211 | user.password = auth.get_crypt_password(new_passwd) | |
219 | sa.add(user) |
|
212 | sa.add(user) | |
220 | sa.commit() |
|
213 | sa.commit() | |
221 | log.info('change password for %s', user_email) |
|
214 | log.info('change password for %s', user_email) | |
222 | if new_passwd is None: |
|
215 | if new_passwd is None: | |
223 | raise Exception('unable to generate new password') |
|
216 | raise Exception('unable to generate new password') | |
224 |
|
217 | |||
225 | except: |
|
218 | except: | |
226 | log.error(traceback.format_exc()) |
|
219 | log.error(traceback.format_exc()) | |
227 | sa.rollback() |
|
220 | sa.rollback() | |
228 |
|
221 | |||
229 | run_task(send_email, user_email, |
|
222 | run_task(send_email, user_email, | |
230 | "Your new rhodecode password", |
|
223 | "Your new rhodecode password", | |
231 | 'Your new rhodecode password:%s' % (new_passwd)) |
|
224 | 'Your new rhodecode password:%s' % (new_passwd)) | |
232 | log.info('send new password mail to %s', user_email) |
|
225 | log.info('send new password mail to %s', user_email) | |
233 |
|
226 | |||
234 |
|
227 | |||
235 | except: |
|
228 | except: | |
236 | log.error('Failed to update user password') |
|
229 | log.error('Failed to update user password') | |
237 | log.error(traceback.format_exc()) |
|
230 | log.error(traceback.format_exc()) | |
|
231 | ||||
238 | return True |
|
232 | return True | |
239 |
|
233 | |||
240 | @task |
|
234 | @task | |
241 | def send_email(recipients, subject, body): |
|
235 | def send_email(recipients, subject, body): | |
242 | """ |
|
236 | """ | |
243 | Sends an email with defined parameters from the .ini files. |
|
237 | Sends an email with defined parameters from the .ini files. | |
244 |
|
238 | |||
245 |
|
239 | |||
246 | :param recipients: list of recipients, it this is empty the defined email |
|
240 | :param recipients: list of recipients, it this is empty the defined email | |
247 | address from field 'email_to' is used instead |
|
241 | address from field 'email_to' is used instead | |
248 | :param subject: subject of the mail |
|
242 | :param subject: subject of the mail | |
249 | :param body: body of the mail |
|
243 | :param body: body of the mail | |
250 | """ |
|
244 | """ | |
251 | log = send_email.get_logger() |
|
245 | log = send_email.get_logger() | |
252 |
email_config = |
|
246 | email_config = config | |
253 |
|
247 | |||
254 | if not recipients: |
|
248 | if not recipients: | |
255 | recipients = [email_config.get('email_to')] |
|
249 | recipients = [email_config.get('email_to')] | |
256 |
|
250 | |||
257 | def str2bool(v): |
|
|||
258 | return v.lower() in ["yes", "true", "t", "1"] if v else None |
|
|||
259 |
|
||||
260 | mail_from = email_config.get('app_email_from') |
|
251 | mail_from = email_config.get('app_email_from') | |
261 | user = email_config.get('smtp_username') |
|
252 | user = email_config.get('smtp_username') | |
262 | passwd = email_config.get('smtp_password') |
|
253 | passwd = email_config.get('smtp_password') | |
263 | mail_server = email_config.get('smtp_server') |
|
254 | mail_server = email_config.get('smtp_server') | |
264 | mail_port = email_config.get('smtp_port') |
|
255 | mail_port = email_config.get('smtp_port') | |
265 | tls = str2bool(email_config.get('smtp_use_tls')) |
|
256 | tls = str2bool(email_config.get('smtp_use_tls')) | |
266 | ssl = str2bool(email_config.get('smtp_use_ssl')) |
|
257 | ssl = str2bool(email_config.get('smtp_use_ssl')) | |
267 |
|
258 | |||
268 | try: |
|
259 | try: | |
269 | m = SmtpMailer(mail_from, user, passwd, mail_server, |
|
260 | m = SmtpMailer(mail_from, user, passwd, mail_server, | |
270 | mail_port, ssl, tls) |
|
261 | mail_port, ssl, tls) | |
271 | m.send(recipients, subject, body) |
|
262 | m.send(recipients, subject, body) | |
272 | except: |
|
263 | except: | |
273 | log.error('Mail sending failed') |
|
264 | log.error('Mail sending failed') | |
274 | log.error(traceback.format_exc()) |
|
265 | log.error(traceback.format_exc()) | |
275 | return False |
|
266 | return False | |
276 | return True |
|
267 | return True | |
277 |
|
268 | |||
278 | @task |
|
269 | @task | |
279 | def create_repo_fork(form_data, cur_user): |
|
270 | def create_repo_fork(form_data, cur_user): | |
280 | from rhodecode.model.repo import RepoModel |
|
271 | from rhodecode.model.repo import RepoModel | |
281 | from vcs import get_backend |
|
272 | from vcs import get_backend | |
282 | log = create_repo_fork.get_logger() |
|
273 | log = create_repo_fork.get_logger() | |
283 | repo_model = RepoModel(get_session()) |
|
274 | repo_model = RepoModel(get_session()) | |
284 | repo_model.create(form_data, cur_user, just_db=True, fork=True) |
|
275 | repo_model.create(form_data, cur_user, just_db=True, fork=True) | |
285 | repo_name = form_data['repo_name'] |
|
276 | repo_name = form_data['repo_name'] | |
286 | repos_path = get_repos_path() |
|
277 | repos_path = get_repos_path() | |
287 | repo_path = os.path.join(repos_path, repo_name) |
|
278 | repo_path = os.path.join(repos_path, repo_name) | |
288 | repo_fork_path = os.path.join(repos_path, form_data['fork_name']) |
|
279 | repo_fork_path = os.path.join(repos_path, form_data['fork_name']) | |
289 | alias = form_data['repo_type'] |
|
280 | alias = form_data['repo_type'] | |
290 |
|
281 | |||
291 | log.info('creating repo fork %s as %s', repo_name, repo_path) |
|
282 | log.info('creating repo fork %s as %s', repo_name, repo_path) | |
292 | backend = get_backend(alias) |
|
283 | backend = get_backend(alias) | |
293 | backend(str(repo_fork_path), create=True, src_url=str(repo_path)) |
|
284 | backend(str(repo_fork_path), create=True, src_url=str(repo_path)) | |
294 |
|
285 | |||
295 | def __get_codes_stats(repo_name): |
|
286 | def __get_codes_stats(repo_name): | |
296 |
LANGUAGES_EXTENSIONS = |
|
287 | LANGUAGES_EXTENSIONS_MAP = {'scm': 'Scheme', 'asmx': 'VbNetAspx', 'Rout': | |
297 | 'aspx', 'asx', 'axd', 'c', 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el', |
|
288 | 'RConsole', 'rest': 'Rst', 'abap': 'ABAP', 'go': 'Go', 'phtml': 'HtmlPhp', | |
298 | 'erl', 'h', 'java', 'js', 'jsp', 'jspx', 'lisp', 'lua', 'm', 'mako', 'ml', |
|
289 | 'ns2': 'Newspeak', 'xml': 'EvoqueXml', 'sh-session': 'BashSession', 'ads': | |
299 | 'pas', 'patch', 'php', 'php3', 'php4', 'phtml', 'pm', 'py', 'rb', 'rst', |
|
290 | 'Ada', 'clj': 'Clojure', 'll': 'Llvm', 'ebuild': 'Bash', 'adb': 'Ada', | |
300 | 's', 'sh', 'tpl', 'txt', 'vim', 'wss', 'xhtml', 'xml', 'xsl', 'xslt', 'yaws'] |
|
291 | 'ada': 'Ada', 'c++-objdump': 'CppObjdump', 'aspx': | |
301 |
|
292 | 'VbNetAspx', 'ksh': 'Bash', 'coffee': 'CoffeeScript', 'vert': 'GLShader', | ||
|
293 | 'Makefile.*': 'Makefile', 'di': 'D', 'dpatch': 'DarcsPatch', 'rake': | |||
|
294 | 'Ruby', 'moo': 'MOOCode', 'erl-sh': 'ErlangShell', 'geo': 'GLShader', | |||
|
295 | 'pov': 'Povray', 'bas': 'VbNet', 'bat': 'Batch', 'd': 'D', 'lisp': | |||
|
296 | 'CommonLisp', 'h': 'C', 'rbx': 'Ruby', 'tcl': 'Tcl', 'c++': 'Cpp', 'md': | |||
|
297 | 'MiniD', '.vimrc': 'Vim', 'xsd': 'Xml', 'ml': 'Ocaml', 'el': 'CommonLisp', | |||
|
298 | 'befunge': 'Befunge', 'xsl': 'Xslt', 'pyx': 'Cython', 'cfm': | |||
|
299 | 'ColdfusionHtml', 'evoque': 'Evoque', 'cfg': 'Ini', 'htm': 'Html', | |||
|
300 | 'Makefile': 'Makefile', 'cfc': 'ColdfusionHtml', 'tex': 'Tex', 'cs': | |||
|
301 | 'CSharp', 'mxml': 'Mxml', 'patch': 'Diff', 'apache.conf': 'ApacheConf', | |||
|
302 | 'scala': 'Scala', 'applescript': 'AppleScript', 'GNUmakefile': 'Makefile', | |||
|
303 | 'c-objdump': 'CObjdump', 'lua': 'Lua', 'apache2.conf': 'ApacheConf', 'rb': | |||
|
304 | 'Ruby', 'gemspec': 'Ruby', 'rl': 'RagelObjectiveC', 'vala': 'Vala', 'tmpl': | |||
|
305 | 'Cheetah', 'bf': 'Brainfuck', 'plt': 'Gnuplot', 'G': 'AntlrRuby', 'xslt': | |||
|
306 | 'Xslt', 'flxh': 'Felix', 'asax': 'VbNetAspx', 'Rakefile': 'Ruby', 'S': 'S', | |||
|
307 | 'wsdl': 'Xml', 'js': 'Javascript', 'autodelegate': 'Myghty', 'properties': | |||
|
308 | 'Ini', 'bash': 'Bash', 'c': 'C', 'g': 'AntlrRuby', 'r3': 'Rebol', 's': | |||
|
309 | 'Gas', 'ashx': 'VbNetAspx', 'cxx': 'Cpp', 'boo': 'Boo', 'prolog': 'Prolog', | |||
|
310 | 'sqlite3-console': 'SqliteConsole', 'cl': 'CommonLisp', 'cc': 'Cpp', 'pot': | |||
|
311 | 'Gettext', 'vim': 'Vim', 'pxi': 'Cython', 'yaml': 'Yaml', 'SConstruct': | |||
|
312 | 'Python', 'diff': 'Diff', 'txt': 'Text', 'cw': 'Redcode', 'pxd': 'Cython', | |||
|
313 | 'plot': 'Gnuplot', 'java': 'Java', 'hrl': 'Erlang', 'py': 'Python', | |||
|
314 | 'makefile': 'Makefile', 'squid.conf': 'SquidConf', 'asm': 'Nasm', 'toc': | |||
|
315 | 'Tex', 'kid': 'Genshi', 'rhtml': 'Rhtml', 'po': 'Gettext', 'pl': 'Prolog', | |||
|
316 | 'pm': 'Perl', 'hx': 'Haxe', 'ascx': 'VbNetAspx', 'ooc': 'Ooc', 'asy': | |||
|
317 | 'Asymptote', 'hs': 'Haskell', 'SConscript': 'Python', 'pytb': | |||
|
318 | 'PythonTraceback', 'myt': 'Myghty', 'hh': 'Cpp', 'R': 'S', 'aux': 'Tex', | |||
|
319 | 'rst': 'Rst', 'cpp-objdump': 'CppObjdump', 'lgt': 'Logtalk', 'rss': 'Xml', | |||
|
320 | 'flx': 'Felix', 'b': 'Brainfuck', 'f': 'Fortran', 'rbw': 'Ruby', | |||
|
321 | '.htaccess': 'ApacheConf', 'cxx-objdump': 'CppObjdump', 'j': 'ObjectiveJ', | |||
|
322 | 'mll': 'Ocaml', 'yml': 'Yaml', 'mu': 'MuPAD', 'r': 'Rebol', 'ASM': 'Nasm', | |||
|
323 | 'erl': 'Erlang', 'mly': 'Ocaml', 'mo': 'Modelica', 'def': 'Modula2', 'ini': | |||
|
324 | 'Ini', 'control': 'DebianControl', 'vb': 'VbNet', 'vapi': 'Vala', 'pro': | |||
|
325 | 'Prolog', 'spt': 'Cheetah', 'mli': 'Ocaml', 'as': 'ActionScript3', 'cmd': | |||
|
326 | 'Batch', 'cpp': 'Cpp', 'io': 'Io', 'tac': 'Python', 'haml': 'Haml', 'rkt': | |||
|
327 | 'Racket', 'st':'Smalltalk', 'inc': 'Povray', 'pas': 'Delphi', 'cmake': | |||
|
328 | 'CMake', 'csh':'Tcsh', 'hpp': 'Cpp', 'feature': 'Gherkin', 'html': 'Html', | |||
|
329 | 'php':'Php', 'php3':'Php', 'php4':'Php', 'php5':'Php', 'xhtml': 'Html', | |||
|
330 | 'hxx': 'Cpp', 'eclass': 'Bash', 'css': 'Css', | |||
|
331 | 'frag': 'GLShader', 'd-objdump': 'DObjdump', 'weechatlog': 'IrcLogs', | |||
|
332 | 'tcsh': 'Tcsh', 'objdump': 'Objdump', 'pyw': 'Python', 'h++': 'Cpp', | |||
|
333 | 'py3tb': 'Python3Traceback', 'jsp': 'Jsp', 'sql': 'Sql', 'mak': 'Makefile', | |||
|
334 | 'php': 'Php', 'mao': 'Mako', 'man': 'Groff', 'dylan': 'Dylan', 'sass': | |||
|
335 | 'Sass', 'cfml': 'ColdfusionHtml', 'darcspatch': 'DarcsPatch', 'tpl': | |||
|
336 | 'Smarty', 'm': 'ObjectiveC', 'f90': 'Fortran', 'mod': 'Modula2', 'sh': | |||
|
337 | 'Bash', 'lhs': 'LiterateHaskell', 'sources.list': 'SourcesList', 'axd': | |||
|
338 | 'VbNetAspx', 'sc': 'Python'} | |||
302 |
|
339 | |||
303 | repos_path = get_repos_path() |
|
340 | repos_path = get_repos_path() | |
304 | p = os.path.join(repos_path, repo_name) |
|
341 | p = os.path.join(repos_path, repo_name) | |
305 | repo = get_repo(p) |
|
342 | repo = get_repo(p) | |
306 | tip = repo.get_changeset() |
|
343 | tip = repo.get_changeset() | |
307 | code_stats = {} |
|
344 | code_stats = {} | |
308 |
|
345 | |||
309 | def aggregate(cs): |
|
346 | def aggregate(cs): | |
310 | for f in cs[2]: |
|
347 | for f in cs[2]: | |
311 |
|
|
348 | ext = f.extension | |
312 |
|
|
349 | key = LANGUAGES_EXTENSIONS_MAP.get(ext, ext) | |
313 | if code_stats.has_key(k): |
|
350 | key = key or ext | |
314 | code_stats[k] += 1 |
|
351 | if ext in LANGUAGES_EXTENSIONS_MAP.keys(): | |
|
352 | if code_stats.has_key(key): | |||
|
353 | code_stats[key] += 1 | |||
315 | else: |
|
354 | else: | |
316 | code_stats[k] = 1 |
|
355 | code_stats[key] = 1 | |
317 |
|
356 | |||
318 | map(aggregate, tip.walk('/')) |
|
357 | map(aggregate, tip.walk('/')) | |
319 |
|
358 | |||
320 | return code_stats or {} |
|
359 | return code_stats or {} | |
321 |
|
360 | |||
322 |
|
361 | |||
323 |
|
362 | |||
324 |
|
363 |
@@ -1,174 +1,201 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 |
|
47 | |||
48 | #################################### |
|
48 | #################################### | |
|
49 | ### CELERY CONFIG #### | |||
|
50 | #################################### | |||
|
51 | use_celery = false | |||
|
52 | broker.host = localhost | |||
|
53 | broker.vhost = rabbitmqhost | |||
|
54 | broker.port = 5672 | |||
|
55 | broker.user = rabbitmq | |||
|
56 | broker.password = qweqwe | |||
|
57 | ||||
|
58 | celery.imports = rhodecode.lib.celerylib.tasks | |||
|
59 | ||||
|
60 | celery.result.backend = amqp | |||
|
61 | celery.result.dburi = amqp:// | |||
|
62 | celery.result.serialier = json | |||
|
63 | ||||
|
64 | #celery.send.task.error.emails = true | |||
|
65 | #celery.amqp.task.result.expires = 18000 | |||
|
66 | ||||
|
67 | celeryd.concurrency = 2 | |||
|
68 | #celeryd.log.file = celeryd.log | |||
|
69 | celeryd.log.level = debug | |||
|
70 | celeryd.max.tasks.per.child = 3 | |||
|
71 | ||||
|
72 | #tasks will never be sent to the queue, but executed locally instead. | |||
|
73 | celery.always.eager = false | |||
|
74 | ||||
|
75 | #################################### | |||
49 | ### BEAKER CACHE #### |
|
76 | ### BEAKER CACHE #### | |
50 | #################################### |
|
77 | #################################### | |
51 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
78 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
52 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
79 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
53 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
80 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
54 |
|
81 | |||
55 | beaker.cache.super_short_term.type=memory |
|
82 | beaker.cache.super_short_term.type=memory | |
56 | beaker.cache.super_short_term.expire=10 |
|
83 | beaker.cache.super_short_term.expire=10 | |
57 |
|
84 | |||
58 | beaker.cache.short_term.type=memory |
|
85 | beaker.cache.short_term.type=memory | |
59 | beaker.cache.short_term.expire=60 |
|
86 | beaker.cache.short_term.expire=60 | |
60 |
|
87 | |||
61 | beaker.cache.long_term.type=memory |
|
88 | beaker.cache.long_term.type=memory | |
62 | beaker.cache.long_term.expire=36000 |
|
89 | beaker.cache.long_term.expire=36000 | |
63 |
|
90 | |||
64 |
|
91 | |||
65 | beaker.cache.sql_cache_short.type=memory |
|
92 | beaker.cache.sql_cache_short.type=memory | |
66 | beaker.cache.sql_cache_short.expire=5 |
|
93 | beaker.cache.sql_cache_short.expire=5 | |
67 |
|
94 | |||
68 | beaker.cache.sql_cache_med.type=memory |
|
95 | beaker.cache.sql_cache_med.type=memory | |
69 | beaker.cache.sql_cache_med.expire=360 |
|
96 | beaker.cache.sql_cache_med.expire=360 | |
70 |
|
97 | |||
71 | beaker.cache.sql_cache_long.type=file |
|
98 | beaker.cache.sql_cache_long.type=file | |
72 | beaker.cache.sql_cache_long.expire=3600 |
|
99 | beaker.cache.sql_cache_long.expire=3600 | |
73 |
|
100 | |||
74 | #################################### |
|
101 | #################################### | |
75 | ### BEAKER SESSION #### |
|
102 | ### BEAKER SESSION #### | |
76 | #################################### |
|
103 | #################################### | |
77 | ## Type of storage used for the session, current types are |
|
104 | ## Type of storage used for the session, current types are | |
78 | ## dbm, file, memcached, database, and memory. |
|
105 | ## dbm, file, memcached, database, and memory. | |
79 | ## The storage uses the Container API |
|
106 | ## The storage uses the Container API | |
80 | ##that is also used by the cache system. |
|
107 | ##that is also used by the cache system. | |
81 | beaker.session.type = file |
|
108 | beaker.session.type = file | |
82 |
|
109 | |||
83 | beaker.session.key = rhodecode |
|
110 | beaker.session.key = rhodecode | |
84 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
111 | beaker.session.secret = g654dcno0-9873jhgfreyu | |
85 | beaker.session.timeout = 36000 |
|
112 | beaker.session.timeout = 36000 | |
86 |
|
113 | |||
87 | ##auto save the session to not to use .save() |
|
114 | ##auto save the session to not to use .save() | |
88 | beaker.session.auto = False |
|
115 | beaker.session.auto = False | |
89 |
|
116 | |||
90 | ##true exire at browser close |
|
117 | ##true exire at browser close | |
91 | #beaker.session.cookie_expires = 3600 |
|
118 | #beaker.session.cookie_expires = 3600 | |
92 |
|
119 | |||
93 |
|
120 | |||
94 | ################################################################################ |
|
121 | ################################################################################ | |
95 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
122 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
96 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
123 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
97 | ## execute malicious code after an exception is raised. ## |
|
124 | ## execute malicious code after an exception is raised. ## | |
98 | ################################################################################ |
|
125 | ################################################################################ | |
99 | #set debug = false |
|
126 | #set debug = false | |
100 |
|
127 | |||
101 | ################################## |
|
128 | ################################## | |
102 | ### LOGVIEW CONFIG ### |
|
129 | ### LOGVIEW CONFIG ### | |
103 | ################################## |
|
130 | ################################## | |
104 | logview.sqlalchemy = #faa |
|
131 | logview.sqlalchemy = #faa | |
105 | logview.pylons.templating = #bfb |
|
132 | logview.pylons.templating = #bfb | |
106 | logview.pylons.util = #eee |
|
133 | logview.pylons.util = #eee | |
107 |
|
134 | |||
108 | ######################################################### |
|
135 | ######################################################### | |
109 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
136 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
110 | ######################################################### |
|
137 | ######################################################### | |
111 | sqlalchemy.db1.url = sqlite:///%(here)s/test.db |
|
138 | sqlalchemy.db1.url = sqlite:///%(here)s/test.db | |
112 | #sqlalchemy.db1.echo = False |
|
139 | #sqlalchemy.db1.echo = False | |
113 | #sqlalchemy.db1.pool_recycle = 3600 |
|
140 | #sqlalchemy.db1.pool_recycle = 3600 | |
114 | sqlalchemy.convert_unicode = true |
|
141 | sqlalchemy.convert_unicode = true | |
115 |
|
142 | |||
116 | ################################ |
|
143 | ################################ | |
117 | ### LOGGING CONFIGURATION #### |
|
144 | ### LOGGING CONFIGURATION #### | |
118 | ################################ |
|
145 | ################################ | |
119 | [loggers] |
|
146 | [loggers] | |
120 | keys = root, routes, rhodecode, sqlalchemy |
|
147 | keys = root, routes, rhodecode, sqlalchemy | |
121 |
|
148 | |||
122 | [handlers] |
|
149 | [handlers] | |
123 | keys = console |
|
150 | keys = console | |
124 |
|
151 | |||
125 | [formatters] |
|
152 | [formatters] | |
126 | keys = generic,color_formatter |
|
153 | keys = generic,color_formatter | |
127 |
|
154 | |||
128 | ############# |
|
155 | ############# | |
129 | ## LOGGERS ## |
|
156 | ## LOGGERS ## | |
130 | ############# |
|
157 | ############# | |
131 | [logger_root] |
|
158 | [logger_root] | |
132 | level = ERROR |
|
159 | level = ERROR | |
133 | handlers = console |
|
160 | handlers = console | |
134 |
|
161 | |||
135 | [logger_routes] |
|
162 | [logger_routes] | |
136 | level = ERROR |
|
163 | level = ERROR | |
137 | handlers = console |
|
164 | handlers = console | |
138 | qualname = routes.middleware |
|
165 | qualname = routes.middleware | |
139 | # "level = DEBUG" logs the route matched and routing variables. |
|
166 | # "level = DEBUG" logs the route matched and routing variables. | |
140 |
|
167 | |||
141 | [logger_rhodecode] |
|
168 | [logger_rhodecode] | |
142 | level = ERROR |
|
169 | level = ERROR | |
143 | handlers = console |
|
170 | handlers = console | |
144 | qualname = rhodecode |
|
171 | qualname = rhodecode | |
145 | propagate = 0 |
|
172 | propagate = 0 | |
146 |
|
173 | |||
147 | [logger_sqlalchemy] |
|
174 | [logger_sqlalchemy] | |
148 | level = ERROR |
|
175 | level = ERROR | |
149 | handlers = console |
|
176 | handlers = console | |
150 | qualname = sqlalchemy.engine |
|
177 | qualname = sqlalchemy.engine | |
151 | propagate = 0 |
|
178 | propagate = 0 | |
152 |
|
179 | |||
153 | ############## |
|
180 | ############## | |
154 | ## HANDLERS ## |
|
181 | ## HANDLERS ## | |
155 | ############## |
|
182 | ############## | |
156 |
|
183 | |||
157 | [handler_console] |
|
184 | [handler_console] | |
158 | class = StreamHandler |
|
185 | class = StreamHandler | |
159 | args = (sys.stderr,) |
|
186 | args = (sys.stderr,) | |
160 | level = NOTSET |
|
187 | level = NOTSET | |
161 | formatter = color_formatter |
|
188 | formatter = color_formatter | |
162 |
|
189 | |||
163 | ################ |
|
190 | ################ | |
164 | ## FORMATTERS ## |
|
191 | ## FORMATTERS ## | |
165 | ################ |
|
192 | ################ | |
166 |
|
193 | |||
167 | [formatter_generic] |
|
194 | [formatter_generic] | |
168 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
195 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
169 | datefmt = %Y-%m-%d %H:%M:%S |
|
196 | datefmt = %Y-%m-%d %H:%M:%S | |
170 |
|
197 | |||
171 | [formatter_color_formatter] |
|
198 | [formatter_color_formatter] | |
172 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
199 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
173 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
200 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
174 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
201 | datefmt = %Y-%m-%d %H:%M:%S |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now