Show More
@@ -1,215 +1,216 b'' | |||||
1 | ################################################################################ |
|
1 | ################################################################################ | |
2 | ################################################################################ |
|
2 | ################################################################################ | |
3 | # RhodeCode - Pylons environment configuration # |
|
3 | # RhodeCode - Pylons environment configuration # | |
4 | # # |
|
4 | # # | |
5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
5 | # The %(here)s variable will be replaced with the parent directory of this file# | |
6 | ################################################################################ |
|
6 | ################################################################################ | |
7 |
|
7 | |||
8 | [DEFAULT] |
|
8 | [DEFAULT] | |
9 | debug = true |
|
9 | debug = true | |
10 | ################################################################################ |
|
10 | ################################################################################ | |
11 | ## Uncomment and replace with the address which should receive ## |
|
11 | ## Uncomment and replace with the address which should receive ## | |
12 | ## any error reports after application crash ## |
|
12 | ## any error reports after application crash ## | |
13 | ## Additionally those settings will be used by RhodeCode mailing system ## |
|
13 | ## Additionally those settings will be used by RhodeCode mailing system ## | |
14 | ################################################################################ |
|
14 | ################################################################################ | |
15 | #email_to = admin@localhost |
|
15 | #email_to = admin@localhost | |
16 | #error_email_from = paste_error@localhost |
|
16 | #error_email_from = paste_error@localhost | |
17 | #app_email_from = rhodecode-noreply@localhost |
|
17 | #app_email_from = rhodecode-noreply@localhost | |
18 | #error_message = |
|
18 | #error_message = | |
19 |
|
19 | |||
20 | #smtp_server = mail.server.com |
|
20 | #smtp_server = mail.server.com | |
21 | #smtp_username = |
|
21 | #smtp_username = | |
22 | #smtp_password = |
|
22 | #smtp_password = | |
23 | #smtp_port = |
|
23 | #smtp_port = | |
24 | #smtp_use_tls = false |
|
24 | #smtp_use_tls = false | |
25 | #smtp_use_ssl = true |
|
25 | #smtp_use_ssl = true | |
26 |
|
26 | |||
27 | [server:main] |
|
27 | [server:main] | |
28 | ##nr of threads to spawn |
|
28 | ##nr of threads to spawn | |
29 | threadpool_workers = 5 |
|
29 | threadpool_workers = 5 | |
30 |
|
30 | |||
31 | ##max request before thread respawn |
|
31 | ##max request before thread respawn | |
32 | threadpool_max_requests = 6 |
|
32 | threadpool_max_requests = 6 | |
33 |
|
33 | |||
34 | ##option to use threads of process |
|
34 | ##option to use threads of process | |
35 | use_threadpool = false |
|
35 | use_threadpool = false | |
36 |
|
36 | |||
37 | use = egg:Paste#http |
|
37 | use = egg:Paste#http | |
38 | host = 0.0.0.0 |
|
38 | host = 0.0.0.0 | |
39 | port = 5000 |
|
39 | port = 5000 | |
40 |
|
40 | |||
41 | [app:main] |
|
41 | [app:main] | |
42 | use = egg:rhodecode |
|
42 | use = egg:rhodecode | |
43 | full_stack = true |
|
43 | full_stack = true | |
44 | static_files = true |
|
44 | static_files = true | |
45 | lang=en |
|
45 | lang=en | |
46 | cache_dir = %(here)s/data |
|
46 | cache_dir = %(here)s/data | |
47 | index_dir = %(here)s/data/index |
|
47 | index_dir = %(here)s/data/index | |
48 | cut_off_limit = 256000 |
|
48 | cut_off_limit = 256000 | |
|
49 | force_https = false | |||
49 |
|
50 | |||
50 | #################################### |
|
51 | #################################### | |
51 | ### CELERY CONFIG #### |
|
52 | ### CELERY CONFIG #### | |
52 | #################################### |
|
53 | #################################### | |
53 | use_celery = false |
|
54 | use_celery = false | |
54 | broker.host = localhost |
|
55 | broker.host = localhost | |
55 | broker.vhost = rabbitmqhost |
|
56 | broker.vhost = rabbitmqhost | |
56 | broker.port = 5672 |
|
57 | broker.port = 5672 | |
57 | broker.user = rabbitmq |
|
58 | broker.user = rabbitmq | |
58 | broker.password = qweqwe |
|
59 | broker.password = qweqwe | |
59 |
|
60 | |||
60 | celery.imports = rhodecode.lib.celerylib.tasks |
|
61 | celery.imports = rhodecode.lib.celerylib.tasks | |
61 |
|
62 | |||
62 | celery.result.backend = amqp |
|
63 | celery.result.backend = amqp | |
63 | celery.result.dburi = amqp:// |
|
64 | celery.result.dburi = amqp:// | |
64 | celery.result.serialier = json |
|
65 | celery.result.serialier = json | |
65 |
|
66 | |||
66 | #celery.send.task.error.emails = true |
|
67 | #celery.send.task.error.emails = true | |
67 | #celery.amqp.task.result.expires = 18000 |
|
68 | #celery.amqp.task.result.expires = 18000 | |
68 |
|
69 | |||
69 | celeryd.concurrency = 2 |
|
70 | celeryd.concurrency = 2 | |
70 | #celeryd.log.file = celeryd.log |
|
71 | #celeryd.log.file = celeryd.log | |
71 | celeryd.log.level = debug |
|
72 | celeryd.log.level = debug | |
72 | celeryd.max.tasks.per.child = 3 |
|
73 | celeryd.max.tasks.per.child = 3 | |
73 |
|
74 | |||
74 | #tasks will never be sent to the queue, but executed locally instead. |
|
75 | #tasks will never be sent to the queue, but executed locally instead. | |
75 | celery.always.eager = false |
|
76 | celery.always.eager = false | |
76 |
|
77 | |||
77 | #################################### |
|
78 | #################################### | |
78 | ### BEAKER CACHE #### |
|
79 | ### BEAKER CACHE #### | |
79 | #################################### |
|
80 | #################################### | |
80 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
81 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
81 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
82 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
82 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
83 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
83 |
|
84 | |||
84 | beaker.cache.super_short_term.type=memory |
|
85 | beaker.cache.super_short_term.type=memory | |
85 | beaker.cache.super_short_term.expire=10 |
|
86 | beaker.cache.super_short_term.expire=10 | |
86 |
|
87 | |||
87 | beaker.cache.short_term.type=memory |
|
88 | beaker.cache.short_term.type=memory | |
88 | beaker.cache.short_term.expire=60 |
|
89 | beaker.cache.short_term.expire=60 | |
89 |
|
90 | |||
90 | beaker.cache.long_term.type=memory |
|
91 | beaker.cache.long_term.type=memory | |
91 | beaker.cache.long_term.expire=36000 |
|
92 | beaker.cache.long_term.expire=36000 | |
92 |
|
93 | |||
93 | beaker.cache.sql_cache_short.type=memory |
|
94 | beaker.cache.sql_cache_short.type=memory | |
94 | beaker.cache.sql_cache_short.expire=10 |
|
95 | beaker.cache.sql_cache_short.expire=10 | |
95 |
|
96 | |||
96 | beaker.cache.sql_cache_med.type=memory |
|
97 | beaker.cache.sql_cache_med.type=memory | |
97 | beaker.cache.sql_cache_med.expire=360 |
|
98 | beaker.cache.sql_cache_med.expire=360 | |
98 |
|
99 | |||
99 | beaker.cache.sql_cache_long.type=file |
|
100 | beaker.cache.sql_cache_long.type=file | |
100 | beaker.cache.sql_cache_long.expire=3600 |
|
101 | beaker.cache.sql_cache_long.expire=3600 | |
101 |
|
102 | |||
102 | #################################### |
|
103 | #################################### | |
103 | ### BEAKER SESSION #### |
|
104 | ### BEAKER SESSION #### | |
104 | #################################### |
|
105 | #################################### | |
105 | ## Type of storage used for the session, current types are |
|
106 | ## Type of storage used for the session, current types are | |
106 | ## dbm, file, memcached, database, and memory. |
|
107 | ## dbm, file, memcached, database, and memory. | |
107 | ## The storage uses the Container API |
|
108 | ## The storage uses the Container API | |
108 | ##that is also used by the cache system. |
|
109 | ##that is also used by the cache system. | |
109 | beaker.session.type = file |
|
110 | beaker.session.type = file | |
110 |
|
111 | |||
111 | beaker.session.key = rhodecode |
|
112 | beaker.session.key = rhodecode | |
112 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
113 | beaker.session.secret = g654dcno0-9873jhgfreyu | |
113 | beaker.session.timeout = 36000 |
|
114 | beaker.session.timeout = 36000 | |
114 |
|
115 | |||
115 | ##auto save the session to not to use .save() |
|
116 | ##auto save the session to not to use .save() | |
116 | beaker.session.auto = False |
|
117 | beaker.session.auto = False | |
117 |
|
118 | |||
118 | ##true exire at browser close |
|
119 | ##true exire at browser close | |
119 | #beaker.session.cookie_expires = 3600 |
|
120 | #beaker.session.cookie_expires = 3600 | |
120 |
|
121 | |||
121 |
|
122 | |||
122 | ################################################################################ |
|
123 | ################################################################################ | |
123 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
124 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
124 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
125 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
125 | ## execute malicious code after an exception is raised. ## |
|
126 | ## execute malicious code after an exception is raised. ## | |
126 | ################################################################################ |
|
127 | ################################################################################ | |
127 | #set debug = false |
|
128 | #set debug = false | |
128 |
|
129 | |||
129 | ################################## |
|
130 | ################################## | |
130 | ### LOGVIEW CONFIG ### |
|
131 | ### LOGVIEW CONFIG ### | |
131 | ################################## |
|
132 | ################################## | |
132 | logview.sqlalchemy = #faa |
|
133 | logview.sqlalchemy = #faa | |
133 | logview.pylons.templating = #bfb |
|
134 | logview.pylons.templating = #bfb | |
134 | logview.pylons.util = #eee |
|
135 | logview.pylons.util = #eee | |
135 |
|
136 | |||
136 | ######################################################### |
|
137 | ######################################################### | |
137 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
138 | ######################################################### |
|
139 | ######################################################### | |
139 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
140 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
140 | #sqlalchemy.db1.echo = False |
|
141 | #sqlalchemy.db1.echo = False | |
141 | #sqlalchemy.db1.pool_recycle = 3600 |
|
142 | #sqlalchemy.db1.pool_recycle = 3600 | |
142 | sqlalchemy.convert_unicode = true |
|
143 | sqlalchemy.convert_unicode = true | |
143 |
|
144 | |||
144 | ################################ |
|
145 | ################################ | |
145 | ### LOGGING CONFIGURATION #### |
|
146 | ### LOGGING CONFIGURATION #### | |
146 | ################################ |
|
147 | ################################ | |
147 | [loggers] |
|
148 | [loggers] | |
148 | keys = root, routes, rhodecode, sqlalchemy,beaker,templates |
|
149 | keys = root, routes, rhodecode, sqlalchemy,beaker,templates | |
149 |
|
150 | |||
150 | [handlers] |
|
151 | [handlers] | |
151 | keys = console |
|
152 | keys = console | |
152 |
|
153 | |||
153 | [formatters] |
|
154 | [formatters] | |
154 | keys = generic,color_formatter |
|
155 | keys = generic,color_formatter | |
155 |
|
156 | |||
156 | ############# |
|
157 | ############# | |
157 | ## LOGGERS ## |
|
158 | ## LOGGERS ## | |
158 | ############# |
|
159 | ############# | |
159 | [logger_root] |
|
160 | [logger_root] | |
160 | level = NOTSET |
|
161 | level = NOTSET | |
161 | handlers = console |
|
162 | handlers = console | |
162 |
|
163 | |||
163 | [logger_routes] |
|
164 | [logger_routes] | |
164 | level = DEBUG |
|
165 | level = DEBUG | |
165 | handlers = console |
|
166 | handlers = console | |
166 | qualname = routes.middleware |
|
167 | qualname = routes.middleware | |
167 | # "level = DEBUG" logs the route matched and routing variables. |
|
168 | # "level = DEBUG" logs the route matched and routing variables. | |
168 | propagate = 0 |
|
169 | propagate = 0 | |
169 |
|
170 | |||
170 | [logger_beaker] |
|
171 | [logger_beaker] | |
171 | level = ERROR |
|
172 | level = ERROR | |
172 | handlers = console |
|
173 | handlers = console | |
173 | qualname = beaker.container |
|
174 | qualname = beaker.container | |
174 | propagate = 0 |
|
175 | propagate = 0 | |
175 |
|
176 | |||
176 | [logger_templates] |
|
177 | [logger_templates] | |
177 | level = INFO |
|
178 | level = INFO | |
178 | handlers = console |
|
179 | handlers = console | |
179 | qualname = pylons.templating |
|
180 | qualname = pylons.templating | |
180 | propagate = 0 |
|
181 | propagate = 0 | |
181 |
|
182 | |||
182 | [logger_rhodecode] |
|
183 | [logger_rhodecode] | |
183 | level = DEBUG |
|
184 | level = DEBUG | |
184 | handlers = console |
|
185 | handlers = console | |
185 | qualname = rhodecode |
|
186 | qualname = rhodecode | |
186 | propagate = 0 |
|
187 | propagate = 0 | |
187 |
|
188 | |||
188 | [logger_sqlalchemy] |
|
189 | [logger_sqlalchemy] | |
189 | level = ERROR |
|
190 | level = ERROR | |
190 | handlers = console |
|
191 | handlers = console | |
191 | qualname = sqlalchemy.engine |
|
192 | qualname = sqlalchemy.engine | |
192 | propagate = 0 |
|
193 | propagate = 0 | |
193 |
|
194 | |||
194 | ############## |
|
195 | ############## | |
195 | ## HANDLERS ## |
|
196 | ## HANDLERS ## | |
196 | ############## |
|
197 | ############## | |
197 |
|
198 | |||
198 | [handler_console] |
|
199 | [handler_console] | |
199 | class = StreamHandler |
|
200 | class = StreamHandler | |
200 | args = (sys.stderr,) |
|
201 | args = (sys.stderr,) | |
201 | level = NOTSET |
|
202 | level = NOTSET | |
202 | formatter = color_formatter |
|
203 | formatter = color_formatter | |
203 |
|
204 | |||
204 | ################ |
|
205 | ################ | |
205 | ## FORMATTERS ## |
|
206 | ## FORMATTERS ## | |
206 | ################ |
|
207 | ################ | |
207 |
|
208 | |||
208 | [formatter_generic] |
|
209 | [formatter_generic] | |
209 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
210 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
210 | datefmt = %Y-%m-%d %H:%M:%S |
|
211 | datefmt = %Y-%m-%d %H:%M:%S | |
211 |
|
212 | |||
212 | [formatter_color_formatter] |
|
213 | [formatter_color_formatter] | |
213 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
214 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
214 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
215 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
215 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
216 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,204 +1,205 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 | cut_off_limit = 256000 |
|
48 | cut_off_limit = 256000 | |
|
49 | force_https = false | |||
49 |
|
50 | |||
50 | #################################### |
|
51 | #################################### | |
51 | ### CELERY CONFIG #### |
|
52 | ### CELERY CONFIG #### | |
52 | #################################### |
|
53 | #################################### | |
53 | use_celery = false |
|
54 | use_celery = false | |
54 | broker.host = localhost |
|
55 | broker.host = localhost | |
55 | broker.vhost = rabbitmqhost |
|
56 | broker.vhost = rabbitmqhost | |
56 | broker.port = 5672 |
|
57 | broker.port = 5672 | |
57 | broker.user = rabbitmq |
|
58 | broker.user = rabbitmq | |
58 | broker.password = qweqwe |
|
59 | broker.password = qweqwe | |
59 |
|
60 | |||
60 | celery.imports = rhodecode.lib.celerylib.tasks |
|
61 | celery.imports = rhodecode.lib.celerylib.tasks | |
61 |
|
62 | |||
62 | celery.result.backend = amqp |
|
63 | celery.result.backend = amqp | |
63 | celery.result.dburi = amqp:// |
|
64 | celery.result.dburi = amqp:// | |
64 | celery.result.serialier = json |
|
65 | celery.result.serialier = json | |
65 |
|
66 | |||
66 | #celery.send.task.error.emails = true |
|
67 | #celery.send.task.error.emails = true | |
67 | #celery.amqp.task.result.expires = 18000 |
|
68 | #celery.amqp.task.result.expires = 18000 | |
68 |
|
69 | |||
69 | celeryd.concurrency = 2 |
|
70 | celeryd.concurrency = 2 | |
70 | #celeryd.log.file = celeryd.log |
|
71 | #celeryd.log.file = celeryd.log | |
71 | celeryd.log.level = debug |
|
72 | celeryd.log.level = debug | |
72 | celeryd.max.tasks.per.child = 3 |
|
73 | celeryd.max.tasks.per.child = 3 | |
73 |
|
74 | |||
74 | #tasks will never be sent to the queue, but executed locally instead. |
|
75 | #tasks will never be sent to the queue, but executed locally instead. | |
75 | celery.always.eager = false |
|
76 | celery.always.eager = false | |
76 |
|
77 | |||
77 | #################################### |
|
78 | #################################### | |
78 | ### BEAKER CACHE #### |
|
79 | ### BEAKER CACHE #### | |
79 | #################################### |
|
80 | #################################### | |
80 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
81 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
81 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
82 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
82 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
83 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
83 |
|
84 | |||
84 | beaker.cache.super_short_term.type=memory |
|
85 | beaker.cache.super_short_term.type=memory | |
85 | beaker.cache.super_short_term.expire=10 |
|
86 | beaker.cache.super_short_term.expire=10 | |
86 |
|
87 | |||
87 | beaker.cache.short_term.type=memory |
|
88 | beaker.cache.short_term.type=memory | |
88 | beaker.cache.short_term.expire=60 |
|
89 | beaker.cache.short_term.expire=60 | |
89 |
|
90 | |||
90 | beaker.cache.long_term.type=memory |
|
91 | beaker.cache.long_term.type=memory | |
91 | beaker.cache.long_term.expire=36000 |
|
92 | beaker.cache.long_term.expire=36000 | |
92 |
|
93 | |||
93 |
|
94 | |||
94 | beaker.cache.sql_cache_short.type=memory |
|
95 | beaker.cache.sql_cache_short.type=memory | |
95 | beaker.cache.sql_cache_short.expire=5 |
|
96 | beaker.cache.sql_cache_short.expire=5 | |
96 |
|
97 | |||
97 | beaker.cache.sql_cache_med.type=memory |
|
98 | beaker.cache.sql_cache_med.type=memory | |
98 | beaker.cache.sql_cache_med.expire=360 |
|
99 | beaker.cache.sql_cache_med.expire=360 | |
99 |
|
100 | |||
100 | beaker.cache.sql_cache_long.type=file |
|
101 | beaker.cache.sql_cache_long.type=file | |
101 | beaker.cache.sql_cache_long.expire=3600 |
|
102 | beaker.cache.sql_cache_long.expire=3600 | |
102 |
|
103 | |||
103 | #################################### |
|
104 | #################################### | |
104 | ### BEAKER SESSION #### |
|
105 | ### BEAKER SESSION #### | |
105 | #################################### |
|
106 | #################################### | |
106 | ## Type of storage used for the session, current types are |
|
107 | ## Type of storage used for the session, current types are | |
107 | ## dbm, file, memcached, database, and memory. |
|
108 | ## dbm, file, memcached, database, and memory. | |
108 | ## The storage uses the Container API |
|
109 | ## The storage uses the Container API | |
109 | ##that is also used by the cache system. |
|
110 | ##that is also used by the cache system. | |
110 | beaker.session.type = file |
|
111 | beaker.session.type = file | |
111 |
|
112 | |||
112 | beaker.session.key = rhodecode |
|
113 | beaker.session.key = rhodecode | |
113 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
114 | beaker.session.secret = g654dcno0-9873jhgfreyu | |
114 | beaker.session.timeout = 36000 |
|
115 | beaker.session.timeout = 36000 | |
115 |
|
116 | |||
116 | ##auto save the session to not to use .save() |
|
117 | ##auto save the session to not to use .save() | |
117 | beaker.session.auto = False |
|
118 | beaker.session.auto = False | |
118 |
|
119 | |||
119 | ##true exire at browser close |
|
120 | ##true exire at browser close | |
120 | #beaker.session.cookie_expires = 3600 |
|
121 | #beaker.session.cookie_expires = 3600 | |
121 |
|
122 | |||
122 |
|
123 | |||
123 | ################################################################################ |
|
124 | ################################################################################ | |
124 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
125 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
125 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
126 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
126 | ## execute malicious code after an exception is raised. ## |
|
127 | ## execute malicious code after an exception is raised. ## | |
127 | ################################################################################ |
|
128 | ################################################################################ | |
128 | set debug = false |
|
129 | set debug = false | |
129 |
|
130 | |||
130 | ################################## |
|
131 | ################################## | |
131 | ### LOGVIEW CONFIG ### |
|
132 | ### LOGVIEW CONFIG ### | |
132 | ################################## |
|
133 | ################################## | |
133 | logview.sqlalchemy = #faa |
|
134 | logview.sqlalchemy = #faa | |
134 | logview.pylons.templating = #bfb |
|
135 | logview.pylons.templating = #bfb | |
135 | logview.pylons.util = #eee |
|
136 | logview.pylons.util = #eee | |
136 |
|
137 | |||
137 | ######################################################### |
|
138 | ######################################################### | |
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
139 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
139 | ######################################################### |
|
140 | ######################################################### | |
140 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
141 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
141 | #sqlalchemy.db1.echo = False |
|
142 | #sqlalchemy.db1.echo = False | |
142 | #sqlalchemy.db1.pool_recycle = 3600 |
|
143 | #sqlalchemy.db1.pool_recycle = 3600 | |
143 | sqlalchemy.convert_unicode = true |
|
144 | sqlalchemy.convert_unicode = true | |
144 |
|
145 | |||
145 | ################################ |
|
146 | ################################ | |
146 | ### LOGGING CONFIGURATION #### |
|
147 | ### LOGGING CONFIGURATION #### | |
147 | ################################ |
|
148 | ################################ | |
148 | [loggers] |
|
149 | [loggers] | |
149 | keys = root, routes, rhodecode, sqlalchemy |
|
150 | keys = root, routes, rhodecode, sqlalchemy | |
150 |
|
151 | |||
151 | [handlers] |
|
152 | [handlers] | |
152 | keys = console |
|
153 | keys = console | |
153 |
|
154 | |||
154 | [formatters] |
|
155 | [formatters] | |
155 | keys = generic,color_formatter |
|
156 | keys = generic,color_formatter | |
156 |
|
157 | |||
157 | ############# |
|
158 | ############# | |
158 | ## LOGGERS ## |
|
159 | ## LOGGERS ## | |
159 | ############# |
|
160 | ############# | |
160 | [logger_root] |
|
161 | [logger_root] | |
161 | level = INFO |
|
162 | level = INFO | |
162 | handlers = console |
|
163 | handlers = console | |
163 |
|
164 | |||
164 | [logger_routes] |
|
165 | [logger_routes] | |
165 | level = INFO |
|
166 | level = INFO | |
166 | handlers = console |
|
167 | handlers = console | |
167 | qualname = routes.middleware |
|
168 | qualname = routes.middleware | |
168 | # "level = DEBUG" logs the route matched and routing variables. |
|
169 | # "level = DEBUG" logs the route matched and routing variables. | |
169 | propagate = 0 |
|
170 | propagate = 0 | |
170 |
|
171 | |||
171 | [logger_rhodecode] |
|
172 | [logger_rhodecode] | |
172 | level = DEBUG |
|
173 | level = DEBUG | |
173 | handlers = console |
|
174 | handlers = console | |
174 | qualname = rhodecode |
|
175 | qualname = rhodecode | |
175 | propagate = 0 |
|
176 | propagate = 0 | |
176 |
|
177 | |||
177 | [logger_sqlalchemy] |
|
178 | [logger_sqlalchemy] | |
178 | level = ERROR |
|
179 | level = ERROR | |
179 | handlers = console |
|
180 | handlers = console | |
180 | qualname = sqlalchemy.engine |
|
181 | qualname = sqlalchemy.engine | |
181 | propagate = 0 |
|
182 | propagate = 0 | |
182 |
|
183 | |||
183 | ############## |
|
184 | ############## | |
184 | ## HANDLERS ## |
|
185 | ## HANDLERS ## | |
185 | ############## |
|
186 | ############## | |
186 |
|
187 | |||
187 | [handler_console] |
|
188 | [handler_console] | |
188 | class = StreamHandler |
|
189 | class = StreamHandler | |
189 | args = (sys.stderr,) |
|
190 | args = (sys.stderr,) | |
190 | level = NOTSET |
|
191 | level = NOTSET | |
191 | formatter = color_formatter |
|
192 | formatter = color_formatter | |
192 |
|
193 | |||
193 | ################ |
|
194 | ################ | |
194 | ## FORMATTERS ## |
|
195 | ## FORMATTERS ## | |
195 | ################ |
|
196 | ################ | |
196 |
|
197 | |||
197 | [formatter_generic] |
|
198 | [formatter_generic] | |
198 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
199 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
199 | datefmt = %Y-%m-%d %H:%M:%S |
|
200 | datefmt = %Y-%m-%d %H:%M:%S | |
200 |
|
201 | |||
201 | [formatter_color_formatter] |
|
202 | [formatter_color_formatter] | |
202 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
203 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
203 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
204 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
204 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
205 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,204 +1,205 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 = 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 | cut_off_limit = 256000 |
|
49 | cut_off_limit = 256000 | |
|
50 | force_https = false | |||
50 |
|
51 | |||
51 | #################################### |
|
52 | #################################### | |
52 | ### CELERY CONFIG #### |
|
53 | ### CELERY CONFIG #### | |
53 | #################################### |
|
54 | #################################### | |
54 | use_celery = false |
|
55 | use_celery = false | |
55 | broker.host = localhost |
|
56 | broker.host = localhost | |
56 | broker.vhost = rabbitmqhost |
|
57 | broker.vhost = rabbitmqhost | |
57 | broker.port = 5672 |
|
58 | broker.port = 5672 | |
58 | broker.user = rabbitmq |
|
59 | broker.user = rabbitmq | |
59 | broker.password = qweqwe |
|
60 | broker.password = qweqwe | |
60 |
|
61 | |||
61 | celery.imports = rhodecode.lib.celerylib.tasks |
|
62 | celery.imports = rhodecode.lib.celerylib.tasks | |
62 |
|
63 | |||
63 | celery.result.backend = amqp |
|
64 | celery.result.backend = amqp | |
64 | celery.result.dburi = amqp:// |
|
65 | celery.result.dburi = amqp:// | |
65 | celery.result.serialier = json |
|
66 | celery.result.serialier = json | |
66 |
|
67 | |||
67 | #celery.send.task.error.emails = true |
|
68 | #celery.send.task.error.emails = true | |
68 | #celery.amqp.task.result.expires = 18000 |
|
69 | #celery.amqp.task.result.expires = 18000 | |
69 |
|
70 | |||
70 | celeryd.concurrency = 2 |
|
71 | celeryd.concurrency = 2 | |
71 | #celeryd.log.file = celeryd.log |
|
72 | #celeryd.log.file = celeryd.log | |
72 | celeryd.log.level = debug |
|
73 | celeryd.log.level = debug | |
73 | celeryd.max.tasks.per.child = 3 |
|
74 | celeryd.max.tasks.per.child = 3 | |
74 |
|
75 | |||
75 | #tasks will never be sent to the queue, but executed locally instead. |
|
76 | #tasks will never be sent to the queue, but executed locally instead. | |
76 | celery.always.eager = false |
|
77 | celery.always.eager = false | |
77 |
|
78 | |||
78 | #################################### |
|
79 | #################################### | |
79 | ### BEAKER CACHE #### |
|
80 | ### BEAKER CACHE #### | |
80 | #################################### |
|
81 | #################################### | |
81 | beaker.cache.data_dir=/%(here)s/data/cache/data |
|
82 | beaker.cache.data_dir=/%(here)s/data/cache/data | |
82 | beaker.cache.lock_dir=/%(here)s/data/cache/lock |
|
83 | beaker.cache.lock_dir=/%(here)s/data/cache/lock | |
83 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
84 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
84 |
|
85 | |||
85 | beaker.cache.super_short_term.type=memory |
|
86 | beaker.cache.super_short_term.type=memory | |
86 | beaker.cache.super_short_term.expire=10 |
|
87 | beaker.cache.super_short_term.expire=10 | |
87 |
|
88 | |||
88 | beaker.cache.short_term.type=memory |
|
89 | beaker.cache.short_term.type=memory | |
89 | beaker.cache.short_term.expire=60 |
|
90 | beaker.cache.short_term.expire=60 | |
90 |
|
91 | |||
91 | beaker.cache.long_term.type=memory |
|
92 | beaker.cache.long_term.type=memory | |
92 | beaker.cache.long_term.expire=36000 |
|
93 | beaker.cache.long_term.expire=36000 | |
93 |
|
94 | |||
94 | beaker.cache.sql_cache_short.type=memory |
|
95 | beaker.cache.sql_cache_short.type=memory | |
95 | beaker.cache.sql_cache_short.expire=10 |
|
96 | beaker.cache.sql_cache_short.expire=10 | |
96 |
|
97 | |||
97 | beaker.cache.sql_cache_med.type=memory |
|
98 | beaker.cache.sql_cache_med.type=memory | |
98 | beaker.cache.sql_cache_med.expire=360 |
|
99 | beaker.cache.sql_cache_med.expire=360 | |
99 |
|
100 | |||
100 | beaker.cache.sql_cache_long.type=file |
|
101 | beaker.cache.sql_cache_long.type=file | |
101 | beaker.cache.sql_cache_long.expire=3600 |
|
102 | beaker.cache.sql_cache_long.expire=3600 | |
102 |
|
103 | |||
103 | #################################### |
|
104 | #################################### | |
104 | ### BEAKER SESSION #### |
|
105 | ### BEAKER SESSION #### | |
105 | #################################### |
|
106 | #################################### | |
106 | ## Type of storage used for the session, current types are |
|
107 | ## Type of storage used for the session, current types are | |
107 | ## dbm, file, memcached, database, and memory. |
|
108 | ## dbm, file, memcached, database, and memory. | |
108 | ## The storage uses the Container API |
|
109 | ## The storage uses the Container API | |
109 | ##that is also used by the cache system. |
|
110 | ##that is also used by the cache system. | |
110 | beaker.session.type = file |
|
111 | beaker.session.type = file | |
111 |
|
112 | |||
112 | beaker.session.key = rhodecode |
|
113 | beaker.session.key = rhodecode | |
113 | beaker.session.secret = ${app_instance_secret} |
|
114 | beaker.session.secret = ${app_instance_secret} | |
114 | beaker.session.timeout = 36000 |
|
115 | beaker.session.timeout = 36000 | |
115 |
|
116 | |||
116 | ##auto save the session to not to use .save() |
|
117 | ##auto save the session to not to use .save() | |
117 | beaker.session.auto = False |
|
118 | beaker.session.auto = False | |
118 |
|
119 | |||
119 | ##true exire at browser close |
|
120 | ##true exire at browser close | |
120 | #beaker.session.cookie_expires = 3600 |
|
121 | #beaker.session.cookie_expires = 3600 | |
121 |
|
122 | |||
122 |
|
123 | |||
123 | ################################################################################ |
|
124 | ################################################################################ | |
124 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
125 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
125 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
126 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
126 | ## execute malicious code after an exception is raised. ## |
|
127 | ## execute malicious code after an exception is raised. ## | |
127 | ################################################################################ |
|
128 | ################################################################################ | |
128 | set debug = false |
|
129 | set debug = false | |
129 |
|
130 | |||
130 | ################################## |
|
131 | ################################## | |
131 | ### LOGVIEW CONFIG ### |
|
132 | ### LOGVIEW CONFIG ### | |
132 | ################################## |
|
133 | ################################## | |
133 | logview.sqlalchemy = #faa |
|
134 | logview.sqlalchemy = #faa | |
134 | logview.pylons.templating = #bfb |
|
135 | logview.pylons.templating = #bfb | |
135 | logview.pylons.util = #eee |
|
136 | logview.pylons.util = #eee | |
136 |
|
137 | |||
137 | ######################################################### |
|
138 | ######################################################### | |
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
139 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
139 | ######################################################### |
|
140 | ######################################################### | |
140 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
141 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
141 | #sqlalchemy.db1.echo = False |
|
142 | #sqlalchemy.db1.echo = False | |
142 | #sqlalchemy.db1.pool_recycle = 3600 |
|
143 | #sqlalchemy.db1.pool_recycle = 3600 | |
143 | sqlalchemy.convert_unicode = true |
|
144 | sqlalchemy.convert_unicode = true | |
144 |
|
145 | |||
145 | ################################ |
|
146 | ################################ | |
146 | ### LOGGING CONFIGURATION #### |
|
147 | ### LOGGING CONFIGURATION #### | |
147 | ################################ |
|
148 | ################################ | |
148 | [loggers] |
|
149 | [loggers] | |
149 | keys = root, routes, rhodecode, sqlalchemy |
|
150 | keys = root, routes, rhodecode, sqlalchemy | |
150 |
|
151 | |||
151 | [handlers] |
|
152 | [handlers] | |
152 | keys = console |
|
153 | keys = console | |
153 |
|
154 | |||
154 | [formatters] |
|
155 | [formatters] | |
155 | keys = generic,color_formatter |
|
156 | keys = generic,color_formatter | |
156 |
|
157 | |||
157 | ############# |
|
158 | ############# | |
158 | ## LOGGERS ## |
|
159 | ## LOGGERS ## | |
159 | ############# |
|
160 | ############# | |
160 | [logger_root] |
|
161 | [logger_root] | |
161 | level = INFO |
|
162 | level = INFO | |
162 | handlers = console |
|
163 | handlers = console | |
163 |
|
164 | |||
164 | [logger_routes] |
|
165 | [logger_routes] | |
165 | level = INFO |
|
166 | level = INFO | |
166 | handlers = console |
|
167 | handlers = console | |
167 | qualname = routes.middleware |
|
168 | qualname = routes.middleware | |
168 | # "level = DEBUG" logs the route matched and routing variables. |
|
169 | # "level = DEBUG" logs the route matched and routing variables. | |
169 | propagate = 0 |
|
170 | propagate = 0 | |
170 |
|
171 | |||
171 | [logger_rhodecode] |
|
172 | [logger_rhodecode] | |
172 | level = DEBUG |
|
173 | level = DEBUG | |
173 | handlers = console |
|
174 | handlers = console | |
174 | qualname = rhodecode |
|
175 | qualname = rhodecode | |
175 | propagate = 0 |
|
176 | propagate = 0 | |
176 |
|
177 | |||
177 | [logger_sqlalchemy] |
|
178 | [logger_sqlalchemy] | |
178 | level = ERROR |
|
179 | level = ERROR | |
179 | handlers = console |
|
180 | handlers = console | |
180 | qualname = sqlalchemy.engine |
|
181 | qualname = sqlalchemy.engine | |
181 | propagate = 0 |
|
182 | propagate = 0 | |
182 |
|
183 | |||
183 | ############## |
|
184 | ############## | |
184 | ## HANDLERS ## |
|
185 | ## HANDLERS ## | |
185 | ############## |
|
186 | ############## | |
186 |
|
187 | |||
187 | [handler_console] |
|
188 | [handler_console] | |
188 | class = StreamHandler |
|
189 | class = StreamHandler | |
189 | args = (sys.stderr,) |
|
190 | args = (sys.stderr,) | |
190 | level = NOTSET |
|
191 | level = NOTSET | |
191 | formatter = color_formatter |
|
192 | formatter = color_formatter | |
192 |
|
193 | |||
193 | ################ |
|
194 | ################ | |
194 | ## FORMATTERS ## |
|
195 | ## FORMATTERS ## | |
195 | ################ |
|
196 | ################ | |
196 |
|
197 | |||
197 | [formatter_generic] |
|
198 | [formatter_generic] | |
198 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
199 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
199 | datefmt = %Y-%m-%d %H:%M:%S |
|
200 | datefmt = %Y-%m-%d %H:%M:%S | |
200 |
|
201 | |||
201 | [formatter_color_formatter] |
|
202 | [formatter_color_formatter] | |
202 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
203 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
203 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
204 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
204 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
|
205 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,76 +1,76 b'' | |||||
1 | """Pylons middleware initialization""" |
|
1 | """Pylons middleware initialization""" | |
2 | from beaker.middleware import SessionMiddleware |
|
2 | from beaker.middleware import SessionMiddleware | |
3 | from paste.cascade import Cascade |
|
3 | from paste.cascade import Cascade | |
4 | from paste.registry import RegistryManager |
|
4 | from paste.registry import RegistryManager | |
5 | from paste.urlparser import StaticURLParser |
|
5 | from paste.urlparser import StaticURLParser | |
6 | from paste.deploy.converters import asbool |
|
6 | from paste.deploy.converters import asbool | |
7 | from pylons.middleware import ErrorHandler, StatusCodeRedirect |
|
7 | from pylons.middleware import ErrorHandler, StatusCodeRedirect | |
8 | from pylons.wsgiapp import PylonsApp |
|
8 | from pylons.wsgiapp import PylonsApp | |
9 | from routes.middleware import RoutesMiddleware |
|
9 | from routes.middleware import RoutesMiddleware | |
10 | from rhodecode.lib.middleware.simplehg import SimpleHg |
|
10 | from rhodecode.lib.middleware.simplehg import SimpleHg | |
11 | from rhodecode.lib.middleware.simplegit import SimpleGit |
|
11 | from rhodecode.lib.middleware.simplegit import SimpleGit | |
12 | from rhodecode.lib.middleware.https_fixup import HttpsFixup |
|
12 | from rhodecode.lib.middleware.https_fixup import HttpsFixup | |
13 | from rhodecode.config.environment import load_environment |
|
13 | from rhodecode.config.environment import load_environment | |
14 | from paste.gzipper import make_gzip_middleware |
|
14 | from paste.gzipper import make_gzip_middleware | |
15 |
|
15 | |||
16 | def make_app(global_conf, full_stack=True, static_files=True, **app_conf): |
|
16 | def make_app(global_conf, full_stack=True, static_files=True, **app_conf): | |
17 | """Create a Pylons WSGI application and return it |
|
17 | """Create a Pylons WSGI application and return it | |
18 |
|
18 | |||
19 | ``global_conf`` |
|
19 | ``global_conf`` | |
20 | The inherited configuration for this application. Normally from |
|
20 | The inherited configuration for this application. Normally from | |
21 | the [DEFAULT] section of the Paste ini file. |
|
21 | the [DEFAULT] section of the Paste ini file. | |
22 |
|
22 | |||
23 | ``full_stack`` |
|
23 | ``full_stack`` | |
24 | Whether or not this application provides a full WSGI stack (by |
|
24 | Whether or not this application provides a full WSGI stack (by | |
25 | default, meaning it handles its own exceptions and errors). |
|
25 | default, meaning it handles its own exceptions and errors). | |
26 | Disable full_stack when this application is "managed" by |
|
26 | Disable full_stack when this application is "managed" by | |
27 | another WSGI middleware. |
|
27 | another WSGI middleware. | |
28 |
|
28 | |||
29 | ``app_conf`` |
|
29 | ``app_conf`` | |
30 | The application's local configuration. Normally specified in |
|
30 | The application's local configuration. Normally specified in | |
31 | the [app:<name>] section of the Paste ini file (where <name> |
|
31 | the [app:<name>] section of the Paste ini file (where <name> | |
32 | defaults to main). |
|
32 | defaults to main). | |
33 |
|
33 | |||
34 | """ |
|
34 | """ | |
35 | # Configure the Pylons environment |
|
35 | # Configure the Pylons environment | |
36 | config = load_environment(global_conf, app_conf) |
|
36 | config = load_environment(global_conf, app_conf) | |
37 |
|
37 | |||
38 | # The Pylons WSGI app |
|
38 | # The Pylons WSGI app | |
39 | app = PylonsApp(config=config) |
|
39 | app = PylonsApp(config=config) | |
40 |
|
40 | |||
41 | # Routing/Session/Cache Middleware |
|
41 | # Routing/Session/Cache Middleware | |
42 | app = RoutesMiddleware(app, config['routes.map']) |
|
42 | app = RoutesMiddleware(app, config['routes.map']) | |
43 | app = SessionMiddleware(app, config) |
|
43 | app = SessionMiddleware(app, config) | |
44 |
|
44 | |||
45 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) |
|
45 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) | |
46 |
|
46 | |||
47 | app = SimpleHg(app, config) |
|
47 | app = SimpleHg(app, config) | |
48 | app = SimpleGit(app, config) |
|
48 | app = SimpleGit(app, config) | |
49 |
|
49 | |||
50 | if asbool(full_stack): |
|
50 | if asbool(full_stack): | |
51 | # Handle Python exceptions |
|
51 | # Handle Python exceptions | |
52 | app = ErrorHandler(app, global_conf, **config['pylons.errorware']) |
|
52 | app = ErrorHandler(app, global_conf, **config['pylons.errorware']) | |
53 |
|
53 | |||
54 | # Display error documents for 401, 403, 404 status codes (and |
|
54 | # Display error documents for 401, 403, 404 status codes (and | |
55 | # 500 when debug is disabled) |
|
55 | # 500 when debug is disabled) | |
56 | if asbool(config['debug']): |
|
56 | if asbool(config['debug']): | |
57 | app = StatusCodeRedirect(app) |
|
57 | app = StatusCodeRedirect(app) | |
58 | else: |
|
58 | else: | |
59 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) |
|
59 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) | |
60 |
|
60 | |||
61 | #enable https redirets based on HTTP_X_URL_SCHEME set by proxy |
|
61 | #enable https redirets based on HTTP_X_URL_SCHEME set by proxy | |
62 | app = HttpsFixup(app) |
|
62 | app = HttpsFixup(app, config) | |
63 |
|
63 | |||
64 | # Establish the Registry for this application |
|
64 | # Establish the Registry for this application | |
65 | app = RegistryManager(app) |
|
65 | app = RegistryManager(app) | |
66 |
|
66 | |||
67 | if asbool(static_files): |
|
67 | if asbool(static_files): | |
68 | # Serve static files |
|
68 | # Serve static files | |
69 | static_app = StaticURLParser(config['pylons.paths']['static_files']) |
|
69 | static_app = StaticURLParser(config['pylons.paths']['static_files']) | |
70 | app = Cascade([static_app, app]) |
|
70 | app = Cascade([static_app, app]) | |
71 | app = make_gzip_middleware(app, global_conf, compress_level=1) |
|
71 | app = make_gzip_middleware(app, global_conf, compress_level=1) | |
72 |
|
72 | |||
73 | app.config = config |
|
73 | app.config = config | |
74 |
|
74 | |||
75 | return app |
|
75 | return app | |
76 |
|
76 |
@@ -0,0 +1,29 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | """ | |||
|
3 | rhodecode.lib.__init__ | |||
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~ | |||
|
5 | ||||
|
6 | Some simple helper functions | |||
|
7 | ||||
|
8 | :created_on: Jan 5, 2011 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
|
13 | # This program is free software; you can redistribute it and/or | |||
|
14 | # modify it under the terms of the GNU General Public License | |||
|
15 | # as published by the Free Software Foundation; version 2 | |||
|
16 | # of the License or (at your opinion) any later version of the license. | |||
|
17 | # | |||
|
18 | # This program is distributed in the hope that it will be useful, | |||
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
21 | # GNU General Public License for more details. | |||
|
22 | # | |||
|
23 | # You should have received a copy of the GNU General Public License | |||
|
24 | # along with this program; if not, write to the Free Software | |||
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |||
|
26 | # MA 02110-1301, USA. | |||
|
27 | ||||
|
28 | def str2bool(v): | |||
|
29 | return v.lower() in ["yes", "true", "t", "1"] if v else None |
@@ -1,106 +1,104 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.celerylib.__init__ |
|
3 | rhodecode.lib.celerylib.__init__ | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | celery libs for RhodeCode |
|
6 | celery libs for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Nov 27, 2010 |
|
8 | :created_on: Nov 27, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 | # |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 | # |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
26 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
27 |
|
27 | |||
28 | import os |
|
28 | import os | |
29 | import sys |
|
29 | import sys | |
30 | import socket |
|
30 | import socket | |
31 | import traceback |
|
31 | import traceback | |
32 | import logging |
|
32 | import logging | |
33 |
|
33 | |||
34 | from hashlib import md5 |
|
34 | from hashlib import md5 | |
35 | from decorator import decorator |
|
35 | from decorator import decorator | |
36 | from vcs.utils.lazy import LazyProperty |
|
36 | from vcs.utils.lazy import LazyProperty | |
37 |
|
37 | |||
|
38 | from rhodecode.lib import str2bool | |||
38 | from rhodecode.lib.pidlock import DaemonLock, LockHeld |
|
39 | from rhodecode.lib.pidlock import DaemonLock, LockHeld | |
39 |
|
40 | |||
40 | from pylons import config |
|
41 | from pylons import config | |
41 |
|
42 | |||
42 | log = logging.getLogger(__name__) |
|
43 | log = logging.getLogger(__name__) | |
43 |
|
44 | |||
44 | def str2bool(v): |
|
|||
45 | return v.lower() in ["yes", "true", "t", "1"] if v else None |
|
|||
46 |
|
||||
47 | try: |
|
45 | try: | |
48 | CELERY_ON = str2bool(config['app_conf'].get('use_celery')) |
|
46 | CELERY_ON = str2bool(config['app_conf'].get('use_celery')) | |
49 | except KeyError: |
|
47 | except KeyError: | |
50 | CELERY_ON = False |
|
48 | CELERY_ON = False | |
51 |
|
49 | |||
52 | class ResultWrapper(object): |
|
50 | class ResultWrapper(object): | |
53 | def __init__(self, task): |
|
51 | def __init__(self, task): | |
54 | self.task = task |
|
52 | self.task = task | |
55 |
|
53 | |||
56 | @LazyProperty |
|
54 | @LazyProperty | |
57 | def result(self): |
|
55 | def result(self): | |
58 | return self.task |
|
56 | return self.task | |
59 |
|
57 | |||
60 | def run_task(task, *args, **kwargs): |
|
58 | def run_task(task, *args, **kwargs): | |
61 | if CELERY_ON: |
|
59 | if CELERY_ON: | |
62 | try: |
|
60 | try: | |
63 | t = task.delay(*args, **kwargs) |
|
61 | t = task.delay(*args, **kwargs) | |
64 | log.info('running task %s:%s', t.task_id, task) |
|
62 | log.info('running task %s:%s', t.task_id, task) | |
65 | return t |
|
63 | return t | |
66 | except socket.error, e: |
|
64 | except socket.error, e: | |
67 | if e.errno == 111: |
|
65 | if e.errno == 111: | |
68 | log.debug('Unable to connect to celeryd. Sync execution') |
|
66 | log.debug('Unable to connect to celeryd. Sync execution') | |
69 | else: |
|
67 | else: | |
70 | log.error(traceback.format_exc()) |
|
68 | log.error(traceback.format_exc()) | |
71 | except KeyError, e: |
|
69 | except KeyError, e: | |
72 | log.debug('Unable to connect to celeryd. Sync execution') |
|
70 | log.debug('Unable to connect to celeryd. Sync execution') | |
73 | except Exception, e: |
|
71 | except Exception, e: | |
74 | log.error(traceback.format_exc()) |
|
72 | log.error(traceback.format_exc()) | |
75 |
|
73 | |||
76 | log.debug('executing task %s in sync mode', task) |
|
74 | log.debug('executing task %s in sync mode', task) | |
77 | return ResultWrapper(task(*args, **kwargs)) |
|
75 | return ResultWrapper(task(*args, **kwargs)) | |
78 |
|
76 | |||
79 |
|
77 | |||
80 | def locked_task(func): |
|
78 | def locked_task(func): | |
81 | def __wrapper(func, *fargs, **fkwargs): |
|
79 | def __wrapper(func, *fargs, **fkwargs): | |
82 | params = list(fargs) |
|
80 | params = list(fargs) | |
83 | params.extend(['%s-%s' % ar for ar in fkwargs.items()]) |
|
81 | params.extend(['%s-%s' % ar for ar in fkwargs.items()]) | |
84 |
|
82 | |||
85 | lockkey = 'task_%s' % \ |
|
83 | lockkey = 'task_%s' % \ | |
86 | md5(str(func.__name__) + '-' + \ |
|
84 | md5(str(func.__name__) + '-' + \ | |
87 | '-'.join(map(str, params))).hexdigest() |
|
85 | '-'.join(map(str, params))).hexdigest() | |
88 | log.info('running task with lockkey %s', lockkey) |
|
86 | log.info('running task with lockkey %s', lockkey) | |
89 | try: |
|
87 | try: | |
90 | l = DaemonLock(lockkey) |
|
88 | l = DaemonLock(lockkey) | |
91 | ret = func(*fargs, **fkwargs) |
|
89 | ret = func(*fargs, **fkwargs) | |
92 | l.release() |
|
90 | l.release() | |
93 | return ret |
|
91 | return ret | |
94 | except LockHeld: |
|
92 | except LockHeld: | |
95 | log.info('LockHeld') |
|
93 | log.info('LockHeld') | |
96 | return 'Task with key %s already running' % lockkey |
|
94 | return 'Task with key %s already running' % lockkey | |
97 |
|
95 | |||
98 | return decorator(__wrapper, func) |
|
96 | return decorator(__wrapper, func) | |
99 |
|
97 | |||
100 |
|
98 | |||
101 |
|
99 | |||
102 |
|
100 | |||
103 |
|
101 | |||
104 |
|
102 | |||
105 |
|
103 | |||
106 |
|
104 |
@@ -1,48 +1,54 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.middleware.https_fixup |
|
3 | rhodecode.lib.middleware.https_fixup | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | middleware to handle https correctly |
|
6 | middleware to handle https correctly | |
7 |
|
7 | |||
8 | :created_on: May 23, 2010 |
|
8 | :created_on: May 23, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 | # |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 | # |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
26 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
27 |
|
27 | |||
|
28 | from rhodecode.lib import str2bool | |||
|
29 | ||||
28 | class HttpsFixup(object): |
|
30 | class HttpsFixup(object): | |
29 | def __init__(self, app): |
|
31 | def __init__(self, app, config): | |
30 | self.application = app |
|
32 | self.application = app | |
|
33 | self.config = config | |||
31 |
|
34 | |||
32 | def __call__(self, environ, start_response): |
|
35 | def __call__(self, environ, start_response): | |
33 | self.__fixup(environ) |
|
36 | self.__fixup(environ) | |
34 | return self.application(environ, start_response) |
|
37 | return self.application(environ, start_response) | |
35 |
|
38 | |||
36 |
|
39 | |||
37 | def __fixup(self, environ): |
|
40 | def __fixup(self, environ): | |
38 | """Function to fixup the environ as needed. In order to use this |
|
41 | """Function to fixup the environ as needed. In order to use this | |
39 | middleware you should set this header inside your |
|
42 | middleware you should set this header inside your | |
40 | proxy ie. nginx, apache etc. |
|
43 | proxy ie. nginx, apache etc. | |
41 | """ |
|
44 | """ | |
42 | proto = environ.get('HTTP_X_URL_SCHEME') |
|
45 | proto = environ.get('HTTP_X_URL_SCHEME') | |
43 |
|
46 | |||
|
47 | if str2bool(self.config.get('force_https')): | |||
|
48 | proto = 'https' | |||
|
49 | ||||
44 | if proto == 'https': |
|
50 | if proto == 'https': | |
45 | environ['wsgi.url_scheme'] = proto |
|
51 | environ['wsgi.url_scheme'] = proto | |
46 | else: |
|
52 | else: | |
47 | environ['wsgi.url_scheme'] = 'http' |
|
53 | environ['wsgi.url_scheme'] = 'http' | |
48 | return None |
|
54 | return None |
General Comments 0
You need to be logged in to leave comments.
Login now