Show More
@@ -1,171 +1,172 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # rhodecode - Pylons environment configuration # |
|
4 | 4 | # # |
|
5 | 5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
6 | 6 | ################################################################################ |
|
7 | 7 | |
|
8 | 8 | [DEFAULT] |
|
9 | 9 | debug = true |
|
10 | 10 | ################################################################################ |
|
11 | 11 | ## Uncomment and replace with the address which should receive ## |
|
12 | 12 | ## any error reports after application crash ## |
|
13 | 13 | ## Additionally those settings will be used by rhodecode mailing system ## |
|
14 | 14 | ################################################################################ |
|
15 | 15 | #email_to = admin@localhost |
|
16 | 16 | #error_email_from = paste_error@localhost |
|
17 | 17 | #app_email_from = rhodecode-noreply@localhost |
|
18 | 18 | #error_message = |
|
19 | 19 | |
|
20 | 20 | #smtp_server = mail.server.com |
|
21 | 21 | #smtp_username = |
|
22 | 22 | #smtp_password = |
|
23 | 23 | #smtp_port = |
|
24 | 24 | #smtp_use_tls = |
|
25 | 25 | |
|
26 | 26 | [server:main] |
|
27 | 27 | ##nr of threads to spawn |
|
28 | 28 | threadpool_workers = 5 |
|
29 | 29 | |
|
30 | 30 | ##max request before |
|
31 | 31 | threadpool_max_requests = 6 |
|
32 | 32 | |
|
33 | 33 | ##option to use threads of process |
|
34 | 34 | use_threadpool = false |
|
35 | 35 | |
|
36 | 36 | use = egg:Paste#http |
|
37 | 37 | host = 127.0.0.1 |
|
38 | 38 | port = 5000 |
|
39 | 39 | |
|
40 | 40 | [app:main] |
|
41 | 41 | use = egg:rhodecode |
|
42 | 42 | full_stack = true |
|
43 | 43 | static_files = true |
|
44 | 44 | lang=en |
|
45 | 45 | cache_dir = %(here)s/data |
|
46 | 46 | |
|
47 | 47 | #################################### |
|
48 | 48 | ### BEAKER CACHE #### |
|
49 | 49 | #################################### |
|
50 | 50 |
|
|
51 | 51 |
|
|
52 | 52 |
|
|
53 | beaker.cache.long_term.type=memory | |
|
54 | beaker.cache.long_term.expire=36000 | |
|
53 | ||
|
54 | beaker.cache.super_short_term.type=memory | |
|
55 | beaker.cache.super_short_term.expire=10 | |
|
55 | 56 | |
|
56 | 57 |
|
|
57 | 58 |
|
|
58 | 59 | |
|
59 |
|
|
|
60 |
|
|
|
60 | beaker.cache.long_term.type=memory | |
|
61 | beaker.cache.long_term.expire=36000 | |
|
61 | 62 | |
|
62 | 63 |
|
|
63 | 64 |
|
|
64 | 65 | |
|
65 | 66 |
|
|
66 | 67 |
|
|
67 | 68 | |
|
68 | 69 |
|
|
69 | 70 |
|
|
70 | 71 | |
|
71 | 72 | #################################### |
|
72 | 73 | ### BEAKER SESSION #### |
|
73 | 74 | #################################### |
|
74 | 75 | ## Type of storage used for the session, current types are |
|
75 | 76 | ## "dbm", "file", "memcached", "database", and "memory". |
|
76 | 77 | ## The storage uses the Container API |
|
77 | 78 | ##that is also used by the cache system. |
|
78 | 79 | beaker.session.type = file |
|
79 | 80 | |
|
80 | 81 | beaker.session.key = rhodecode |
|
81 | 82 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
82 | 83 | beaker.session.timeout = 36000 |
|
83 | 84 | |
|
84 | 85 | ##auto save the session to not to use .save() |
|
85 | 86 | beaker.session.auto = False |
|
86 | 87 | |
|
87 | 88 | ##true exire at browser close |
|
88 | 89 | #beaker.session.cookie_expires = 3600 |
|
89 | 90 | |
|
90 | 91 | |
|
91 | 92 | ################################################################################ |
|
92 | 93 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
93 | 94 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
94 | 95 | ## execute malicious code after an exception is raised. ## |
|
95 | 96 | ################################################################################ |
|
96 | 97 | #set debug = false |
|
97 | 98 | |
|
98 | 99 | ################################## |
|
99 | 100 | ### LOGVIEW CONFIG ### |
|
100 | 101 | ################################## |
|
101 | 102 | logview.sqlalchemy = #faa |
|
102 | 103 | logview.pylons.templating = #bfb |
|
103 | 104 | logview.pylons.util = #eee |
|
104 | 105 | |
|
105 | 106 | ######################################################### |
|
106 | 107 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
107 | 108 | ######################################################### |
|
108 | 109 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
109 | 110 | #sqlalchemy.db1.echo = False |
|
110 | 111 | #sqlalchemy.db1.pool_recycle = 3600 |
|
111 | 112 | sqlalchemy.convert_unicode = true |
|
112 | 113 | |
|
113 | 114 | ################################ |
|
114 | 115 | ### LOGGING CONFIGURATION #### |
|
115 | 116 | ################################ |
|
116 | 117 | [loggers] |
|
117 | 118 | keys = root, routes, rhodecode, sqlalchemy |
|
118 | 119 | |
|
119 | 120 | [handlers] |
|
120 | 121 | keys = console |
|
121 | 122 | |
|
122 | 123 | [formatters] |
|
123 | 124 | keys = generic,color_formatter |
|
124 | 125 | |
|
125 | 126 | ############# |
|
126 | 127 | ## LOGGERS ## |
|
127 | 128 | ############# |
|
128 | 129 | [logger_root] |
|
129 | 130 | level = NOTSET |
|
130 | 131 | handlers = console |
|
131 | 132 | |
|
132 | 133 | [logger_routes] |
|
133 | 134 | level = DEBUG |
|
134 | 135 | handlers = console |
|
135 | 136 | qualname = routes.middleware |
|
136 | 137 | # "level = DEBUG" logs the route matched and routing variables. |
|
137 | 138 | |
|
138 | 139 | [logger_rhodecode] |
|
139 | 140 | level = DEBUG |
|
140 | 141 | handlers = console |
|
141 | 142 | qualname = rhodecode |
|
142 | 143 | propagate = 0 |
|
143 | 144 | |
|
144 | 145 | [logger_sqlalchemy] |
|
145 | 146 | level = ERROR |
|
146 | 147 | handlers = console |
|
147 | 148 | qualname = sqlalchemy.engine |
|
148 | 149 | propagate = 0 |
|
149 | 150 | |
|
150 | 151 | ############## |
|
151 | 152 | ## HANDLERS ## |
|
152 | 153 | ############## |
|
153 | 154 | |
|
154 | 155 | [handler_console] |
|
155 | 156 | class = StreamHandler |
|
156 | 157 | args = (sys.stderr,) |
|
157 | 158 | level = NOTSET |
|
158 | 159 | formatter = color_formatter |
|
159 | 160 | |
|
160 | 161 | ################ |
|
161 | 162 | ## FORMATTERS ## |
|
162 | 163 | ################ |
|
163 | 164 | |
|
164 | 165 | [formatter_generic] |
|
165 | 166 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
166 | 167 | datefmt = %Y-%m-%d %H:%M:%S |
|
167 | 168 | |
|
168 | 169 | [formatter_color_formatter] |
|
169 | 170 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
170 | 171 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
171 | 172 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
@@ -1,20 +1,23 b'' | |||
|
1 | 1 | .. _changelog: |
|
2 | 2 | |
|
3 | 3 | Changelog |
|
4 | 4 | ========= |
|
5 | 5 | |
|
6 | 6 | 1.0.0rc4 (**2010-10-12**) |
|
7 | 7 | |
|
8 | 8 | - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman) |
|
9 | 9 | - removed cache_manager settings from sqlalchemy meta |
|
10 | 10 | - added sqlalchemy cache settings to ini files |
|
11 | - validated password length and added second try of failure on paster setup-app | |
|
12 | - fixed setup database destroy prompt even when there was no db | |
|
13 | ||
|
11 | 14 | |
|
12 | 15 | 1.0.0rc3 (**2010-10-11**) |
|
13 | 16 | |
|
14 | 17 | - fixed i18n during installation. |
|
15 | 18 | |
|
16 | 19 | 1.0.0rc2 (**2010-10-11**) |
|
17 | 20 | |
|
18 | 21 | - Disabled dirsize in file browser, it's causing nasty bug when dir renames |
|
19 | 22 | occure. After vcs is fixed it'll be put back again. |
|
20 | 23 | - templating/css rewrites, optimized css. |
@@ -1,129 +1,129 b'' | |||
|
1 | 1 | .. _setup: |
|
2 | 2 | |
|
3 | 3 | Setup |
|
4 | 4 | ===== |
|
5 | 5 | |
|
6 | 6 | |
|
7 | 7 | Setting up the application |
|
8 | 8 | -------------------------- |
|
9 | 9 | |
|
10 | 10 | :: |
|
11 | 11 | |
|
12 | 12 | paster make-config RhodeCode production.ini |
|
13 | 13 | |
|
14 | 14 | - This will create `production.ini` config inside the directory |
|
15 | 15 | this config contain various settings for rhodecode, e.g port, email settings |
|
16 | 16 | static files, cache and logging. |
|
17 | 17 | |
|
18 | 18 | :: |
|
19 | 19 | |
|
20 |
paster setup-app production.ini |
|
|
20 | paster setup-app production.ini | |
|
21 | 21 | |
|
22 | 22 | - This command will create all needed tables and an admin account. |
|
23 | 23 | When asked for a path You can either use a new location of one with already |
|
24 | 24 | existing ones. RhodeCode will simply add all new found repositories to |
|
25 | 25 | it's database. Also make sure You specify correct path to repositories. |
|
26 | 26 | - Remember that the given path for mercurial_ repositories must be write |
|
27 | 27 | accessible for the application. It's very important since RhodeCode web interface |
|
28 | 28 | will work even without such an access but, when trying to do a push it'll |
|
29 | 29 | eventually fail with permission denied errors. |
|
30 | 30 | - Run |
|
31 | 31 | |
|
32 | 32 | :: |
|
33 | 33 | |
|
34 | 34 | paster serve production.ini |
|
35 | 35 | |
|
36 | 36 | - This command runs the rhodecode server the app should be available at the |
|
37 | 37 | 127.0.0.1:5000. This ip and port is configurable via the production.ini |
|
38 | 38 | file created in previous step |
|
39 | 39 | - Use admin account you created to login. |
|
40 | 40 | - Default permissions on each repository is read, and owner is admin. So |
|
41 | 41 | remember to update these if needed. |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | Setting up Whoosh |
|
45 | 45 | ----------------- |
|
46 | 46 | |
|
47 | 47 | - For full text search You can either put crontab entry for |
|
48 | 48 | |
|
49 | 49 | :: |
|
50 | 50 | |
|
51 | 51 | python /var/www/rhodecode/<rhodecode_installation_path>/lib/indexers/daemon.py incremental <put_here_path_to_repos> |
|
52 | 52 | |
|
53 | 53 | When using incremental mode whoosh will check last modification date of each file |
|
54 | 54 | and add it to reindex if newer file is available. Also indexing daemon checks |
|
55 | 55 | for removed files and removes them from index. Sometime You might want to rebuild |
|
56 | 56 | index from scrach, in admin pannel You can check `build from scratch` flag |
|
57 | 57 | and in standalone daemon You can pass `full` instead on incremental to build |
|
58 | 58 | remove previos index and build new one. |
|
59 | 59 | |
|
60 | 60 | Nginx virtual host example |
|
61 | 61 | -------------------------- |
|
62 | 62 | |
|
63 | 63 | Sample config for nginx:: |
|
64 | 64 | |
|
65 | 65 | server { |
|
66 | 66 | listen 80; |
|
67 | 67 | server_name hg.myserver.com; |
|
68 | 68 | access_log /var/log/nginx/rhodecode.access.log; |
|
69 | 69 | error_log /var/log/nginx/rhodecode.error.log; |
|
70 | 70 | location / { |
|
71 | 71 | root /var/www/rhodecode/rhodecode/public/; |
|
72 | 72 | if (!-f $request_filename){ |
|
73 | 73 | proxy_pass http://127.0.0.1:5000; |
|
74 | 74 | } |
|
75 | 75 | #this is important for https !!! |
|
76 | 76 | proxy_set_header X-Url-Scheme $scheme; |
|
77 | 77 | include /etc/nginx/proxy.conf; |
|
78 | 78 | } |
|
79 | 79 | } |
|
80 | 80 | |
|
81 | 81 | Here's the proxy.conf. It's tuned so it'll not timeout on long |
|
82 | 82 | pushes and also on large pushes:: |
|
83 | 83 | |
|
84 | 84 | proxy_redirect off; |
|
85 | 85 | proxy_set_header Host $host; |
|
86 | 86 | proxy_set_header X-Host $http_host; |
|
87 | 87 | proxy_set_header X-Real-IP $remote_addr; |
|
88 | 88 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
89 | 89 | proxy_set_header Proxy-host $proxy_host; |
|
90 | 90 | client_max_body_size 400m; |
|
91 | 91 | client_body_buffer_size 128k; |
|
92 | 92 | proxy_buffering off; |
|
93 | 93 | proxy_connect_timeout 3600; |
|
94 | 94 | proxy_send_timeout 3600; |
|
95 | 95 | proxy_read_timeout 3600; |
|
96 | 96 | proxy_buffer_size 8k; |
|
97 | 97 | proxy_buffers 8 32k; |
|
98 | 98 | proxy_busy_buffers_size 64k; |
|
99 | 99 | proxy_temp_file_write_size 64k; |
|
100 | 100 | |
|
101 | 101 | Also when using root path with nginx You might set the static files to false |
|
102 | 102 | in production.ini file:: |
|
103 | 103 | |
|
104 | 104 | [app:main] |
|
105 | 105 | use = egg:rhodecode |
|
106 | 106 | full_stack = true |
|
107 | 107 | static_files = false |
|
108 | 108 | lang=en |
|
109 | 109 | cache_dir = %(here)s/data |
|
110 | 110 | |
|
111 | 111 | To not have the statics served by the application. And improve speed. |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | Other configuration files |
|
115 | 115 | ------------------------- |
|
116 | 116 | |
|
117 | 117 | Some extra configuration files and examples can be found here: |
|
118 | 118 | http://hg.python-works.com/rhodecode/files/tip/init.d |
|
119 | 119 | |
|
120 | 120 | and also an celeryconfig file can be use from here: |
|
121 | 121 | http://hg.python-works.com/rhodecode/files/tip/celeryconfig.py |
|
122 | 122 | |
|
123 | 123 | |
|
124 | 124 | |
|
125 | 125 | .. _virtualenv: http://pypi.python.org/pypi/virtualenv |
|
126 | 126 | .. _python: http://www.python.org/ |
|
127 | 127 | .. _mercurial: http://mercurial.selenic.com/ |
|
128 | 128 | .. _celery: http://celeryproject.org/ |
|
129 | 129 | .. _rabbitmq: http://www.rabbitmq.com/ No newline at end of file |
@@ -1,171 +1,172 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # rhodecode - Pylons environment configuration # |
|
4 | 4 | # # |
|
5 | 5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
6 | 6 | ################################################################################ |
|
7 | 7 | |
|
8 | 8 | [DEFAULT] |
|
9 | 9 | debug = true |
|
10 | 10 | ################################################################################ |
|
11 | 11 | ## Uncomment and replace with the address which should receive ## |
|
12 | 12 | ## any error reports after application crash ## |
|
13 | 13 | ## Additionally those settings will be used by rhodecode mailing system ## |
|
14 | 14 | ################################################################################ |
|
15 | 15 | #email_to = admin@localhost |
|
16 | 16 | #error_email_from = paste_error@localhost |
|
17 | 17 | #app_email_from = rhodecode-noreply@localhost |
|
18 | 18 | #error_message = |
|
19 | 19 | |
|
20 | 20 | #smtp_server = mail.server.com |
|
21 | 21 | #smtp_username = |
|
22 | 22 | #smtp_password = |
|
23 | 23 | #smtp_port = |
|
24 | 24 | #smtp_use_tls = false |
|
25 | 25 | |
|
26 | 26 | [server:main] |
|
27 | 27 | ##nr of threads to spawn |
|
28 | 28 | threadpool_workers = 5 |
|
29 | 29 | |
|
30 | 30 | ##max request before thread respawn |
|
31 | 31 | threadpool_max_requests = 2 |
|
32 | 32 | |
|
33 | 33 | ##option to use threads of process |
|
34 | 34 | use_threadpool = true |
|
35 | 35 | |
|
36 | 36 | use = egg:Paste#http |
|
37 | 37 | host = 127.0.0.1 |
|
38 | 38 | port = 8001 |
|
39 | 39 | |
|
40 | 40 | [app:main] |
|
41 | 41 | use = egg:rhodecode |
|
42 | 42 | full_stack = true |
|
43 | 43 | static_files = false |
|
44 | 44 | lang=en |
|
45 | 45 | cache_dir = %(here)s/data |
|
46 | 46 | |
|
47 | 47 | #################################### |
|
48 | 48 | ### BEAKER CACHE #### |
|
49 | 49 | #################################### |
|
50 | 50 |
|
|
51 | 51 |
|
|
52 | 52 |
|
|
53 | beaker.cache.long_term.type=memory | |
|
54 | beaker.cache.long_term.expire=36000 | |
|
53 | ||
|
54 | beaker.cache.super_short_term.type=memory | |
|
55 | beaker.cache.super_short_term.expire=10 | |
|
55 | 56 | |
|
56 | 57 |
|
|
57 | 58 |
|
|
58 | 59 | |
|
59 |
|
|
|
60 |
|
|
|
60 | beaker.cache.long_term.type=memory | |
|
61 | beaker.cache.long_term.expire=36000 | |
|
61 | 62 | |
|
62 | 63 |
|
|
63 | 64 |
|
|
64 | 65 | |
|
65 | 66 |
|
|
66 | 67 |
|
|
67 | 68 | |
|
68 | 69 |
|
|
69 | 70 |
|
|
70 | 71 | |
|
71 | 72 | #################################### |
|
72 | 73 | ### BEAKER SESSION #### |
|
73 | 74 | #################################### |
|
74 | 75 | ## Type of storage used for the session, current types are |
|
75 | 76 | ## "dbm", "file", "memcached", "database", and "memory". |
|
76 | 77 | ## The storage uses the Container API |
|
77 | 78 | ##that is also used by the cache system. |
|
78 | 79 | beaker.session.type = file |
|
79 | 80 | |
|
80 | 81 | beaker.session.key = rhodecode |
|
81 | 82 | beaker.session.secret = g654dcno0-9873jhgfreyu |
|
82 | 83 | beaker.session.timeout = 36000 |
|
83 | 84 | |
|
84 | 85 | ##auto save the session to not to use .save() |
|
85 | 86 | beaker.session.auto = False |
|
86 | 87 | |
|
87 | 88 | ##true exire at browser close |
|
88 | 89 | #beaker.session.cookie_expires = 3600 |
|
89 | 90 | |
|
90 | 91 | |
|
91 | 92 | ################################################################################ |
|
92 | 93 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
93 | 94 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
94 | 95 | ## execute malicious code after an exception is raised. ## |
|
95 | 96 | ################################################################################ |
|
96 | 97 | set debug = false |
|
97 | 98 | |
|
98 | 99 | ################################## |
|
99 | 100 | ### LOGVIEW CONFIG ### |
|
100 | 101 | ################################## |
|
101 | 102 | logview.sqlalchemy = #faa |
|
102 | 103 | logview.pylons.templating = #bfb |
|
103 | 104 | logview.pylons.util = #eee |
|
104 | 105 | |
|
105 | 106 | ######################################################### |
|
106 | 107 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
107 | 108 | ######################################################### |
|
108 | 109 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
109 | 110 | #sqlalchemy.db1.echo = False |
|
110 | 111 | #sqlalchemy.db1.pool_recycle = 3600 |
|
111 | 112 | sqlalchemy.convert_unicode = true |
|
112 | 113 | |
|
113 | 114 | ################################ |
|
114 | 115 | ### LOGGING CONFIGURATION #### |
|
115 | 116 | ################################ |
|
116 | 117 | [loggers] |
|
117 | 118 | keys = root, routes, rhodecode, sqlalchemy |
|
118 | 119 | |
|
119 | 120 | [handlers] |
|
120 | 121 | keys = console |
|
121 | 122 | |
|
122 | 123 | [formatters] |
|
123 | 124 | keys = generic,color_formatter |
|
124 | 125 | |
|
125 | 126 | ############# |
|
126 | 127 | ## LOGGERS ## |
|
127 | 128 | ############# |
|
128 | 129 | [logger_root] |
|
129 | 130 | level = INFO |
|
130 | 131 | handlers = console |
|
131 | 132 | |
|
132 | 133 | [logger_routes] |
|
133 | 134 | level = INFO |
|
134 | 135 | handlers = console |
|
135 | 136 | qualname = routes.middleware |
|
136 | 137 | # "level = DEBUG" logs the route matched and routing variables. |
|
137 | 138 | |
|
138 | 139 | [logger_rhodecode] |
|
139 | 140 | level = DEBUG |
|
140 | 141 | handlers = console |
|
141 | 142 | qualname = rhodecode |
|
142 | 143 | propagate = 0 |
|
143 | 144 | |
|
144 | 145 | [logger_sqlalchemy] |
|
145 | 146 | level = ERROR |
|
146 | 147 | handlers = console |
|
147 | 148 | qualname = sqlalchemy.engine |
|
148 | 149 | propagate = 0 |
|
149 | 150 | |
|
150 | 151 | ############## |
|
151 | 152 | ## HANDLERS ## |
|
152 | 153 | ############## |
|
153 | 154 | |
|
154 | 155 | [handler_console] |
|
155 | 156 | class = StreamHandler |
|
156 | 157 | args = (sys.stderr,) |
|
157 | 158 | level = NOTSET |
|
158 | 159 | formatter = color_formatter |
|
159 | 160 | |
|
160 | 161 | ################ |
|
161 | 162 | ## FORMATTERS ## |
|
162 | 163 | ################ |
|
163 | 164 | |
|
164 | 165 | [formatter_generic] |
|
165 | 166 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
166 | 167 | datefmt = %Y-%m-%d %H:%M:%S |
|
167 | 168 | |
|
168 | 169 | [formatter_color_formatter] |
|
169 | 170 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
170 | 171 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
171 | 172 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
@@ -1,172 +1,173 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # rhodecode - Pylons environment configuration # |
|
4 | 4 | # # |
|
5 | 5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
6 | 6 | ################################################################################ |
|
7 | 7 | |
|
8 | 8 | [DEFAULT] |
|
9 | 9 | debug = true |
|
10 | 10 | ################################################################################ |
|
11 | 11 | ## Uncomment and replace with the address which should receive ## |
|
12 | 12 | ## any error reports after application crash ## |
|
13 | 13 | ## Additionally those settings will be used by rhodecode mailing system ## |
|
14 | 14 | ################################################################################ |
|
15 | 15 | #email_to = admin@localhost |
|
16 | 16 | #error_email_from = paste_error@localhost |
|
17 | 17 | #app_email_from = rhodecode-noreply@localhost |
|
18 | 18 | #error_message = |
|
19 | 19 | |
|
20 | 20 | #smtp_server = mail.server.com |
|
21 | 21 | #smtp_username = |
|
22 | 22 | #smtp_password = |
|
23 | 23 | #smtp_port = |
|
24 | 24 | #smtp_use_tls = false |
|
25 | 25 | |
|
26 | 26 | [server:main] |
|
27 | 27 | ##nr of threads to spawn |
|
28 | 28 | threadpool_workers = 5 |
|
29 | 29 | |
|
30 | 30 | ##max request before thread respawn |
|
31 | 31 | threadpool_max_requests = 2 |
|
32 | 32 | |
|
33 | 33 | ##option to use threads of process |
|
34 | 34 | use_threadpool = true |
|
35 | 35 | |
|
36 | 36 | use = egg:Paste#http |
|
37 | 37 | host = 127.0.0.1 |
|
38 | 38 | port = 5000 |
|
39 | 39 | |
|
40 | 40 | [app:main] |
|
41 | 41 | use = egg:rhodecode |
|
42 | 42 | full_stack = true |
|
43 | 43 | static_files = true |
|
44 | 44 | lang=en |
|
45 | 45 | cache_dir = %(here)s/data |
|
46 | 46 | app_instance_uuid = ${app_instance_uuid} |
|
47 | 47 | |
|
48 | 48 | #################################### |
|
49 | 49 | ### BEAKER CACHE #### |
|
50 | 50 | #################################### |
|
51 | 51 |
|
|
52 | 52 |
|
|
53 | 53 |
|
|
54 | beaker.cache.long_term.type=memory | |
|
55 | beaker.cache.long_term.expire=36000 | |
|
54 | ||
|
55 | beaker.cache.super_short_term.type=memory | |
|
56 | beaker.cache.super_short_term.expire=10 | |
|
56 | 57 | |
|
57 | 58 |
|
|
58 | 59 |
|
|
59 | 60 | |
|
60 |
|
|
|
61 |
|
|
|
61 | beaker.cache.long_term.type=memory | |
|
62 | beaker.cache.long_term.expire=36000 | |
|
62 | 63 | |
|
63 | 64 |
|
|
64 | 65 |
|
|
65 | 66 | |
|
66 | 67 |
|
|
67 | 68 |
|
|
68 | 69 | |
|
69 | 70 |
|
|
70 | 71 |
|
|
71 | 72 | |
|
72 | 73 | #################################### |
|
73 | 74 | ### BEAKER SESSION #### |
|
74 | 75 | #################################### |
|
75 | 76 | ## Type of storage used for the session, current types are |
|
76 | 77 | ## "dbm", "file", "memcached", "database", and "memory". |
|
77 | 78 | ## The storage uses the Container API |
|
78 | 79 | ##that is also used by the cache system. |
|
79 | 80 | beaker.session.type = file |
|
80 | 81 | |
|
81 | 82 | beaker.session.key = rhodecode |
|
82 | 83 | beaker.session.secret = ${app_instance_secret} |
|
83 | 84 | beaker.session.timeout = 36000 |
|
84 | 85 | |
|
85 | 86 | ##auto save the session to not to use .save() |
|
86 | 87 | beaker.session.auto = False |
|
87 | 88 | |
|
88 | 89 | ##true exire at browser close |
|
89 | 90 | #beaker.session.cookie_expires = 3600 |
|
90 | 91 | |
|
91 | 92 | |
|
92 | 93 | ################################################################################ |
|
93 | 94 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
94 | 95 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
95 | 96 | ## execute malicious code after an exception is raised. ## |
|
96 | 97 | ################################################################################ |
|
97 | 98 | set debug = false |
|
98 | 99 | |
|
99 | 100 | ################################## |
|
100 | 101 | ### LOGVIEW CONFIG ### |
|
101 | 102 | ################################## |
|
102 | 103 | logview.sqlalchemy = #faa |
|
103 | 104 | logview.pylons.templating = #bfb |
|
104 | 105 | logview.pylons.util = #eee |
|
105 | 106 | |
|
106 | 107 | ######################################################### |
|
107 | 108 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
108 | 109 | ######################################################### |
|
109 | 110 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
110 | 111 | #sqlalchemy.db1.echo = False |
|
111 | 112 | #sqlalchemy.db1.pool_recycle = 3600 |
|
112 | 113 | sqlalchemy.convert_unicode = true |
|
113 | 114 | |
|
114 | 115 | ################################ |
|
115 | 116 | ### LOGGING CONFIGURATION #### |
|
116 | 117 | ################################ |
|
117 | 118 | [loggers] |
|
118 | 119 | keys = root, routes, rhodecode, sqlalchemy |
|
119 | 120 | |
|
120 | 121 | [handlers] |
|
121 | 122 | keys = console |
|
122 | 123 | |
|
123 | 124 | [formatters] |
|
124 | 125 | keys = generic,color_formatter |
|
125 | 126 | |
|
126 | 127 | ############# |
|
127 | 128 | ## LOGGERS ## |
|
128 | 129 | ############# |
|
129 | 130 | [logger_root] |
|
130 | 131 | level = INFO |
|
131 | 132 | handlers = console |
|
132 | 133 | |
|
133 | 134 | [logger_routes] |
|
134 | 135 | level = INFO |
|
135 | 136 | handlers = console |
|
136 | 137 | qualname = routes.middleware |
|
137 | 138 | # "level = DEBUG" logs the route matched and routing variables. |
|
138 | 139 | |
|
139 | 140 | [logger_rhodecode] |
|
140 | 141 | level = DEBUG |
|
141 | 142 | handlers = console |
|
142 | 143 | qualname = rhodecode |
|
143 | 144 | propagate = 0 |
|
144 | 145 | |
|
145 | 146 | [logger_sqlalchemy] |
|
146 | 147 | level = ERROR |
|
147 | 148 | handlers = console |
|
148 | 149 | qualname = sqlalchemy.engine |
|
149 | 150 | propagate = 0 |
|
150 | 151 | |
|
151 | 152 | ############## |
|
152 | 153 | ## HANDLERS ## |
|
153 | 154 | ############## |
|
154 | 155 | |
|
155 | 156 | [handler_console] |
|
156 | 157 | class = StreamHandler |
|
157 | 158 | args = (sys.stderr,) |
|
158 | 159 | level = NOTSET |
|
159 | 160 | formatter = color_formatter |
|
160 | 161 | |
|
161 | 162 | ################ |
|
162 | 163 | ## FORMATTERS ## |
|
163 | 164 | ################ |
|
164 | 165 | |
|
165 | 166 | [formatter_generic] |
|
166 | 167 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
167 | 168 | datefmt = %Y-%m-%d %H:%M:%S |
|
168 | 169 | |
|
169 | 170 | [formatter_color_formatter] |
|
170 | 171 | class=rhodecode.lib.colored_formatter.ColorFormatter |
|
171 | 172 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
172 | 173 | datefmt = %Y-%m-%d %H:%M:%S No newline at end of file |
@@ -1,270 +1,287 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # encoding: utf-8 |
|
3 | 3 | # database management for RhodeCode |
|
4 | 4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
5 | 5 | # |
|
6 | 6 | # This program is free software; you can redistribute it and/or |
|
7 | 7 | # modify it under the terms of the GNU General Public License |
|
8 | 8 | # as published by the Free Software Foundation; version 2 |
|
9 | 9 | # of the License or (at your opinion) any later version of the license. |
|
10 | 10 | # |
|
11 | 11 | # This program is distributed in the hope that it will be useful, |
|
12 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | # GNU General Public License for more details. |
|
15 | 15 | # |
|
16 | 16 | # You should have received a copy of the GNU General Public License |
|
17 | 17 | # along with this program; if not, write to the Free Software |
|
18 | 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 | # MA 02110-1301, USA. |
|
20 | 20 | |
|
21 | 21 | """ |
|
22 | 22 | Created on April 10, 2010 |
|
23 | 23 | database management and creation for RhodeCode |
|
24 | 24 | @author: marcink |
|
25 | 25 | """ |
|
26 | 26 | |
|
27 | 27 | from os.path import dirname as dn, join as jn |
|
28 | 28 | import os |
|
29 | 29 | import sys |
|
30 | 30 | import uuid |
|
31 | 31 | |
|
32 | 32 | from rhodecode.lib.auth import get_crypt_password |
|
33 | 33 | from rhodecode.lib.utils import ask_ok |
|
34 | 34 | from rhodecode.model import init_model |
|
35 | 35 | from rhodecode.model.db import User, Permission, RhodeCodeUi, RhodeCodeSettings, \ |
|
36 | 36 | UserToPerm |
|
37 | 37 | from rhodecode.model import meta |
|
38 | 38 | from sqlalchemy.engine import create_engine |
|
39 | 39 | import logging |
|
40 | 40 | |
|
41 | 41 | log = logging.getLogger(__name__) |
|
42 | 42 | |
|
43 | 43 | class DbManage(object): |
|
44 | 44 | def __init__(self, log_sql, dbname, root, tests=False): |
|
45 | 45 | self.dbname = dbname |
|
46 | 46 | self.tests = tests |
|
47 | 47 | self.root = root |
|
48 | 48 | dburi = 'sqlite:////%s' % jn(self.root, self.dbname) |
|
49 | 49 | engine = create_engine(dburi, echo=log_sql) |
|
50 | 50 | init_model(engine) |
|
51 | 51 | self.sa = meta.Session |
|
52 | 52 | self.db_exists = False |
|
53 | 53 | |
|
54 | 54 | def check_for_db(self, override): |
|
55 | 55 | db_path = jn(self.root, self.dbname) |
|
56 | 56 | log.info('checking for existing db in %s', db_path) |
|
57 | 57 | if os.path.isfile(db_path): |
|
58 | 58 | self.db_exists = True |
|
59 | log.info('database exist') | |
|
60 | 59 | if not override: |
|
61 | 60 | raise Exception('database already exists') |
|
62 | 61 | |
|
63 | 62 | def create_tables(self, override=False): |
|
64 | 63 | """ |
|
65 | 64 | Create a auth database |
|
66 | 65 | """ |
|
67 | 66 | self.check_for_db(override) |
|
68 |
if |
|
|
67 | if self.db_exists: | |
|
69 | 68 | log.info("database exist and it's going to be destroyed") |
|
70 | 69 | if self.tests: |
|
71 | 70 | destroy = True |
|
72 | 71 | else: |
|
73 | 72 | destroy = ask_ok('Are you sure to destroy old database ? [y/n]') |
|
74 | 73 | if not destroy: |
|
75 | 74 | sys.exit() |
|
76 | 75 | if self.db_exists and destroy: |
|
77 | 76 | os.remove(jn(self.root, self.dbname)) |
|
78 | 77 | checkfirst = not override |
|
79 | 78 | meta.Base.metadata.create_all(checkfirst=checkfirst) |
|
80 | 79 | log.info('Created tables for %s', self.dbname) |
|
81 | 80 | |
|
82 | def admin_prompt(self): | |
|
81 | def admin_prompt(self, second=False): | |
|
83 | 82 | if not self.tests: |
|
84 | 83 | import getpass |
|
85 | username = raw_input('Specify admin username:') | |
|
86 | password = getpass.getpass('Specify admin password:') | |
|
84 | ||
|
85 | ||
|
86 | def get_password(): | |
|
87 | password = getpass.getpass('Specify admin password (min 6 chars):') | |
|
87 | 88 | confirm = getpass.getpass('Confirm password:') |
|
89 | ||
|
88 | 90 | if password != confirm: |
|
89 | 91 | log.error('passwords mismatch') |
|
92 | return False | |
|
93 | if len(password) < 6: | |
|
94 | log.error('password is to short use at least 6 characters') | |
|
95 | return False | |
|
96 | ||
|
97 | return password | |
|
98 | ||
|
99 | username = raw_input('Specify admin username:') | |
|
100 | ||
|
101 | password = get_password() | |
|
102 | if not password: | |
|
103 | #second try | |
|
104 | password = get_password() | |
|
105 | if not password: | |
|
90 | 106 | sys.exit() |
|
107 | ||
|
91 | 108 | email = raw_input('Specify admin email:') |
|
92 | 109 | self.create_user(username, password, email, True) |
|
93 | 110 | else: |
|
94 | 111 | log.info('creating admin and regular test users') |
|
95 | 112 | self.create_user('test_admin', 'test12', 'test_admin@mail.com', True) |
|
96 | 113 | self.create_user('test_regular', 'test12', 'test_regular@mail.com', False) |
|
97 | 114 | self.create_user('test_regular2', 'test12', 'test_regular2@mail.com', False) |
|
98 | 115 | |
|
99 | 116 | |
|
100 | 117 | |
|
101 | 118 | def config_prompt(self, test_repo_path=''): |
|
102 | 119 | log.info('Setting up repositories config') |
|
103 | 120 | |
|
104 | 121 | if not self.tests and not test_repo_path: |
|
105 | 122 | path = raw_input('Specify valid full path to your repositories' |
|
106 | 123 | ' you can change this later in application settings:') |
|
107 | 124 | else: |
|
108 | 125 | path = test_repo_path |
|
109 | 126 | |
|
110 | 127 | if not os.path.isdir(path): |
|
111 | 128 | log.error('You entered wrong path: %s', path) |
|
112 | 129 | sys.exit() |
|
113 | 130 | |
|
114 | 131 | hooks1 = RhodeCodeUi() |
|
115 | 132 | hooks1.ui_section = 'hooks' |
|
116 | 133 | hooks1.ui_key = 'changegroup.update' |
|
117 | 134 | hooks1.ui_value = 'hg update >&2' |
|
118 | 135 | hooks1.ui_active = False |
|
119 | 136 | |
|
120 | 137 | hooks2 = RhodeCodeUi() |
|
121 | 138 | hooks2.ui_section = 'hooks' |
|
122 | 139 | hooks2.ui_key = 'changegroup.repo_size' |
|
123 | 140 | hooks2.ui_value = 'python:rhodecode.lib.hooks.repo_size' |
|
124 | 141 | |
|
125 | 142 | web1 = RhodeCodeUi() |
|
126 | 143 | web1.ui_section = 'web' |
|
127 | 144 | web1.ui_key = 'push_ssl' |
|
128 | 145 | web1.ui_value = 'false' |
|
129 | 146 | |
|
130 | 147 | web2 = RhodeCodeUi() |
|
131 | 148 | web2.ui_section = 'web' |
|
132 | 149 | web2.ui_key = 'allow_archive' |
|
133 | 150 | web2.ui_value = 'gz zip bz2' |
|
134 | 151 | |
|
135 | 152 | web3 = RhodeCodeUi() |
|
136 | 153 | web3.ui_section = 'web' |
|
137 | 154 | web3.ui_key = 'allow_push' |
|
138 | 155 | web3.ui_value = '*' |
|
139 | 156 | |
|
140 | 157 | web4 = RhodeCodeUi() |
|
141 | 158 | web4.ui_section = 'web' |
|
142 | 159 | web4.ui_key = 'baseurl' |
|
143 | 160 | web4.ui_value = '/' |
|
144 | 161 | |
|
145 | 162 | paths = RhodeCodeUi() |
|
146 | 163 | paths.ui_section = 'paths' |
|
147 | 164 | paths.ui_key = '/' |
|
148 | 165 | paths.ui_value = os.path.join(path, '*') |
|
149 | 166 | |
|
150 | 167 | |
|
151 | 168 | hgsettings1 = RhodeCodeSettings() |
|
152 | 169 | |
|
153 | 170 | hgsettings1.app_settings_name = 'realm' |
|
154 | 171 | hgsettings1.app_settings_value = 'RhodeCode authentication' |
|
155 | 172 | |
|
156 | 173 | hgsettings2 = RhodeCodeSettings() |
|
157 | 174 | hgsettings2.app_settings_name = 'title' |
|
158 | 175 | hgsettings2.app_settings_value = 'RhodeCode' |
|
159 | 176 | |
|
160 | 177 | try: |
|
161 | 178 | self.sa.add(hooks1) |
|
162 | 179 | self.sa.add(hooks2) |
|
163 | 180 | self.sa.add(web1) |
|
164 | 181 | self.sa.add(web2) |
|
165 | 182 | self.sa.add(web3) |
|
166 | 183 | self.sa.add(web4) |
|
167 | 184 | self.sa.add(paths) |
|
168 | 185 | self.sa.add(hgsettings1) |
|
169 | 186 | self.sa.add(hgsettings2) |
|
170 | 187 | self.sa.commit() |
|
171 | 188 | except: |
|
172 | 189 | self.sa.rollback() |
|
173 | 190 | raise |
|
174 | 191 | log.info('created ui config') |
|
175 | 192 | |
|
176 | 193 | def create_user(self, username, password, email='', admin=False): |
|
177 | 194 | log.info('creating administrator user %s', username) |
|
178 | 195 | new_user = User() |
|
179 | 196 | new_user.username = username |
|
180 | 197 | new_user.password = get_crypt_password(password) |
|
181 | 198 | new_user.name = 'RhodeCode' |
|
182 | 199 | new_user.lastname = 'Admin' |
|
183 | 200 | new_user.email = email |
|
184 | 201 | new_user.admin = admin |
|
185 | 202 | new_user.active = True |
|
186 | 203 | |
|
187 | 204 | try: |
|
188 | 205 | self.sa.add(new_user) |
|
189 | 206 | self.sa.commit() |
|
190 | 207 | except: |
|
191 | 208 | self.sa.rollback() |
|
192 | 209 | raise |
|
193 | 210 | |
|
194 | 211 | def create_default_user(self): |
|
195 | 212 | log.info('creating default user') |
|
196 | 213 | #create default user for handling default permissions. |
|
197 | 214 | def_user = User() |
|
198 | 215 | def_user.username = 'default' |
|
199 | 216 | def_user.password = get_crypt_password(str(uuid.uuid1())[:8]) |
|
200 | 217 | def_user.name = 'default' |
|
201 | 218 | def_user.lastname = 'default' |
|
202 | 219 | def_user.email = 'default@default.com' |
|
203 | 220 | def_user.admin = False |
|
204 | 221 | def_user.active = False |
|
205 | 222 | try: |
|
206 | 223 | self.sa.add(def_user) |
|
207 | 224 | self.sa.commit() |
|
208 | 225 | except: |
|
209 | 226 | self.sa.rollback() |
|
210 | 227 | raise |
|
211 | 228 | |
|
212 | 229 | def create_permissions(self): |
|
213 | 230 | #module.(access|create|change|delete)_[name] |
|
214 | 231 | #module.(read|write|owner) |
|
215 | 232 | perms = [('repository.none', 'Repository no access'), |
|
216 | 233 | ('repository.read', 'Repository read access'), |
|
217 | 234 | ('repository.write', 'Repository write access'), |
|
218 | 235 | ('repository.admin', 'Repository admin access'), |
|
219 | 236 | ('hg.admin', 'Hg Administrator'), |
|
220 | 237 | ('hg.create.repository', 'Repository create'), |
|
221 | 238 | ('hg.create.none', 'Repository creation disabled'), |
|
222 | 239 | ('hg.register.none', 'Register disabled'), |
|
223 | 240 | ('hg.register.manual_activate', 'Register new user with rhodecode without manual activation'), |
|
224 | 241 | ('hg.register.auto_activate', 'Register new user with rhodecode without auto activation'), |
|
225 | 242 | ] |
|
226 | 243 | |
|
227 | 244 | for p in perms: |
|
228 | 245 | new_perm = Permission() |
|
229 | 246 | new_perm.permission_name = p[0] |
|
230 | 247 | new_perm.permission_longname = p[1] |
|
231 | 248 | try: |
|
232 | 249 | self.sa.add(new_perm) |
|
233 | 250 | self.sa.commit() |
|
234 | 251 | except: |
|
235 | 252 | self.sa.rollback() |
|
236 | 253 | raise |
|
237 | 254 | |
|
238 | 255 | def populate_default_permissions(self): |
|
239 | 256 | log.info('creating default user permissions') |
|
240 | 257 | |
|
241 | 258 | default_user = self.sa.query(User)\ |
|
242 | 259 | .filter(User.username == 'default').scalar() |
|
243 | 260 | |
|
244 | 261 | reg_perm = UserToPerm() |
|
245 | 262 | reg_perm.user = default_user |
|
246 | 263 | reg_perm.permission = self.sa.query(Permission)\ |
|
247 | 264 | .filter(Permission.permission_name == 'hg.register.manual_activate')\ |
|
248 | 265 | .scalar() |
|
249 | 266 | |
|
250 | 267 | create_repo_perm = UserToPerm() |
|
251 | 268 | create_repo_perm.user = default_user |
|
252 | 269 | create_repo_perm.permission = self.sa.query(Permission)\ |
|
253 | 270 | .filter(Permission.permission_name == 'hg.create.repository')\ |
|
254 | 271 | .scalar() |
|
255 | 272 | |
|
256 | 273 | default_repo_perm = UserToPerm() |
|
257 | 274 | default_repo_perm.user = default_user |
|
258 | 275 | default_repo_perm.permission = self.sa.query(Permission)\ |
|
259 | 276 | .filter(Permission.permission_name == 'repository.read')\ |
|
260 | 277 | .scalar() |
|
261 | 278 | |
|
262 | 279 | try: |
|
263 | 280 | self.sa.add(reg_perm) |
|
264 | 281 | self.sa.add(create_repo_perm) |
|
265 | 282 | self.sa.add(default_repo_perm) |
|
266 | 283 | self.sa.commit() |
|
267 | 284 | except: |
|
268 | 285 | self.sa.rollback() |
|
269 | 286 | raise |
|
270 | 287 |
General Comments 0
You need to be logged in to leave comments.
Login now