##// END OF EJS Templates
new setup-rhodecode command with optional defaults
marcink -
r2284:e285aa09 beta
parent child Browse files
Show More
@@ -0,0 +1,87 b''
1 import os
2 from paste.script.appinstall import AbstractInstallCommand
3 from paste.script.command import BadCommand
4 from paste.deploy import appconfig
5
6
7 class SetupCommand(AbstractInstallCommand):
8
9 default_verbosity = 1
10 max_args = 1
11 min_args = 1
12 summary = "Setup an application, given a config file"
13 usage = "CONFIG_FILE"
14
15 description = """\
16 Note: this is an experimental command, and it will probably change
17 in several ways by the next release.
18
19 Setup an application according to its configuration file. This is
20 the second part of a two-phase web application installation
21 process (the first phase is prepare-app). The setup process may
22 consist of things like creating directories and setting up
23 databases.
24 """
25
26 parser = AbstractInstallCommand.standard_parser(
27 simulate=True, quiet=True, interactive=True)
28 parser.add_option('--user',
29 action='store',
30 dest='username',
31 default=None,
32 help='Admin Username')
33 parser.add_option('--email',
34 action='store',
35 dest='email',
36 default=None,
37 help='Admin Email')
38 parser.add_option('--password',
39 action='store',
40 dest='password',
41 default=None,
42 help='Admin password min 6 chars')
43 parser.add_option('--repos',
44 action='store',
45 dest='repos_location',
46 default=None,
47 help='Absolute path to repositories location')
48 parser.add_option('--name',
49 action='store',
50 dest='section_name',
51 default=None,
52 help='The name of the section to set up (default: app:main)')
53
54 def command(self):
55 config_spec = self.args[0]
56 section = self.options.section_name
57 if section is None:
58 if '#' in config_spec:
59 config_spec, section = config_spec.split('#', 1)
60 else:
61 section = 'main'
62 if not ':' in section:
63 plain_section = section
64 section = 'app:'+section
65 else:
66 plain_section = section.split(':', 1)[0]
67 if not config_spec.startswith('config:'):
68 config_spec = 'config:' + config_spec
69 if plain_section != 'main':
70 config_spec += '#' + plain_section
71 config_file = config_spec[len('config:'):].split('#', 1)[0]
72 config_file = os.path.join(os.getcwd(), config_file)
73 self.logging_file_config(config_file)
74 conf = appconfig(config_spec, relative_to=os.getcwd())
75 ep_name = conf.context.entry_point_name
76 ep_group = conf.context.protocol
77 dist = conf.context.distribution
78 if dist is None:
79 raise BadCommand(
80 "The section %r is not the application (probably a filter). "
81 "You should add #section_name, where section_name is the "
82 "section that configures your application" % plain_section)
83 installer = self.get_installer(dist, ep_group, ep_name)
84 installer.setup_config(
85 self, config_file, section, self.sysconfig_install_vars(installer))
86 self.call_sysconfig_functions(
87 'post_setup_hook', installer, config_file) No newline at end of file
@@ -1,661 +1,664 b''
1 .. _changelog:
1 .. _changelog:
2
2
3 =========
3 =========
4 Changelog
4 Changelog
5 =========
5 =========
6
6
7 1.4.0 (**2012-XX-XX**)
7 1.4.0 (**2012-XX-XX**)
8 ----------------------
8 ----------------------
9
9
10 :status: in-progress
10 :status: in-progress
11 :branch: beta
11 :branch: beta
12
12
13 news
13 news
14 ++++
14 ++++
15
15
16 - new codereview system
17 - changed setup-app into setup-rhodecode and added default options to it.
18
16 fixes
19 fixes
17 +++++
20 +++++
18
21
19 1.3.6 (**2012-05-16**)
22 1.3.6 (**2012-05-16**)
20 ----------------------
23 ----------------------
21
24
22 news
25 news
23 ++++
26 ++++
24
27
25 - chinese traditional translation
28 - chinese traditional translation
26
29
27 fixes
30 fixes
28 +++++
31 +++++
29
32
30 - fixed no scm found warning
33 - fixed no scm found warning
31 - fixed __future__ import error on rcextensions
34 - fixed __future__ import error on rcextensions
32 - made simplejson required lib for speedup on JSON encoding
35 - made simplejson required lib for speedup on JSON encoding
33 - fixes #449 bad regex could get more than revisions from parsing history
36 - fixes #449 bad regex could get more than revisions from parsing history
34
37
35 1.3.5 (**2012-05-10**)
38 1.3.5 (**2012-05-10**)
36 ----------------------
39 ----------------------
37
40
38 news
41 news
39 ++++
42 ++++
40
43
41 - use ext_json for json module
44 - use ext_json for json module
42 - unified annotation view with file source view
45 - unified annotation view with file source view
43 - notification improvements, better inbox + css
46 - notification improvements, better inbox + css
44 - #419 don't strip passwords for login forms, make rhodecode
47 - #419 don't strip passwords for login forms, make rhodecode
45 more compatible with LDAP servers
48 more compatible with LDAP servers
46 - Added HTTP_X_FORWARDED_FOR as another method of extracting
49 - Added HTTP_X_FORWARDED_FOR as another method of extracting
47 IP for pull/push logs. - moved all to base controller
50 IP for pull/push logs. - moved all to base controller
48 - #415: Adding comment to changeset causes reload.
51 - #415: Adding comment to changeset causes reload.
49 Comments are now added via ajax and doesn't reload the page
52 Comments are now added via ajax and doesn't reload the page
50 - #374 LDAP config is discarded when LDAP can't be activated
53 - #374 LDAP config is discarded when LDAP can't be activated
51 - limited push/pull operations are now logged for git in the journal
54 - limited push/pull operations are now logged for git in the journal
52 - bumped mercurial to 2.2.X series
55 - bumped mercurial to 2.2.X series
53 - added support for displaying submodules in file-browser
56 - added support for displaying submodules in file-browser
54 - #421 added bookmarks in changelog view
57 - #421 added bookmarks in changelog view
55
58
56 fixes
59 fixes
57 +++++
60 +++++
58
61
59 - fixed dev-version marker for stable when served from source codes
62 - fixed dev-version marker for stable when served from source codes
60 - fixed missing permission checks on show forks page
63 - fixed missing permission checks on show forks page
61 - #418 cast to unicode fixes in notification objects
64 - #418 cast to unicode fixes in notification objects
62 - #426 fixed mention extracting regex
65 - #426 fixed mention extracting regex
63 - fixed remote-pulling for git remotes remopositories
66 - fixed remote-pulling for git remotes remopositories
64 - fixed #434: Error when accessing files or changesets of a git repository
67 - fixed #434: Error when accessing files or changesets of a git repository
65 with submodules
68 with submodules
66 - fixed issue with empty APIKEYS for users after registration ref. #438
69 - fixed issue with empty APIKEYS for users after registration ref. #438
67 - fixed issue with getting README files from git repositories
70 - fixed issue with getting README files from git repositories
68
71
69 1.3.4 (**2012-03-28**)
72 1.3.4 (**2012-03-28**)
70 ----------------------
73 ----------------------
71
74
72 news
75 news
73 ++++
76 ++++
74
77
75 - Whoosh logging is now controlled by the .ini files logging setup
78 - Whoosh logging is now controlled by the .ini files logging setup
76 - added clone-url into edit form on /settings page
79 - added clone-url into edit form on /settings page
77 - added help text into repo add/edit forms
80 - added help text into repo add/edit forms
78 - created rcextensions module with additional mappings (ref #322) and
81 - created rcextensions module with additional mappings (ref #322) and
79 post push/pull/create repo hooks callbacks
82 post push/pull/create repo hooks callbacks
80 - implemented #377 Users view for his own permissions on account page
83 - implemented #377 Users view for his own permissions on account page
81 - #399 added inheritance of permissions for users group on repos groups
84 - #399 added inheritance of permissions for users group on repos groups
82 - #401 repository group is automatically pre-selected when adding repos
85 - #401 repository group is automatically pre-selected when adding repos
83 inside a repository group
86 inside a repository group
84 - added alternative HTTP 403 response when client failed to authenticate. Helps
87 - added alternative HTTP 403 response when client failed to authenticate. Helps
85 solving issues with Mercurial and LDAP
88 solving issues with Mercurial and LDAP
86 - #402 removed group prefix from repository name when listing repositories
89 - #402 removed group prefix from repository name when listing repositories
87 inside a group
90 inside a group
88 - added gravatars into permission view and permissions autocomplete
91 - added gravatars into permission view and permissions autocomplete
89 - #347 when running multiple RhodeCode instances, properly invalidates cache
92 - #347 when running multiple RhodeCode instances, properly invalidates cache
90 for all registered servers
93 for all registered servers
91
94
92 fixes
95 fixes
93 +++++
96 +++++
94
97
95 - fixed #390 cache invalidation problems on repos inside group
98 - fixed #390 cache invalidation problems on repos inside group
96 - fixed #385 clone by ID url was loosing proxy prefix in URL
99 - fixed #385 clone by ID url was loosing proxy prefix in URL
97 - fixed some unicode problems with waitress
100 - fixed some unicode problems with waitress
98 - fixed issue with escaping < and > in changeset commits
101 - fixed issue with escaping < and > in changeset commits
99 - fixed error occurring during recursive group creation in API
102 - fixed error occurring during recursive group creation in API
100 create_repo function
103 create_repo function
101 - fixed #393 py2.5 fixes for routes url generator
104 - fixed #393 py2.5 fixes for routes url generator
102 - fixed #397 Private repository groups shows up before login
105 - fixed #397 Private repository groups shows up before login
103 - fixed #396 fixed problems with revoking users in nested groups
106 - fixed #396 fixed problems with revoking users in nested groups
104 - fixed mysql unicode issues + specified InnoDB as default engine with
107 - fixed mysql unicode issues + specified InnoDB as default engine with
105 utf8 charset
108 utf8 charset
106 - #406 trim long branch/tag names in changelog to not break UI
109 - #406 trim long branch/tag names in changelog to not break UI
107
110
108 1.3.3 (**2012-03-02**)
111 1.3.3 (**2012-03-02**)
109 ----------------------
112 ----------------------
110
113
111 news
114 news
112 ++++
115 ++++
113
116
114
117
115 fixes
118 fixes
116 +++++
119 +++++
117
120
118 - fixed some python2.5 compatibility issues
121 - fixed some python2.5 compatibility issues
119 - fixed issues with removed repos was accidentally added as groups, after
122 - fixed issues with removed repos was accidentally added as groups, after
120 full rescan of paths
123 full rescan of paths
121 - fixes #376 Cannot edit user (using container auth)
124 - fixes #376 Cannot edit user (using container auth)
122 - fixes #378 Invalid image urls on changeset screen with proxy-prefix
125 - fixes #378 Invalid image urls on changeset screen with proxy-prefix
123 configuration
126 configuration
124 - fixed initial sorting of repos inside repo group
127 - fixed initial sorting of repos inside repo group
125 - fixes issue when user tried to resubmit same permission into user/user_groups
128 - fixes issue when user tried to resubmit same permission into user/user_groups
126 - bumped beaker version that fixes #375 leap error bug
129 - bumped beaker version that fixes #375 leap error bug
127 - fixed raw_changeset for git. It was generated with hg patch headers
130 - fixed raw_changeset for git. It was generated with hg patch headers
128 - fixed vcs issue with last_changeset for filenodes
131 - fixed vcs issue with last_changeset for filenodes
129 - fixed missing commit after hook delete
132 - fixed missing commit after hook delete
130 - fixed #372 issues with git operation detection that caused a security issue
133 - fixed #372 issues with git operation detection that caused a security issue
131 for git repos
134 for git repos
132
135
133 1.3.2 (**2012-02-28**)
136 1.3.2 (**2012-02-28**)
134 ----------------------
137 ----------------------
135
138
136 news
139 news
137 ++++
140 ++++
138
141
139
142
140 fixes
143 fixes
141 +++++
144 +++++
142
145
143 - fixed git protocol issues with repos-groups
146 - fixed git protocol issues with repos-groups
144 - fixed git remote repos validator that prevented from cloning remote git repos
147 - fixed git remote repos validator that prevented from cloning remote git repos
145 - fixes #370 ending slashes fixes for repo and groups
148 - fixes #370 ending slashes fixes for repo and groups
146 - fixes #368 improved git-protocol detection to handle other clients
149 - fixes #368 improved git-protocol detection to handle other clients
147 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
150 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
148 Moved To Root
151 Moved To Root
149 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
152 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
150 - fixed #373 missing cascade drop on user_group_to_perm table
153 - fixed #373 missing cascade drop on user_group_to_perm table
151
154
152 1.3.1 (**2012-02-27**)
155 1.3.1 (**2012-02-27**)
153 ----------------------
156 ----------------------
154
157
155 news
158 news
156 ++++
159 ++++
157
160
158
161
159 fixes
162 fixes
160 +++++
163 +++++
161
164
162 - redirection loop occurs when remember-me wasn't checked during login
165 - redirection loop occurs when remember-me wasn't checked during login
163 - fixes issues with git blob history generation
166 - fixes issues with git blob history generation
164 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
167 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
165
168
166 1.3.0 (**2012-02-26**)
169 1.3.0 (**2012-02-26**)
167 ----------------------
170 ----------------------
168
171
169 news
172 news
170 ++++
173 ++++
171
174
172 - code review, inspired by github code-comments
175 - code review, inspired by github code-comments
173 - #215 rst and markdown README files support
176 - #215 rst and markdown README files support
174 - #252 Container-based and proxy pass-through authentication support
177 - #252 Container-based and proxy pass-through authentication support
175 - #44 branch browser. Filtering of changelog by branches
178 - #44 branch browser. Filtering of changelog by branches
176 - mercurial bookmarks support
179 - mercurial bookmarks support
177 - new hover top menu, optimized to add maximum size for important views
180 - new hover top menu, optimized to add maximum size for important views
178 - configurable clone url template with possibility to specify protocol like
181 - configurable clone url template with possibility to specify protocol like
179 ssh:// or http:// and also manually alter other parts of clone_url.
182 ssh:// or http:// and also manually alter other parts of clone_url.
180 - enabled largefiles extension by default
183 - enabled largefiles extension by default
181 - optimized summary file pages and saved a lot of unused space in them
184 - optimized summary file pages and saved a lot of unused space in them
182 - #239 option to manually mark repository as fork
185 - #239 option to manually mark repository as fork
183 - #320 mapping of commit authors to RhodeCode users
186 - #320 mapping of commit authors to RhodeCode users
184 - #304 hashes are displayed using monospace font
187 - #304 hashes are displayed using monospace font
185 - diff configuration, toggle white lines and context lines
188 - diff configuration, toggle white lines and context lines
186 - #307 configurable diffs, whitespace toggle, increasing context lines
189 - #307 configurable diffs, whitespace toggle, increasing context lines
187 - sorting on branches, tags and bookmarks using YUI datatable
190 - sorting on branches, tags and bookmarks using YUI datatable
188 - improved file filter on files page
191 - improved file filter on files page
189 - implements #330 api method for listing nodes ar particular revision
192 - implements #330 api method for listing nodes ar particular revision
190 - #73 added linking issues in commit messages to chosen issue tracker url
193 - #73 added linking issues in commit messages to chosen issue tracker url
191 based on user defined regular expression
194 based on user defined regular expression
192 - added linking of changesets in commit messages
195 - added linking of changesets in commit messages
193 - new compact changelog with expandable commit messages
196 - new compact changelog with expandable commit messages
194 - firstname and lastname are optional in user creation
197 - firstname and lastname are optional in user creation
195 - #348 added post-create repository hook
198 - #348 added post-create repository hook
196 - #212 global encoding settings is now configurable from .ini files
199 - #212 global encoding settings is now configurable from .ini files
197 - #227 added repository groups permissions
200 - #227 added repository groups permissions
198 - markdown gets codehilite extensions
201 - markdown gets codehilite extensions
199 - new API methods, delete_repositories, grante/revoke permissions for groups
202 - new API methods, delete_repositories, grante/revoke permissions for groups
200 and repos
203 and repos
201
204
202
205
203 fixes
206 fixes
204 +++++
207 +++++
205
208
206 - rewrote dbsession management for atomic operations, and better error handling
209 - rewrote dbsession management for atomic operations, and better error handling
207 - fixed sorting of repo tables
210 - fixed sorting of repo tables
208 - #326 escape of special html entities in diffs
211 - #326 escape of special html entities in diffs
209 - normalized user_name => username in api attributes
212 - normalized user_name => username in api attributes
210 - fixes #298 ldap created users with mixed case emails created conflicts
213 - fixes #298 ldap created users with mixed case emails created conflicts
211 on saving a form
214 on saving a form
212 - fixes issue when owner of a repo couldn't revoke permissions for users
215 - fixes issue when owner of a repo couldn't revoke permissions for users
213 and groups
216 and groups
214 - fixes #271 rare JSON serialization problem with statistics
217 - fixes #271 rare JSON serialization problem with statistics
215 - fixes #337 missing validation check for conflicting names of a group with a
218 - fixes #337 missing validation check for conflicting names of a group with a
216 repositories group
219 repositories group
217 - #340 fixed session problem for mysql and celery tasks
220 - #340 fixed session problem for mysql and celery tasks
218 - fixed #331 RhodeCode mangles repository names if the a repository group
221 - fixed #331 RhodeCode mangles repository names if the a repository group
219 contains the "full path" to the repositories
222 contains the "full path" to the repositories
220 - #355 RhodeCode doesn't store encrypted LDAP passwords
223 - #355 RhodeCode doesn't store encrypted LDAP passwords
221
224
222 1.2.5 (**2012-01-28**)
225 1.2.5 (**2012-01-28**)
223 ----------------------
226 ----------------------
224
227
225 news
228 news
226 ++++
229 ++++
227
230
228 fixes
231 fixes
229 +++++
232 +++++
230
233
231 - #340 Celery complains about MySQL server gone away, added session cleanup
234 - #340 Celery complains about MySQL server gone away, added session cleanup
232 for celery tasks
235 for celery tasks
233 - #341 "scanning for repositories in None" log message during Rescan was missing
236 - #341 "scanning for repositories in None" log message during Rescan was missing
234 a parameter
237 a parameter
235 - fixed creating archives with subrepos. Some hooks were triggered during that
238 - fixed creating archives with subrepos. Some hooks were triggered during that
236 operation leading to crash.
239 operation leading to crash.
237 - fixed missing email in account page.
240 - fixed missing email in account page.
238 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
241 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
239 forking on windows impossible
242 forking on windows impossible
240
243
241 1.2.4 (**2012-01-19**)
244 1.2.4 (**2012-01-19**)
242 ----------------------
245 ----------------------
243
246
244 news
247 news
245 ++++
248 ++++
246
249
247 - RhodeCode is bundled with mercurial series 2.0.X by default, with
250 - RhodeCode is bundled with mercurial series 2.0.X by default, with
248 full support to largefiles extension. Enabled by default in new installations
251 full support to largefiles extension. Enabled by default in new installations
249 - #329 Ability to Add/Remove Groups to/from a Repository via AP
252 - #329 Ability to Add/Remove Groups to/from a Repository via AP
250 - added requires.txt file with requirements
253 - added requires.txt file with requirements
251
254
252 fixes
255 fixes
253 +++++
256 +++++
254
257
255 - fixes db session issues with celery when emailing admins
258 - fixes db session issues with celery when emailing admins
256 - #331 RhodeCode mangles repository names if the a repository group
259 - #331 RhodeCode mangles repository names if the a repository group
257 contains the "full path" to the repositories
260 contains the "full path" to the repositories
258 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
261 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
259 - DB session cleanup after hg protocol operations, fixes issues with
262 - DB session cleanup after hg protocol operations, fixes issues with
260 `mysql has gone away` errors
263 `mysql has gone away` errors
261 - #333 doc fixes for get_repo api function
264 - #333 doc fixes for get_repo api function
262 - #271 rare JSON serialization problem with statistics enabled
265 - #271 rare JSON serialization problem with statistics enabled
263 - #337 Fixes issues with validation of repository name conflicting with
266 - #337 Fixes issues with validation of repository name conflicting with
264 a group name. A proper message is now displayed.
267 a group name. A proper message is now displayed.
265 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
268 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
266 doesn't work
269 doesn't work
267 - #316 fixes issues with web description in hgrc files
270 - #316 fixes issues with web description in hgrc files
268
271
269 1.2.3 (**2011-11-02**)
272 1.2.3 (**2011-11-02**)
270 ----------------------
273 ----------------------
271
274
272 news
275 news
273 ++++
276 ++++
274
277
275 - added option to manage repos group for non admin users
278 - added option to manage repos group for non admin users
276 - added following API methods for get_users, create_user, get_users_groups,
279 - added following API methods for get_users, create_user, get_users_groups,
277 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
280 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
278 get_repo, create_repo, add_user_to_repo
281 get_repo, create_repo, add_user_to_repo
279 - implements #237 added password confirmation for my account
282 - implements #237 added password confirmation for my account
280 and admin edit user.
283 and admin edit user.
281 - implements #291 email notification for global events are now sent to all
284 - implements #291 email notification for global events are now sent to all
282 administrator users, and global config email.
285 administrator users, and global config email.
283
286
284 fixes
287 fixes
285 +++++
288 +++++
286
289
287 - added option for passing auth method for smtp mailer
290 - added option for passing auth method for smtp mailer
288 - #276 issue with adding a single user with id>10 to usergroups
291 - #276 issue with adding a single user with id>10 to usergroups
289 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
292 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
290 - #288 fixes managing of repos in a group for non admin user
293 - #288 fixes managing of repos in a group for non admin user
291
294
292 1.2.2 (**2011-10-17**)
295 1.2.2 (**2011-10-17**)
293 ----------------------
296 ----------------------
294
297
295 news
298 news
296 ++++
299 ++++
297
300
298 - #226 repo groups are available by path instead of numerical id
301 - #226 repo groups are available by path instead of numerical id
299
302
300 fixes
303 fixes
301 +++++
304 +++++
302
305
303 - #259 Groups with the same name but with different parent group
306 - #259 Groups with the same name but with different parent group
304 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
307 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
305 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
308 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
306 - #265 ldap save fails sometimes on converting attributes to booleans,
309 - #265 ldap save fails sometimes on converting attributes to booleans,
307 added getter and setter into model that will prevent from this on db model level
310 added getter and setter into model that will prevent from this on db model level
308 - fixed problems with timestamps issues #251 and #213
311 - fixed problems with timestamps issues #251 and #213
309 - fixes #266 RhodeCode allows to create repo with the same name and in
312 - fixes #266 RhodeCode allows to create repo with the same name and in
310 the same parent as group
313 the same parent as group
311 - fixes #245 Rescan of the repositories on Windows
314 - fixes #245 Rescan of the repositories on Windows
312 - fixes #248 cannot edit repos inside a group on windows
315 - fixes #248 cannot edit repos inside a group on windows
313 - fixes #219 forking problems on windows
316 - fixes #219 forking problems on windows
314
317
315 1.2.1 (**2011-10-08**)
318 1.2.1 (**2011-10-08**)
316 ----------------------
319 ----------------------
317
320
318 news
321 news
319 ++++
322 ++++
320
323
321
324
322 fixes
325 fixes
323 +++++
326 +++++
324
327
325 - fixed problems with basic auth and push problems
328 - fixed problems with basic auth and push problems
326 - gui fixes
329 - gui fixes
327 - fixed logger
330 - fixed logger
328
331
329 1.2.0 (**2011-10-07**)
332 1.2.0 (**2011-10-07**)
330 ----------------------
333 ----------------------
331
334
332 news
335 news
333 ++++
336 ++++
334
337
335 - implemented #47 repository groups
338 - implemented #47 repository groups
336 - implemented #89 Can setup google analytics code from settings menu
339 - implemented #89 Can setup google analytics code from settings menu
337 - implemented #91 added nicer looking archive urls with more download options
340 - implemented #91 added nicer looking archive urls with more download options
338 like tags, branches
341 like tags, branches
339 - implemented #44 into file browsing, and added follow branch option
342 - implemented #44 into file browsing, and added follow branch option
340 - implemented #84 downloads can be enabled/disabled for each repository
343 - implemented #84 downloads can be enabled/disabled for each repository
341 - anonymous repository can be cloned without having to pass default:default
344 - anonymous repository can be cloned without having to pass default:default
342 into clone url
345 into clone url
343 - fixed #90 whoosh indexer can index chooses repositories passed in command
346 - fixed #90 whoosh indexer can index chooses repositories passed in command
344 line
347 line
345 - extended journal with day aggregates and paging
348 - extended journal with day aggregates and paging
346 - implemented #107 source code lines highlight ranges
349 - implemented #107 source code lines highlight ranges
347 - implemented #93 customizable changelog on combined revision ranges -
350 - implemented #93 customizable changelog on combined revision ranges -
348 equivalent of githubs compare view
351 equivalent of githubs compare view
349 - implemented #108 extended and more powerful LDAP configuration
352 - implemented #108 extended and more powerful LDAP configuration
350 - implemented #56 users groups
353 - implemented #56 users groups
351 - major code rewrites optimized codes for speed and memory usage
354 - major code rewrites optimized codes for speed and memory usage
352 - raw and diff downloads are now in git format
355 - raw and diff downloads are now in git format
353 - setup command checks for write access to given path
356 - setup command checks for write access to given path
354 - fixed many issues with international characters and unicode. It uses utf8
357 - fixed many issues with international characters and unicode. It uses utf8
355 decode with replace to provide less errors even with non utf8 encoded strings
358 decode with replace to provide less errors even with non utf8 encoded strings
356 - #125 added API KEY access to feeds
359 - #125 added API KEY access to feeds
357 - #109 Repository can be created from external Mercurial link (aka. remote
360 - #109 Repository can be created from external Mercurial link (aka. remote
358 repository, and manually updated (via pull) from admin panel
361 repository, and manually updated (via pull) from admin panel
359 - beta git support - push/pull server + basic view for git repos
362 - beta git support - push/pull server + basic view for git repos
360 - added followers page and forks page
363 - added followers page and forks page
361 - server side file creation (with binary file upload interface)
364 - server side file creation (with binary file upload interface)
362 and edition with commits powered by codemirror
365 and edition with commits powered by codemirror
363 - #111 file browser file finder, quick lookup files on whole file tree
366 - #111 file browser file finder, quick lookup files on whole file tree
364 - added quick login sliding menu into main page
367 - added quick login sliding menu into main page
365 - changelog uses lazy loading of affected files details, in some scenarios
368 - changelog uses lazy loading of affected files details, in some scenarios
366 this can improve speed of changelog page dramatically especially for
369 this can improve speed of changelog page dramatically especially for
367 larger repositories.
370 larger repositories.
368 - implements #214 added support for downloading subrepos in download menu.
371 - implements #214 added support for downloading subrepos in download menu.
369 - Added basic API for direct operations on rhodecode via JSON
372 - Added basic API for direct operations on rhodecode via JSON
370 - Implemented advanced hook management
373 - Implemented advanced hook management
371
374
372 fixes
375 fixes
373 +++++
376 +++++
374
377
375 - fixed file browser bug, when switching into given form revision the url was
378 - fixed file browser bug, when switching into given form revision the url was
376 not changing
379 not changing
377 - fixed propagation to error controller on simplehg and simplegit middlewares
380 - fixed propagation to error controller on simplehg and simplegit middlewares
378 - fixed error when trying to make a download on empty repository
381 - fixed error when trying to make a download on empty repository
379 - fixed problem with '[' chars in commit messages in journal
382 - fixed problem with '[' chars in commit messages in journal
380 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
383 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
381 - journal fork fixes
384 - journal fork fixes
382 - removed issue with space inside renamed repository after deletion
385 - removed issue with space inside renamed repository after deletion
383 - fixed strange issue on formencode imports
386 - fixed strange issue on formencode imports
384 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
387 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
385 - #150 fixes for errors on repositories mapped in db but corrupted in
388 - #150 fixes for errors on repositories mapped in db but corrupted in
386 filesystem
389 filesystem
387 - fixed problem with ascendant characters in realm #181
390 - fixed problem with ascendant characters in realm #181
388 - fixed problem with sqlite file based database connection pool
391 - fixed problem with sqlite file based database connection pool
389 - whoosh indexer and code stats share the same dynamic extensions map
392 - whoosh indexer and code stats share the same dynamic extensions map
390 - fixes #188 - relationship delete of repo_to_perm entry on user removal
393 - fixes #188 - relationship delete of repo_to_perm entry on user removal
391 - fixes issue #189 Trending source files shows "show more" when no more exist
394 - fixes issue #189 Trending source files shows "show more" when no more exist
392 - fixes issue #197 Relative paths for pidlocks
395 - fixes issue #197 Relative paths for pidlocks
393 - fixes issue #198 password will require only 3 chars now for login form
396 - fixes issue #198 password will require only 3 chars now for login form
394 - fixes issue #199 wrong redirection for non admin users after creating a repository
397 - fixes issue #199 wrong redirection for non admin users after creating a repository
395 - fixes issues #202, bad db constraint made impossible to attach same group
398 - fixes issues #202, bad db constraint made impossible to attach same group
396 more than one time. Affects only mysql/postgres
399 more than one time. Affects only mysql/postgres
397 - fixes #218 os.kill patch for windows was missing sig param
400 - fixes #218 os.kill patch for windows was missing sig param
398 - improved rendering of dag (they are not trimmed anymore when number of
401 - improved rendering of dag (they are not trimmed anymore when number of
399 heads exceeds 5)
402 heads exceeds 5)
400
403
401 1.1.8 (**2011-04-12**)
404 1.1.8 (**2011-04-12**)
402 ----------------------
405 ----------------------
403
406
404 news
407 news
405 ++++
408 ++++
406
409
407 - improved windows support
410 - improved windows support
408
411
409 fixes
412 fixes
410 +++++
413 +++++
411
414
412 - fixed #140 freeze of python dateutil library, since new version is python2.x
415 - fixed #140 freeze of python dateutil library, since new version is python2.x
413 incompatible
416 incompatible
414 - setup-app will check for write permission in given path
417 - setup-app will check for write permission in given path
415 - cleaned up license info issue #149
418 - cleaned up license info issue #149
416 - fixes for issues #137,#116 and problems with unicode and accented characters.
419 - fixes for issues #137,#116 and problems with unicode and accented characters.
417 - fixes crashes on gravatar, when passed in email as unicode
420 - fixes crashes on gravatar, when passed in email as unicode
418 - fixed tooltip flickering problems
421 - fixed tooltip flickering problems
419 - fixed came_from redirection on windows
422 - fixed came_from redirection on windows
420 - fixed logging modules, and sql formatters
423 - fixed logging modules, and sql formatters
421 - windows fixes for os.kill issue #133
424 - windows fixes for os.kill issue #133
422 - fixes path splitting for windows issues #148
425 - fixes path splitting for windows issues #148
423 - fixed issue #143 wrong import on migration to 1.1.X
426 - fixed issue #143 wrong import on migration to 1.1.X
424 - fixed problems with displaying binary files, thanks to Thomas Waldmann
427 - fixed problems with displaying binary files, thanks to Thomas Waldmann
425 - removed name from archive files since it's breaking ui for long repo names
428 - removed name from archive files since it's breaking ui for long repo names
426 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
429 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
427 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
430 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
428 Thomas Waldmann
431 Thomas Waldmann
429 - fixed issue #166 summary pager was skipping 10 revisions on second page
432 - fixed issue #166 summary pager was skipping 10 revisions on second page
430
433
431
434
432 1.1.7 (**2011-03-23**)
435 1.1.7 (**2011-03-23**)
433 ----------------------
436 ----------------------
434
437
435 news
438 news
436 ++++
439 ++++
437
440
438 fixes
441 fixes
439 +++++
442 +++++
440
443
441 - fixed (again) #136 installation support for FreeBSD
444 - fixed (again) #136 installation support for FreeBSD
442
445
443
446
444 1.1.6 (**2011-03-21**)
447 1.1.6 (**2011-03-21**)
445 ----------------------
448 ----------------------
446
449
447 news
450 news
448 ++++
451 ++++
449
452
450 fixes
453 fixes
451 +++++
454 +++++
452
455
453 - fixed #136 installation support for FreeBSD
456 - fixed #136 installation support for FreeBSD
454 - RhodeCode will check for python version during installation
457 - RhodeCode will check for python version during installation
455
458
456 1.1.5 (**2011-03-17**)
459 1.1.5 (**2011-03-17**)
457 ----------------------
460 ----------------------
458
461
459 news
462 news
460 ++++
463 ++++
461
464
462 - basic windows support, by exchanging pybcrypt into sha256 for windows only
465 - basic windows support, by exchanging pybcrypt into sha256 for windows only
463 highly inspired by idea of mantis406
466 highly inspired by idea of mantis406
464
467
465 fixes
468 fixes
466 +++++
469 +++++
467
470
468 - fixed sorting by author in main page
471 - fixed sorting by author in main page
469 - fixed crashes with diffs on binary files
472 - fixed crashes with diffs on binary files
470 - fixed #131 problem with boolean values for LDAP
473 - fixed #131 problem with boolean values for LDAP
471 - fixed #122 mysql problems thanks to striker69
474 - fixed #122 mysql problems thanks to striker69
472 - fixed problem with errors on calling raw/raw_files/annotate functions
475 - fixed problem with errors on calling raw/raw_files/annotate functions
473 with unknown revisions
476 with unknown revisions
474 - fixed returned rawfiles attachment names with international character
477 - fixed returned rawfiles attachment names with international character
475 - cleaned out docs, big thanks to Jason Harris
478 - cleaned out docs, big thanks to Jason Harris
476
479
477 1.1.4 (**2011-02-19**)
480 1.1.4 (**2011-02-19**)
478 ----------------------
481 ----------------------
479
482
480 news
483 news
481 ++++
484 ++++
482
485
483 fixes
486 fixes
484 +++++
487 +++++
485
488
486 - fixed formencode import problem on settings page, that caused server crash
489 - fixed formencode import problem on settings page, that caused server crash
487 when that page was accessed as first after server start
490 when that page was accessed as first after server start
488 - journal fixes
491 - journal fixes
489 - fixed option to access repository just by entering http://server/<repo_name>
492 - fixed option to access repository just by entering http://server/<repo_name>
490
493
491 1.1.3 (**2011-02-16**)
494 1.1.3 (**2011-02-16**)
492 ----------------------
495 ----------------------
493
496
494 news
497 news
495 ++++
498 ++++
496
499
497 - implemented #102 allowing the '.' character in username
500 - implemented #102 allowing the '.' character in username
498 - added option to access repository just by entering http://server/<repo_name>
501 - added option to access repository just by entering http://server/<repo_name>
499 - celery task ignores result for better performance
502 - celery task ignores result for better performance
500
503
501 fixes
504 fixes
502 +++++
505 +++++
503
506
504 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
507 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
505 apollo13 and Johan Walles
508 apollo13 and Johan Walles
506 - small fixes in journal
509 - small fixes in journal
507 - fixed problems with getting setting for celery from .ini files
510 - fixed problems with getting setting for celery from .ini files
508 - registration, password reset and login boxes share the same title as main
511 - registration, password reset and login boxes share the same title as main
509 application now
512 application now
510 - fixed #113: to high permissions to fork repository
513 - fixed #113: to high permissions to fork repository
511 - fixed problem with '[' chars in commit messages in journal
514 - fixed problem with '[' chars in commit messages in journal
512 - removed issue with space inside renamed repository after deletion
515 - removed issue with space inside renamed repository after deletion
513 - db transaction fixes when filesystem repository creation failed
516 - db transaction fixes when filesystem repository creation failed
514 - fixed #106 relation issues on databases different than sqlite
517 - fixed #106 relation issues on databases different than sqlite
515 - fixed static files paths links to use of url() method
518 - fixed static files paths links to use of url() method
516
519
517 1.1.2 (**2011-01-12**)
520 1.1.2 (**2011-01-12**)
518 ----------------------
521 ----------------------
519
522
520 news
523 news
521 ++++
524 ++++
522
525
523
526
524 fixes
527 fixes
525 +++++
528 +++++
526
529
527 - fixes #98 protection against float division of percentage stats
530 - fixes #98 protection against float division of percentage stats
528 - fixed graph bug
531 - fixed graph bug
529 - forced webhelpers version since it was making troubles during installation
532 - forced webhelpers version since it was making troubles during installation
530
533
531 1.1.1 (**2011-01-06**)
534 1.1.1 (**2011-01-06**)
532 ----------------------
535 ----------------------
533
536
534 news
537 news
535 ++++
538 ++++
536
539
537 - added force https option into ini files for easier https usage (no need to
540 - added force https option into ini files for easier https usage (no need to
538 set server headers with this options)
541 set server headers with this options)
539 - small css updates
542 - small css updates
540
543
541 fixes
544 fixes
542 +++++
545 +++++
543
546
544 - fixed #96 redirect loop on files view on repositories without changesets
547 - fixed #96 redirect loop on files view on repositories without changesets
545 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
548 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
546 and server crashed with errors
549 and server crashed with errors
547 - fixed large tooltips problems on main page
550 - fixed large tooltips problems on main page
548 - fixed #92 whoosh indexer is more error proof
551 - fixed #92 whoosh indexer is more error proof
549
552
550 1.1.0 (**2010-12-18**)
553 1.1.0 (**2010-12-18**)
551 ----------------------
554 ----------------------
552
555
553 news
556 news
554 ++++
557 ++++
555
558
556 - rewrite of internals for vcs >=0.1.10
559 - rewrite of internals for vcs >=0.1.10
557 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
560 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
558 with older clients
561 with older clients
559 - anonymous access, authentication via ldap
562 - anonymous access, authentication via ldap
560 - performance upgrade for cached repos list - each repository has its own
563 - performance upgrade for cached repos list - each repository has its own
561 cache that's invalidated when needed.
564 cache that's invalidated when needed.
562 - performance upgrades on repositories with large amount of commits (20K+)
565 - performance upgrades on repositories with large amount of commits (20K+)
563 - main page quick filter for filtering repositories
566 - main page quick filter for filtering repositories
564 - user dashboards with ability to follow chosen repositories actions
567 - user dashboards with ability to follow chosen repositories actions
565 - sends email to admin on new user registration
568 - sends email to admin on new user registration
566 - added cache/statistics reset options into repository settings
569 - added cache/statistics reset options into repository settings
567 - more detailed action logger (based on hooks) with pushed changesets lists
570 - more detailed action logger (based on hooks) with pushed changesets lists
568 and options to disable those hooks from admin panel
571 and options to disable those hooks from admin panel
569 - introduced new enhanced changelog for merges that shows more accurate results
572 - introduced new enhanced changelog for merges that shows more accurate results
570 - new improved and faster code stats (based on pygments lexers mapping tables,
573 - new improved and faster code stats (based on pygments lexers mapping tables,
571 showing up to 10 trending sources for each repository. Additionally stats
574 showing up to 10 trending sources for each repository. Additionally stats
572 can be disabled in repository settings.
575 can be disabled in repository settings.
573 - gui optimizations, fixed application width to 1024px
576 - gui optimizations, fixed application width to 1024px
574 - added cut off (for large files/changesets) limit into config files
577 - added cut off (for large files/changesets) limit into config files
575 - whoosh, celeryd, upgrade moved to paster command
578 - whoosh, celeryd, upgrade moved to paster command
576 - other than sqlite database backends can be used
579 - other than sqlite database backends can be used
577
580
578 fixes
581 fixes
579 +++++
582 +++++
580
583
581 - fixes #61 forked repo was showing only after cache expired
584 - fixes #61 forked repo was showing only after cache expired
582 - fixes #76 no confirmation on user deletes
585 - fixes #76 no confirmation on user deletes
583 - fixes #66 Name field misspelled
586 - fixes #66 Name field misspelled
584 - fixes #72 block user removal when he owns repositories
587 - fixes #72 block user removal when he owns repositories
585 - fixes #69 added password confirmation fields
588 - fixes #69 added password confirmation fields
586 - fixes #87 RhodeCode crashes occasionally on updating repository owner
589 - fixes #87 RhodeCode crashes occasionally on updating repository owner
587 - fixes #82 broken annotations on files with more than 1 blank line at the end
590 - fixes #82 broken annotations on files with more than 1 blank line at the end
588 - a lot of fixes and tweaks for file browser
591 - a lot of fixes and tweaks for file browser
589 - fixed detached session issues
592 - fixed detached session issues
590 - fixed when user had no repos he would see all repos listed in my account
593 - fixed when user had no repos he would see all repos listed in my account
591 - fixed ui() instance bug when global hgrc settings was loaded for server
594 - fixed ui() instance bug when global hgrc settings was loaded for server
592 instance and all hgrc options were merged with our db ui() object
595 instance and all hgrc options were merged with our db ui() object
593 - numerous small bugfixes
596 - numerous small bugfixes
594
597
595 (special thanks for TkSoh for detailed feedback)
598 (special thanks for TkSoh for detailed feedback)
596
599
597
600
598 1.0.2 (**2010-11-12**)
601 1.0.2 (**2010-11-12**)
599 ----------------------
602 ----------------------
600
603
601 news
604 news
602 ++++
605 ++++
603
606
604 - tested under python2.7
607 - tested under python2.7
605 - bumped sqlalchemy and celery versions
608 - bumped sqlalchemy and celery versions
606
609
607 fixes
610 fixes
608 +++++
611 +++++
609
612
610 - fixed #59 missing graph.js
613 - fixed #59 missing graph.js
611 - fixed repo_size crash when repository had broken symlinks
614 - fixed repo_size crash when repository had broken symlinks
612 - fixed python2.5 crashes.
615 - fixed python2.5 crashes.
613
616
614
617
615 1.0.1 (**2010-11-10**)
618 1.0.1 (**2010-11-10**)
616 ----------------------
619 ----------------------
617
620
618 news
621 news
619 ++++
622 ++++
620
623
621 - small css updated
624 - small css updated
622
625
623 fixes
626 fixes
624 +++++
627 +++++
625
628
626 - fixed #53 python2.5 incompatible enumerate calls
629 - fixed #53 python2.5 incompatible enumerate calls
627 - fixed #52 disable mercurial extension for web
630 - fixed #52 disable mercurial extension for web
628 - fixed #51 deleting repositories don't delete it's dependent objects
631 - fixed #51 deleting repositories don't delete it's dependent objects
629
632
630
633
631 1.0.0 (**2010-11-02**)
634 1.0.0 (**2010-11-02**)
632 ----------------------
635 ----------------------
633
636
634 - security bugfix simplehg wasn't checking for permissions on commands
637 - security bugfix simplehg wasn't checking for permissions on commands
635 other than pull or push.
638 other than pull or push.
636 - fixed doubled messages after push or pull in admin journal
639 - fixed doubled messages after push or pull in admin journal
637 - templating and css corrections, fixed repo switcher on chrome, updated titles
640 - templating and css corrections, fixed repo switcher on chrome, updated titles
638 - admin menu accessible from options menu on repository view
641 - admin menu accessible from options menu on repository view
639 - permissions cached queries
642 - permissions cached queries
640
643
641 1.0.0rc4 (**2010-10-12**)
644 1.0.0rc4 (**2010-10-12**)
642 --------------------------
645 --------------------------
643
646
644 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
647 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
645 - removed cache_manager settings from sqlalchemy meta
648 - removed cache_manager settings from sqlalchemy meta
646 - added sqlalchemy cache settings to ini files
649 - added sqlalchemy cache settings to ini files
647 - validated password length and added second try of failure on paster setup-app
650 - validated password length and added second try of failure on paster setup-app
648 - fixed setup database destroy prompt even when there was no db
651 - fixed setup database destroy prompt even when there was no db
649
652
650
653
651 1.0.0rc3 (**2010-10-11**)
654 1.0.0rc3 (**2010-10-11**)
652 -------------------------
655 -------------------------
653
656
654 - fixed i18n during installation.
657 - fixed i18n during installation.
655
658
656 1.0.0rc2 (**2010-10-11**)
659 1.0.0rc2 (**2010-10-11**)
657 -------------------------
660 -------------------------
658
661
659 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
662 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
660 occure. After vcs is fixed it'll be put back again.
663 occure. After vcs is fixed it'll be put back again.
661 - templating/css rewrites, optimized css. No newline at end of file
664 - templating/css rewrites, optimized css.
@@ -1,731 +1,732 b''
1 .. _setup:
1 .. _setup:
2
2
3 =====
3 =====
4 Setup
4 Setup
5 =====
5 =====
6
6
7
7
8 Setting up RhodeCode
8 Setting up RhodeCode
9 --------------------
9 --------------------
10
10
11 First, you will need to create a RhodeCode configuration file. Run the
11 First, you will need to create a RhodeCode configuration file. Run the
12 following command to do this::
12 following command to do this::
13
13
14 paster make-config RhodeCode production.ini
14 paster make-config RhodeCode production.ini
15
15
16 - This will create the file `production.ini` in the current directory. This
16 - This will create the file `production.ini` in the current directory. This
17 configuration file contains the various settings for RhodeCode, e.g proxy
17 configuration file contains the various settings for RhodeCode, e.g proxy
18 port, email settings, usage of static files, cache, celery settings and
18 port, email settings, usage of static files, cache, celery settings and
19 logging.
19 logging.
20
20
21
21
22 Next, you need to create the databases used by RhodeCode. I recommend that you
22 Next, you need to create the databases used by RhodeCode. I recommend that you
23 use postgresql or sqlite (default). If you choose a database other than the
23 use postgresql or sqlite (default). If you choose a database other than the
24 default ensure you properly adjust the db url in your production.ini
24 default ensure you properly adjust the db url in your production.ini
25 configuration file to use this other database. RhodeCode currently supports
25 configuration file to use this other database. RhodeCode currently supports
26 postgresql, sqlite and mysql databases. Create the database by running
26 postgresql, sqlite and mysql databases. Create the database by running
27 the following command::
27 the following command::
28
28
29 paster setup-app production.ini
29 paster setup-rhodecode production.ini
30
30
31 This will prompt you for a "root" path. This "root" path is the location where
31 This will prompt you for a "root" path. This "root" path is the location where
32 RhodeCode will store all of its repositories on the current machine. After
32 RhodeCode will store all of its repositories on the current machine. After
33 entering this "root" path ``setup-app`` will also prompt you for a username
33 entering this "root" path ``setup-rhodecode`` will also prompt you for a username
34 and password for the initial admin account which ``setup-app`` sets up for you.
34 and password for the initial admin account which ``setup-rhodecode`` sets
35 up for you.
35
36
36 - The ``setup-app`` command will create all of the needed tables and an admin
37 - The ``setup-rhodecode`` command will create all of the needed tables and an
37 account. When choosing a root path you can either use a new empty location,
38 admin account. When choosing a root path you can either use a new empty
38 or a location which already contains existing repositories. If you choose a
39 location, or a location which already contains existing repositories. If you
39 location which contains existing repositories RhodeCode will simply add all
40 choose a location which contains existing repositories RhodeCode will simply
40 of the repositories at the chosen location to it's database. (Note: make
41 add all of the repositories at the chosen location to it's database.
41 sure you specify the correct path to the root).
42 (Note: make sure you specify the correct path to the root).
42 - Note: the given path for mercurial_ repositories **must** be write accessible
43 - Note: the given path for mercurial_ repositories **must** be write accessible
43 for the application. It's very important since the RhodeCode web interface
44 for the application. It's very important since the RhodeCode web interface
44 will work without write access, but when trying to do a push it will
45 will work without write access, but when trying to do a push it will
45 eventually fail with permission denied errors unless it has write access.
46 eventually fail with permission denied errors unless it has write access.
46
47
47 You are now ready to use RhodeCode, to run it simply execute::
48 You are now ready to use RhodeCode, to run it simply execute::
48
49
49 paster serve production.ini
50 paster serve production.ini
50
51
51 - This command runs the RhodeCode server. The web app should be available at the
52 - This command runs the RhodeCode server. The web app should be available at the
52 127.0.0.1:5000. This ip and port is configurable via the production.ini
53 127.0.0.1:5000. This ip and port is configurable via the production.ini
53 file created in previous step
54 file created in previous step
54 - Use the admin account you created above when running ``setup-app`` to login
55 - Use the admin account you created above when running ``setup-rhodecode``
55 to the web app.
56 to login to the web app.
56 - The default permissions on each repository is read, and the owner is admin.
57 - The default permissions on each repository is read, and the owner is admin.
57 Remember to update these if needed.
58 Remember to update these if needed.
58 - In the admin panel you can toggle ldap, anonymous, permissions settings. As
59 - In the admin panel you can toggle ldap, anonymous, permissions settings. As
59 well as edit more advanced options on users and repositories
60 well as edit more advanced options on users and repositories
60
61
61 Optionally users can create `rcextensions` package that extends RhodeCode
62 Optionally users can create `rcextensions` package that extends RhodeCode
62 functionality. To do this simply execute::
63 functionality. To do this simply execute::
63
64
64 paster make-rcext production.ini
65 paster make-rcext production.ini
65
66
66 This will create `rcextensions` package in the same place that your `ini` file
67 This will create `rcextensions` package in the same place that your `ini` file
67 lives. With `rcextensions` it's possible to add additional mapping for whoosh,
68 lives. With `rcextensions` it's possible to add additional mapping for whoosh,
68 stats and add additional code into the push/pull/create repo hooks. For example
69 stats and add additional code into the push/pull/create repo hooks. For example
69 for sending signals to build-bots such as jenkins.
70 for sending signals to build-bots such as jenkins.
70 Please see the `__init__.py` file inside `rcextensions` package
71 Please see the `__init__.py` file inside `rcextensions` package
71 for more details.
72 for more details.
72
73
73
74
74 Using RhodeCode with SSH
75 Using RhodeCode with SSH
75 ------------------------
76 ------------------------
76
77
77 RhodeCode currently only hosts repositories using http and https. (The addition
78 RhodeCode currently only hosts repositories using http and https. (The addition
78 of ssh hosting is a planned future feature.) However you can easily use ssh in
79 of ssh hosting is a planned future feature.) However you can easily use ssh in
79 parallel with RhodeCode. (Repository access via ssh is a standard "out of
80 parallel with RhodeCode. (Repository access via ssh is a standard "out of
80 the box" feature of mercurial_ and you can use this to access any of the
81 the box" feature of mercurial_ and you can use this to access any of the
81 repositories that RhodeCode is hosting. See PublishingRepositories_)
82 repositories that RhodeCode is hosting. See PublishingRepositories_)
82
83
83 RhodeCode repository structures are kept in directories with the same name
84 RhodeCode repository structures are kept in directories with the same name
84 as the project. When using repository groups, each group is a subdirectory.
85 as the project. When using repository groups, each group is a subdirectory.
85 This allows you to easily use ssh for accessing repositories.
86 This allows you to easily use ssh for accessing repositories.
86
87
87 In order to use ssh you need to make sure that your web-server and the users
88 In order to use ssh you need to make sure that your web-server and the users
88 login accounts have the correct permissions set on the appropriate directories.
89 login accounts have the correct permissions set on the appropriate directories.
89 (Note that these permissions are independent of any permissions you have set up
90 (Note that these permissions are independent of any permissions you have set up
90 using the RhodeCode web interface.)
91 using the RhodeCode web interface.)
91
92
92 If your main directory (the same as set in RhodeCode settings) is for example
93 If your main directory (the same as set in RhodeCode settings) is for example
93 set to **/home/hg** and the repository you are using is named `rhodecode`, then
94 set to **/home/hg** and the repository you are using is named `rhodecode`, then
94 to clone via ssh you should run::
95 to clone via ssh you should run::
95
96
96 hg clone ssh://user@server.com/home/hg/rhodecode
97 hg clone ssh://user@server.com/home/hg/rhodecode
97
98
98 Using other external tools such as mercurial-server_ or using ssh key based
99 Using other external tools such as mercurial-server_ or using ssh key based
99 authentication is fully supported.
100 authentication is fully supported.
100
101
101 Note: In an advanced setup, in order for your ssh access to use the same
102 Note: In an advanced setup, in order for your ssh access to use the same
102 permissions as set up via the RhodeCode web interface, you can create an
103 permissions as set up via the RhodeCode web interface, you can create an
103 authentication hook to connect to the rhodecode db and runs check functions for
104 authentication hook to connect to the rhodecode db and runs check functions for
104 permissions against that.
105 permissions against that.
105
106
106 Setting up Whoosh full text search
107 Setting up Whoosh full text search
107 ----------------------------------
108 ----------------------------------
108
109
109 Starting from version 1.1 the whoosh index can be build by using the paster
110 Starting from version 1.1 the whoosh index can be build by using the paster
110 command ``make-index``. To use ``make-index`` you must specify the configuration
111 command ``make-index``. To use ``make-index`` you must specify the configuration
111 file that stores the location of the index. You may specify the location of the
112 file that stores the location of the index. You may specify the location of the
112 repositories (`--repo-location`). If not specified, this value is retrieved
113 repositories (`--repo-location`). If not specified, this value is retrieved
113 from the RhodeCode database. This was required prior to 1.2. Starting from
114 from the RhodeCode database. This was required prior to 1.2. Starting from
114 version 1.2 it is also possible to specify a comma separated list of
115 version 1.2 it is also possible to specify a comma separated list of
115 repositories (`--index-only`) to build index only on chooses repositories
116 repositories (`--index-only`) to build index only on chooses repositories
116 skipping any other found in repos location
117 skipping any other found in repos location
117
118
118 You may optionally pass the option `-f` to enable a full index rebuild. Without
119 You may optionally pass the option `-f` to enable a full index rebuild. Without
119 the `-f` option, indexing will run always in "incremental" mode.
120 the `-f` option, indexing will run always in "incremental" mode.
120
121
121 For an incremental index build use::
122 For an incremental index build use::
122
123
123 paster make-index production.ini
124 paster make-index production.ini
124
125
125 For a full index rebuild use::
126 For a full index rebuild use::
126
127
127 paster make-index production.ini -f
128 paster make-index production.ini -f
128
129
129
130
130 building index just for chosen repositories is possible with such command::
131 building index just for chosen repositories is possible with such command::
131
132
132 paster make-index production.ini --index-only=vcs,rhodecode
133 paster make-index production.ini --index-only=vcs,rhodecode
133
134
134
135
135 In order to do periodical index builds and keep your index always up to date.
136 In order to do periodical index builds and keep your index always up to date.
136 It's recommended to do a crontab entry for incremental indexing.
137 It's recommended to do a crontab entry for incremental indexing.
137 An example entry might look like this::
138 An example entry might look like this::
138
139
139 /path/to/python/bin/paster make-index /path/to/rhodecode/production.ini
140 /path/to/python/bin/paster make-index /path/to/rhodecode/production.ini
140
141
141 When using incremental mode (the default) whoosh will check the last
142 When using incremental mode (the default) whoosh will check the last
142 modification date of each file and add it to be reindexed if a newer file is
143 modification date of each file and add it to be reindexed if a newer file is
143 available. The indexing daemon checks for any removed files and removes them
144 available. The indexing daemon checks for any removed files and removes them
144 from index.
145 from index.
145
146
146 If you want to rebuild index from scratch, you can use the `-f` flag as above,
147 If you want to rebuild index from scratch, you can use the `-f` flag as above,
147 or in the admin panel you can check `build from scratch` flag.
148 or in the admin panel you can check `build from scratch` flag.
148
149
149
150
150 Setting up LDAP support
151 Setting up LDAP support
151 -----------------------
152 -----------------------
152
153
153 RhodeCode starting from version 1.1 supports ldap authentication. In order
154 RhodeCode starting from version 1.1 supports ldap authentication. In order
154 to use LDAP, you have to install the python-ldap_ package. This package is
155 to use LDAP, you have to install the python-ldap_ package. This package is
155 available via pypi, so you can install it by running
156 available via pypi, so you can install it by running
156
157
157 using easy_install::
158 using easy_install::
158
159
159 easy_install python-ldap
160 easy_install python-ldap
160
161
161 using pip::
162 using pip::
162
163
163 pip install python-ldap
164 pip install python-ldap
164
165
165 .. note::
166 .. note::
166 python-ldap requires some certain libs on your system, so before installing
167 python-ldap requires some certain libs on your system, so before installing
167 it check that you have at least `openldap`, and `sasl` libraries.
168 it check that you have at least `openldap`, and `sasl` libraries.
168
169
169 LDAP settings are located in admin->ldap section,
170 LDAP settings are located in admin->ldap section,
170
171
171 Here's a typical ldap setup::
172 Here's a typical ldap setup::
172
173
173 Connection settings
174 Connection settings
174 Enable LDAP = checked
175 Enable LDAP = checked
175 Host = host.example.org
176 Host = host.example.org
176 Port = 389
177 Port = 389
177 Account = <account>
178 Account = <account>
178 Password = <password>
179 Password = <password>
179 Connection Security = LDAPS connection
180 Connection Security = LDAPS connection
180 Certificate Checks = DEMAND
181 Certificate Checks = DEMAND
181
182
182 Search settings
183 Search settings
183 Base DN = CN=users,DC=host,DC=example,DC=org
184 Base DN = CN=users,DC=host,DC=example,DC=org
184 LDAP Filter = (&(objectClass=user)(!(objectClass=computer)))
185 LDAP Filter = (&(objectClass=user)(!(objectClass=computer)))
185 LDAP Search Scope = SUBTREE
186 LDAP Search Scope = SUBTREE
186
187
187 Attribute mappings
188 Attribute mappings
188 Login Attribute = uid
189 Login Attribute = uid
189 First Name Attribute = firstName
190 First Name Attribute = firstName
190 Last Name Attribute = lastName
191 Last Name Attribute = lastName
191 E-mail Attribute = mail
192 E-mail Attribute = mail
192
193
193 .. _enable_ldap:
194 .. _enable_ldap:
194
195
195 Enable LDAP : required
196 Enable LDAP : required
196 Whether to use LDAP for authenticating users.
197 Whether to use LDAP for authenticating users.
197
198
198 .. _ldap_host:
199 .. _ldap_host:
199
200
200 Host : required
201 Host : required
201 LDAP server hostname or IP address.
202 LDAP server hostname or IP address.
202
203
203 .. _Port:
204 .. _Port:
204
205
205 Port : required
206 Port : required
206 389 for un-encrypted LDAP, 636 for SSL-encrypted LDAP.
207 389 for un-encrypted LDAP, 636 for SSL-encrypted LDAP.
207
208
208 .. _ldap_account:
209 .. _ldap_account:
209
210
210 Account : optional
211 Account : optional
211 Only required if the LDAP server does not allow anonymous browsing of
212 Only required if the LDAP server does not allow anonymous browsing of
212 records. This should be a special account for record browsing. This
213 records. This should be a special account for record browsing. This
213 will require `LDAP Password`_ below.
214 will require `LDAP Password`_ below.
214
215
215 .. _LDAP Password:
216 .. _LDAP Password:
216
217
217 Password : optional
218 Password : optional
218 Only required if the LDAP server does not allow anonymous browsing of
219 Only required if the LDAP server does not allow anonymous browsing of
219 records.
220 records.
220
221
221 .. _Enable LDAPS:
222 .. _Enable LDAPS:
222
223
223 Connection Security : required
224 Connection Security : required
224 Defines the connection to LDAP server
225 Defines the connection to LDAP server
225
226
226 No encryption
227 No encryption
227 Plain non encrypted connection
228 Plain non encrypted connection
228
229
229 LDAPS connection
230 LDAPS connection
230 Enable ldaps connection. It will likely require `Port`_ to be set to
231 Enable ldaps connection. It will likely require `Port`_ to be set to
231 a different value (standard LDAPS port is 636). When LDAPS is enabled
232 a different value (standard LDAPS port is 636). When LDAPS is enabled
232 then `Certificate Checks`_ is required.
233 then `Certificate Checks`_ is required.
233
234
234 START_TLS on LDAP connection
235 START_TLS on LDAP connection
235 START TLS connection
236 START TLS connection
236
237
237 .. _Certificate Checks:
238 .. _Certificate Checks:
238
239
239 Certificate Checks : optional
240 Certificate Checks : optional
240 How SSL certificates verification is handled - this is only useful when
241 How SSL certificates verification is handled - this is only useful when
241 `Enable LDAPS`_ is enabled. Only DEMAND or HARD offer full SSL security
242 `Enable LDAPS`_ is enabled. Only DEMAND or HARD offer full SSL security
242 while the other options are susceptible to man-in-the-middle attacks. SSL
243 while the other options are susceptible to man-in-the-middle attacks. SSL
243 certificates can be installed to /etc/openldap/cacerts so that the
244 certificates can be installed to /etc/openldap/cacerts so that the
244 DEMAND or HARD options can be used with self-signed certificates or
245 DEMAND or HARD options can be used with self-signed certificates or
245 certificates that do not have traceable certificates of authority.
246 certificates that do not have traceable certificates of authority.
246
247
247 NEVER
248 NEVER
248 A serve certificate will never be requested or checked.
249 A serve certificate will never be requested or checked.
249
250
250 ALLOW
251 ALLOW
251 A server certificate is requested. Failure to provide a
252 A server certificate is requested. Failure to provide a
252 certificate or providing a bad certificate will not terminate the
253 certificate or providing a bad certificate will not terminate the
253 session.
254 session.
254
255
255 TRY
256 TRY
256 A server certificate is requested. Failure to provide a
257 A server certificate is requested. Failure to provide a
257 certificate does not halt the session; providing a bad certificate
258 certificate does not halt the session; providing a bad certificate
258 halts the session.
259 halts the session.
259
260
260 DEMAND
261 DEMAND
261 A server certificate is requested and must be provided and
262 A server certificate is requested and must be provided and
262 authenticated for the session to proceed.
263 authenticated for the session to proceed.
263
264
264 HARD
265 HARD
265 The same as DEMAND.
266 The same as DEMAND.
266
267
267 .. _Base DN:
268 .. _Base DN:
268
269
269 Base DN : required
270 Base DN : required
270 The Distinguished Name (DN) where searches for users will be performed.
271 The Distinguished Name (DN) where searches for users will be performed.
271 Searches can be controlled by `LDAP Filter`_ and `LDAP Search Scope`_.
272 Searches can be controlled by `LDAP Filter`_ and `LDAP Search Scope`_.
272
273
273 .. _LDAP Filter:
274 .. _LDAP Filter:
274
275
275 LDAP Filter : optional
276 LDAP Filter : optional
276 A LDAP filter defined by RFC 2254. This is more useful when `LDAP
277 A LDAP filter defined by RFC 2254. This is more useful when `LDAP
277 Search Scope`_ is set to SUBTREE. The filter is useful for limiting
278 Search Scope`_ is set to SUBTREE. The filter is useful for limiting
278 which LDAP objects are identified as representing Users for
279 which LDAP objects are identified as representing Users for
279 authentication. The filter is augmented by `Login Attribute`_ below.
280 authentication. The filter is augmented by `Login Attribute`_ below.
280 This can commonly be left blank.
281 This can commonly be left blank.
281
282
282 .. _LDAP Search Scope:
283 .. _LDAP Search Scope:
283
284
284 LDAP Search Scope : required
285 LDAP Search Scope : required
285 This limits how far LDAP will search for a matching object.
286 This limits how far LDAP will search for a matching object.
286
287
287 BASE
288 BASE
288 Only allows searching of `Base DN`_ and is usually not what you
289 Only allows searching of `Base DN`_ and is usually not what you
289 want.
290 want.
290
291
291 ONELEVEL
292 ONELEVEL
292 Searches all entries under `Base DN`_, but not Base DN itself.
293 Searches all entries under `Base DN`_, but not Base DN itself.
293
294
294 SUBTREE
295 SUBTREE
295 Searches all entries below `Base DN`_, but not Base DN itself.
296 Searches all entries below `Base DN`_, but not Base DN itself.
296 When using SUBTREE `LDAP Filter`_ is useful to limit object
297 When using SUBTREE `LDAP Filter`_ is useful to limit object
297 location.
298 location.
298
299
299 .. _Login Attribute:
300 .. _Login Attribute:
300
301
301 Login Attribute : required
302 Login Attribute : required
302 The LDAP record attribute that will be matched as the USERNAME or
303 The LDAP record attribute that will be matched as the USERNAME or
303 ACCOUNT used to connect to RhodeCode. This will be added to `LDAP
304 ACCOUNT used to connect to RhodeCode. This will be added to `LDAP
304 Filter`_ for locating the User object. If `LDAP Filter`_ is specified as
305 Filter`_ for locating the User object. If `LDAP Filter`_ is specified as
305 "LDAPFILTER", `Login Attribute`_ is specified as "uid" and the user has
306 "LDAPFILTER", `Login Attribute`_ is specified as "uid" and the user has
306 connected as "jsmith" then the `LDAP Filter`_ will be augmented as below
307 connected as "jsmith" then the `LDAP Filter`_ will be augmented as below
307 ::
308 ::
308
309
309 (&(LDAPFILTER)(uid=jsmith))
310 (&(LDAPFILTER)(uid=jsmith))
310
311
311 .. _ldap_attr_firstname:
312 .. _ldap_attr_firstname:
312
313
313 First Name Attribute : required
314 First Name Attribute : required
314 The LDAP record attribute which represents the user's first name.
315 The LDAP record attribute which represents the user's first name.
315
316
316 .. _ldap_attr_lastname:
317 .. _ldap_attr_lastname:
317
318
318 Last Name Attribute : required
319 Last Name Attribute : required
319 The LDAP record attribute which represents the user's last name.
320 The LDAP record attribute which represents the user's last name.
320
321
321 .. _ldap_attr_email:
322 .. _ldap_attr_email:
322
323
323 Email Attribute : required
324 Email Attribute : required
324 The LDAP record attribute which represents the user's email address.
325 The LDAP record attribute which represents the user's email address.
325
326
326 If all data are entered correctly, and python-ldap_ is properly installed
327 If all data are entered correctly, and python-ldap_ is properly installed
327 users should be granted access to RhodeCode with ldap accounts. At this
328 users should be granted access to RhodeCode with ldap accounts. At this
328 time user information is copied from LDAP into the RhodeCode user database.
329 time user information is copied from LDAP into the RhodeCode user database.
329 This means that updates of an LDAP user object may not be reflected as a
330 This means that updates of an LDAP user object may not be reflected as a
330 user update in RhodeCode.
331 user update in RhodeCode.
331
332
332 If You have problems with LDAP access and believe You entered correct
333 If You have problems with LDAP access and believe You entered correct
333 information check out the RhodeCode logs, any error messages sent from LDAP
334 information check out the RhodeCode logs, any error messages sent from LDAP
334 will be saved there.
335 will be saved there.
335
336
336 Active Directory
337 Active Directory
337 ''''''''''''''''
338 ''''''''''''''''
338
339
339 RhodeCode can use Microsoft Active Directory for user authentication. This
340 RhodeCode can use Microsoft Active Directory for user authentication. This
340 is done through an LDAP or LDAPS connection to Active Directory. The
341 is done through an LDAP or LDAPS connection to Active Directory. The
341 following LDAP configuration settings are typical for using Active
342 following LDAP configuration settings are typical for using Active
342 Directory ::
343 Directory ::
343
344
344 Base DN = OU=SBSUsers,OU=Users,OU=MyBusiness,DC=v3sys,DC=local
345 Base DN = OU=SBSUsers,OU=Users,OU=MyBusiness,DC=v3sys,DC=local
345 Login Attribute = sAMAccountName
346 Login Attribute = sAMAccountName
346 First Name Attribute = givenName
347 First Name Attribute = givenName
347 Last Name Attribute = sn
348 Last Name Attribute = sn
348 E-mail Attribute = mail
349 E-mail Attribute = mail
349
350
350 All other LDAP settings will likely be site-specific and should be
351 All other LDAP settings will likely be site-specific and should be
351 appropriately configured.
352 appropriately configured.
352
353
353
354
354 Authentication by container or reverse-proxy
355 Authentication by container or reverse-proxy
355 --------------------------------------------
356 --------------------------------------------
356
357
357 Starting with version 1.3, RhodeCode supports delegating the authentication
358 Starting with version 1.3, RhodeCode supports delegating the authentication
358 of users to its WSGI container, or to a reverse-proxy server through which all
359 of users to its WSGI container, or to a reverse-proxy server through which all
359 clients access the application.
360 clients access the application.
360
361
361 When these authentication methods are enabled in RhodeCode, it uses the
362 When these authentication methods are enabled in RhodeCode, it uses the
362 username that the container/proxy (Apache/Nginx/etc) authenticated and doesn't
363 username that the container/proxy (Apache/Nginx/etc) authenticated and doesn't
363 perform the authentication itself. The authorization, however, is still done by
364 perform the authentication itself. The authorization, however, is still done by
364 RhodeCode according to its settings.
365 RhodeCode according to its settings.
365
366
366 When a user logs in for the first time using these authentication methods,
367 When a user logs in for the first time using these authentication methods,
367 a matching user account is created in RhodeCode with default permissions. An
368 a matching user account is created in RhodeCode with default permissions. An
368 administrator can then modify it using RhodeCode's admin interface.
369 administrator can then modify it using RhodeCode's admin interface.
369 It's also possible for an administrator to create accounts and configure their
370 It's also possible for an administrator to create accounts and configure their
370 permissions before the user logs in for the first time.
371 permissions before the user logs in for the first time.
371
372
372 Container-based authentication
373 Container-based authentication
373 ''''''''''''''''''''''''''''''
374 ''''''''''''''''''''''''''''''
374
375
375 In a container-based authentication setup, RhodeCode reads the user name from
376 In a container-based authentication setup, RhodeCode reads the user name from
376 the ``REMOTE_USER`` server variable provided by the WSGI container.
377 the ``REMOTE_USER`` server variable provided by the WSGI container.
377
378
378 After setting up your container (see `Apache's WSGI config`_), you'd need
379 After setting up your container (see `Apache's WSGI config`_), you'd need
379 to configure it to require authentication on the location configured for
380 to configure it to require authentication on the location configured for
380 RhodeCode.
381 RhodeCode.
381
382
382 In order for RhodeCode to start using the provided username, you should set the
383 In order for RhodeCode to start using the provided username, you should set the
383 following in the [app:main] section of your .ini file::
384 following in the [app:main] section of your .ini file::
384
385
385 container_auth_enabled = true
386 container_auth_enabled = true
386
387
387
388
388 Proxy pass-through authentication
389 Proxy pass-through authentication
389 '''''''''''''''''''''''''''''''''
390 '''''''''''''''''''''''''''''''''
390
391
391 In a proxy pass-through authentication setup, RhodeCode reads the user name
392 In a proxy pass-through authentication setup, RhodeCode reads the user name
392 from the ``X-Forwarded-User`` request header, which should be configured to be
393 from the ``X-Forwarded-User`` request header, which should be configured to be
393 sent by the reverse-proxy server.
394 sent by the reverse-proxy server.
394
395
395 After setting up your proxy solution (see `Apache virtual host reverse proxy example`_,
396 After setting up your proxy solution (see `Apache virtual host reverse proxy example`_,
396 `Apache as subdirectory`_ or `Nginx virtual host example`_), you'd need to
397 `Apache as subdirectory`_ or `Nginx virtual host example`_), you'd need to
397 configure the authentication and add the username in a request header named
398 configure the authentication and add the username in a request header named
398 ``X-Forwarded-User``.
399 ``X-Forwarded-User``.
399
400
400 For example, the following config section for Apache sets a subdirectory in a
401 For example, the following config section for Apache sets a subdirectory in a
401 reverse-proxy setup with basic auth::
402 reverse-proxy setup with basic auth::
402
403
403 <Location /<someprefix> >
404 <Location /<someprefix> >
404 ProxyPass http://127.0.0.1:5000/<someprefix>
405 ProxyPass http://127.0.0.1:5000/<someprefix>
405 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
406 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
406 SetEnvIf X-Url-Scheme https HTTPS=1
407 SetEnvIf X-Url-Scheme https HTTPS=1
407
408
408 AuthType Basic
409 AuthType Basic
409 AuthName "RhodeCode authentication"
410 AuthName "RhodeCode authentication"
410 AuthUserFile /home/web/rhodecode/.htpasswd
411 AuthUserFile /home/web/rhodecode/.htpasswd
411 require valid-user
412 require valid-user
412
413
413 RequestHeader unset X-Forwarded-User
414 RequestHeader unset X-Forwarded-User
414
415
415 RewriteEngine On
416 RewriteEngine On
416 RewriteCond %{LA-U:REMOTE_USER} (.+)
417 RewriteCond %{LA-U:REMOTE_USER} (.+)
417 RewriteRule .* - [E=RU:%1]
418 RewriteRule .* - [E=RU:%1]
418 RequestHeader set X-Forwarded-User %{RU}e
419 RequestHeader set X-Forwarded-User %{RU}e
419 </Location>
420 </Location>
420
421
421 In order for RhodeCode to start using the forwarded username, you should set
422 In order for RhodeCode to start using the forwarded username, you should set
422 the following in the [app:main] section of your .ini file::
423 the following in the [app:main] section of your .ini file::
423
424
424 proxypass_auth_enabled = true
425 proxypass_auth_enabled = true
425
426
426 .. note::
427 .. note::
427 If you enable proxy pass-through authentication, make sure your server is
428 If you enable proxy pass-through authentication, make sure your server is
428 only accessible through the proxy. Otherwise, any client would be able to
429 only accessible through the proxy. Otherwise, any client would be able to
429 forge the authentication header and could effectively become authenticated
430 forge the authentication header and could effectively become authenticated
430 using any account of their liking.
431 using any account of their liking.
431
432
432 Integration with Issue trackers
433 Integration with Issue trackers
433 -------------------------------
434 -------------------------------
434
435
435 RhodeCode provides a simple integration with issue trackers. It's possible
436 RhodeCode provides a simple integration with issue trackers. It's possible
436 to define a regular expression that will fetch issue id stored in commit
437 to define a regular expression that will fetch issue id stored in commit
437 messages and replace that with an url to this issue. To enable this simply
438 messages and replace that with an url to this issue. To enable this simply
438 uncomment following variables in the ini file::
439 uncomment following variables in the ini file::
439
440
440 url_pat = (?:^#|\s#)(\w+)
441 url_pat = (?:^#|\s#)(\w+)
441 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
442 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
442 issue_prefix = #
443 issue_prefix = #
443
444
444 `url_pat` is the regular expression that will fetch issues from commit messages.
445 `url_pat` is the regular expression that will fetch issues from commit messages.
445 Default regex will match issues in format of #<number> eg. #300.
446 Default regex will match issues in format of #<number> eg. #300.
446
447
447 Matched issues will be replace with the link specified as `issue_server_link`
448 Matched issues will be replace with the link specified as `issue_server_link`
448 {id} will be replaced with issue id, and {repo} with repository name.
449 {id} will be replaced with issue id, and {repo} with repository name.
449 Since the # is striped `issue_prefix` is added as a prefix to url.
450 Since the # is striped `issue_prefix` is added as a prefix to url.
450 `issue_prefix` can be something different than # if you pass
451 `issue_prefix` can be something different than # if you pass
451 ISSUE- as issue prefix this will generate an url in format::
452 ISSUE- as issue prefix this will generate an url in format::
452
453
453 <a href="https://myissueserver.com/example_repo/issue/300">ISSUE-300</a>
454 <a href="https://myissueserver.com/example_repo/issue/300">ISSUE-300</a>
454
455
455 Hook management
456 Hook management
456 ---------------
457 ---------------
457
458
458 Hooks can be managed in similar way to this used in .hgrc files.
459 Hooks can be managed in similar way to this used in .hgrc files.
459 To access hooks setting click `advanced setup` on Hooks section of Mercurial
460 To access hooks setting click `advanced setup` on Hooks section of Mercurial
460 Settings in Admin.
461 Settings in Admin.
461
462
462 There are 4 built in hooks that cannot be changed (only enable/disable by
463 There are 4 built in hooks that cannot be changed (only enable/disable by
463 checkboxes on previos section).
464 checkboxes on previos section).
464 To add another custom hook simply fill in first section with
465 To add another custom hook simply fill in first section with
465 <name>.<hook_type> and the second one with hook path. Example hooks
466 <name>.<hook_type> and the second one with hook path. Example hooks
466 can be found at *rhodecode.lib.hooks*.
467 can be found at *rhodecode.lib.hooks*.
467
468
468
469
469 Changing default encoding
470 Changing default encoding
470 -------------------------
471 -------------------------
471
472
472 By default RhodeCode uses utf8 encoding, starting from 1.3 series this
473 By default RhodeCode uses utf8 encoding, starting from 1.3 series this
473 can be changed, simply edit default_encoding in .ini file to desired one.
474 can be changed, simply edit default_encoding in .ini file to desired one.
474 This affects many parts in rhodecode including commiters names, filenames,
475 This affects many parts in rhodecode including commiters names, filenames,
475 encoding of commit messages. In addition RhodeCode can detect if `chardet`
476 encoding of commit messages. In addition RhodeCode can detect if `chardet`
476 library is installed. If `chardet` is detected RhodeCode will fallback to it
477 library is installed. If `chardet` is detected RhodeCode will fallback to it
477 when there are encode/decode errors.
478 when there are encode/decode errors.
478
479
479
480
480 Setting Up Celery
481 Setting Up Celery
481 -----------------
482 -----------------
482
483
483 Since version 1.1 celery is configured by the rhodecode ini configuration files.
484 Since version 1.1 celery is configured by the rhodecode ini configuration files.
484 Simply set use_celery=true in the ini file then add / change the configuration
485 Simply set use_celery=true in the ini file then add / change the configuration
485 variables inside the ini file.
486 variables inside the ini file.
486
487
487 Remember that the ini files use the format with '.' not with '_' like celery.
488 Remember that the ini files use the format with '.' not with '_' like celery.
488 So for example setting `BROKER_HOST` in celery means setting `broker.host` in
489 So for example setting `BROKER_HOST` in celery means setting `broker.host` in
489 the config file.
490 the config file.
490
491
491 In order to start using celery run::
492 In order to start using celery run::
492
493
493 paster celeryd <configfile.ini>
494 paster celeryd <configfile.ini>
494
495
495
496
496 .. note::
497 .. note::
497 Make sure you run this command from the same virtualenv, and with the same
498 Make sure you run this command from the same virtualenv, and with the same
498 user that rhodecode runs.
499 user that rhodecode runs.
499
500
500 HTTPS support
501 HTTPS support
501 -------------
502 -------------
502
503
503 There are two ways to enable https:
504 There are two ways to enable https:
504
505
505 - Set HTTP_X_URL_SCHEME in your http server headers, than rhodecode will
506 - Set HTTP_X_URL_SCHEME in your http server headers, than rhodecode will
506 recognize this headers and make proper https redirections
507 recognize this headers and make proper https redirections
507 - Alternatively, change the `force_https = true` flag in the ini configuration
508 - Alternatively, change the `force_https = true` flag in the ini configuration
508 to force using https, no headers are needed than to enable https
509 to force using https, no headers are needed than to enable https
509
510
510
511
511 Nginx virtual host example
512 Nginx virtual host example
512 --------------------------
513 --------------------------
513
514
514 Sample config for nginx using proxy::
515 Sample config for nginx using proxy::
515
516
516 upstream rc {
517 upstream rc {
517 server 127.0.0.1:5000;
518 server 127.0.0.1:5000;
518 # add more instances for load balancing
519 # add more instances for load balancing
519 #server 127.0.0.1:5001;
520 #server 127.0.0.1:5001;
520 #server 127.0.0.1:5002;
521 #server 127.0.0.1:5002;
521 }
522 }
522
523
523 server {
524 server {
524 listen 80;
525 listen 80;
525 server_name hg.myserver.com;
526 server_name hg.myserver.com;
526 access_log /var/log/nginx/rhodecode.access.log;
527 access_log /var/log/nginx/rhodecode.access.log;
527 error_log /var/log/nginx/rhodecode.error.log;
528 error_log /var/log/nginx/rhodecode.error.log;
528
529
529 location / {
530 location / {
530 try_files $uri @rhode;
531 try_files $uri @rhode;
531 }
532 }
532
533
533 location @rhode {
534 location @rhode {
534 proxy_pass http://rc;
535 proxy_pass http://rc;
535 include /etc/nginx/proxy.conf;
536 include /etc/nginx/proxy.conf;
536 }
537 }
537
538
538 }
539 }
539
540
540 Here's the proxy.conf. It's tuned so it will not timeout on long
541 Here's the proxy.conf. It's tuned so it will not timeout on long
541 pushes or large pushes::
542 pushes or large pushes::
542
543
543 proxy_redirect off;
544 proxy_redirect off;
544 proxy_set_header Host $host;
545 proxy_set_header Host $host;
545 proxy_set_header X-Url-Scheme $scheme;
546 proxy_set_header X-Url-Scheme $scheme;
546 proxy_set_header X-Host $http_host;
547 proxy_set_header X-Host $http_host;
547 proxy_set_header X-Real-IP $remote_addr;
548 proxy_set_header X-Real-IP $remote_addr;
548 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
549 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
549 proxy_set_header Proxy-host $proxy_host;
550 proxy_set_header Proxy-host $proxy_host;
550 client_max_body_size 400m;
551 client_max_body_size 400m;
551 client_body_buffer_size 128k;
552 client_body_buffer_size 128k;
552 proxy_buffering off;
553 proxy_buffering off;
553 proxy_connect_timeout 7200;
554 proxy_connect_timeout 7200;
554 proxy_send_timeout 7200;
555 proxy_send_timeout 7200;
555 proxy_read_timeout 7200;
556 proxy_read_timeout 7200;
556 proxy_buffers 8 32k;
557 proxy_buffers 8 32k;
557
558
558 Also, when using root path with nginx you might set the static files to false
559 Also, when using root path with nginx you might set the static files to false
559 in the production.ini file::
560 in the production.ini file::
560
561
561 [app:main]
562 [app:main]
562 use = egg:rhodecode
563 use = egg:rhodecode
563 full_stack = true
564 full_stack = true
564 static_files = false
565 static_files = false
565 lang=en
566 lang=en
566 cache_dir = %(here)s/data
567 cache_dir = %(here)s/data
567
568
568 In order to not have the statics served by the application. This improves speed.
569 In order to not have the statics served by the application. This improves speed.
569
570
570
571
571 Apache virtual host reverse proxy example
572 Apache virtual host reverse proxy example
572 -----------------------------------------
573 -----------------------------------------
573
574
574 Here is a sample configuration file for apache using proxy::
575 Here is a sample configuration file for apache using proxy::
575
576
576 <VirtualHost *:80>
577 <VirtualHost *:80>
577 ServerName hg.myserver.com
578 ServerName hg.myserver.com
578 ServerAlias hg.myserver.com
579 ServerAlias hg.myserver.com
579
580
580 <Proxy *>
581 <Proxy *>
581 Order allow,deny
582 Order allow,deny
582 Allow from all
583 Allow from all
583 </Proxy>
584 </Proxy>
584
585
585 #important !
586 #important !
586 #Directive to properly generate url (clone url) for pylons
587 #Directive to properly generate url (clone url) for pylons
587 ProxyPreserveHost On
588 ProxyPreserveHost On
588
589
589 #rhodecode instance
590 #rhodecode instance
590 ProxyPass / http://127.0.0.1:5000/
591 ProxyPass / http://127.0.0.1:5000/
591 ProxyPassReverse / http://127.0.0.1:5000/
592 ProxyPassReverse / http://127.0.0.1:5000/
592
593
593 #to enable https use line below
594 #to enable https use line below
594 #SetEnvIf X-Url-Scheme https HTTPS=1
595 #SetEnvIf X-Url-Scheme https HTTPS=1
595
596
596 </VirtualHost>
597 </VirtualHost>
597
598
598
599
599 Additional tutorial
600 Additional tutorial
600 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
601 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
601
602
602
603
603 Apache as subdirectory
604 Apache as subdirectory
604 ----------------------
605 ----------------------
605
606
606 Apache subdirectory part::
607 Apache subdirectory part::
607
608
608 <Location /<someprefix> >
609 <Location /<someprefix> >
609 ProxyPass http://127.0.0.1:5000/<someprefix>
610 ProxyPass http://127.0.0.1:5000/<someprefix>
610 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
611 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
611 SetEnvIf X-Url-Scheme https HTTPS=1
612 SetEnvIf X-Url-Scheme https HTTPS=1
612 </Location>
613 </Location>
613
614
614 Besides the regular apache setup you will need to add the following line
615 Besides the regular apache setup you will need to add the following line
615 into [app:main] section of your .ini file::
616 into [app:main] section of your .ini file::
616
617
617 filter-with = proxy-prefix
618 filter-with = proxy-prefix
618
619
619 Add the following at the end of the .ini file::
620 Add the following at the end of the .ini file::
620
621
621 [filter:proxy-prefix]
622 [filter:proxy-prefix]
622 use = egg:PasteDeploy#prefix
623 use = egg:PasteDeploy#prefix
623 prefix = /<someprefix>
624 prefix = /<someprefix>
624
625
625
626
626 then change <someprefix> into your choosen prefix
627 then change <someprefix> into your choosen prefix
627
628
628 Apache's WSGI config
629 Apache's WSGI config
629 --------------------
630 --------------------
630
631
631 Alternatively, RhodeCode can be set up with Apache under mod_wsgi. For
632 Alternatively, RhodeCode can be set up with Apache under mod_wsgi. For
632 that, you'll need to:
633 that, you'll need to:
633
634
634 - Install mod_wsgi. If using a Debian-based distro, you can install
635 - Install mod_wsgi. If using a Debian-based distro, you can install
635 the package libapache2-mod-wsgi::
636 the package libapache2-mod-wsgi::
636
637
637 aptitude install libapache2-mod-wsgi
638 aptitude install libapache2-mod-wsgi
638
639
639 - Enable mod_wsgi::
640 - Enable mod_wsgi::
640
641
641 a2enmod wsgi
642 a2enmod wsgi
642
643
643 - Create a wsgi dispatch script, like the one below. Make sure you
644 - Create a wsgi dispatch script, like the one below. Make sure you
644 check the paths correctly point to where you installed RhodeCode
645 check the paths correctly point to where you installed RhodeCode
645 and its Python Virtual Environment.
646 and its Python Virtual Environment.
646 - Enable the WSGIScriptAlias directive for the wsgi dispatch script,
647 - Enable the WSGIScriptAlias directive for the wsgi dispatch script,
647 as in the following example. Once again, check the paths are
648 as in the following example. Once again, check the paths are
648 correctly specified.
649 correctly specified.
649
650
650 Here is a sample excerpt from an Apache Virtual Host configuration file::
651 Here is a sample excerpt from an Apache Virtual Host configuration file::
651
652
652 WSGIDaemonProcess pylons user=www-data group=www-data processes=1 \
653 WSGIDaemonProcess pylons user=www-data group=www-data processes=1 \
653 threads=4 \
654 threads=4 \
654 python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages
655 python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages
655 WSGIScriptAlias / /home/web/rhodecode/dispatch.wsgi
656 WSGIScriptAlias / /home/web/rhodecode/dispatch.wsgi
656 WSGIPassAuthorization On
657 WSGIPassAuthorization On
657
658
658 Example wsgi dispatch script::
659 Example wsgi dispatch script::
659
660
660 import os
661 import os
661 os.environ["HGENCODING"] = "UTF-8"
662 os.environ["HGENCODING"] = "UTF-8"
662 os.environ['PYTHON_EGG_CACHE'] = '/home/web/rhodecode/.egg-cache'
663 os.environ['PYTHON_EGG_CACHE'] = '/home/web/rhodecode/.egg-cache'
663
664
664 # sometimes it's needed to set the curent dir
665 # sometimes it's needed to set the curent dir
665 os.chdir('/home/web/rhodecode/')
666 os.chdir('/home/web/rhodecode/')
666
667
667 import site
668 import site
668 site.addsitedir("/home/web/rhodecode/pyenv/lib/python2.6/site-packages")
669 site.addsitedir("/home/web/rhodecode/pyenv/lib/python2.6/site-packages")
669
670
670 from paste.deploy import loadapp
671 from paste.deploy import loadapp
671 from paste.script.util.logging_config import fileConfig
672 from paste.script.util.logging_config import fileConfig
672
673
673 fileConfig('/home/web/rhodecode/production.ini')
674 fileConfig('/home/web/rhodecode/production.ini')
674 application = loadapp('config:/home/web/rhodecode/production.ini')
675 application = loadapp('config:/home/web/rhodecode/production.ini')
675
676
676 Note: when using mod_wsgi you'll need to install the same version of
677 Note: when using mod_wsgi you'll need to install the same version of
677 Mercurial that's inside RhodeCode's virtualenv also on the system's Python
678 Mercurial that's inside RhodeCode's virtualenv also on the system's Python
678 environment.
679 environment.
679
680
680
681
681 Other configuration files
682 Other configuration files
682 -------------------------
683 -------------------------
683
684
684 Some example init.d scripts can be found here, for debian and gentoo:
685 Some example init.d scripts can be found here, for debian and gentoo:
685
686
686 https://rhodecode.org/rhodecode/files/tip/init.d
687 https://rhodecode.org/rhodecode/files/tip/init.d
687
688
688
689
689 Troubleshooting
690 Troubleshooting
690 ---------------
691 ---------------
691
692
692 :Q: **Missing static files?**
693 :Q: **Missing static files?**
693 :A: Make sure either to set the `static_files = true` in the .ini file or
694 :A: Make sure either to set the `static_files = true` in the .ini file or
694 double check the root path for your http setup. It should point to
695 double check the root path for your http setup. It should point to
695 for example:
696 for example:
696 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
697 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
697
698
698 |
699 |
699
700
700 :Q: **Can't install celery/rabbitmq**
701 :Q: **Can't install celery/rabbitmq**
701 :A: Don't worry RhodeCode works without them too. No extra setup is required.
702 :A: Don't worry RhodeCode works without them too. No extra setup is required.
702
703
703 |
704 |
704
705
705 :Q: **Long lasting push timeouts?**
706 :Q: **Long lasting push timeouts?**
706 :A: Make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
707 :A: Make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
707 are caused by https server and not RhodeCode.
708 are caused by https server and not RhodeCode.
708
709
709 |
710 |
710
711
711 :Q: **Large pushes timeouts?**
712 :Q: **Large pushes timeouts?**
712 :A: Make sure you set a proper max_body_size for the http server.
713 :A: Make sure you set a proper max_body_size for the http server.
713
714
714 |
715 |
715
716
716 :Q: **Apache doesn't pass basicAuth on pull/push?**
717 :Q: **Apache doesn't pass basicAuth on pull/push?**
717 :A: Make sure you added `WSGIPassAuthorization true`.
718 :A: Make sure you added `WSGIPassAuthorization true`.
718
719
719 For further questions search the `Issues tracker`_, or post a message in the
720 For further questions search the `Issues tracker`_, or post a message in the
720 `google group rhodecode`_
721 `google group rhodecode`_
721
722
722 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
723 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
723 .. _python: http://www.python.org/
724 .. _python: http://www.python.org/
724 .. _mercurial: http://mercurial.selenic.com/
725 .. _mercurial: http://mercurial.selenic.com/
725 .. _celery: http://celeryproject.org/
726 .. _celery: http://celeryproject.org/
726 .. _rabbitmq: http://www.rabbitmq.com/
727 .. _rabbitmq: http://www.rabbitmq.com/
727 .. _python-ldap: http://www.python-ldap.org/
728 .. _python-ldap: http://www.python-ldap.org/
728 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
729 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
729 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
730 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
730 .. _Issues tracker: https://bitbucket.org/marcinkuzminski/rhodecode/issues
731 .. _Issues tracker: https://bitbucket.org/marcinkuzminski/rhodecode/issues
731 .. _google group rhodecode: http://groups.google.com/group/rhodecode
732 .. _google group rhodecode: http://groups.google.com/group/rhodecode
@@ -1,527 +1,535 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.lib.db_manage
3 rhodecode.lib.db_manage
4 ~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Database creation, and setup module for RhodeCode. Used for creation
6 Database creation, and setup module for RhodeCode. Used for creation
7 of database as well as for migration operations
7 of database as well as for migration operations
8
8
9 :created_on: Apr 10, 2010
9 :created_on: Apr 10, 2010
10 :author: marcink
10 :author: marcink
11 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
12 :license: GPLv3, see COPYING for more details.
13 """
13 """
14 # This program is free software: you can redistribute it and/or modify
14 # This program is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation, either version 3 of the License, or
16 # the Free Software Foundation, either version 3 of the License, or
17 # (at your option) any later version.
17 # (at your option) any later version.
18 #
18 #
19 # This program is distributed in the hope that it will be useful,
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
22 # GNU General Public License for more details.
23 #
23 #
24 # You should have received a copy of the GNU General Public License
24 # You should have received a copy of the GNU General Public License
25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26
26
27 import os
27 import os
28 import sys
28 import sys
29 import uuid
29 import uuid
30 import logging
30 import logging
31 from os.path import dirname as dn, join as jn
31 from os.path import dirname as dn, join as jn
32
32
33 from rhodecode import __dbversion__
33 from rhodecode import __dbversion__
34 from rhodecode.model import meta
34 from rhodecode.model import meta
35
35
36 from rhodecode.model.user import UserModel
36 from rhodecode.model.user import UserModel
37 from rhodecode.lib.utils import ask_ok
37 from rhodecode.lib.utils import ask_ok
38 from rhodecode.model import init_model
38 from rhodecode.model import init_model
39 from rhodecode.model.db import User, Permission, RhodeCodeUi, \
39 from rhodecode.model.db import User, Permission, RhodeCodeUi, \
40 RhodeCodeSetting, UserToPerm, DbMigrateVersion, RepoGroup,\
40 RhodeCodeSetting, UserToPerm, DbMigrateVersion, RepoGroup,\
41 UserRepoGroupToPerm
41 UserRepoGroupToPerm
42
42
43 from sqlalchemy.engine import create_engine
43 from sqlalchemy.engine import create_engine
44 from rhodecode.model.repos_group import ReposGroupModel
44 from rhodecode.model.repos_group import ReposGroupModel
45
45
46 log = logging.getLogger(__name__)
46 log = logging.getLogger(__name__)
47
47
48
48
49 class DbManage(object):
49 class DbManage(object):
50 def __init__(self, log_sql, dbconf, root, tests=False):
50 def __init__(self, log_sql, dbconf, root, tests=False):
51 self.dbname = dbconf.split('/')[-1]
51 self.dbname = dbconf.split('/')[-1]
52 self.tests = tests
52 self.tests = tests
53 self.root = root
53 self.root = root
54 self.dburi = dbconf
54 self.dburi = dbconf
55 self.log_sql = log_sql
55 self.log_sql = log_sql
56 self.db_exists = False
56 self.db_exists = False
57 self.init_db()
57 self.init_db()
58
58
59 def init_db(self):
59 def init_db(self):
60 engine = create_engine(self.dburi, echo=self.log_sql)
60 engine = create_engine(self.dburi, echo=self.log_sql)
61 init_model(engine)
61 init_model(engine)
62 self.sa = meta.Session
62 self.sa = meta.Session
63
63
64 def create_tables(self, override=False):
64 def create_tables(self, override=False):
65 """
65 """
66 Create a auth database
66 Create a auth database
67 """
67 """
68
68
69 log.info("Any existing database is going to be destroyed")
69 log.info("Any existing database is going to be destroyed")
70 if self.tests:
70 if self.tests:
71 destroy = True
71 destroy = True
72 else:
72 else:
73 destroy = ask_ok('Are you sure to destroy old database ? [y/n]')
73 destroy = ask_ok('Are you sure to destroy old database ? [y/n]')
74 if not destroy:
74 if not destroy:
75 sys.exit()
75 sys.exit()
76 if destroy:
76 if destroy:
77 meta.Base.metadata.drop_all()
77 meta.Base.metadata.drop_all()
78
78
79 checkfirst = not override
79 checkfirst = not override
80 meta.Base.metadata.create_all(checkfirst=checkfirst)
80 meta.Base.metadata.create_all(checkfirst=checkfirst)
81 log.info('Created tables for %s' % self.dbname)
81 log.info('Created tables for %s' % self.dbname)
82
82
83 def set_db_version(self):
83 def set_db_version(self):
84 ver = DbMigrateVersion()
84 ver = DbMigrateVersion()
85 ver.version = __dbversion__
85 ver.version = __dbversion__
86 ver.repository_id = 'rhodecode_db_migrations'
86 ver.repository_id = 'rhodecode_db_migrations'
87 ver.repository_path = 'versions'
87 ver.repository_path = 'versions'
88 self.sa.add(ver)
88 self.sa.add(ver)
89 log.info('db version set to: %s' % __dbversion__)
89 log.info('db version set to: %s' % __dbversion__)
90
90
91 def upgrade(self):
91 def upgrade(self):
92 """
92 """
93 Upgrades given database schema to given revision following
93 Upgrades given database schema to given revision following
94 all needed steps, to perform the upgrade
94 all needed steps, to perform the upgrade
95
95
96 """
96 """
97
97
98 from rhodecode.lib.dbmigrate.migrate.versioning import api
98 from rhodecode.lib.dbmigrate.migrate.versioning import api
99 from rhodecode.lib.dbmigrate.migrate.exceptions import \
99 from rhodecode.lib.dbmigrate.migrate.exceptions import \
100 DatabaseNotControlledError
100 DatabaseNotControlledError
101
101
102 if 'sqlite' in self.dburi:
102 if 'sqlite' in self.dburi:
103 print (
103 print (
104 '********************** WARNING **********************\n'
104 '********************** WARNING **********************\n'
105 'Make sure your version of sqlite is at least 3.7.X. \n'
105 'Make sure your version of sqlite is at least 3.7.X. \n'
106 'Earlier versions are known to fail on some migrations\n'
106 'Earlier versions are known to fail on some migrations\n'
107 '*****************************************************\n'
107 '*****************************************************\n'
108 )
108 )
109 upgrade = ask_ok('You are about to perform database upgrade, make '
109 upgrade = ask_ok('You are about to perform database upgrade, make '
110 'sure You backed up your database before. '
110 'sure You backed up your database before. '
111 'Continue ? [y/n]')
111 'Continue ? [y/n]')
112 if not upgrade:
112 if not upgrade:
113 sys.exit('Nothing done')
113 sys.exit('Nothing done')
114
114
115 repository_path = jn(dn(dn(dn(os.path.realpath(__file__)))),
115 repository_path = jn(dn(dn(dn(os.path.realpath(__file__)))),
116 'rhodecode/lib/dbmigrate')
116 'rhodecode/lib/dbmigrate')
117 db_uri = self.dburi
117 db_uri = self.dburi
118
118
119 try:
119 try:
120 curr_version = api.db_version(db_uri, repository_path)
120 curr_version = api.db_version(db_uri, repository_path)
121 msg = ('Found current database under version'
121 msg = ('Found current database under version'
122 ' control with version %s' % curr_version)
122 ' control with version %s' % curr_version)
123
123
124 except (RuntimeError, DatabaseNotControlledError):
124 except (RuntimeError, DatabaseNotControlledError):
125 curr_version = 1
125 curr_version = 1
126 msg = ('Current database is not under version control. Setting'
126 msg = ('Current database is not under version control. Setting'
127 ' as version %s' % curr_version)
127 ' as version %s' % curr_version)
128 api.version_control(db_uri, repository_path, curr_version)
128 api.version_control(db_uri, repository_path, curr_version)
129
129
130 print (msg)
130 print (msg)
131
131
132 if curr_version == __dbversion__:
132 if curr_version == __dbversion__:
133 sys.exit('This database is already at the newest version')
133 sys.exit('This database is already at the newest version')
134
134
135 #======================================================================
135 #======================================================================
136 # UPGRADE STEPS
136 # UPGRADE STEPS
137 #======================================================================
137 #======================================================================
138 class UpgradeSteps(object):
138 class UpgradeSteps(object):
139 """
139 """
140 Those steps follow schema versions so for example schema
140 Those steps follow schema versions so for example schema
141 for example schema with seq 002 == step_2 and so on.
141 for example schema with seq 002 == step_2 and so on.
142 """
142 """
143
143
144 def __init__(self, klass):
144 def __init__(self, klass):
145 self.klass = klass
145 self.klass = klass
146
146
147 def step_0(self):
147 def step_0(self):
148 # step 0 is the schema upgrade, and than follow proper upgrades
148 # step 0 is the schema upgrade, and than follow proper upgrades
149 print ('attempting to do database upgrade to version %s' \
149 print ('attempting to do database upgrade to version %s' \
150 % __dbversion__)
150 % __dbversion__)
151 api.upgrade(db_uri, repository_path, __dbversion__)
151 api.upgrade(db_uri, repository_path, __dbversion__)
152 print ('Schema upgrade completed')
152 print ('Schema upgrade completed')
153
153
154 def step_1(self):
154 def step_1(self):
155 pass
155 pass
156
156
157 def step_2(self):
157 def step_2(self):
158 print ('Patching repo paths for newer version of RhodeCode')
158 print ('Patching repo paths for newer version of RhodeCode')
159 self.klass.fix_repo_paths()
159 self.klass.fix_repo_paths()
160
160
161 print ('Patching default user of RhodeCode')
161 print ('Patching default user of RhodeCode')
162 self.klass.fix_default_user()
162 self.klass.fix_default_user()
163
163
164 log.info('Changing ui settings')
164 log.info('Changing ui settings')
165 self.klass.create_ui_settings()
165 self.klass.create_ui_settings()
166
166
167 def step_3(self):
167 def step_3(self):
168 print ('Adding additional settings into RhodeCode db')
168 print ('Adding additional settings into RhodeCode db')
169 self.klass.fix_settings()
169 self.klass.fix_settings()
170 print ('Adding ldap defaults')
170 print ('Adding ldap defaults')
171 self.klass.create_ldap_options(skip_existing=True)
171 self.klass.create_ldap_options(skip_existing=True)
172
172
173 def step_4(self):
173 def step_4(self):
174 print ('create permissions and fix groups')
174 print ('create permissions and fix groups')
175 self.klass.create_permissions()
175 self.klass.create_permissions()
176 self.klass.fixup_groups()
176 self.klass.fixup_groups()
177
177
178 def step_5(self):
178 def step_5(self):
179 pass
179 pass
180
180
181 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
181 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
182
182
183 # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
183 # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
184 for step in upgrade_steps:
184 for step in upgrade_steps:
185 print ('performing upgrade step %s' % step)
185 print ('performing upgrade step %s' % step)
186 getattr(UpgradeSteps(self), 'step_%s' % step)()
186 getattr(UpgradeSteps(self), 'step_%s' % step)()
187 self.sa.commit()
187 self.sa.commit()
188
188
189 def fix_repo_paths(self):
189 def fix_repo_paths(self):
190 """
190 """
191 Fixes a old rhodecode version path into new one without a '*'
191 Fixes a old rhodecode version path into new one without a '*'
192 """
192 """
193
193
194 paths = self.sa.query(RhodeCodeUi)\
194 paths = self.sa.query(RhodeCodeUi)\
195 .filter(RhodeCodeUi.ui_key == '/')\
195 .filter(RhodeCodeUi.ui_key == '/')\
196 .scalar()
196 .scalar()
197
197
198 paths.ui_value = paths.ui_value.replace('*', '')
198 paths.ui_value = paths.ui_value.replace('*', '')
199
199
200 try:
200 try:
201 self.sa.add(paths)
201 self.sa.add(paths)
202 self.sa.commit()
202 self.sa.commit()
203 except:
203 except:
204 self.sa.rollback()
204 self.sa.rollback()
205 raise
205 raise
206
206
207 def fix_default_user(self):
207 def fix_default_user(self):
208 """
208 """
209 Fixes a old default user with some 'nicer' default values,
209 Fixes a old default user with some 'nicer' default values,
210 used mostly for anonymous access
210 used mostly for anonymous access
211 """
211 """
212 def_user = self.sa.query(User)\
212 def_user = self.sa.query(User)\
213 .filter(User.username == 'default')\
213 .filter(User.username == 'default')\
214 .one()
214 .one()
215
215
216 def_user.name = 'Anonymous'
216 def_user.name = 'Anonymous'
217 def_user.lastname = 'User'
217 def_user.lastname = 'User'
218 def_user.email = 'anonymous@rhodecode.org'
218 def_user.email = 'anonymous@rhodecode.org'
219
219
220 try:
220 try:
221 self.sa.add(def_user)
221 self.sa.add(def_user)
222 self.sa.commit()
222 self.sa.commit()
223 except:
223 except:
224 self.sa.rollback()
224 self.sa.rollback()
225 raise
225 raise
226
226
227 def fix_settings(self):
227 def fix_settings(self):
228 """
228 """
229 Fixes rhodecode settings adds ga_code key for google analytics
229 Fixes rhodecode settings adds ga_code key for google analytics
230 """
230 """
231
231
232 hgsettings3 = RhodeCodeSetting('ga_code', '')
232 hgsettings3 = RhodeCodeSetting('ga_code', '')
233
233
234 try:
234 try:
235 self.sa.add(hgsettings3)
235 self.sa.add(hgsettings3)
236 self.sa.commit()
236 self.sa.commit()
237 except:
237 except:
238 self.sa.rollback()
238 self.sa.rollback()
239 raise
239 raise
240
240
241 def admin_prompt(self, second=False):
241 def admin_prompt(self, second=False, defaults={}):
242 if not self.tests:
242 if not self.tests:
243 import getpass
243 import getpass
244
244
245 # defaults
246 username = defaults.get('username')
247 password = defaults.get('password')
248 email = defaults.get('email')
249
245 def get_password():
250 def get_password():
246 password = getpass.getpass('Specify admin password '
251 password = getpass.getpass('Specify admin password '
247 '(min 6 chars):')
252 '(min 6 chars):')
248 confirm = getpass.getpass('Confirm password:')
253 confirm = getpass.getpass('Confirm password:')
249
254
250 if password != confirm:
255 if password != confirm:
251 log.error('passwords mismatch')
256 log.error('passwords mismatch')
252 return False
257 return False
253 if len(password) < 6:
258 if len(password) < 6:
254 log.error('password is to short use at least 6 characters')
259 log.error('password is to short use at least 6 characters')
255 return False
260 return False
256
261
257 return password
262 return password
258
263 if username is None:
259 username = raw_input('Specify admin username:')
264 username = raw_input('Specify admin username:')
260
265 if password is None:
261 password = get_password()
262 if not password:
263 #second try
264 password = get_password()
266 password = get_password()
265 if not password:
267 if not password:
266 sys.exit()
268 #second try
267
269 password = get_password()
268 email = raw_input('Specify admin email:')
270 if not password:
271 sys.exit()
272 if email is None:
273 email = raw_input('Specify admin email:')
269 self.create_user(username, password, email, True)
274 self.create_user(username, password, email, True)
270 else:
275 else:
271 log.info('creating admin and regular test users')
276 log.info('creating admin and regular test users')
272 from rhodecode.tests import TEST_USER_ADMIN_LOGIN,\
277 from rhodecode.tests import TEST_USER_ADMIN_LOGIN,\
273 TEST_USER_ADMIN_PASS, TEST_USER_ADMIN_EMAIL,\
278 TEST_USER_ADMIN_PASS, TEST_USER_ADMIN_EMAIL,\
274 TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,\
279 TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,\
275 TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR2_LOGIN, \
280 TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR2_LOGIN, \
276 TEST_USER_REGULAR2_PASS, TEST_USER_REGULAR2_EMAIL
281 TEST_USER_REGULAR2_PASS, TEST_USER_REGULAR2_EMAIL
277
282
278 self.create_user(TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS,
283 self.create_user(TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS,
279 TEST_USER_ADMIN_EMAIL, True)
284 TEST_USER_ADMIN_EMAIL, True)
280
285
281 self.create_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,
286 self.create_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,
282 TEST_USER_REGULAR_EMAIL, False)
287 TEST_USER_REGULAR_EMAIL, False)
283
288
284 self.create_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS,
289 self.create_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS,
285 TEST_USER_REGULAR2_EMAIL, False)
290 TEST_USER_REGULAR2_EMAIL, False)
286
291
287 def create_ui_settings(self):
292 def create_ui_settings(self):
288 """
293 """
289 Creates ui settings, fills out hooks
294 Creates ui settings, fills out hooks
290 and disables dotencode
295 and disables dotencode
291 """
296 """
292
297
293 #HOOKS
298 #HOOKS
294 hooks1_key = RhodeCodeUi.HOOK_UPDATE
299 hooks1_key = RhodeCodeUi.HOOK_UPDATE
295 hooks1_ = self.sa.query(RhodeCodeUi)\
300 hooks1_ = self.sa.query(RhodeCodeUi)\
296 .filter(RhodeCodeUi.ui_key == hooks1_key).scalar()
301 .filter(RhodeCodeUi.ui_key == hooks1_key).scalar()
297
302
298 hooks1 = RhodeCodeUi() if hooks1_ is None else hooks1_
303 hooks1 = RhodeCodeUi() if hooks1_ is None else hooks1_
299 hooks1.ui_section = 'hooks'
304 hooks1.ui_section = 'hooks'
300 hooks1.ui_key = hooks1_key
305 hooks1.ui_key = hooks1_key
301 hooks1.ui_value = 'hg update >&2'
306 hooks1.ui_value = 'hg update >&2'
302 hooks1.ui_active = False
307 hooks1.ui_active = False
303
308
304 hooks2_key = RhodeCodeUi.HOOK_REPO_SIZE
309 hooks2_key = RhodeCodeUi.HOOK_REPO_SIZE
305 hooks2_ = self.sa.query(RhodeCodeUi)\
310 hooks2_ = self.sa.query(RhodeCodeUi)\
306 .filter(RhodeCodeUi.ui_key == hooks2_key).scalar()
311 .filter(RhodeCodeUi.ui_key == hooks2_key).scalar()
307
312
308 hooks2 = RhodeCodeUi() if hooks2_ is None else hooks2_
313 hooks2 = RhodeCodeUi() if hooks2_ is None else hooks2_
309 hooks2.ui_section = 'hooks'
314 hooks2.ui_section = 'hooks'
310 hooks2.ui_key = hooks2_key
315 hooks2.ui_key = hooks2_key
311 hooks2.ui_value = 'python:rhodecode.lib.hooks.repo_size'
316 hooks2.ui_value = 'python:rhodecode.lib.hooks.repo_size'
312
317
313 hooks3 = RhodeCodeUi()
318 hooks3 = RhodeCodeUi()
314 hooks3.ui_section = 'hooks'
319 hooks3.ui_section = 'hooks'
315 hooks3.ui_key = RhodeCodeUi.HOOK_PUSH
320 hooks3.ui_key = RhodeCodeUi.HOOK_PUSH
316 hooks3.ui_value = 'python:rhodecode.lib.hooks.log_push_action'
321 hooks3.ui_value = 'python:rhodecode.lib.hooks.log_push_action'
317
322
318 hooks4 = RhodeCodeUi()
323 hooks4 = RhodeCodeUi()
319 hooks4.ui_section = 'hooks'
324 hooks4.ui_section = 'hooks'
320 hooks4.ui_key = RhodeCodeUi.HOOK_PULL
325 hooks4.ui_key = RhodeCodeUi.HOOK_PULL
321 hooks4.ui_value = 'python:rhodecode.lib.hooks.log_pull_action'
326 hooks4.ui_value = 'python:rhodecode.lib.hooks.log_pull_action'
322
327
323 # For mercurial 1.7 set backward comapatibility with format
328 # For mercurial 1.7 set backward comapatibility with format
324 dotencode_disable = RhodeCodeUi()
329 dotencode_disable = RhodeCodeUi()
325 dotencode_disable.ui_section = 'format'
330 dotencode_disable.ui_section = 'format'
326 dotencode_disable.ui_key = 'dotencode'
331 dotencode_disable.ui_key = 'dotencode'
327 dotencode_disable.ui_value = 'false'
332 dotencode_disable.ui_value = 'false'
328
333
329 # enable largefiles
334 # enable largefiles
330 largefiles = RhodeCodeUi()
335 largefiles = RhodeCodeUi()
331 largefiles.ui_section = 'extensions'
336 largefiles.ui_section = 'extensions'
332 largefiles.ui_key = 'largefiles'
337 largefiles.ui_key = 'largefiles'
333 largefiles.ui_value = ''
338 largefiles.ui_value = ''
334
339
335 self.sa.add(hooks1)
340 self.sa.add(hooks1)
336 self.sa.add(hooks2)
341 self.sa.add(hooks2)
337 self.sa.add(hooks3)
342 self.sa.add(hooks3)
338 self.sa.add(hooks4)
343 self.sa.add(hooks4)
339 self.sa.add(largefiles)
344 self.sa.add(largefiles)
340
345
341 def create_ldap_options(self, skip_existing=False):
346 def create_ldap_options(self, skip_existing=False):
342 """Creates ldap settings"""
347 """Creates ldap settings"""
343
348
344 for k, v in [('ldap_active', 'false'), ('ldap_host', ''),
349 for k, v in [('ldap_active', 'false'), ('ldap_host', ''),
345 ('ldap_port', '389'), ('ldap_tls_kind', 'PLAIN'),
350 ('ldap_port', '389'), ('ldap_tls_kind', 'PLAIN'),
346 ('ldap_tls_reqcert', ''), ('ldap_dn_user', ''),
351 ('ldap_tls_reqcert', ''), ('ldap_dn_user', ''),
347 ('ldap_dn_pass', ''), ('ldap_base_dn', ''),
352 ('ldap_dn_pass', ''), ('ldap_base_dn', ''),
348 ('ldap_filter', ''), ('ldap_search_scope', ''),
353 ('ldap_filter', ''), ('ldap_search_scope', ''),
349 ('ldap_attr_login', ''), ('ldap_attr_firstname', ''),
354 ('ldap_attr_login', ''), ('ldap_attr_firstname', ''),
350 ('ldap_attr_lastname', ''), ('ldap_attr_email', '')]:
355 ('ldap_attr_lastname', ''), ('ldap_attr_email', '')]:
351
356
352 if skip_existing and RhodeCodeSetting.get_by_name(k) != None:
357 if skip_existing and RhodeCodeSetting.get_by_name(k) != None:
353 log.debug('Skipping option %s' % k)
358 log.debug('Skipping option %s' % k)
354 continue
359 continue
355 setting = RhodeCodeSetting(k, v)
360 setting = RhodeCodeSetting(k, v)
356 self.sa.add(setting)
361 self.sa.add(setting)
357
362
358 def fixup_groups(self):
363 def fixup_groups(self):
359 def_usr = User.get_by_username('default')
364 def_usr = User.get_by_username('default')
360 for g in RepoGroup.query().all():
365 for g in RepoGroup.query().all():
361 g.group_name = g.get_new_name(g.name)
366 g.group_name = g.get_new_name(g.name)
362 self.sa.add(g)
367 self.sa.add(g)
363 # get default perm
368 # get default perm
364 default = UserRepoGroupToPerm.query()\
369 default = UserRepoGroupToPerm.query()\
365 .filter(UserRepoGroupToPerm.group == g)\
370 .filter(UserRepoGroupToPerm.group == g)\
366 .filter(UserRepoGroupToPerm.user == def_usr)\
371 .filter(UserRepoGroupToPerm.user == def_usr)\
367 .scalar()
372 .scalar()
368
373
369 if default is None:
374 if default is None:
370 log.debug('missing default permission for group %s adding' % g)
375 log.debug('missing default permission for group %s adding' % g)
371 ReposGroupModel()._create_default_perms(g)
376 ReposGroupModel()._create_default_perms(g)
372
377
373 def config_prompt(self, test_repo_path='', retries=3):
378 def config_prompt(self, test_repo_path='', retries=3, defaults={}):
379 _path = defaults.get('repos_location')
374 if retries == 3:
380 if retries == 3:
375 log.info('Setting up repositories config')
381 log.info('Setting up repositories config')
376
382
377 if not self.tests and not test_repo_path:
383 if _path is not None:
384 path = _path
385 elif not self.tests and not test_repo_path:
378 path = raw_input(
386 path = raw_input(
379 'Enter a valid absolute path to store repositories. '
387 'Enter a valid absolute path to store repositories. '
380 'All repositories in that path will be added automatically:'
388 'All repositories in that path will be added automatically:'
381 )
389 )
382 else:
390 else:
383 path = test_repo_path
391 path = test_repo_path
384 path_ok = True
392 path_ok = True
385
393
386 # check proper dir
394 # check proper dir
387 if not os.path.isdir(path):
395 if not os.path.isdir(path):
388 path_ok = False
396 path_ok = False
389 log.error('Given path %s is not a valid directory' % path)
397 log.error('Given path %s is not a valid directory' % path)
390
398
391 elif not os.path.isabs(path):
399 elif not os.path.isabs(path):
392 path_ok = False
400 path_ok = False
393 log.error('Given path %s is not an absolute path' % path)
401 log.error('Given path %s is not an absolute path' % path)
394
402
395 # check write access
403 # check write access
396 elif not os.access(path, os.W_OK) and path_ok:
404 elif not os.access(path, os.W_OK) and path_ok:
397 path_ok = False
405 path_ok = False
398 log.error('No write permission to given path %s' % path)
406 log.error('No write permission to given path %s' % path)
399
407
400 if retries == 0:
408 if retries == 0:
401 sys.exit('max retries reached')
409 sys.exit('max retries reached')
402 if path_ok is False:
410 if path_ok is False:
403 retries -= 1
411 retries -= 1
404 return self.config_prompt(test_repo_path, retries)
412 return self.config_prompt(test_repo_path, retries)
405
413
406 return path
414 return path
407
415
408 def create_settings(self, path):
416 def create_settings(self, path):
409
417
410 self.create_ui_settings()
418 self.create_ui_settings()
411
419
412 #HG UI OPTIONS
420 #HG UI OPTIONS
413 web1 = RhodeCodeUi()
421 web1 = RhodeCodeUi()
414 web1.ui_section = 'web'
422 web1.ui_section = 'web'
415 web1.ui_key = 'push_ssl'
423 web1.ui_key = 'push_ssl'
416 web1.ui_value = 'false'
424 web1.ui_value = 'false'
417
425
418 web2 = RhodeCodeUi()
426 web2 = RhodeCodeUi()
419 web2.ui_section = 'web'
427 web2.ui_section = 'web'
420 web2.ui_key = 'allow_archive'
428 web2.ui_key = 'allow_archive'
421 web2.ui_value = 'gz zip bz2'
429 web2.ui_value = 'gz zip bz2'
422
430
423 web3 = RhodeCodeUi()
431 web3 = RhodeCodeUi()
424 web3.ui_section = 'web'
432 web3.ui_section = 'web'
425 web3.ui_key = 'allow_push'
433 web3.ui_key = 'allow_push'
426 web3.ui_value = '*'
434 web3.ui_value = '*'
427
435
428 web4 = RhodeCodeUi()
436 web4 = RhodeCodeUi()
429 web4.ui_section = 'web'
437 web4.ui_section = 'web'
430 web4.ui_key = 'baseurl'
438 web4.ui_key = 'baseurl'
431 web4.ui_value = '/'
439 web4.ui_value = '/'
432
440
433 paths = RhodeCodeUi()
441 paths = RhodeCodeUi()
434 paths.ui_section = 'paths'
442 paths.ui_section = 'paths'
435 paths.ui_key = '/'
443 paths.ui_key = '/'
436 paths.ui_value = path
444 paths.ui_value = path
437
445
438 hgsettings1 = RhodeCodeSetting('realm', 'RhodeCode authentication')
446 hgsettings1 = RhodeCodeSetting('realm', 'RhodeCode authentication')
439 hgsettings2 = RhodeCodeSetting('title', 'RhodeCode')
447 hgsettings2 = RhodeCodeSetting('title', 'RhodeCode')
440 hgsettings3 = RhodeCodeSetting('ga_code', '')
448 hgsettings3 = RhodeCodeSetting('ga_code', '')
441
449
442 self.sa.add(web1)
450 self.sa.add(web1)
443 self.sa.add(web2)
451 self.sa.add(web2)
444 self.sa.add(web3)
452 self.sa.add(web3)
445 self.sa.add(web4)
453 self.sa.add(web4)
446 self.sa.add(paths)
454 self.sa.add(paths)
447 self.sa.add(hgsettings1)
455 self.sa.add(hgsettings1)
448 self.sa.add(hgsettings2)
456 self.sa.add(hgsettings2)
449 self.sa.add(hgsettings3)
457 self.sa.add(hgsettings3)
450
458
451 self.create_ldap_options()
459 self.create_ldap_options()
452
460
453 log.info('created ui config')
461 log.info('created ui config')
454
462
455 def create_user(self, username, password, email='', admin=False):
463 def create_user(self, username, password, email='', admin=False):
456 log.info('creating user %s' % username)
464 log.info('creating user %s' % username)
457 UserModel().create_or_update(username, password, email,
465 UserModel().create_or_update(username, password, email,
458 name='RhodeCode', lastname='Admin',
466 name='RhodeCode', lastname='Admin',
459 active=True, admin=admin)
467 active=True, admin=admin)
460
468
461 def create_default_user(self):
469 def create_default_user(self):
462 log.info('creating default user')
470 log.info('creating default user')
463 # create default user for handling default permissions.
471 # create default user for handling default permissions.
464 UserModel().create_or_update(username='default',
472 UserModel().create_or_update(username='default',
465 password=str(uuid.uuid1())[:8],
473 password=str(uuid.uuid1())[:8],
466 email='anonymous@rhodecode.org',
474 email='anonymous@rhodecode.org',
467 name='Anonymous', lastname='User')
475 name='Anonymous', lastname='User')
468
476
469 def create_permissions(self):
477 def create_permissions(self):
470 # module.(access|create|change|delete)_[name]
478 # module.(access|create|change|delete)_[name]
471 # module.(none|read|write|admin)
479 # module.(none|read|write|admin)
472 perms = [
480 perms = [
473 ('repository.none', 'Repository no access'),
481 ('repository.none', 'Repository no access'),
474 ('repository.read', 'Repository read access'),
482 ('repository.read', 'Repository read access'),
475 ('repository.write', 'Repository write access'),
483 ('repository.write', 'Repository write access'),
476 ('repository.admin', 'Repository admin access'),
484 ('repository.admin', 'Repository admin access'),
477
485
478 ('group.none', 'Repositories Group no access'),
486 ('group.none', 'Repositories Group no access'),
479 ('group.read', 'Repositories Group read access'),
487 ('group.read', 'Repositories Group read access'),
480 ('group.write', 'Repositories Group write access'),
488 ('group.write', 'Repositories Group write access'),
481 ('group.admin', 'Repositories Group admin access'),
489 ('group.admin', 'Repositories Group admin access'),
482
490
483 ('hg.admin', 'Hg Administrator'),
491 ('hg.admin', 'Hg Administrator'),
484 ('hg.create.repository', 'Repository create'),
492 ('hg.create.repository', 'Repository create'),
485 ('hg.create.none', 'Repository creation disabled'),
493 ('hg.create.none', 'Repository creation disabled'),
486 ('hg.register.none', 'Register disabled'),
494 ('hg.register.none', 'Register disabled'),
487 ('hg.register.manual_activate', 'Register new user with RhodeCode '
495 ('hg.register.manual_activate', 'Register new user with RhodeCode '
488 'without manual activation'),
496 'without manual activation'),
489
497
490 ('hg.register.auto_activate', 'Register new user with RhodeCode '
498 ('hg.register.auto_activate', 'Register new user with RhodeCode '
491 'without auto activation'),
499 'without auto activation'),
492 ]
500 ]
493
501
494 for p in perms:
502 for p in perms:
495 if not Permission.get_by_key(p[0]):
503 if not Permission.get_by_key(p[0]):
496 new_perm = Permission()
504 new_perm = Permission()
497 new_perm.permission_name = p[0]
505 new_perm.permission_name = p[0]
498 new_perm.permission_longname = p[1]
506 new_perm.permission_longname = p[1]
499 self.sa.add(new_perm)
507 self.sa.add(new_perm)
500
508
501 def populate_default_permissions(self):
509 def populate_default_permissions(self):
502 log.info('creating default user permissions')
510 log.info('creating default user permissions')
503
511
504 default_user = self.sa.query(User)\
512 default_user = self.sa.query(User)\
505 .filter(User.username == 'default').scalar()
513 .filter(User.username == 'default').scalar()
506
514
507 reg_perm = UserToPerm()
515 reg_perm = UserToPerm()
508 reg_perm.user = default_user
516 reg_perm.user = default_user
509 reg_perm.permission = self.sa.query(Permission)\
517 reg_perm.permission = self.sa.query(Permission)\
510 .filter(Permission.permission_name == 'hg.register.manual_activate')\
518 .filter(Permission.permission_name == 'hg.register.manual_activate')\
511 .scalar()
519 .scalar()
512
520
513 create_repo_perm = UserToPerm()
521 create_repo_perm = UserToPerm()
514 create_repo_perm.user = default_user
522 create_repo_perm.user = default_user
515 create_repo_perm.permission = self.sa.query(Permission)\
523 create_repo_perm.permission = self.sa.query(Permission)\
516 .filter(Permission.permission_name == 'hg.create.repository')\
524 .filter(Permission.permission_name == 'hg.create.repository')\
517 .scalar()
525 .scalar()
518
526
519 default_repo_perm = UserToPerm()
527 default_repo_perm = UserToPerm()
520 default_repo_perm.user = default_user
528 default_repo_perm.user = default_user
521 default_repo_perm.permission = self.sa.query(Permission)\
529 default_repo_perm.permission = self.sa.query(Permission)\
522 .filter(Permission.permission_name == 'repository.read')\
530 .filter(Permission.permission_name == 'repository.read')\
523 .scalar()
531 .scalar()
524
532
525 self.sa.add(reg_perm)
533 self.sa.add(reg_perm)
526 self.sa.add(create_repo_perm)
534 self.sa.add(create_repo_perm)
527 self.sa.add(default_repo_perm)
535 self.sa.add(default_repo_perm)
@@ -1,49 +1,50 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.websetup
3 rhodecode.websetup
4 ~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~
5
5
6 Weboperations and setup for rhodecode
6 Weboperations and setup for rhodecode
7
7
8 :created_on: Dec 11, 2010
8 :created_on: Dec 11, 2010
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2010-2012 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 modify
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
16 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25
25
26 import logging
26 import logging
27
27
28 from rhodecode.config.environment import load_environment
28 from rhodecode.config.environment import load_environment
29 from rhodecode.lib.db_manage import DbManage
29 from rhodecode.lib.db_manage import DbManage
30 from rhodecode.model.meta import Session
30 from rhodecode.model.meta import Session
31
31
32
32
33 log = logging.getLogger(__name__)
33 log = logging.getLogger(__name__)
34
34
35
35
36 def setup_app(command, conf, vars):
36 def setup_app(command, conf, vars):
37 """Place any commands to setup rhodecode here"""
37 """Place any commands to setup rhodecode here"""
38 dbconf = conf['sqlalchemy.db1.url']
38 dbconf = conf['sqlalchemy.db1.url']
39 dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'],
39 dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'],
40 tests=False)
40 tests=False)
41 dbmanage.create_tables(override=True)
41 dbmanage.create_tables(override=True)
42 dbmanage.set_db_version()
42 dbmanage.set_db_version()
43 dbmanage.create_settings(dbmanage.config_prompt(None))
43 opts = dbmanage.config_prompt(None, defaults=command.options.__dict__)
44 dbmanage.create_settings(opts)
44 dbmanage.create_default_user()
45 dbmanage.create_default_user()
45 dbmanage.admin_prompt()
46 dbmanage.admin_prompt(defaults=command.options.__dict__)
46 dbmanage.create_permissions()
47 dbmanage.create_permissions()
47 dbmanage.populate_default_permissions()
48 dbmanage.populate_default_permissions()
48 Session.commit()
49 Session.commit()
49 load_environment(conf.global_conf, conf.local_conf, initial=True)
50 load_environment(conf.global_conf, conf.local_conf, initial=True)
@@ -1,102 +1,103 b''
1 import sys
1 import sys
2 from rhodecode import get_version
2 from rhodecode import get_version
3 from rhodecode import __license__
3 from rhodecode import __license__
4 from rhodecode import __py_version__
4 from rhodecode import __py_version__
5 from rhodecode import requirements
5 from rhodecode import requirements
6
6
7 if __py_version__ < (2, 5):
7 if __py_version__ < (2, 5):
8 raise Exception('RhodeCode requires python 2.5 or later')
8 raise Exception('RhodeCode requires python 2.5 or later')
9
9
10 dependency_links = [
10 dependency_links = [
11 ]
11 ]
12
12
13 classifiers = [
13 classifiers = [
14 'Development Status :: 4 - Beta',
14 'Development Status :: 4 - Beta',
15 'Environment :: Web Environment',
15 'Environment :: Web Environment',
16 'Framework :: Pylons',
16 'Framework :: Pylons',
17 'Intended Audience :: Developers',
17 'Intended Audience :: Developers',
18 'License :: OSI Approved :: GNU General Public License (GPL)',
18 'License :: OSI Approved :: GNU General Public License (GPL)',
19 'Operating System :: OS Independent',
19 'Operating System :: OS Independent',
20 'Programming Language :: Python',
20 'Programming Language :: Python',
21 'Programming Language :: Python :: 2.5',
21 'Programming Language :: Python :: 2.5',
22 'Programming Language :: Python :: 2.6',
22 'Programming Language :: Python :: 2.6',
23 'Programming Language :: Python :: 2.7',
23 'Programming Language :: Python :: 2.7',
24 ]
24 ]
25
25
26
26
27 # additional files from project that goes somewhere in the filesystem
27 # additional files from project that goes somewhere in the filesystem
28 # relative to sys.prefix
28 # relative to sys.prefix
29 data_files = []
29 data_files = []
30
30
31 # additional files that goes into package itself
31 # additional files that goes into package itself
32 package_data = {'rhodecode': ['i18n/*/LC_MESSAGES/*.mo', ], }
32 package_data = {'rhodecode': ['i18n/*/LC_MESSAGES/*.mo', ], }
33
33
34 description = ('Mercurial repository browser/management with '
34 description = ('Mercurial repository browser/management with '
35 'build in push/pull server and full text search')
35 'build in push/pull server and full text search')
36 keywords = ' '.join(['rhodecode', 'rhodiumcode', 'mercurial', 'git',
36 keywords = ' '.join(['rhodecode', 'rhodiumcode', 'mercurial', 'git',
37 'code review', 'repo groups', 'ldap'
37 'code review', 'repo groups', 'ldap'
38 'repository management', 'hgweb replacement'
38 'repository management', 'hgweb replacement'
39 'hgwebdir', 'gitweb replacement', 'serving hgweb', ])
39 'hgwebdir', 'gitweb replacement', 'serving hgweb', ])
40 # long description
40 # long description
41 try:
41 try:
42 readme_file = 'README.rst'
42 readme_file = 'README.rst'
43 changelog_file = 'docs/changelog.rst'
43 changelog_file = 'docs/changelog.rst'
44 long_description = open(readme_file).read() + '\n\n' + \
44 long_description = open(readme_file).read() + '\n\n' + \
45 open(changelog_file).read()
45 open(changelog_file).read()
46
46
47 except IOError, err:
47 except IOError, err:
48 sys.stderr.write("[WARNING] Cannot find file specified as "
48 sys.stderr.write("[WARNING] Cannot find file specified as "
49 "long_description (%s)\n or changelog (%s) skipping that file" \
49 "long_description (%s)\n or changelog (%s) skipping that file" \
50 % (readme_file, changelog_file))
50 % (readme_file, changelog_file))
51 long_description = description
51 long_description = description
52
52
53
53
54 try:
54 try:
55 from setuptools import setup, find_packages
55 from setuptools import setup, find_packages
56 except ImportError:
56 except ImportError:
57 from ez_setup import use_setuptools
57 from ez_setup import use_setuptools
58 use_setuptools()
58 use_setuptools()
59 from setuptools import setup, find_packages
59 from setuptools import setup, find_packages
60 # packages
60 # packages
61 packages = find_packages(exclude=['ez_setup'])
61 packages = find_packages(exclude=['ez_setup'])
62
62
63 setup(
63 setup(
64 name='RhodeCode',
64 name='RhodeCode',
65 version=get_version(),
65 version=get_version(),
66 description=description,
66 description=description,
67 long_description=long_description,
67 long_description=long_description,
68 keywords=keywords,
68 keywords=keywords,
69 license=__license__,
69 license=__license__,
70 author='Marcin Kuzminski',
70 author='Marcin Kuzminski',
71 author_email='marcin@python-works.com',
71 author_email='marcin@python-works.com',
72 dependency_links=dependency_links,
72 dependency_links=dependency_links,
73 url='http://rhodecode.org',
73 url='http://rhodecode.org',
74 install_requires=requirements,
74 install_requires=requirements,
75 classifiers=classifiers,
75 classifiers=classifiers,
76 setup_requires=["PasteScript>=1.6.3"],
76 setup_requires=["PasteScript>=1.6.3"],
77 data_files=data_files,
77 data_files=data_files,
78 packages=packages,
78 packages=packages,
79 include_package_data=True,
79 include_package_data=True,
80 test_suite='nose.collector',
80 test_suite='nose.collector',
81 package_data=package_data,
81 package_data=package_data,
82 message_extractors={'rhodecode': [
82 message_extractors={'rhodecode': [
83 ('**.py', 'python', None),
83 ('**.py', 'python', None),
84 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
84 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
85 ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
85 ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
86 ('public/**', 'ignore', None)]},
86 ('public/**', 'ignore', None)]},
87 zip_safe=False,
87 zip_safe=False,
88 paster_plugins=['PasteScript', 'Pylons'],
88 paster_plugins=['PasteScript', 'Pylons'],
89 entry_points="""
89 entry_points="""
90 [paste.app_factory]
90 [paste.app_factory]
91 main = rhodecode.config.middleware:make_app
91 main = rhodecode.config.middleware:make_app
92
92
93 [paste.app_install]
93 [paste.app_install]
94 main = pylons.util:PylonsInstaller
94 main = pylons.util:PylonsInstaller
95
95
96 [paste.global_paster_command]
96 [paste.global_paster_command]
97 setup-rhodecode=rhodecode.config.setup:SetupCommand
97 make-index=rhodecode.lib.indexers:MakeIndex
98 make-index=rhodecode.lib.indexers:MakeIndex
98 make-rcext=rhodecode.config.rcextensions.make_rcextensions:MakeRcExt
99 make-rcext=rhodecode.config.rcextensions.make_rcextensions:MakeRcExt
99 upgrade-db=rhodecode.lib.dbmigrate:UpgradeDb
100 upgrade-db=rhodecode.lib.dbmigrate:UpgradeDb
100 celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand
101 celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand
101 """,
102 """,
102 )
103 )
General Comments 0
You need to be logged in to leave comments. Login now