##// END OF EJS Templates
docs: spelling, grammar, content and typography
Søren Løvborg -
r5425:5ae8e644 default
parent child Browse files
Show More
@@ -1,211 +1,213 b''
1 1 ================
2 2 Kallithea README
3 3 ================
4 4
5 5 About
6 6 -----
7 7
8 8 **Kallithea** is a fast and powerful management tool for Mercurial_ and Git_
9 9 with a built-in push/pull server, full text search and code-review. It works on
10 10 http/https and has a built in permission/authentication system with the ability
11 11 to authenticate via LDAP or ActiveDirectory. Kallithea also provides simple API
12 12 so it's easy to integrate with existing external systems.
13 13
14 14 Kallithea is similar in some respects to GitHub_ or Bitbucket_, however
15 15 Kallithea can be run as standalone hosted application on your own server. It is
16 16 open-source donationware and focuses more on providing a customised,
17 17 self-administered interface for Mercurial_ and Git_ repositories. Kallithea
18 18 works on Unix-like systems and Windows, and is powered by the vcs_ library
19 19 created by Łukasz Balcerzak and Marcin Kuźmiński to uniformly handle multiple
20 20 version control systems.
21 21
22 22 Kallithea was forked from RhodeCode in July 2014 and has been heavily modified.
23 23
24
24 25 Installation
25 26 ------------
26 27 Kallithea requires Python_ 2.x and it is recommended to install it in a
27 28 virtualenv_. Official releases of Kallithea can be installed with::
28 29
29 30 pip install kallithea
30 31
31 32 The development repository is kept very stable and used in production by the
32 developers - you can do the same.
33 developers -- you can do the same.
33 34
34 35 Please visit https://docs.kallithea-scm.org/en/latest/installation.html for
35 36 more details.
36 37
37 38
38 39 Source code
39 40 -----------
40 41
41 42 The latest sources can be obtained from
42 43 https://kallithea-scm.org/repos/kallithea.
43 44
44 45 The issue tracker and a repository mirror can be found at Bitbucket_ on
45 46 https://bitbucket.org/conservancy/kallithea.
46 47
47 48
48 49 Kallithea features
49 50 ------------------
50 51
51 52 - Has its own middleware to handle Mercurial_ and Git_ protocol requests. Each
52 53 request is authenticated and logged together with IP address.
53 54 - Built for speed and performance. You can make multiple pulls/pushes
54 55 simultaneously. Proven to work with thousands of repositories and users.
55 56 - Supports http/https, LDAP, AD, proxy-pass authentication.
56 57 - Full permissions (private/read/write/admin) together with IP restrictions for
57 58 each repository, additional explicit forking, repositories group and
58 59 repository creation permissions.
59 60 - User groups for easier permission management.
60 61 - Repository groups let you group repos and manage them easier. They come with
61 62 permission delegation features, so you can delegate groups management.
62 63 - Users can fork other users repos, and compare them at any time.
63 64 - Built-in versioned paste functionality (Gist) for sharing code snippets.
64 65 - Integrates easily with other systems, with custom created mappers you can
65 66 connect it to almost any issue tracker, and with a JSON-RPC API you can make
66 67 much more.
67 68 - Built-in commit API lets you add, edit and commit files right from Kallithea
68 69 web interface using simple editor or upload binary files using simple form.
69 70 - Powerful pull request driven review system with inline commenting, changeset
70 71 statuses, and notification system.
71 72 - Importing and syncing repositories from remote locations for Git_, Mercurial_
72 73 and Subversion.
73 74 - Mako templates let you customize the look and feel of the application.
74 75 - Beautiful diffs, annotations and source code browsing all colored by
75 76 pygments. Raw diffs are made in Git-diff format for both VCS systems,
76 77 including Git_ binary-patches.
77 78 - Mercurial_ and Git_ DAG graphs and Flot-powered graphs with zooming and
78 79 statistics to track activity for repositories.
79 80 - Admin interface with user/permission management. Admin activity journal, logs
80 81 pulls, pushes, forks, registrations and other actions made by all users.
81 82 - Server side forks. It is possible to fork a project and modify it freely
82 83 without breaking the main repository.
83 84 - reST and Markdown README support for repositories.
84 85 - Full text search powered by Whoosh on the source files, commit messages, and
85 86 file names. Built-in indexing daemons, with optional incremental index build
86 87 (no external search servers required all in one application).
87 88 - Setup project descriptions/tags and info inside built in DB for easy,
88 89 non-filesystem operations.
89 90 - Intelligent cache with invalidation after push or project change, provides
90 91 high performance and always up to date data.
91 92 - RSS/Atom feeds, Gravatar support, downloadable sources as zip/tar/gz.
92 93 - Optional async tasks for speed and performance using Celery_.
93 94 - Backup scripts can do backup of whole app and send it over scp to desired
94 95 location.
95 96 - Based on Pylons, SQLAlchemy, SQLite, Whoosh, vcs.
96 97
97 98
98 99 License
99 100 -------
100 101
101 102 **Kallithea** is released under the GPLv3 license. Kallithea is a `Software
102 103 Freedom Conservancy`_ project and thus controlled by a non-profit organization.
103 104 No commercial entity can take ownership of the project and change the
104 105 direction.
105 106
106 107 Kallithea started out as an effort to make sure the existing GPLv3 codebase
107 108 would stay available under a legal license. Kallithea thus has to stay GPLv3
108 109 compatible ... but we are also happy it is GPLv3 and happy to keep it that way.
109 110 A different license (such as AGPL) could perhaps help attract a different
110 111 community with a different mix of Free Software people and companies but we are
111 112 happy with the current focus.
112 113
113 114
114 115 Community
115 116 ---------
116 117
117 118 **Kallithea** is maintained by its users who contribute the fixes they would
118 119 like to see.
119 120
120 121 Get in touch with the rest of the community:
121 122
122 - Join the mailing list users and developers - see
123 - Join the mailing list users and developers -- see
123 124 http://lists.sfconservancy.org/mailman/listinfo/kallithea-general.
124 125
125 126 - Use IRC and join #kallithea on FreeNode (irc.freenode.net) or use
126 127 http://webchat.freenode.net/?channels=kallithea.
127 128
128 129 - Follow Kallithea on Twitter, **@KallitheaSCM**.
129 130
130 131 - Issues can be reported at `issue tracker
131 132 <https://bitbucket.org/conservancy/kallithea/issues>`_.
132 133
133 134 .. note::
134 135
135 136 Please try to read the documentation before posting any issues,
136 137 especially the **troubleshooting section**
137 138
138 139
139 140 Online documentation
140 141 --------------------
141 142
142 143 Online documentation for the current version of Kallithea is available at
143 144 https://pythonhosted.org/Kallithea/. Documentation for the current development
144 145 version can be found on https://docs.kallithea-scm.org/.
145 146
146 147 You can also build the documentation locally: go to ``docs/`` and run::
147 148
148 149 make html
149 150
150 151 .. note:: You need to have Sphinx_ installed to build the
151 152 documentation. If you don't have Sphinx_ installed you can
152 153 install it via the command: ``pip install sphinx`` .
153 154
154 155
155 156 Converting from RhodeCode
156 157 -------------------------
157 158
158 159 Currently, you have two options for working with an existing RhodeCode
159 160 database:
160 161
161 162 - keep the database unconverted (intended for testing and evaluation)
162 163 - convert the database in a one-time step
163 164
164 165 Maintaining interoperability
165 166 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166 167
167 168 Interoperability with RhodeCode 2.2.X installations is provided so you don't
168 169 have to immediately commit to switching to Kallithea. This option will most
169 170 likely go away once the two projects have diverged significantly.
170 171
171 172 To run Kallithea on a RhodeCode database, run::
172 173
173 174 echo "BRAND = 'rhodecode'" > kallithea/brand.py
174 175
175 176 This location will depend on where you installed Kallithea. If you installed
176 177 via::
177 178
178 179 python setup.py install
179 180
180 181 then you will find this location at
181 182 ``$VIRTUAL_ENV/lib/python2.7/site-packages/Kallithea-0.1-py2.7.egg/kallithea``.
182 183
183 184 One-time conversion
184 185 ~~~~~~~~~~~~~~~~~~~
185 186
186 187 Alternatively, if you would like to convert the database for good, you can use
187 188 a helper script provided by Kallithea. This script will operate directly on the
188 189 database, using the database string you can find in your ``production.ini`` (or
189 190 ``development.ini``) file. For example, if using SQLite::
190 191
191 192 cd /path/to/kallithea
192 193 cp /path/to/rhodecode/rhodecode.db kallithea.db
193 194 pip install sqlalchemy-migrate
194 195 python kallithea/bin/rebranddb.py sqlite:///kallithea.db
195 196
196 197 .. Note::
197 198
198 199 If you started out using the branding interoperability approach mentioned
199 200 above, watch out for stray brand.pyc after removing brand.py.
200 201
202
201 203 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
202 204 .. _Python: http://www.python.org/
203 205 .. _Sphinx: http://sphinx.pocoo.org/
204 206 .. _Mercurial: http://mercurial.selenic.com/
205 207 .. _Bitbucket: http://bitbucket.org/
206 208 .. _GitHub: http://github.com/
207 209 .. _Subversion: http://subversion.tigris.org/
208 210 .. _Git: http://git-scm.com/
209 211 .. _Celery: http://celeryproject.org/
210 212 .. _vcs: http://pypi.python.org/pypi/vcs
211 213 .. _Software Freedom Conservancy: http://sfconservancy.org/
@@ -1,1065 +1,1072 b''
1 1 .. _api:
2 2
3 3 ===
4 4 API
5 5 ===
6 6
7 7
8 8 Kallithea has a simple JSON RPC API with a single schema for calling all API
9 9 methods. Everything is available by sending JSON encoded http(s) requests to
10 <your_server>/_admin/api .
10 ``<your_server>/_admin/api``.
11 11
12 12
13 13 API access for web views
14 14 ++++++++++++++++++++++++
15 15
16 16 API access can also be turned on for each web view in Kallithea that is
17 17 decorated with the ``@LoginRequired`` decorator. Some views use
18 18 ``@LoginRequired(api_access=True)`` and are always available. By default only
19 RSS/ATOM feed views are enabled. Other views are
19 RSS/Atom feed views are enabled. Other views are
20 20 only available if they have been white listed. Edit the
21 21 ``api_access_controllers_whitelist`` option in your .ini file and define views
22 22 that should have API access enabled.
23 23
24 For example, to enable API access to patch/diff raw file and archive::
24 For example, to enable API access to patch/diff, raw file and archive::
25 25
26 26 api_access_controllers_whitelist =
27 27 ChangesetController:changeset_patch,
28 28 ChangesetController:changeset_raw,
29 29 FilesController:raw,
30 30 FilesController:archivefile
31 31
32 32 After this change, a Kallithea view can be accessed without login by adding a
33 33 GET parameter ``?api_key=<api_key>`` to the URL.
34 34
35 35 Exposing raw diffs is a good way to integrate with
36 3rd party services like code review, or build farms that could download archives.
36 third-party services like code review, or build farms that can download archives.
37 37
38 38
39 39 API access
40 40 ++++++++++
41 41
42 42 Clients must send JSON encoded JSON-RPC requests::
43 43
44 44 {
45 45 "id: "<id>",
46 46 "api_key": "<api_key>",
47 47 "method": "<method_name>",
48 48 "args": {"<arg_key>": "<arg_val>"}
49 49 }
50 50
51 51 For example, to pull to a local "CPython" mirror using curl::
52 52
53 curl https://server.com/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}'
53 curl https://example.com/_admin/api -X POST -H 'content-type:text/plain' \
54 --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}'
54 55
55 56 In general, provide
56 57 - *id*, a value of any type, can be used to match the response with the request that it is replying to.
57 58 - *api_key*, for authentication and permission validation.
58 - *method*, the name of the method to call - a list of available methods can be found below.
59 - *method*, the name of the method to call -- a list of available methods can be found below.
59 60 - *args*, the arguments to pass to the method.
60 61
61 62 .. note::
62 63
63 api_key can be found or set on the user account page
64 api_key can be found or set on the user account page.
64 65
65 66 The response to the JSON-RPC API call will always be a JSON structure::
66 67
67 68 {
68 69 "id":<id>, # the id that was used in the request
69 "result": "<result>"|null, # JSON formatted result, null if any errors
70 "error": "null"|<error_message> # JSON formatted error (if any)
70 "result": <result>|null, # JSON formatted result (null on error)
71 "error": null|<error_message> # JSON formatted error (null on success)
71 72 }
72 73
73 All responses from API will be ``HTTP/1.0 200 OK``. If there is an error,
74 All responses from the API will be ``HTTP/1.0 200 OK``. If an error occurs,
74 75 the reponse will have a failure description in *error* and
75 76 *result* will be null.
76 77
77 78
78 79 API client
79 80 ++++++++++
80 81
81 Kallithea comes with a ``kallithea-api`` command line tool providing a convenient
82 Kallithea comes with a ``kallithea-api`` command line tool, providing a convenient
82 83 way to call the JSON-RPC API.
83 84
84 85 For example, to call ``get_repo``::
85 86
86 87 kallithea-api --apihost=<your.kallithea.server.url> --apikey=<yourapikey> get_repo
87 88
88 89 calling {"api_key": "<apikey>", "id": 75, "args": {}, "method": "get_repo"} to http://127.0.0.1:5000
89 90 Kallithea said:
90 91 {'error': 'Missing non optional `repoid` arg in JSON DATA',
91 92 'id': 75,
92 93 'result': None}
93 94
94 95 Oops, looks like we forgot to add an argument. Let's try again, now
95 96 providing the ``repoid`` as a parameter::
96 97
97 98 kallithea-api get_repo repoid:myrepo
98 99
99 100 calling {"api_key": "<apikey>", "id": 39, "args": {"repoid": "myrepo"}, "method": "get_repo"} to http://127.0.0.1:5000
100 101 Kallithea said:
101 102 {'error': None,
102 103 'id': 39,
103 104 'result': <json data...>}
104 105
105 106 To avoid specifying ``apihost`` and ``apikey`` every time, run::
106 107
107 108 kallithea-api --save-config --apihost=<your.kallithea.server.url> --apikey=<yourapikey>
108 109
109 This will create a ``~/.config/kallithea`` with the specified hostname and apikey
110 This will create a ``~/.config/kallithea`` with the specified hostname and API key
110 111 so you don't have to specify them every time.
111 112
112 113
113 114 API methods
114 115 +++++++++++
115 116
116 117
117 118 pull
118 119 ----
119 120
120 121 Pull the given repo from remote location. Can be used to automatically keep
121 122 remote repos up to date.
122 123 This command can only be executed using the api_key of a user with admin rights.
123 124
124 125 INPUT::
125 126
126 127 id : <id_for_response>
127 128 api_key : "<api_key>"
128 129 method : "pull"
129 130 args : {
130 131 "repoid" : "<reponame or repo_id>"
131 132 }
132 133
133 134 OUTPUT::
134 135
135 136 id : <id_given_in_input>
136 137 result : "Pulled from `<reponame>`"
137 138 error : null
138 139
139 140
140 141 rescan_repos
141 142 ------------
142 143
143 144 Rescan repositories. If ``remove_obsolete`` is set,
144 145 Kallithea will delete repos that are in the database but not in the filesystem.
145 146 This command can only be executed using the api_key of a user with admin rights.
146 147
147 148 INPUT::
148 149
149 150 id : <id_for_response>
150 151 api_key : "<api_key>"
151 152 method : "rescan_repos"
152 153 args : {
153 154 "remove_obsolete" : "<boolean = Optional(False)>"
154 155 }
155 156
156 157 OUTPUT::
157 158
158 159 id : <id_given_in_input>
159 160 result : "{'added': [<list of names of added repos>],
160 161 'removed': [<list of names of removed repos>]}"
161 162 error : null
162 163
163 164
164 165 invalidate_cache
165 166 ----------------
166 167
167 168 Invalidate the cache for a repository.
168 169 This command can only be executed using the api_key of a user with admin rights,
169 170 or that of a regular user with admin or write access to the repository.
170 171
171 172 INPUT::
172 173
173 174 id : <id_for_response>
174 175 api_key : "<api_key>"
175 176 method : "invalidate_cache"
176 177 args : {
177 178 "repoid" : "<reponame or repo_id>"
178 179 }
179 180
180 181 OUTPUT::
181 182
182 183 id : <id_given_in_input>
183 184 result : "Caches of repository `<reponame>`"
184 185 error : null
185 186
186 187
187 188 lock
188 189 ----
189 190
190 191 Set the locking state on the given repository by the given user.
191 192 If the param ``userid`` is skipped, it is set to the ID of the user who is calling this method.
192 193 If param ``locked`` is skipped, the current lock state of the repository is returned.
193 194 This command can only be executed using the api_key of a user with admin rights, or that of a regular user with admin or write access to the repository.
194 195
195 196 INPUT::
196 197
197 198 id : <id_for_response>
198 199 api_key : "<api_key>"
199 200 method : "lock"
200 201 args : {
201 202 "repoid" : "<reponame or repo_id>"
202 203 "userid" : "<user_id or username = Optional(=apiuser)>",
203 204 "locked" : "<bool true|false = Optional(=None)>"
204 205 }
205 206
206 207 OUTPUT::
207 208
208 209 id : <id_given_in_input>
209 210 result : {
210 211 "repo": "<reponame>",
211 212 "locked": "<bool true|false>",
212 213 "locked_since": "<float lock_time>",
213 214 "locked_by": "<username>",
214 215 "msg": "User `<username>` set lock state for repo `<reponame>` to `<false|true>`"
215 216 }
216 217 error : null
217 218
218 219
219 220 get_ip
220 221 ------
221 222
222 223 Return IP address as seen from Kallithea server, together with all
223 224 defined IP addresses for given user.
224 225 This command can only be executed using the api_key of a user with admin rights.
225 226
226 227 INPUT::
227 228
228 229 id : <id_for_response>
229 230 api_key : "<api_key>"
230 231 method : "get_ip"
231 232 args : {
232 233 "userid" : "<user_id or username>",
233 234 }
234 235
235 236 OUTPUT::
236 237
237 238 id : <id_given_in_input>
238 239 result : {
239 240 "ip_addr_server": <ip_from_clien>",
240 241 "user_ips": [
241 242 {
242 243 "ip_addr": "<ip_with_mask>",
243 244 "ip_range": ["<start_ip>", "<end_ip>"],
244 245 },
245 246 ...
246 247 ]
247 248 }
248 249
249 250 error : null
250 251
251 252
252 253 get_user
253 254 --------
254 255
255 256 Get a user by username or userid. The result is empty if user can't be found.
256 257 If userid param is skipped, it is set to id of user who is calling this method.
257 258 Any userid can be specified when the command is executed using the api_key of a user with admin rights.
258 259 Regular users can only speicy their own userid.
259 260
260 261
261 262 INPUT::
262 263
263 264 id : <id_for_response>
264 265 api_key : "<api_key>"
265 266 method : "get_user"
266 267 args : {
267 268 "userid" : "<username or user_id Optional(=apiuser)>"
268 269 }
269 270
270 271 OUTPUT::
271 272
272 273 id : <id_given_in_input>
273 274 result: None if user does not exist or
274 275 {
275 276 "user_id" : "<user_id>",
276 277 "api_key" : "<api_key>",
277 278 "username" : "<username>",
278 279 "firstname": "<firstname>",
279 280 "lastname" : "<lastname>",
280 281 "email" : "<email>",
281 282 "emails": "<list_of_all_additional_emails>",
282 283 "ip_addresses": "<list_of_ip_addresses_for_user>",
283 284 "active" : "<bool>",
284 285 "admin" :  "<bool>",
285 286 "ldap_dn" : "<ldap_dn>",
286 287 "last_login": "<last_login>",
287 288 "permissions": {
288 289 "global": ["hg.create.repository",
289 290 "repository.read",
290 291 "hg.register.manual_activate"],
291 292 "repositories": {"repo1": "repository.none"},
292 293 "repositories_groups": {"Group1": "group.read"}
293 294 },
294 295 }
295 296 error: null
296 297
297 298
298 299 get_users
299 300 ---------
300 301
301 302 List all existing users.
302 303 This command can only be executed using the api_key of a user with admin rights.
303 304
304 305
305 306 INPUT::
306 307
307 308 id : <id_for_response>
308 309 api_key : "<api_key>"
309 310 method : "get_users"
310 311 args : { }
311 312
312 313 OUTPUT::
313 314
314 315 id : <id_given_in_input>
315 316 result: [
316 317 {
317 318 "user_id" : "<user_id>",
318 319 "api_key" : "<api_key>",
319 320 "username" : "<username>",
320 321 "firstname": "<firstname>",
321 322 "lastname" : "<lastname>",
322 323 "email" : "<email>",
323 324 "emails": "<list_of_all_additional_emails>",
324 325 "ip_addresses": "<list_of_ip_addresses_for_user>",
325 326 "active" : "<bool>",
326 327 "admin" :  "<bool>",
327 328 "ldap_dn" : "<ldap_dn>",
328 329 "last_login": "<last_login>",
329 330 },
330 331
331 332 ]
332 333 error: null
333 334
334 335
336 .. _create-user:
337
335 338 create_user
336 339 -----------
337 340
338 341 Create new user.
339 342 This command can only be executed using the api_key of a user with admin rights.
340 343
341 344
342 345 INPUT::
343 346
344 347 id : <id_for_response>
345 348 api_key : "<api_key>"
346 349 method : "create_user"
347 350 args : {
348 351 "username" : "<username>",
349 352 "email" : "<useremail>",
350 353 "password" : "<password = Optional(None)>",
351 354 "firstname" : "<firstname> = Optional(None)",
352 355 "lastname" : "<lastname> = Optional(None)",
353 356 "active" : "<bool> = Optional(True)",
354 357 "admin" : "<bool> = Optional(False)",
355 358 "ldap_dn" : "<ldap_dn> = Optional(None)"
356 359 }
357 360
358 361 OUTPUT::
359 362
360 363 id : <id_given_in_input>
361 364 result: {
362 365 "msg" : "created new user `<username>`",
363 366 "user": {
364 367 "user_id" : "<user_id>",
365 368 "username" : "<username>",
366 369 "firstname": "<firstname>",
367 370 "lastname" : "<lastname>",
368 371 "email" : "<email>",
369 372 "emails": "<list_of_all_additional_emails>",
370 373 "active" : "<bool>",
371 374 "admin" :  "<bool>",
372 375 "ldap_dn" : "<ldap_dn>",
373 376 "last_login": "<last_login>",
374 377 },
375 378 }
376 379 error: null
377 380
381 Example::
382
383 kallithea-api create_user username:bent email:bent@example.com firstname:Bent lastname:Bentsen extern_type:ldap extern_name:uid=bent,dc=example,dc=com
384
378 385
379 386 update_user
380 387 -----------
381 388
382 389 Update the given user if such user exists.
383 390 This command can only be executed using the api_key of a user with admin rights.
384 391
385 392
386 393 INPUT::
387 394
388 395 id : <id_for_response>
389 396 api_key : "<api_key>"
390 397 method : "update_user"
391 398 args : {
392 399 "userid" : "<user_id or username>",
393 400 "username" : "<username> = Optional(None)",
394 401 "email" : "<useremail> = Optional(None)",
395 402 "password" : "<password> = Optional(None)",
396 403 "firstname" : "<firstname> = Optional(None)",
397 404 "lastname" : "<lastname> = Optional(None)",
398 405 "active" : "<bool> = Optional(None)",
399 406 "admin" : "<bool> = Optional(None)",
400 407 "ldap_dn" : "<ldap_dn> = Optional(None)"
401 408 }
402 409
403 410 OUTPUT::
404 411
405 412 id : <id_given_in_input>
406 413 result: {
407 414 "msg" : "updated user ID:<userid> <username>",
408 415 "user": {
409 416 "user_id" : "<user_id>",
410 417 "api_key" : "<api_key>",
411 418 "username" : "<username>",
412 419 "firstname": "<firstname>",
413 420 "lastname" : "<lastname>",
414 421 "email" : "<email>",
415 422 "emails": "<list_of_all_additional_emails>",
416 423 "active" : "<bool>",
417 424 "admin" :  "<bool>",
418 425 "ldap_dn" : "<ldap_dn>",
419 426 "last_login": "<last_login>",
420 427 },
421 428 }
422 429 error: null
423 430
424 431
425 432 delete_user
426 433 -----------
427 434
428 435 Delete the given user if such a user exists.
429 436 This command can only be executed using the api_key of a user with admin rights.
430 437
431 438
432 439 INPUT::
433 440
434 441 id : <id_for_response>
435 442 api_key : "<api_key>"
436 443 method : "delete_user"
437 444 args : {
438 445 "userid" : "<user_id or username>",
439 446 }
440 447
441 448 OUTPUT::
442 449
443 450 id : <id_given_in_input>
444 451 result: {
445 452 "msg" : "deleted user ID:<userid> <username>",
446 453 "user": null
447 454 }
448 455 error: null
449 456
450 457
451 458 get_user_group
452 459 --------------
453 460
454 461 Get an existing user group.
455 462 This command can only be executed using the api_key of a user with admin rights.
456 463
457 464
458 465 INPUT::
459 466
460 467 id : <id_for_response>
461 468 api_key : "<api_key>"
462 469 method : "get_user_group"
463 470 args : {
464 471 "usergroupid" : "<user group id or name>"
465 472 }
466 473
467 474 OUTPUT::
468 475
469 476 id : <id_given_in_input>
470 477 result : None if group not exist
471 478 {
472 479 "users_group_id" : "<id>",
473 480 "group_name" : "<groupname>",
474 481 "active": "<bool>",
475 482 "members" : [
476 483 {
477 484 "user_id" : "<user_id>",
478 485 "api_key" : "<api_key>",
479 486 "username" : "<username>",
480 487 "firstname": "<firstname>",
481 488 "lastname" : "<lastname>",
482 489 "email" : "<email>",
483 490 "emails": "<list_of_all_additional_emails>",
484 491 "active" : "<bool>",
485 492 "admin" :  "<bool>",
486 493 "ldap_dn" : "<ldap_dn>",
487 494 "last_login": "<last_login>",
488 495 },
489 496
490 497 ]
491 498 }
492 499 error : null
493 500
494 501
495 502 get_user_groups
496 503 ---------------
497 504
498 505 List all existing user groups.
499 506 This command can only be executed using the api_key of a user with admin rights.
500 507
501 508
502 509 INPUT::
503 510
504 511 id : <id_for_response>
505 512 api_key : "<api_key>"
506 513 method : "get_user_groups"
507 514 args : { }
508 515
509 516 OUTPUT::
510 517
511 518 id : <id_given_in_input>
512 519 result : [
513 520 {
514 521 "users_group_id" : "<id>",
515 522 "group_name" : "<groupname>",
516 523 "active": "<bool>",
517 524 },
518 525
519 526 ]
520 527 error : null
521 528
522 529
523 530 create_user_group
524 531 -----------------
525 532
526 533 Create a new user group.
527 534 This command can only be executed using the api_key of a user with admin rights.
528 535
529 536
530 537 INPUT::
531 538
532 539 id : <id_for_response>
533 540 api_key : "<api_key>"
534 541 method : "create_user_group"
535 542 args: {
536 543 "group_name": "<groupname>",
537 544 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
538 545 "active": "<bool> = Optional(True)"
539 546 }
540 547
541 548 OUTPUT::
542 549
543 550 id : <id_given_in_input>
544 551 result: {
545 552 "msg": "created new user group `<groupname>`",
546 553 "users_group": {
547 554 "users_group_id" : "<id>",
548 555 "group_name" : "<groupname>",
549 556 "active": "<bool>",
550 557 },
551 558 }
552 559 error: null
553 560
554 561
555 562 add_user_to_user_group
556 563 ----------------------
557 564
558 565 Adds a user to a user group. If the user already is in that group, success will be
559 566 ``false``.
560 567 This command can only be executed using the api_key of a user with admin rights.
561 568
562 569
563 570 INPUT::
564 571
565 572 id : <id_for_response>
566 573 api_key : "<api_key>"
567 574 method : "add_user_user_group"
568 575 args: {
569 576 "usersgroupid" : "<user group id or name>",
570 577 "userid" : "<user_id or username>",
571 578 }
572 579
573 580 OUTPUT::
574 581
575 582 id : <id_given_in_input>
576 583 result: {
577 584 "success": True|False # depends on if member is in group
578 585 "msg": "added member `<username>` to a user group `<groupname>` |
579 586 User is already in that group"
580 587 }
581 588 error: null
582 589
583 590
584 591 remove_user_from_user_group
585 592 ---------------------------
586 593
587 594 Remove a user from a user group. If the user isn't in the given group, success will
588 595 be ``false``.
589 596 This command can only be executed using the api_key of a user with admin rights.
590 597
591 598
592 599 INPUT::
593 600
594 601 id : <id_for_response>
595 602 api_key : "<api_key>"
596 603 method : "remove_user_from_user_group"
597 604 args: {
598 605 "usersgroupid" : "<user group id or name>",
599 606 "userid" : "<user_id or username>",
600 607 }
601 608
602 609 OUTPUT::
603 610
604 611 id : <id_given_in_input>
605 612 result: {
606 613 "success": True|False, # depends on if member is in group
607 614 "msg": "removed member <username> from user group <groupname> |
608 615 User wasn't in group"
609 616 }
610 617 error: null
611 618
612 619
613 620 get_repo
614 621 --------
615 622
616 623 Get an existing repository by its name or repository_id. Members will contain
617 624 either users_group or users associated to that repository.
618 625 This command can only be executed using the api_key of a user with admin rights,
619 626 or that of a regular user with at least read access to the repository.
620 627
621 628 INPUT::
622 629
623 630 id : <id_for_response>
624 631 api_key : "<api_key>"
625 632 method : "get_repo"
626 633 args: {
627 634 "repoid" : "<reponame or repo_id>"
628 635 }
629 636
630 637 OUTPUT::
631 638
632 639 id : <id_given_in_input>
633 640 result: None if repository does not exist or
634 641 {
635 642 "repo_id" : "<repo_id>",
636 643 "repo_name" : "<reponame>"
637 644 "repo_type" : "<repo_type>",
638 645 "clone_uri" : "<clone_uri>",
639 646 "enable_downloads": "<bool>",
640 647 "enable_locking": "<bool>",
641 648 "enable_statistics": "<bool>",
642 649 "private": "<bool>",
643 650 "created_on" : "<date_time_created>",
644 651 "description" : "<description>",
645 652 "landing_rev": "<landing_rev>",
646 653 "last_changeset": {
647 654 "author": "<full_author>",
648 655 "date": "<date_time_of_commit>",
649 656 "message": "<commit_message>",
650 657 "raw_id": "<raw_id>",
651 658 "revision": "<numeric_revision>",
652 659 "short_id": "<short_id>"
653 660 }
654 661 "owner": "<repo_owner>",
655 662 "fork_of": "<name_of_fork_parent>",
656 663 "members" : [
657 664 {
658 665 "type": "user",
659 666 "user_id" : "<user_id>",
660 667 "api_key" : "<api_key>",
661 668 "username" : "<username>",
662 669 "firstname": "<firstname>",
663 670 "lastname" : "<lastname>",
664 671 "email" : "<email>",
665 672 "emails": "<list_of_all_additional_emails>",
666 673 "active" : "<bool>",
667 674 "admin" :  "<bool>",
668 675 "ldap_dn" : "<ldap_dn>",
669 676 "last_login": "<last_login>",
670 677 "permission" : "repository.(read|write|admin)"
671 678 },
672 679
673 680 {
674 681 "type": "users_group",
675 682 "id" : "<usersgroupid>",
676 683 "name" : "<usersgroupname>",
677 684 "active": "<bool>",
678 685 "permission" : "repository.(read|write|admin)"
679 686 },
680 687
681 688 ]
682 689 "followers": [
683 690 {
684 691 "user_id" : "<user_id>",
685 692 "username" : "<username>",
686 693 "api_key" : "<api_key>",
687 694 "firstname": "<firstname>",
688 695 "lastname" : "<lastname>",
689 696 "email" : "<email>",
690 697 "emails": "<list_of_all_additional_emails>",
691 698 "ip_addresses": "<list_of_ip_addresses_for_user>",
692 699 "active" : "<bool>",
693 700 "admin" :  "<bool>",
694 701 "ldap_dn" : "<ldap_dn>",
695 702 "last_login": "<last_login>",
696 703 },
697 704
698 705 ]
699 706 }
700 707 error: null
701 708
702 709
703 710 get_repos
704 711 ---------
705 712
706 713 List all existing repositories.
707 714 This command can only be executed using the api_key of a user with admin rights,
708 715 or that of a regular user with at least read access to the repository.
709 716
710 717
711 718 INPUT::
712 719
713 720 id : <id_for_response>
714 721 api_key : "<api_key>"
715 722 method : "get_repos"
716 723 args: { }
717 724
718 725 OUTPUT::
719 726
720 727 id : <id_given_in_input>
721 728 result: [
722 729 {
723 730 "repo_id" : "<repo_id>",
724 731 "repo_name" : "<reponame>"
725 732 "repo_type" : "<repo_type>",
726 733 "clone_uri" : "<clone_uri>",
727 734 "private" : "<bool>",
728 735 "created_on" : "<datetimecreated>",
729 736 "description" : "<description>",
730 737 "landing_rev": "<landing_rev>",
731 738 "owner": "<repo_owner>",
732 739 "fork_of": "<name_of_fork_parent>",
733 740 "enable_downloads": "<bool>",
734 741 "enable_locking": "<bool>",
735 742 "enable_statistics": "<bool>",
736 743 },
737 744
738 745 ]
739 746 error: null
740 747
741 748
742 749 get_repo_nodes
743 750 --------------
744 751
745 752 Return a list of files and directories for a given path at the given revision.
746 753 It is possible to specify ret_type to show only ``files`` or ``dirs``.
747 754 This command can only be executed using the api_key of a user with admin rights.
748 755
749 756
750 757 INPUT::
751 758
752 759 id : <id_for_response>
753 760 api_key : "<api_key>"
754 761 method : "get_repo_nodes"
755 762 args: {
756 763 "repoid" : "<reponame or repo_id>"
757 764 "revision" : "<revision>",
758 765 "root_path" : "<root_path>",
759 766 "ret_type" : "<ret_type> = Optional('all')"
760 767 }
761 768
762 769 OUTPUT::
763 770
764 771 id : <id_given_in_input>
765 772 result: [
766 773 {
767 774 "name" : "<name>"
768 775 "type" : "<type>",
769 776 },
770 777
771 778 ]
772 779 error: null
773 780
774 781
775 782 create_repo
776 783 -----------
777 784
778 785 Create a repository. If the repository name contains "/", all needed repository
779 786 groups will be created. For example "foo/bar/baz" will create repository groups
780 787 "foo", "bar" (with "foo" as parent), and create "baz" repository with
781 788 "bar" as group.
782 789 This command can only be executed using the api_key of a user with admin rights,
783 790 or that of a regular user with create repository permission.
784 791 Regular users cannot specify owner parameter.
785 792
786 793
787 794 INPUT::
788 795
789 796 id : <id_for_response>
790 797 api_key : "<api_key>"
791 798 method : "create_repo"
792 799 args: {
793 800 "repo_name" : "<reponame>",
794 801 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
795 802 "repo_type" : "<repo_type> = Optional('hg')",
796 803 "description" : "<description> = Optional('')",
797 804 "private" : "<bool> = Optional(False)",
798 805 "clone_uri" : "<clone_uri> = Optional(None)",
799 806 "landing_rev" : "<landing_rev> = Optional('tip')",
800 807 "enable_downloads": "<bool> = Optional(False)",
801 808 "enable_locking": "<bool> = Optional(False)",
802 809 "enable_statistics": "<bool> = Optional(False)",
803 810 }
804 811
805 812 OUTPUT::
806 813
807 814 id : <id_given_in_input>
808 815 result: {
809 816 "msg": "Created new repository `<reponame>`",
810 817 "repo": {
811 818 "repo_id" : "<repo_id>",
812 819 "repo_name" : "<reponame>"
813 820 "repo_type" : "<repo_type>",
814 821 "clone_uri" : "<clone_uri>",
815 822 "private" : "<bool>",
816 823 "created_on" : "<datetimecreated>",
817 824 "description" : "<description>",
818 825 "landing_rev": "<landing_rev>",
819 826 "owner": "<username or user_id>",
820 827 "fork_of": "<name_of_fork_parent>",
821 828 "enable_downloads": "<bool>",
822 829 "enable_locking": "<bool>",
823 830 "enable_statistics": "<bool>",
824 831 },
825 832 }
826 833 error: null
827 834
828 835
829 836 update_repo
830 837 -----------
831 838
832 839 Update a repository.
833 840 This command can only be executed using the api_key of a user with admin rights,
834 841 or that of a regular user with create repository permission.
835 842 Regular users cannot specify owner parameter.
836 843
837 844
838 845 INPUT::
839 846
840 847 id : <id_for_response>
841 848 api_key : "<api_key>"
842 849 method : "update_repo"
843 850 args: {
844 851 "repoid" : "<reponame or repo_id>"
845 852 "name" : "<reponame> = Optional('')",
846 853 "group" : "<group_id> = Optional(None)",
847 854 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
848 855 "description" : "<description> = Optional('')",
849 856 "private" : "<bool> = Optional(False)",
850 857 "clone_uri" : "<clone_uri> = Optional(None)",
851 858 "landing_rev" : "<landing_rev> = Optional('tip')",
852 859 "enable_downloads": "<bool> = Optional(False)",
853 860 "enable_locking": "<bool> = Optional(False)",
854 861 "enable_statistics": "<bool> = Optional(False)",
855 862 }
856 863
857 864 OUTPUT::
858 865
859 866 id : <id_given_in_input>
860 867 result: {
861 868 "msg": "updated repo ID:repo_id `<reponame>`",
862 869 "repository": {
863 870 "repo_id" : "<repo_id>",
864 871 "repo_name" : "<reponame>"
865 872 "repo_type" : "<repo_type>",
866 873 "clone_uri" : "<clone_uri>",
867 874 "private": "<bool>",
868 875 "created_on" : "<datetimecreated>",
869 876 "description" : "<description>",
870 877 "landing_rev": "<landing_rev>",
871 878 "owner": "<username or user_id>",
872 879 "fork_of": "<name_of_fork_parent>",
873 880 "enable_downloads": "<bool>",
874 881 "enable_locking": "<bool>",
875 882 "enable_statistics": "<bool>",
876 883 "last_changeset": {
877 884 "author": "<full_author>",
878 885 "date": "<date_time_of_commit>",
879 886 "message": "<commit_message>",
880 887 "raw_id": "<raw_id>",
881 888 "revision": "<numeric_revision>",
882 889 "short_id": "<short_id>"
883 890 }
884 891 "locked_by": "<username>",
885 892 "locked_date": "<float lock_time>",
886 893 },
887 894 }
888 895 error: null
889 896
890 897
891 898 fork_repo
892 899 ---------
893 900
894 901 Create a fork of the given repo. If using Celery, this will
895 902 return success message immediately and a fork will be created
896 903 asynchronously.
897 904 This command can only be executed using the api_key of a user with admin
898 905 rights, or with the global fork permission, by a regular user with create
899 906 repository permission and at least read access to the repository.
900 907 Regular users cannot specify owner parameter.
901 908
902 909
903 910 INPUT::
904 911
905 912 id : <id_for_response>
906 913 api_key : "<api_key>"
907 914 method : "fork_repo"
908 915 args: {
909 916 "repoid" : "<reponame or repo_id>",
910 917 "fork_name": "<forkname>",
911 918 "owner": "<username or user_id = Optional(=apiuser)>",
912 919 "description": "<description>",
913 920 "copy_permissions": "<bool>",
914 921 "private": "<bool>",
915 922 "landing_rev": "<landing_rev>"
916 923
917 924 }
918 925
919 926 OUTPUT::
920 927
921 928 id : <id_given_in_input>
922 929 result: {
923 930 "msg": "Created fork of `<reponame>` as `<forkname>`",
924 931 "success": true
925 932 }
926 933 error: null
927 934
928 935
929 936 delete_repo
930 937 -----------
931 938
932 939 Delete a repository.
933 940 This command can only be executed using the api_key of a user with admin rights,
934 941 or that of a regular user with admin access to the repository.
935 942 When ``forks`` param is set it is possible to detach or delete forks of the deleted repository.
936 943
937 944
938 945 INPUT::
939 946
940 947 id : <id_for_response>
941 948 api_key : "<api_key>"
942 949 method : "delete_repo"
943 950 args: {
944 951 "repoid" : "<reponame or repo_id>",
945 952 "forks" : "`delete` or `detach` = Optional(None)"
946 953 }
947 954
948 955 OUTPUT::
949 956
950 957 id : <id_given_in_input>
951 958 result: {
952 959 "msg": "Deleted repository `<reponame>`",
953 960 "success": true
954 961 }
955 962 error: null
956 963
957 964
958 965 grant_user_permission
959 966 ---------------------
960 967
961 968 Grant permission for a user on the given repository, or update the existing one if found.
962 969 This command can only be executed using the api_key of a user with admin rights.
963 970
964 971
965 972 INPUT::
966 973
967 974 id : <id_for_response>
968 975 api_key : "<api_key>"
969 976 method : "grant_user_permission"
970 977 args: {
971 978 "repoid" : "<reponame or repo_id>"
972 979 "userid" : "<username or user_id>"
973 980 "perm" : "(repository.(none|read|write|admin))",
974 981 }
975 982
976 983 OUTPUT::
977 984
978 985 id : <id_given_in_input>
979 986 result: {
980 987 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
981 988 "success": true
982 989 }
983 990 error: null
984 991
985 992
986 993 revoke_user_permission
987 994 ----------------------
988 995
989 996 Revoke permission for a user on the given repository.
990 997 This command can only be executed using the api_key of a user with admin rights.
991 998
992 999
993 1000 INPUT::
994 1001
995 1002 id : <id_for_response>
996 1003 api_key : "<api_key>"
997 1004 method : "revoke_user_permission"
998 1005 args: {
999 1006 "repoid" : "<reponame or repo_id>"
1000 1007 "userid" : "<username or user_id>"
1001 1008 }
1002 1009
1003 1010 OUTPUT::
1004 1011
1005 1012 id : <id_given_in_input>
1006 1013 result: {
1007 1014 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
1008 1015 "success": true
1009 1016 }
1010 1017 error: null
1011 1018
1012 1019
1013 1020 grant_user_group_permission
1014 1021 ---------------------------
1015 1022
1016 1023 Grant permission for a user group on the given repository, or update the
1017 1024 existing one if found.
1018 1025 This command can only be executed using the api_key of a user with admin rights.
1019 1026
1020 1027
1021 1028 INPUT::
1022 1029
1023 1030 id : <id_for_response>
1024 1031 api_key : "<api_key>"
1025 1032 method : "grant_user_group_permission"
1026 1033 args: {
1027 1034 "repoid" : "<reponame or repo_id>"
1028 1035 "usersgroupid" : "<user group id or name>"
1029 1036 "perm" : "(repository.(none|read|write|admin))",
1030 1037 }
1031 1038
1032 1039 OUTPUT::
1033 1040
1034 1041 id : <id_given_in_input>
1035 1042 result: {
1036 1043 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
1037 1044 "success": true
1038 1045 }
1039 1046 error: null
1040 1047
1041 1048
1042 1049 revoke_user_group_permission
1043 1050 ----------------------------
1044 1051
1045 1052 Revoke permission for a user group on the given repository.
1046 1053 This command can only be executed using the api_key of a user with admin rights.
1047 1054
1048 1055 INPUT::
1049 1056
1050 1057 id : <id_for_response>
1051 1058 api_key : "<api_key>"
1052 1059 method : "revoke_user_group_permission"
1053 1060 args: {
1054 1061 "repoid" : "<reponame or repo_id>"
1055 1062 "usersgroupid" : "<user group id or name>"
1056 1063 }
1057 1064
1058 1065 OUTPUT::
1059 1066
1060 1067 id : <id_given_in_input>
1061 1068 result: {
1062 1069 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
1063 1070 "success": true
1064 1071 }
1065 1072 error: null
@@ -1,9 +1,9 b''
1 1 .. _changelog:
2 2
3 3 =========
4 4 Changelog
5 5 =========
6 6
7 Kallithea project doesn't keep its changelog here. We refer you to our Mercurial logs_ .
7 Kallithea project doesn't keep its changelog here. We refer you to our `Mercurial logs`__.
8 8
9 .. _logs: https://kallithea-scm.org/repos/kallithea/changelog
9 .. __: https://kallithea-scm.org/repos/kallithea/changelog
@@ -1,226 +1,227 b''
1 1 # -*- coding: utf-8 -*-
2 2 #
3 3 # Kallithea documentation build configuration file, created by
4 4 # sphinx-quickstart on Sun Oct 10 16:46:37 2010.
5 5 #
6 6 # This file is execfile()d with the current directory set to its containing dir.
7 7 #
8 8 # Note that not all possible configuration values are present in this
9 9 # autogenerated file.
10 10 #
11 11 # All configuration values have a default; values that are commented out
12 12 # serve to show the default.
13 13
14 14 import sys
15 15 import os
16 16
17 17 # If extensions (or modules to document with autodoc) are in another directory,
18 18 # add these directories to sys.path here. If the directory is relative to the
19 19 # documentation root, use os.path.abspath to make it absolute, like shown here.
20 20 sys.path.insert(0, os.path.abspath('..'))
21 21
22 22 # -- General configuration -----------------------------------------------------
23 23
24 24 # If your documentation needs a minimal Sphinx version, state it here.
25 25 #needs_sphinx = '1.0'
26 26
27 27 # Add any Sphinx extension module names here, as strings. They can be extensions
28 28 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
29 29 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
30 30 'sphinx.ext.intersphinx', 'sphinx.ext.todo',
31 31 'sphinx.ext.viewcode']
32 32
33 33 # Add any paths that contain templates here, relative to this directory.
34 34 templates_path = ['_templates']
35 35
36 36 # The suffix of source filenames.
37 37 source_suffix = '.rst'
38 38
39 39 # The encoding of source files.
40 40 #source_encoding = 'utf-8-sig'
41 41
42 42 # The master toctree document.
43 43 master_doc = 'index'
44 44
45 45 # General information about the project.
46 46 project = u'Kallithea'
47 47 copyright = u'2010-2015 by various authors, licensed as GPLv3.'
48 48
49 49 # The version info for the project you're documenting, acts as replacement for
50 50 # |version| and |release|, also used in various other places throughout the
51 51 # built documents.
52 52 #
53 53 # The short X.Y version.
54 54 root = os.path.dirname(os.path.dirname(__file__))
55 55 sys.path.append(root)
56 56 from kallithea import __version__
57 57 version = __version__
58 58 # The full version, including alpha/beta/rc tags.
59 59 release = __version__
60 60
61 61 # The language for content autogenerated by Sphinx. Refer to documentation
62 62 # for a list of supported languages.
63 63 #language = None
64 64
65 65 # There are two options for replacing |today|: either, you set today to some
66 66 # non-false value, then it is used:
67 67 #today = ''
68 68 # Else, today_fmt is used as the format for a strftime call.
69 69 #today_fmt = '%B %d, %Y'
70 70
71 71 # List of patterns, relative to source directory, that match files and
72 72 # directories to ignore when looking for source files.
73 73 exclude_patterns = ['_build']
74 74
75 75 # The reST default role (used for this markup: `text`) to use for all documents.
76 76 #default_role = None
77 77
78 78 # If true, '()' will be appended to :func: etc. cross-reference text.
79 79 #add_function_parentheses = True
80 80
81 81 # If true, the current module name will be prepended to all description
82 82 # unit titles (such as .. function::).
83 83 #add_module_names = True
84 84
85 85 # If true, sectionauthor and moduleauthor directives will be shown in the
86 86 # output. They are ignored by default.
87 87 #show_authors = False
88 88
89 89 # The name of the Pygments (syntax highlighting) style to use.
90 90 pygments_style = 'sphinx'
91 highlight_language = 'none'
91 92
92 93 # A list of ignored prefixes for module index sorting.
93 94 #modindex_common_prefix = []
94 95
95 96
96 97 # -- Options for HTML output ---------------------------------------------------
97 98
98 99 # The theme to use for HTML and HTML Help pages. See the documentation for
99 100 # a list of builtin themes.
100 101 html_theme = 'nature'
101 102
102 103 # Theme options are theme-specific and customize the look and feel of a theme
103 104 # further. For a list of options available for each theme, see the
104 105 # documentation.
105 106 #html_theme_options = {}
106 107
107 108 # Add any paths that contain custom themes here, relative to this directory.
108 109 html_theme_path = ['theme']
109 110
110 111 # The name for this set of Sphinx documents. If None, it defaults to
111 112 # "<project> v<release> documentation".
112 113 #html_title = None
113 114
114 115 # A shorter title for the navigation bar. Default is the same as html_title.
115 116 #html_short_title = None
116 117
117 118 # The name of an image file (relative to this directory) to place at the top
118 119 # of the sidebar.
119 120 #html_logo = None
120 121
121 122 # The name of an image file (within the static path) to use as favicon of the
122 123 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
123 124 # pixels large.
124 125 #html_favicon = None
125 126
126 127 # Add any paths that contain custom static files (such as style sheets) here,
127 128 # relative to this directory. They are copied after the builtin static files,
128 129 # so a file named "default.css" will overwrite the builtin "default.css".
129 130 #html_static_path = ['_static']
130 131
131 132 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
132 133 # using the given strftime format.
133 134 #html_last_updated_fmt = '%b %d, %Y'
134 135
135 136 # If true, SmartyPants will be used to convert quotes and dashes to
136 137 # typographically correct entities.
137 138 #html_use_smartypants = True
138 139
139 140 # Custom sidebar templates, maps document names to template names.
140 141 #html_sidebars = {}
141 142
142 143 # Additional templates that should be rendered to pages, maps page names to
143 144 # template names.
144 145 #html_additional_pages = {}
145 146
146 147 # If false, no module index is generated.
147 148 #html_domain_indices = True
148 149
149 150 # If false, no index is generated.
150 151 #html_use_index = True
151 152
152 153 # If true, the index is split into individual pages for each letter.
153 154 #html_split_index = False
154 155
155 156 # If true, links to the reST sources are added to the pages.
156 157 #html_show_sourcelink = True
157 158
158 159 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
159 160 #html_show_sphinx = True
160 161
161 162 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
162 163 #html_show_copyright = True
163 164
164 165 # If true, an OpenSearch description file will be output, and all pages will
165 166 # contain a <link> tag referring to it. The value of this option must be the
166 167 # base URL from which the finished HTML is served.
167 168 #html_use_opensearch = ''
168 169
169 170 # This is the file name suffix for HTML files (e.g. ".xhtml").
170 171 #html_file_suffix = None
171 172
172 173 # Output file base name for HTML help builder.
173 174 htmlhelp_basename = 'Kallithea-docs'
174 175
175 176
176 177 # -- Options for LaTeX output --------------------------------------------------
177 178
178 179 # The paper size ('letter' or 'a4').
179 180 #latex_paper_size = 'letter'
180 181
181 182 # The font size ('10pt', '11pt' or '12pt').
182 183 #latex_font_size = '10pt'
183 184
184 185 # Grouping the document tree into LaTeX files. List of tuples
185 186 # (source start file, target name, title, author, documentclass [howto/manual]).
186 187 latex_documents = [
187 188 ('index', 'Kallithea.tex', u'Kallithea Documentation',
188 189 u'Kallithea Developers', 'manual'),
189 190 ]
190 191
191 192 # The name of an image file (relative to this directory) to place at the top of
192 193 # the title page.
193 194 #latex_logo = None
194 195
195 196 # For "manual" documents, if this is true, then toplevel headings are parts,
196 197 # not chapters.
197 198 #latex_use_parts = False
198 199
199 200 # If true, show page references after internal links.
200 201 #latex_show_pagerefs = False
201 202
202 203 # If true, show URL addresses after external links.
203 204 #latex_show_urls = False
204 205
205 206 # Additional stuff for the LaTeX preamble.
206 207 #latex_preamble = ''
207 208
208 209 # Documents to append as an appendix to all manuals.
209 210 #latex_appendices = []
210 211
211 212 # If false, no module index is generated.
212 213 #latex_domain_indices = True
213 214
214 215
215 216 # -- Options for manual page output --------------------------------------------
216 217
217 218 # One entry per manual page. List of tuples
218 219 # (source start file, name, description, authors, manual section).
219 220 man_pages = [
220 221 ('index', 'kallithea', u'Kallithea Documentation',
221 222 [u'Kallithea Developers'], 1)
222 223 ]
223 224
224 225
225 226 # Example configuration for intersphinx: refer to the Python standard library.
226 227 intersphinx_mapping = {'http://docs.python.org/': None}
@@ -1,149 +1,151 b''
1 1 .. _contributing:
2 2
3 3 =========================
4 4 Contributing to Kallithea
5 5 =========================
6 6
7 7 Kallithea is developed and maintained by its users. Please join us and scratch
8 8 your own itch.
9 9
10 10
11 11 Infrastructure
12 12 --------------
13 13
14 The main repository is hosted at Our Own Kallithea (aka OOK) on
15 https://kallithea-scm.org/repos/kallithea/ (which is our self-hosted instance
16 of Kallithea).
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
16 of Kallithea.
17 17
18 For now, we use Bitbucket_ for `Pull Requests`_ and `Issue Tracker`_ services. The
19 issue tracker is for tracking bugs, not for support, discussion, or ideas -
20 please use the `mailing list`_ to reach the community.
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
21 21
22 22 We use Weblate_ to translate the user interface messages into languages other
23 23 than English. Join our project on `Hosted Weblate`_ to help us.
24 24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
25 25 for more details.
26 26
27 27 Getting started
28 28 ---------------
29 29
30 30 To get started with development::
31 31
32 32 hg clone https://kallithea-scm.org/repos/kallithea
33 33 cd kallithea
34 34 virtualenv ../kallithea-venv
35 35 source ../kallithea-venv/bin/activate
36 36 python setup.py develop
37 37 paster make-config Kallithea my.ini
38 38 paster setup-db my.ini --user=user --email=user@example.com --password=password --repos=/tmp
39 39 paster serve my.ini --reload &
40 40 firefox http://127.0.0.1:5000/
41 41
42 42 You can also start out by forking https://bitbucket.org/conservancy/kallithea
43 43 on Bitbucket_ and create a local clone of your own fork.
44 44
45 45
46 46 Running tests
47 47 -------------
48 48
49 49 After finishing your changes make sure all tests pass cleanly. You can run
50 50 the testsuite running ``nosetests`` from the project root, or if you use tox
51 run ``tox`` for python2.6-2.7 with multiple database test.
51 run ``tox`` for Python 2.6--2.7 with multiple database test.
52 52
53 53 When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
54 54 SQLite database specified there.
55 55
56 56 It is possible to avoid recreating the full test database on each invocation of
57 57 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
58 58
59 59 paster serve kallithea/tests/test.ini --pid-file=test.pid --daemon
60 60 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 nosetests
61 61 kill -9 $(cat test.pid)
62 62
63 63 You can run individual tests by specifying their path as argument to nosetests.
64 64 nosetests also has many more options, see `nosetests -h`. Some useful options
65 65 are::
66 66
67 67 -x, --stop Stop running tests after the first error or failure
68 68 -s, --nocapture Don't capture stdout (any stdout output will be
69 69 printed immediately) [NOSE_NOCAPTURE]
70 70 --failed Run the tests that failed in the last test run.
71 71
72 72 Coding/contribution guidelines
73 73 ------------------------------
74 74
75 75 Kallithea is GPLv3 and we assume all contributions are made by the
76 76 committer/contributor and under GPLv3 unless explicitly stated. We do care a
77 77 lot about preservation of copyright and license information for existing code
78 78 that is brought into the project.
79 79
80 80 We don't have a formal coding/formatting standard. We are currently using a mix
81 81 of Mercurial (http://mercurial.selenic.com/wiki/CodingStyle), pep8, and
82 82 consistency with existing code. Run whitespacecleanup.sh to avoid stupid
83 83 whitespace noise in your patches.
84 84
85 85 We support both Python 2.6.x and 2.7.x and nothing else. For now we don't care
86 86 about Python 3 compatibility.
87 87
88 88 We try to support the most common modern web browsers. IE9 is still supported
89 89 to the extent it is feasible, IE8 is not.
90 90
91 91 We primarily support Linux and OS X on the server side but Windows should also work.
92 92
93 Html templates should use 2 spaces for indentation ... but be pragmatic. We
93 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
94 94 should use templates cleverly and avoid duplication. We should use reasonable
95 semantic markup with classes and ids that can be used for styling and testing.
95 semantic markup with element classes and IDs that can be used for styling and testing.
96 96 We should only use inline styles in places where it really is semantic (such as
97 display:none).
97 ``display: none``).
98 98
99 JavaScript must use ';' between/after statements. Indentation 4 spaces. Inline
100 multiline functions should be indented two levels - one for the () and one for
101 {}. jQuery value arrays should have a leading $.
99 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
100 multiline functions should be indented two levels -- one for the ``()`` and one for
101 ``{}``.
102 Variables holding jQuery objects should be named with a leading ``$``.
102 103
103 104 Commit messages should have a leading short line summarizing the changes. For
104 bug fixes, put "(Issue #123)" at the end of this line.
105 bug fixes, put ``(Issue #123)`` at the end of this line.
105 106
106 Contributions will be accepted in most formats - such as pull requests on
107 Contributions will be accepted in most formats -- such as pull requests on
107 108 bitbucket, something hosted on your own Kallithea instance, or patches sent by
108 email to the kallithea-general mailing list.
109 email to the `kallithea-general`_ mailing list.
109 110
110 111 Make sure to test your changes both manually and with the automatic tests
111 112 before posting.
112 113
113 114 We care about quality and review and keeping a clean repository history. We
114 115 might give feedback that requests polishing contributions until they are
115 116 "perfect". We might also rebase and collapse and make minor adjustments to your
116 117 changes when we apply them.
117 118
118 119 We try to make sure we have consensus on the direction the project is taking.
119 Everything non-sensitive should be discussed in public - preferably on the
120 Everything non-sensitive should be discussed in public -- preferably on the
120 121 mailing list. We aim at having all non-trivial changes reviewed by at least
121 122 one other core developer before pushing. Obvious non-controversial changes will
122 123 be handled more casually.
123 124
124 125 For now we just have one official branch ("default") and will keep it so stable
125 126 that it can be (and is) used in production. Experimental changes should live
126 127 elsewhere (for example in a pull request) until they are ready.
127 128
128 129 .. _translations:
129 130 .. include:: ./../kallithea/i18n/how_to
130 131
131 132 "Roadmap"
132 133 ---------
133 134
134 135 We do not have a road map but are waiting for your contributions. Refer to the
135 wiki_ for some ideas of places we might want to go - contributions in these
136 wiki_ for some ideas of places we might want to go -- contributions in these
136 137 areas are very welcome.
137 138
138 139
139 140 Thank you for your contribution!
140 141 --------------------------------
141 142
142 143
143 144 .. _Weblate: http://weblate.org/
144 .. _Issue Tracker: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
145 .. _Pull Requests: https://bitbucket.org/conservancy/kallithea/pull-requests
145 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
146 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
146 147 .. _bitbucket: http://bitbucket.org/
147 148 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
149 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
148 150 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
149 151 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
@@ -1,203 +1,204 b''
1 1 .. _installation:
2 2
3 3 ==========================
4 4 Installation on Unix/Linux
5 5 ==========================
6 6
7 Here are more details about 3 ways to install Kallithea:
7 The following describes three different ways of installing Kallithea:
8 8
9 9 - :ref:`installation-source`: The simplest way to keep the installation
10 uptodate and keep track of local customizations is to run directly from
11 source in a Kallithea repository clone and use virtualenv.
10 up-to-date and track any local customizations is to run directly from
11 source in a Kallithea repository clone, preferably inside a virtualenv
12 virtual Python environment.
12 13
13 14 - :ref:`installation-virtualenv`: If you prefer to only use released versions
14 15 of Kallithea, the recommended method is to install Kallithea in a virtual
15 16 Python environment using `virtualenv`. The advantages of this method over
16 17 direct installation is that Kallithea and its dependencies are completely
17 18 contained inside the virtualenv (which also means you can have multiple
18 19 installations side by side or remove it entirely by just removing the
19 20 virtualenv directory) and does not require root privileges.
20 21
21 22 - :ref:`installation-without-virtualenv`: The alternative method of installing
22 23 a Kallithea release is using standard pip. The package will be installed in
23 24 the same location as all other Python packages you have ever installed. As a
24 25 result, removing it is not as straightforward as with a virtualenv, as you'd
25 26 have to remove its dependencies manually and make sure that they are not
26 27 needed by other packages.
27 28
28 29 .. _installation-source:
29 30
30 31 Installation from repository source
31 32 -----------------------------------
32 33
33 To install Kallithea in a virtualenv using the stable branch of the development
34 To install Kallithea in a virtualenv_ using the stable branch of the development
34 35 repository, follow the instructions below::
35 36
36 37 hg clone https://kallithea-scm.org/repos/kallithea -u stable
37 38 cd kallithea
38 39 virtualenv ../kallithea-venv
39 40 source ../kallithea-venv/bin/activate
40 41 python setup.py develop
41 42 python setup.py compile_catalog # for translation of the UI
42 43
43 44 You can now proceed to :ref:`setup`.
44 45
45 46 To upgrade, simply update the repository with ``hg pull -u`` and restart the
46 47 server.
47 48
48 49 .. _installation-virtualenv:
49 50
50 51 Installing a released version in a virtualenv
51 52 ---------------------------------------------
52 53
53 54 It is highly recommended to use a separate virtualenv_ for installing Kallithea.
54 55 This way, all libraries required by Kallithea will be installed separately from your
55 56 main Python installation and other applications and things will be less
56 57 problematic when upgrading the system or Kallithea.
57 58 An additional benefit of virtualenv_ is that it doesn't require root privileges.
58 59
59 60 - Assuming you have installed virtualenv_, create a new virtual environment
60 61 for example, in `/srv/kallithea/venv`, using the virtualenv command::
61 62
62 63 virtualenv /srv/kallithea/venv
63 64
64 65 - Activate the virtualenv_ in your current shell session by running::
65 66
66 67 source /srv/kallithea/venv/bin/activate
67 68
68 69 .. note:: You can't use UNIX ``sudo`` to source the ``virtualenv`` script; it
69 70 will "activate" a shell that terminates immediately. It is also perfectly
70 71 acceptable (and desirable) to create a virtualenv as a normal user.
71 72
72 73 - Make a folder for Kallithea data files, and configuration somewhere on the
73 74 filesystem. For example::
74 75
75 76 mkdir /srv/kallithea
76 77
77 78 - Go into the created directory and run this command to install Kallithea::
78 79
79 80 pip install kallithea
80 81
81 82 Alternatively, download a .tar.gz from http://pypi.python.org/pypi/Kallithea,
82 83 extract it and run::
83 84
84 85 python setup.py install
85 86
86 87 - This will install Kallithea together with pylons_ and all other required
87 88 python libraries into the activated virtualenv.
88 89
89 90 You can now proceed to :ref:`setup`.
90 91
91 92 .. _installation-without-virtualenv:
92 93
93 94 Installing a released version without virtualenv
94 95 ------------------------------------------------
95 96
96 97 For installation without virtualenv, 'just' use::
97 98
98 99 pip install kallithea
99 100
100 101 Note that this method requires root privileges and will install packages
101 102 globally without using the system's package manager.
102 103
103 104 To install as a regular user in ``~/.local``, you can use::
104 105
105 106 pip install --user kallithea
106 107
107 108 You can now proceed to :ref:`setup`.
108 109
109 110 Upgrading Kallithea from Python Package Index (PyPI)
110 111 ----------------------------------------------------
111 112
112 113 .. note::
113 114 It is strongly recommended that you **always** perform a database and
114 115 configuration backup before doing an upgrade.
115 116
116 117 These directions will use '{version}' to note that this is the version of
117 118 Kallithea that these files were used with. If backing up your Kallithea
118 119 instance from version 0.1 to 0.2, the ``my.ini`` file could be
119 120 backed up to ``my.ini.0-1``.
120 121
121 122
122 123 If using a SQLite database, stop the Kallithea process/daemon/service, and
123 124 then make a copy of the database file::
124 125
125 126 service kallithea stop
126 127 cp kallithea.db kallithea.db.{version}
127 128
128 129
129 130 Back up your configuration file::
130 131
131 132 cp my.ini my.ini.{version}
132 133
133 134
134 135 Ensure that you are using the Python virtual environment that you originally
135 136 installed Kallithea in by running::
136 137
137 138 pip freeze
138 139
139 140 This will list all packages installed in the current environment. If
140 141 Kallithea isn't listed, activate the correct virtual environment::
141 142
142 143 source /srv/kallithea/venv/bin/activate
143 144
144 145
145 146 Once you have verified the environment you can upgrade Kallithea with::
146 147
147 148 pip install --upgrade kallithea
148 149
149 150
150 151 Then run the following command from the installation directory::
151 152
152 153 paster make-config Kallithea my.ini
153 154
154 155 This will display any changes made by the new version of Kallithea to your
155 156 current configuration. It will try to perform an automerge. It is recommended
156 157 that you recheck the content after the automerge.
157 158
158 159 .. note::
159 160 Please always make sure your .ini files are up to date. Errors can
160 161 often be caused by missing parameters added in new versions.
161 162
162 163
163 164 It is also recommended that you rebuild the whoosh index after upgrading since
164 165 the new whoosh version could introduce some incompatible index changes. Please
165 166 read the changelog to see if there were any changes to whoosh.
166 167
167 168
168 169 The final step is to upgrade the database. To do this simply run::
169 170
170 171 paster upgrade-db my.ini
171 172
172 173 This will upgrade the schema and update some of the defaults in the database,
173 174 and will always recheck the settings of the application, if there are no new
174 175 options that need to be set.
175 176
176 177
177 178 .. note::
178 179 The DB schema upgrade library has some limitations and can sometimes fail if you try to
179 180 upgrade from older major releases. In such a case simply run upgrades sequentially, e.g.,
180 181 upgrading from 0.1.X to 0.3.X should be done like this: 0.1.X. > 0.2.X > 0.3.X
181 182 You can always specify what version of Kallithea you want to install for example in pip
182 183 `pip install Kallithea==0.2`
183 184
184 185 You may find it helpful to clear out your log file so that new errors are
185 186 readily apparent::
186 187
187 188 echo > kallithea.log
188 189
189 190 Once that is complete, you may now start your upgraded Kallithea Instance::
190 191
191 192 service kallithea start
192 193
193 194 Or::
194 195
195 196 paster serve /srv/kallithea/my.ini
196 197
197 198 .. note::
198 199 If you're using Celery, make sure you restart all instances of it after
199 200 upgrade.
200 201
201 202
202 203 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
203 204 .. _pylons: http://www.pylonsproject.org/
@@ -1,108 +1,108 b''
1 1 .. _installation_iis:
2 2
3 3 =====================================================================
4 4 Installing Kallithea on Microsoft Internet Information Services (IIS)
5 5 =====================================================================
6 6
7 7 The following is documented using IIS 7/8 terminology. There should be nothing
8 8 preventing you from applying this on IIS 6 well.
9 9
10 10 .. note::
11 11
12 12 For the best security, it is strongly recommended to only host the site over
13 13 a secure connection, e.g. using TLS.
14 14
15 15 Prerequisites
16 16 -------------
17 17
18 18 Apart from the normal requirements for Kallithea, it is also necessary to get an
19 19 ISAPI-WSGI bridge module, e.g. isapi-wsgi.
20 20
21 21 Installation
22 22 ------------
23 23
24 The following will assume that your Kallithea is at ``c:\inetpub\kallithea`` and
24 The following assumes that your Kallithea is at ``c:\inetpub\kallithea``, and
25 25 will be served from the root of its own website. The changes to serve it in its
26 26 own virtual folder will be noted where appropriate.
27 27
28 28 Application pool
29 29 ................
30 30
31 31 Make sure that there is a unique application pool for the Kallithea application
32 32 with an identity that has read access to the Kallithea distribution.
33 33
34 34 The application pool does not need to be able to run any managed code. If you
35 are using a 32-bit Python installation, then you must enable 32 bit program in
36 the advanced settings for the application pool otherwise Python will not be able
37 to run on the website and consequently, Kallithea will not be able to run.
35 are using a 32-bit Python installation, then you must enable 32-bit program in
36 the advanced settings for the application pool; otherwise Python will not be able
37 to run on the website and neither will Kallithea.
38 38
39 39 .. note::
40 40
41 The application pool can be the same as an existing application pool as long
42 as the requirements to Kallithea are enabled by the existing application
43 pool.
41 The application pool can be the same as an existing application pool,
42 as long as the Kallithea requirements are met by the existing pool.
43
44 44
45 45 ISAPI handler
46 46 .............
47 47
48 48 The ISAPI handler can be generated using::
49 49
50 50 paster install-iis my.ini --root=/
51 51
52 52 This will generate a ``dispatch.py`` file in the current directory that contains
53 53 the necessary components to finalize an installation into IIS. Once this file
54 54 has been generated, it is necessary to run the following command due to the way
55 55 that ISAPI-WSGI is made::
56 56
57 57 python dispatch.py install
58 58
59 59 This accomplishes two things: generating an ISAPI compliant DLL file,
60 60 ``_dispatch.dll``, and installing a script map handler into IIS for the
61 61 ``--root`` specified above pointing to ``_dispatch.dll``.
62 62
63 63 The ISAPI handler is registered to all file extensions, so it will automatically
64 64 be the one handling all requests to the specified root. When the website starts
65 65 the ISAPI handler, it will start a thread pool managed wrapper around the paster
66 66 middleware WSGI handler that Kallithea runs within and each HTTP request to the
67 67 site will be processed through this logic henceforth.
68 68
69 69 Authentication with Kallithea using IIS authentication modules
70 70 ..............................................................
71 71
72 72 The recommended way to handle authentication with Kallithea using IIS is to let
73 73 IIS handle all the authentication and just pass it to Kallithea.
74 74
75 75 To move responsibility into IIS from Kallithea, we need to configure Kallithea
76 76 to let external systems handle authentication and then let Kallithea create the
77 77 user automatically. To do this, access the administration's authentication page
78 78 and enable the ``kallithea.lib.auth_modules.auth_container`` plugin. Once it is
79 79 added, enable it with the ``REMOTE_USER`` header and check *Clean username*.
80 80 Finally, save the changes on this page.
81 81
82 82 Switch to the administration's permissions page and disable anonymous access,
83 83 otherwise Kallithea will not attempt to use the authenticated user name. By
84 84 default, Kallithea will populate the list of users lazily as they log in. Either
85 85 disable external auth account activation and ensure that you pre-populate the
86 86 user database with an external tool, or set it to *Automatic activation of
87 87 external account*. Finally, save the changes.
88 88
89 89 The last necessary step is to enable the relevant authentication in IIS, e.g.
90 90 Windows authentication.
91 91
92 92 Troubleshooting
93 93 ---------------
94 94
95 95 Typically, any issues in this setup will either be entirely in IIS or entirely
96 96 in Kallithea (or Kallithea's WSGI/paster middleware). Consequently, two
97 97 different options for finding issues exist: IIS' failed request tracking which
98 98 is great at finding issues until they exist inside Kallithea, at which point the
99 99 ISAPI-WSGI wrapper above uses ``win32traceutil``, which is part of ``pywin32``.
100 100
101 101 In order to dump output from WSGI using ``win32traceutil`` it is sufficient to
102 102 type the following in a console window::
103 103
104 104 python -m win32traceutil
105 105
106 106 and any exceptions occurring in the WSGI layer and below (i.e. in the Kallithea
107 107 application itself) that are uncaught, will be printed here complete with stack
108 108 traces, making it a lot easier to identify issues.
@@ -1,291 +1,292 b''
1 1 .. _installation_win_old:
2 2
3 3 ======================================================================
4 4 Installation and upgrade on Windows (XP/Vista/Server 2003/Server 2008)
5 5 ======================================================================
6 6
7 7 First-time install
8 8 ::::::::::::::::::
9 9
10 Target OS: Windows XP SP3 32bit English (Clean installation)
10 Target OS: Windows XP SP3 32-bit English (Clean installation)
11 11 + All Windows Updates until 24-may-2012
12 12
13 13 .. note::
14 14
15 This installation is for 32bit systems, for 64bit windows you might need
16 to download proper 64bit versions of the different packages(Windows Installer, Win32py extensions)
15 This installation is for 32-bit systems, for 64-bit Windows you might need
16 to download proper 64-bit versions of the different packages (Windows Installer, Win32py extensions)
17 17 plus some extra tweaks.
18 These extra steps haven been marked as "64bit".
18 These extra steps haven been marked as "64-bit".
19 19 Tested on Windows Server 2008 R2 SP1, 9-feb-2013.
20 If you run into any 64bit related problems, please check these pages:
20 If you run into any 64-bit related problems, please check these pages:
21 21 - http://blog.victorjabur.com/2011/06/05/compiling-python-2-7-modules-on-windows-32-and-64-using-msvc-2008-express/
22 22 - http://bugs.python.org/issue7511
23 23
24 24 Step 1 - Install Visual Studio 2008 Express
25 25 -------------------------------------------
26 26
27 27
28 28 Optional: You can also install MinGW, but VS2008 installation is easier.
29 29
30 30 Download "Visual C++ 2008 Express Edition with SP1" from:
31 31 http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso
32 32 (if not found or relocated, google for "visual studio 2008 express" for updated link. This link was taken from http://stackoverflow.com/questions/15318560/visual-c-2008-express-download-link-dead)
33 33
34 34 You can also download full ISO file for offline installation, just
35 35 choose "All - Offline Install ISO image file" in the previous page and
36 36 choose "Visual C++ 2008 Express" when installing.
37 37
38 38 .. note::
39 39
40 40 Using other versions of Visual Studio will lead to random crashes.
41 41 You must use Visual Studio 2008!"
42 42
43 43 .. note::
44 44
45 45 Silverlight Runtime and SQL Server 2008 Express Edition are not
46 46 required, you can uncheck them
47 47
48 48 .. note::
49 49
50 64bit: You also need to install the Microsoft Windows SDK for .NET 3.5 SP1 (.NET 4.0 won't work).
50 64-bit: You also need to install the Microsoft Windows SDK for .NET 3.5 SP1 (.NET 4.0 won't work).
51 51 Download from: http://www.microsoft.com/en-us/download/details.aspx?id=3138
52 52
53 53 .. note::
54 54
55 64bit: You also need to copy and rename a .bat file to make the Visual C++ compiler work.
56 I am not sure why this is not necessary for 32bit.
55 64-bit: You also need to copy and rename a .bat file to make the Visual C++ compiler work.
56 I am not sure why this is not necessary for 32-bit.
57 57 Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat
58 58
59 59
60 Step 2 - Install Python
61 -----------------------
60 Step 2 -- Install Python
61 ------------------------
62 62
63 Install Python 2.x.y (x = 6 or 7) x86 version (32bit). DO NOT USE A 3.x version.
63 Install Python 2.x.y (x = 6 or 7) x86 version (32-bit). DO NOT USE A 3.x version.
64 64 Download Python 2.x.y from:
65 65 http://www.python.org/download/
66 66
67 Choose "Windows Installer" (32bit version) not "Windows X86-64
67 Choose "Windows Installer" (32-bit version) not "Windows X86-64
68 68 Installer". While writing this guide, the latest version was v2.7.3.
69 69 Remember the specific major and minor version installed, because it will
70 70 be needed in the next step. In this case, it is "2.7".
71 71
72 72 .. note::
73 73
74 64bit: Just download and install the 64bit version of python.
74 64-bit: Just download and install the 64-bit version of python.
75
75 76
76 Step 3 - Install Win32py extensions
77 -----------------------------------
77 Step 3 -- Install Win32py extensions
78 ------------------------------------
78 79
79 80 Download pywin32 from:
80 81 http://sourceforge.net/projects/pywin32/files/
81 82
82 83 - Click on "pywin32" folder
83 84 - Click on the first folder (in this case, Build 217, maybe newer when you try)
84 85 - Choose the file ending with ".win32-py2.x.exe" -> x being the minor
85 86 version of Python you installed (in this case, 7)
86 87 When writing this guide, the file was:
87 88 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download
88 89
89 90 .. note::
90 91
91 64bit: Download and install the 64bit version.
92 64-bit: Download and install the 64-bit version.
92 93 At the time of writing you can find this at:
93 94 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe/download
94 95
95 Step 4 - Python BIN
96 -------------------
96
97 Step 4 -- Python BIN
98 --------------------
97 99
98 100 Add Python BIN folder to the path
99 101
100 102 You have to add the Python folder to the path, you can do it manually
101 103 (editing "PATH" environment variable) or using Windows Support Tools
102 104 that came preinstalled in Vista/7 and can be installed in Windows XP.
103 105
104 106 - Using support tools on WINDOWS XP:
105 107 If you use Windows XP you can install them using Windows XP CD and
106 108 navigating to \SUPPORT\TOOLS. There, execute Setup.EXE (not MSI).
107 109 Afterwards, open a CMD and type::
108 110
109 111 SETX PATH "%PATH%;[your-python-path]" -M
110 112
111 113 Close CMD (the path variable will be updated then)
112 114
113 115 - Using support tools on WINDOWS Vista/7:
114 116
115 117 Open a CMD and type::
116 118
117 119 SETX PATH "%PATH%;[your-python-path]" /M
118 120
119 121 Please substitute [your-python-path] with your Python installation path.
120 122 Typically: C:\\Python27
121 123
122 124
123 Step 5 - Kallithea folder structure
124 -----------------------------------
125 Step 5 -- Kallithea folder structure
126 ------------------------------------
125 127
126 128 Create a Kallithea folder structure
127 129
128 130 This is only a example to install Kallithea, you can of course change
129 131 it. However, this guide will follow the proposed structure, so please
130 132 later adapt the paths if you change them. My recommendation is to use
131 133 folders with NO SPACES. But you can try if you are brave...
132 134
133 135 Create the following folder structure::
134 136
135 137 C:\Kallithea
136 138 C:\Kallithea\Bin
137 139 C:\Kallithea\Env
138 140 C:\Kallithea\Repos
139 141
140 142
141 Step 6 - Install virtualenv
142 ---------------------------
143 Step 6 -- Install virtualenv
144 ----------------------------
143 145
144 146 Install Virtual Env for Python
145 147
146 148 Navigate to: http://www.virtualenv.org/en/latest/index.html#installation
147 149 Right click on "virtualenv.py" file and choose "Save link as...".
148 150 Download to C:\\Kallithea (or whatever you want)
149 151 (the file is located at
150 152 https://raw.github.com/pypa/virtualenv/master/virtualenv.py)
151 153
152 154 Create a virtual Python environment in C:\\Kallithea\\Env (or similar). To
153 155 do so, open a CMD (Python Path should be included in Step3), navigate
154 156 where you downloaded "virtualenv.py", and write::
155 157
156 158 python virtualenv.py C:\Kallithea\Env
157 159
158 160 (--no-site-packages is now the default behaviour of virtualenv, no need
159 161 to include it)
160 162
161 163
162 Step 7 - Install Kallithea
163 --------------------------
164 Step 7 -- Install Kallithea
165 ---------------------------
164 166
165 167 Finally, install Kallithea
166 168
167 169 Close previously opened command prompt/s, and open a Visual Studio 2008
168 170 Command Prompt (**IMPORTANT!!**). To do so, go to Start Menu, and then open
169 171 "Microsoft Visual C++ 2008 Express Edition" -> "Visual Studio Tools" ->
170 172 "Visual Studio 2008 Command Prompt"
171 173
172 174 .. note::
173 175
174 64bit: For 64bit you need to modify the shortcut that is used to start the
176 64-bit: For 64-bit you need to modify the shortcut that is used to start the
175 177 Visual Studio 2008 Command Prompt. Use right-mouse click to open properties.
176 178
177 179 Change commandline from::
178 180
179 181 %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
180 182
181 183 to::
182 184
183 185 %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" amd64
184 186
185 187
186 188 In that CMD (loaded with VS2008 PATHs) type::
187 189
188 190 cd C:\Kallithea\Env\Scripts (or similar)
189 191 activate
190 192
191 193 The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
192 194 (depending of your folder structure). Then type::
193 195
194 196 pip install kallithea
195 197
196 198 (long step, please wait until fully complete)
197 199
198 200 Some warnings will appear, don't worry as they are normal.
199 201
200 202
201 Step 8 - Configuring Kallithea
202 ------------------------------
203
203 Step 8 -- Configuring Kallithea
204 -------------------------------
204 205
205 206 steps taken from http://packages.python.org/Kallithea/setup.html
206 207
207 208 You have to use the same Visual Studio 2008 command prompt as Step7, so
208 209 if you closed it reopen it following the same commands (including the
209 210 "activate" one). When ready, just type::
210 211
211 212 cd C:\Kallithea\Bin
212 213 paster make-config Kallithea production.ini
213 214
214 215 Then, you must edit production.ini to fit your needs (network address and
215 216 port, mail settings, database, whatever). I recommend using NotePad++
216 217 (free) or similar text editor, as it handles well the EndOfLine
217 218 character differences between Unix and Windows
218 219 (http://notepad-plus-plus.org/)
219 220
220 221 For the sake of simplicity lets run it with the default settings. After
221 222 your edits (if any), in the previous Command Prompt, type::
222 223
223 224 paster setup-db production.ini
224 225
225 226 (this time a NEW database will be installed, you must follow a different
226 227 step to later UPGRADE to a newer Kallithea version)
227 228
228 229 The script will ask you for confirmation about creating a NEW database,
229 230 answer yes (y)
230 231 The script will ask you for repository path, answer C:\\Kallithea\\Repos
231 232 (or similar)
232 233 The script will ask you for admin username and password, answer "admin"
233 234 + "123456" (or whatever you want)
234 235 The script will ask you for admin mail, answer "admin@xxxx.com" (or
235 236 whatever you want)
236 237
237 238 If you make some mistake and the script does not end, don't worry, start
238 239 it again.
239 240
240 241
241 Step 9 - Running Kallithea
242 --------------------------
242 Step 9 -- Running Kallithea
243 ---------------------------
243 244
244 245
245 246 In the previous command prompt, being in the C:\\Kallithea\\Bin folder,
246 247 just type::
247 248
248 249 paster serve production.ini
249 250
250 251 Open yout web server, and go to http://127.0.0.1:5000
251 252
252 253 It works!! :-)
253 254
254 255 Remark:
255 256 If it does not work first time, just Ctrl-C the CMD process and start it
256 257 again. Don't forget the "http://" in Internet Explorer
257 258
258 259
259 260
260 261 What this Guide does not cover:
261 262
262 263 - Installing Celery
263 264 - Running Kallithea as Windows Service. You can investigate here:
264 265
265 266 - http://pypi.python.org/pypi/wsgisvc
266 267 - http://ryrobes.com/python/running-python-scripts-as-a-windows-service/
267 268 - http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service
268 269
269 270 - Using Apache. You can investigate here:
270 271
271 272 - https://groups.google.com/group/rhodecode/msg/c433074e813ffdc4
272 273
273 274
274 275 Upgrading
275 276 :::::::::
276 277
277 278 Stop running Kallithea
278 279 Open a CommandPrompt like in Step7 (VS2008 path + activate) and type::
279 280
280 281 easy_install -U kallithea
281 282 cd \Kallithea\Bin
282 283
283 284 { backup your production.ini file now} ::
284 285
285 286 paster make-config Kallithea production.ini
286 287
287 288 (check changes and update your production.ini accordingly) ::
288 289
289 290 paster upgrade-db production.ini (update database)
290 291
291 292 Full steps in http://packages.python.org/Kallithea/upgrade.html
@@ -1,795 +1,819 b''
1 1 .. _setup:
2 2
3 3 =====
4 4 Setup
5 5 =====
6 6
7 7
8 8 Setting up Kallithea
9 9 --------------------
10 10
11 11 First, you will need to create a Kallithea configuration file. Run the
12 12 following command to do so::
13 13
14 14 paster make-config Kallithea my.ini
15 15
16 16 This will create the file ``my.ini`` in the current directory. This
17 configuration file contains the various settings for Kallithea, e.g.,
17 configuration file contains the various settings for Kallithea, e.g.
18 18 proxy port, email settings, usage of static files, cache, Celery
19 19 settings, and logging.
20 20
21 21
22 22 Next, you need to create the databases used by Kallithea. It is recommended to
23 23 use PostgreSQL or SQLite (default). If you choose a database other than the
24 24 default, ensure you properly adjust the database URL in your ``my.ini``
25 25 configuration file to use this other database. Kallithea currently supports
26 26 PostgreSQL, SQLite and MySQL databases. Create the database by running
27 27 the following command::
28 28
29 29 paster setup-db my.ini
30 30
31 31 This will prompt you for a "root" path. This "root" path is the location where
32 32 Kallithea will store all of its repositories on the current machine. After
33 33 entering this "root" path ``setup-db`` will also prompt you for a username
34 34 and password for the initial admin account which ``setup-db`` sets
35 35 up for you.
36 36
37 The setup process can be fully automated, example for lazy::
37 The ``setup-db`` values can also be given on the command line.
38 Example::
38 39
39 paster setup-db my.ini --user=nn --password=secret --email=nn@your.kallithea.server --repos=/srv/repos
40 paster setup-db my.ini --user=nn --password=secret --email=nn@example.org --repos=/srv/repos
40 41
41 42
42 The ``setup-db`` command will create all of the needed tables and an
43 The ``setup-db`` command will create all needed tables and an
43 44 admin account. When choosing a root path you can either use a new
44 45 empty location, or a location which already contains existing
45 46 repositories. If you choose a location which contains existing
46 47 repositories Kallithea will add all of the repositories at the chosen
47 48 location to its database. (Note: make sure you specify the correct
48 49 path to the root).
49 50
50 51 .. note:: the given path for Mercurial_ repositories **must** be write
51 52 accessible for the application. It's very important since
52 53 the Kallithea web interface will work without write access,
53 54 but when trying to do a push it will fail with permission
54 55 denied errors unless it has write access.
55 56
56 57 You are now ready to use Kallithea. To run it simply execute::
57 58
58 59 paster serve my.ini
59 60
60 61 - This command runs the Kallithea server. The web app should be available at
61 http://127.0.0.1:5000. This ip and port is configurable via the my.ini
62 file created in previous step
63 - Use the admin account you created above when running ``setup-db``
64 to login to the web app.
62 http://127.0.0.1:5000. The IP address and port is configurable via the
63 configuration file created in the previous step.
64 - Log in to Kallithea using the admin account created when running ``setup-db``.
65 65 - The default permissions on each repository is read, and the owner is admin.
66 66 Remember to update these if needed.
67 67 - In the admin panel you can toggle LDAP, anonymous, and permissions
68 68 settings, as well as edit more advanced options on users and
69 repositories
69 repositories.
70 70
71 71
72 72 Extensions
73 73 ----------
74 74
75 Optionally users can create an ``rcextensions`` package that extends Kallithea
76 functionality. To do this simply execute::
75 Optionally one can create an ``rcextensions`` package that extends Kallithea
76 functionality.
77 To generate a skeleton extensions package, run::
77 78
78 79 paster make-rcext my.ini
79 80
80 81 This will create an ``rcextensions`` package next to the specified ``ini`` file.
81 82 With ``rcextensions`` it's possible to add additional mapping for whoosh,
82 83 stats and add additional code into the push/pull/create/delete repo hooks,
83 84 for example for sending signals to build-bots such as Jenkins.
84 85
85 86 See the ``__init__.py`` file inside the generated ``rcextensions`` package
86 87 for more details.
87 88
88 89
89 90 Using Kallithea with SSH
90 91 ------------------------
91 92
92 93 Kallithea currently only hosts repositories using http and https. (The addition
93 94 of ssh hosting is a planned future feature.) However you can easily use ssh in
94 95 parallel with Kallithea. (Repository access via ssh is a standard "out of
95 96 the box" feature of Mercurial_ and you can use this to access any of the
96 97 repositories that Kallithea is hosting. See PublishingRepositories_)
97 98
98 99 Kallithea repository structures are kept in directories with the same name
99 100 as the project. When using repository groups, each group is a subdirectory.
100 101 This allows you to easily use ssh for accessing repositories.
101 102
102 103 In order to use ssh you need to make sure that your web server and the users'
103 104 login accounts have the correct permissions set on the appropriate directories.
104 105
105 106 .. note:: These permissions are independent of any permissions you
106 107 have set up using the Kallithea web interface.
107 108
108 109 If your main directory (the same as set in Kallithea settings) is for
109 110 example set to ``/srv/repos`` and the repository you are using is
110 111 named ``kallithea``, then to clone via ssh you should run::
111 112
112 113 hg clone ssh://user@server.com//srv/repos/kallithea
113 114
114 115 Using other external tools such as mercurial-server_ or using ssh key-based
115 116 authentication is fully supported.
116 117
117 118 .. note:: In an advanced setup, in order for your ssh access to use
118 119 the same permissions as set up via the Kallithea web
119 120 interface, you can create an authentication hook to connect
120 121 to the Kallithea db and run check functions for permissions
121 122 against that.
122 123
123 124 Setting up Whoosh full text search
124 125 ----------------------------------
125 126
126 The whoosh index can be built by using the paster
127 command ``make-index``. To use ``make-index`` you must specify the configuration
128 file that stores the location of the index. You may specify the location of the
129 repositories (``--repo-location``). If not specified, this value is retrieved
130 from the Kallithea database.
131 It is also possible to specify a comma separated list of
132 repositories (``--index-only``) to build index only on chooses repositories
133 skipping any other found in repos location
127 Kallithea provides full text search of repositories using `Whoosh`__.
134 128
135 You may optionally pass the option ``-f`` to enable a full index rebuild. Without
136 the ``-f`` option, indexing will run always in "incremental" mode.
129 .. __: https://pythonhosted.org/Whoosh/
137 130
138 For an incremental index build use::
131 For an incremental index build, run::
139 132
140 133 paster make-index my.ini
141 134
142 For a full index rebuild use::
135 For a full index rebuild, run::
143 136
144 137 paster make-index my.ini -f
145 138
139 The ``--repo-location`` option allows the location of the repositories to be overriden;
140 usually, the location is retrieved from the Kallithea database.
146 141
147 Building an index for just selected repositories is possible with such command::
142 The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
148 143
149 144 paster make-index my.ini --index-only=vcs,kallithea
150 145
151 146
152 In order to do periodic index builds and keep your index always up to
153 date, it is recommended to use a crontab entry. An example entry
154 might look like this::
147 To keep your index up-to-date it is necessary to do periodic index builds;
148 for this, it is recommended to use a crontab entry. Example::
155 149
156 /path/to/python/bin/paster make-index /path/to/kallithea/my.ini
150 0 3 * * * /path/to/virtualenv/bin/paster make-index /path/to/kallithea/my.ini
157 151
158 When using incremental mode (the default) whoosh will check the last
152 When using incremental mode (the default), Whoosh will check the last
159 153 modification date of each file and add it to be reindexed if a newer file is
160 154 available. The indexing daemon checks for any removed files and removes them
161 155 from index.
162 156
163 157 If you want to rebuild the index from scratch, you can use the ``-f`` flag as above,
164 or in the admin panel you can check the "build from scratch" flag.
158 or in the admin panel you can check the "build from scratch" checkbox.
165 159
166 160
167 161 Setting up LDAP support
168 162 -----------------------
169 163
170 164 Kallithea supports LDAP authentication. In order
171 165 to use LDAP, you have to install the python-ldap_ package. This package is
172 available via pypi, so you can install it by running::
166 available via PyPI, so you can install it by running::
173 167
174 168 pip install python-ldap
175 169
176 170 .. note:: ``python-ldap`` requires some libraries to be installed on
177 171 your system, so before installing it check that you have at
178 172 least the ``openldap`` and ``sasl`` libraries.
179 173
180 174 LDAP settings are located in the Admin->LDAP section.
181 175
182 176 Here's a typical LDAP setup::
183 177
184 178 Connection settings
185 179 Enable LDAP = checked
186 180 Host = host.example.org
187 181 Port = 389
188 182 Account = <account>
189 183 Password = <password>
190 184 Connection Security = LDAPS connection
191 185 Certificate Checks = DEMAND
192 186
193 187 Search settings
194 188 Base DN = CN=users,DC=host,DC=example,DC=org
195 189 LDAP Filter = (&(objectClass=user)(!(objectClass=computer)))
196 190 LDAP Search Scope = SUBTREE
197 191
198 192 Attribute mappings
199 193 Login Attribute = uid
200 194 First Name Attribute = firstName
201 195 Last Name Attribute = lastName
202 196 Email Attribute = mail
203 197
204 198 If your user groups are placed in an Organisation Unit (OU) structure, the Search Settings configuration differs::
205 199
206 200 Search settings
207 201 Base DN = DC=host,DC=example,DC=org
208 202 LDAP Filter = (&(memberOf=CN=your user group,OU=subunit,OU=unit,DC=host,DC=example,DC=org)(objectClass=user))
209 203 LDAP Search Scope = SUBTREE
210 204
211 205 .. _enable_ldap:
212 206
213 207 Enable LDAP : required
214 208 Whether to use LDAP for authenticating users.
215 209
216 210 .. _ldap_host:
217 211
218 212 Host : required
219 213 LDAP server hostname or IP address. Can be also a comma separated
220 214 list of servers to support LDAP fail-over.
221 215
222 216 .. _Port:
223 217
224 218 Port : required
225 219 389 for un-encrypted LDAP, 636 for SSL-encrypted LDAP.
226 220
227 221 .. _ldap_account:
228 222
229 223 Account : optional
230 224 Only required if the LDAP server does not allow anonymous browsing of
231 225 records. This should be a special account for record browsing. This
232 226 will require `LDAP Password`_ below.
233 227
234 228 .. _LDAP Password:
235 229
236 230 Password : optional
237 231 Only required if the LDAP server does not allow anonymous browsing of
238 232 records.
239 233
240 234 .. _Enable LDAPS:
241 235
242 236 Connection Security : required
243 237 Defines the connection to LDAP server
244 238
245 239 No encryption
246 240 Plain non encrypted connection
247 241
248 242 LDAPS connection
249 243 Enable LDAPS connections. It will likely require `Port`_ to be set to
250 244 a different value (standard LDAPS port is 636). When LDAPS is enabled
251 245 then `Certificate Checks`_ is required.
252 246
253 247 START_TLS on LDAP connection
254 248 START TLS connection
255 249
256 250 .. _Certificate Checks:
257 251
258 252 Certificate Checks : optional
259 253 How SSL certificates verification is handled - this is only useful when
260 254 `Enable LDAPS`_ is enabled. Only DEMAND or HARD offer full SSL security
261 255 while the other options are susceptible to man-in-the-middle attacks. SSL
262 256 certificates can be installed to /etc/openldap/cacerts so that the
263 257 DEMAND or HARD options can be used with self-signed certificates or
264 258 certificates that do not have traceable certificates of authority.
265 259
266 260 NEVER
267 261 A serve certificate will never be requested or checked.
268 262
269 263 ALLOW
270 264 A server certificate is requested. Failure to provide a
271 265 certificate or providing a bad certificate will not terminate the
272 266 session.
273 267
274 268 TRY
275 269 A server certificate is requested. Failure to provide a
276 270 certificate does not halt the session; providing a bad certificate
277 271 halts the session.
278 272
279 273 DEMAND
280 274 A server certificate is requested and must be provided and
281 275 authenticated for the session to proceed.
282 276
283 277 HARD
284 278 The same as DEMAND.
285 279
286 280 .. _Base DN:
287 281
288 282 Base DN : required
289 283 The Distinguished Name (DN) where searches for users will be performed.
290 284 Searches can be controlled by `LDAP Filter`_ and `LDAP Search Scope`_.
291 285
292 286 .. _LDAP Filter:
293 287
294 288 LDAP Filter : optional
295 289 A LDAP filter defined by RFC 2254. This is more useful when `LDAP
296 290 Search Scope`_ is set to SUBTREE. The filter is useful for limiting
297 291 which LDAP objects are identified as representing Users for
298 292 authentication. The filter is augmented by `Login Attribute`_ below.
299 293 This can commonly be left blank.
300 294
301 295 .. _LDAP Search Scope:
302 296
303 297 LDAP Search Scope : required
304 298 This limits how far LDAP will search for a matching object.
305 299
306 300 BASE
307 301 Only allows searching of `Base DN`_ and is usually not what you
308 302 want.
309 303
310 304 ONELEVEL
311 305 Searches all entries under `Base DN`_, but not Base DN itself.
312 306
313 307 SUBTREE
314 308 Searches all entries below `Base DN`_, but not Base DN itself.
315 309 When using SUBTREE `LDAP Filter`_ is useful to limit object
316 310 location.
317 311
318 312 .. _Login Attribute:
319 313
320 314 Login Attribute : required
321 315 The LDAP record attribute that will be matched as the USERNAME or
322 316 ACCOUNT used to connect to Kallithea. This will be added to `LDAP
323 317 Filter`_ for locating the User object. If `LDAP Filter`_ is specified as
324 318 "LDAPFILTER", `Login Attribute`_ is specified as "uid" and the user has
325 319 connected as "jsmith" then the `LDAP Filter`_ will be augmented as below
326 320 ::
327 321
328 322 (&(LDAPFILTER)(uid=jsmith))
329 323
330 324 .. _ldap_attr_firstname:
331 325
332 326 First Name Attribute : required
333 327 The LDAP record attribute which represents the user's first name.
334 328
335 329 .. _ldap_attr_lastname:
336 330
337 331 Last Name Attribute : required
338 332 The LDAP record attribute which represents the user's last name.
339 333
340 334 .. _ldap_attr_email:
341 335
342 336 Email Attribute : required
343 337 The LDAP record attribute which represents the user's email address.
344 338
345 339 If all data are entered correctly, and python-ldap_ is properly installed
346 340 users should be granted access to Kallithea with LDAP accounts. At this
347 341 time user information is copied from LDAP into the Kallithea user database.
348 342 This means that updates of an LDAP user object may not be reflected as a
349 343 user update in Kallithea.
350 344
351 345 If You have problems with LDAP access and believe You entered correct
352 346 information check out the Kallithea logs, any error messages sent from LDAP
353 347 will be saved there.
354 348
355 349 Active Directory
356 350 ''''''''''''''''
357 351
358 352 Kallithea can use Microsoft Active Directory for user authentication. This
359 353 is done through an LDAP or LDAPS connection to Active Directory. The
360 354 following LDAP configuration settings are typical for using Active
361 355 Directory ::
362 356
363 357 Base DN = OU=SBSUsers,OU=Users,OU=MyBusiness,DC=v3sys,DC=local
364 358 Login Attribute = sAMAccountName
365 359 First Name Attribute = givenName
366 360 Last Name Attribute = sn
367 361 Email Attribute = mail
368 362
369 363 All other LDAP settings will likely be site-specific and should be
370 364 appropriately configured.
371 365
372 366
373 367 Authentication by container or reverse-proxy
374 368 --------------------------------------------
375 369
376 370 Kallithea supports delegating the authentication
377 371 of users to its WSGI container, or to a reverse-proxy server through which all
378 372 clients access the application.
379 373
380 374 When these authentication methods are enabled in Kallithea, it uses the
381 username that the container/proxy (Apache/Nginx/etc) authenticated and doesn't
375 username that the container/proxy (Apache or Nginx, etc.) provides and doesn't
382 376 perform the authentication itself. The authorization, however, is still done by
383 377 Kallithea according to its settings.
384 378
385 379 When a user logs in for the first time using these authentication methods,
386 380 a matching user account is created in Kallithea with default permissions. An
387 381 administrator can then modify it using Kallithea's admin interface.
382
388 383 It's also possible for an administrator to create accounts and configure their
389 permissions before the user logs in for the first time.
384 permissions before the user logs in for the first time, using the :ref:`create-user` API.
390 385
391 386
392 387 Container-based authentication
393 388 ''''''''''''''''''''''''''''''
394 389
395 390 In a container-based authentication setup, Kallithea reads the user name from
396 391 the ``REMOTE_USER`` server variable provided by the WSGI container.
397 392
398 After setting up your container (see `Apache's WSGI config`_), you'd need
393 After setting up your container (see `Apache with mod_wsgi`_), you'll need
399 394 to configure it to require authentication on the location configured for
400 395 Kallithea.
401 396
402 397
403 398 Proxy pass-through authentication
404 399 '''''''''''''''''''''''''''''''''
405 400
406 401 In a proxy pass-through authentication setup, Kallithea reads the user name
407 402 from the ``X-Forwarded-User`` request header, which should be configured to be
408 403 sent by the reverse-proxy server.
409 404
410 405 After setting up your proxy solution (see `Apache virtual host reverse proxy example`_,
411 `Apache as subdirectory`_ or `Nginx virtual host example`_), you'd need to
406 `Apache as subdirectory`_ or `Nginx virtual host example`_), you'll need to
412 407 configure the authentication and add the username in a request header named
413 408 ``X-Forwarded-User``.
414 409
415 410 For example, the following config section for Apache sets a subdirectory in a
416 reverse-proxy setup with basic auth::
411 reverse-proxy setup with basic auth:
412
413 .. code-block:: apache
417 414
418 <Location /<someprefix> >
419 ProxyPass http://127.0.0.1:5000/<someprefix>
420 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
415 <Location /someprefix>
416 ProxyPass http://127.0.0.1:5000/someprefix
417 ProxyPassReverse http://127.0.0.1:5000/someprefix
421 418 SetEnvIf X-Url-Scheme https HTTPS=1
422 419
423 420 AuthType Basic
424 421 AuthName "Kallithea authentication"
425 422 AuthUserFile /srv/kallithea/.htpasswd
426 require valid-user
423 Require valid-user
427 424
428 425 RequestHeader unset X-Forwarded-User
429 426
430 427 RewriteEngine On
431 428 RewriteCond %{LA-U:REMOTE_USER} (.+)
432 429 RewriteRule .* - [E=RU:%1]
433 430 RequestHeader set X-Forwarded-User %{RU}e
434 431 </Location>
435 432
436 433
437 434 .. note::
438 435 If you enable proxy pass-through authentication, make sure your server is
439 436 only accessible through the proxy. Otherwise, any client would be able to
440 437 forge the authentication header and could effectively become authenticated
441 438 using any account of their liking.
442 439
443 440
444 441 Integration with issue trackers
445 442 -------------------------------
446 443
447 444 Kallithea provides a simple integration with issue trackers. It's possible
448 to define a regular expression that will fetch an issue id stored in a commit
449 messages and replace that with a URL to the issue. To enable this simply
445 to define a regular expression that will match an issue ID in commit messages,
446 and have that replaced with a URL to the issue. To enable this simply
450 447 uncomment the following variables in the ini file::
451 448
452 449 issue_pat = (?:^#|\s#)(\w+)
453 450 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
454 451 issue_prefix = #
455 452
456 453 ``issue_pat`` is the regular expression describing which strings in
457 454 commit messages will be treated as issue references. A match group in
458 455 parentheses should be used to specify the actual issue id.
459 456
460 457 The default expression matches issues in the format ``#<number>``, e.g., ``#300``.
461 458
462 Matched issues are replaced with the link specified as
463 ``issue_server_link`` ``{id}`` is replaced with issue id, and
459 Matched issue references are replaced with the link specified in
460 ``issue_server_link``. ``{id}`` is replaced with the issue ID, and
464 461 ``{repo}`` with the repository name. Since the # is stripped away,
465 462 ``issue_prefix`` is prepended to the link text. ``issue_prefix`` doesn't
466 463 necessarily need to be ``#``: if you set issue prefix to ``ISSUE-`` this will
467 generate a URL in the format::
464 generate a URL in the format:
465
466 .. code-block:: html
468 467
469 468 <a href="https://myissueserver.com/example_repo/issue/300">ISSUE-300</a>
470 469
471 470 If needed, more than one pattern can be specified by appending a unique suffix to
472 471 the variables. For example::
473 472
474 473 issue_pat_wiki = (?:wiki-)(.+)
475 474 issue_server_link_wiki = https://mywiki.com/{id}
476 475 issue_prefix_wiki = WIKI-
477 476
478 477 With these settings, wiki pages can be referenced as wiki-some-id, and every
479 such reference will be transformed into::
478 such reference will be transformed into:
479
480 .. code-block:: html
480 481
481 482 <a href="https://mywiki.com/some-id">WIKI-some-id</a>
482 483
483 484
484 485 Hook management
485 486 ---------------
486 487
487 488 Hooks can be managed in similar way to that used in ``.hgrc`` files.
488 489 To access hooks setting click `advanced setup` in the `Hooks` section
489 490 of Mercurial Settings in Admin.
490 491
491 There are four built in hooks that cannot be changed (only enabled/disabled by
492 checkboxes in the previous section).
493 To add another custom hook simply fill in the first section with
494 ``<name>.<hook_type>`` and the second one with hook path. Example hooks
492 The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section.
493
494 To add another custom hook simply fill in the first textbox with
495 ``<name>.<hook_type>`` and the second with the hook path. Example hooks
495 496 can be found in ``kallithea.lib.hooks``.
496 497
497 498
498 499 Changing default encoding
499 500 -------------------------
500 501
501 502 By default, Kallithea uses UTF-8 encoding.
502 503 This is configurable as ``default_encoding`` in the .ini file.
503 504 This affects many parts in Kallithea including user names, filenames, and
504 505 encoding of commit messages. In addition Kallithea can detect if the ``chardet``
505 506 library is installed. If ``chardet`` is detected Kallithea will fallback to it
506 507 when there are encode/decode errors.
507 508
508 509
509 510 Celery configuration
510 511 --------------------
511 512
512 513 Kallithea can use the distributed task queue system Celery_ to run tasks like
513 514 cloning repositories or sending emails.
514 515
515 516 Kallithea will in most setups work perfectly fine out of the box (without
516 517 Celery), executing all tasks in the web server process. Some tasks can however
517 518 take some time to run and it can be better to run such tasks asynchronously in
518 519 a separate process so the web server can focus on serving web requests.
519 520
520 521 For installation and configuration of Celery, see the `Celery documentation`_.
521 522 Note that Celery requires a message broker service like RabbitMQ_ (recommended)
522 523 or Redis_.
523 524
524 525 The use of Celery is configured in the Kallithea ini configuration file.
525 526 To enable it, simply set::
526 527
527 528 use_celery = true
528 529
529 530 and add or change the ``celery.*`` and ``broker.*`` configuration variables.
530 531
531 532 Remember that the ini files use the format with '.' and not with '_' like
532 533 Celery. So for example setting `BROKER_HOST` in Celery means setting
533 534 `broker.host` in the configuration file.
534 535
535 536 To start the Celery process, run::
536 537
537 538 paster celeryd <configfile.ini>
538 539
539 540
540 541 .. note::
541 542 Make sure you run this command from the same virtualenv, and with the same
542 543 user that Kallithea runs.
543 544
545
544 546 HTTPS support
545 547 -------------
546 548
547 549 Kallithea will by default generate URLs based on the WSGI environment.
548 550
549 551 Alternatively, you can use some special configuration settings to control
550 552 directly which scheme/protocol Kallithea will use when generating URLs:
551 553
552 - With ``https_fixup = true``, the scheme will be taken from the ``HTTP_X_URL_SCHEME``,
553 ``HTTP_X_FORWARDED_SCHEME`` or ``HTTP_X_FORWARDED_PROTO HTTP`` header (default ``http``).
554 - With ``https_fixup = true``, the scheme will be taken from the
555 ``X-Url-Scheme``, ``X-Forwarded-Scheme`` or ``X-Forwarded-Proto`` HTTP header
556 (default ``http``).
554 557 - With ``force_https = true`` the default will be ``https``.
555 - With ``use_htsts = true``, it will set ``Strict-Transport-Security`` when using https.
558 - With ``use_htsts = true``, Kallithea will set ``Strict-Transport-Security`` when using https.
559
556 560
557 561 Nginx virtual host example
558 562 --------------------------
559 563
560 Sample config for nginx using proxy::
564 Sample config for Nginx using proxy:
565
566 .. code-block:: nginx
561 567
562 568 upstream kallithea {
563 569 server 127.0.0.1:5000;
564 570 # add more instances for load balancing
565 571 #server 127.0.0.1:5001;
566 572 #server 127.0.0.1:5002;
567 573 }
568 574
569 575 ## gist alias
570 576 server {
571 577 listen 443;
572 578 server_name gist.myserver.com;
573 579 access_log /var/log/nginx/gist.access.log;
574 580 error_log /var/log/nginx/gist.error.log;
575 581
576 582 ssl on;
577 583 ssl_certificate gist.your.kallithea.server.crt;
578 584 ssl_certificate_key gist.your.kallithea.server.key;
579 585
580 586 ssl_session_timeout 5m;
581 587
582 588 ssl_protocols SSLv3 TLSv1;
583 589 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
584 590 ssl_prefer_server_ciphers on;
585 591
586 592 rewrite ^/(.+)$ https://your.kallithea.server/_admin/gists/$1;
587 593 rewrite (.*) https://your.kallithea.server/_admin/gists;
588 594 }
589 595
590 596 server {
591 597 listen 443;
592 598 server_name your.kallithea.server;
593 599 access_log /var/log/nginx/kallithea.access.log;
594 600 error_log /var/log/nginx/kallithea.error.log;
595 601
596 602 ssl on;
597 603 ssl_certificate your.kallithea.server.crt;
598 604 ssl_certificate_key your.kallithea.server.key;
599 605
600 606 ssl_session_timeout 5m;
601 607
602 608 ssl_protocols SSLv3 TLSv1;
603 609 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
604 610 ssl_prefer_server_ciphers on;
605 611
606 612 ## uncomment root directive if you want to serve static files by nginx
607 613 ## requires static_files = false in .ini file
608 614 #root /path/to/installation/kallithea/public;
609 615 include /etc/nginx/proxy.conf;
610 616 location / {
611 617 try_files $uri @kallithea;
612 618 }
613 619
614 620 location @kallithea {
615 621 proxy_pass http://kallithea;
616 622 }
617 623
618 624 }
619 625
620 626 Here's the proxy.conf. It's tuned so it will not timeout on long
621 627 pushes or large pushes::
622 628
623 629 proxy_redirect off;
624 630 proxy_set_header Host $host;
625 631 ## needed for container auth
626 632 #proxy_set_header REMOTE_USER $remote_user;
627 633 #proxy_set_header X-Forwarded-User $remote_user;
628 634 proxy_set_header X-Url-Scheme $scheme;
629 635 proxy_set_header X-Host $http_host;
630 636 proxy_set_header X-Real-IP $remote_addr;
631 637 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
632 638 proxy_set_header Proxy-host $proxy_host;
633 639 proxy_buffering off;
634 640 proxy_connect_timeout 7200;
635 641 proxy_send_timeout 7200;
636 642 proxy_read_timeout 7200;
637 643 proxy_buffers 8 32k;
638 644 client_max_body_size 1024m;
639 645 client_body_buffer_size 128k;
640 646 large_client_header_buffers 8 64k;
641 647
642 648
643 649 Apache virtual host reverse proxy example
644 650 -----------------------------------------
645 651
646 Here is a sample configuration file for apache using proxy::
652 Here is a sample configuration file for Apache using proxy:
653
654 .. code-block:: apache
647 655
648 656 <VirtualHost *:80>
649 657 ServerName hg.myserver.com
650 658 ServerAlias hg.myserver.com
651 659
652 660 <Proxy *>
653 Order allow,deny
654 Allow from all
661 # For Apache 2.4 and later:
662 Require all granted
663
664 # For Apache 2.2 and earlier, instead use:
665 # Order allow,deny
666 # Allow from all
655 667 </Proxy>
656 668
657 669 #important !
658 670 #Directive to properly generate url (clone url) for pylons
659 671 ProxyPreserveHost On
660 672
661 673 #kallithea instance
662 674 ProxyPass / http://127.0.0.1:5000/
663 675 ProxyPassReverse / http://127.0.0.1:5000/
664 676
665 677 #to enable https use line below
666 678 #SetEnvIf X-Url-Scheme https HTTPS=1
667
668 679 </VirtualHost>
669 680
670 681
671 682 Additional tutorial
672 683 http://pylonsbook.com/en/1.1/deployment.html#using-apache-to-proxy-requests-to-pylons
673 684
674 685
675 686 Apache as subdirectory
676 687 ----------------------
677 688
678 Apache subdirectory part::
689 Apache subdirectory part:
690
691 .. code-block:: apache
679 692
680 693 <Location /<someprefix> >
681 694 ProxyPass http://127.0.0.1:5000/<someprefix>
682 695 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
683 696 SetEnvIf X-Url-Scheme https HTTPS=1
684 697 </Location>
685 698
686 699 Besides the regular apache setup you will need to add the following line
687 700 into ``[app:main]`` section of your .ini file::
688 701
689 702 filter-with = proxy-prefix
690 703
691 704 Add the following at the end of the .ini file::
692 705
693 706 [filter:proxy-prefix]
694 707 use = egg:PasteDeploy#prefix
695 708 prefix = /<someprefix>
696 709
697 710
698 711 then change ``<someprefix>`` into your chosen prefix
699 712
700 Apache's WSGI config
713 Apache with mod_wsgi
701 714 --------------------
702 715
703 716 Alternatively, Kallithea can be set up with Apache under mod_wsgi. For
704 717 that, you'll need to:
705 718
706 719 - Install mod_wsgi. If using a Debian-based distro, you can install
707 720 the package libapache2-mod-wsgi::
708 721
709 722 aptitude install libapache2-mod-wsgi
710 723
711 724 - Enable mod_wsgi::
712 725
713 726 a2enmod wsgi
714 727
715 728 - Create a wsgi dispatch script, like the one below. Make sure you
716 729 check that the paths correctly point to where you installed Kallithea
717 730 and its Python Virtual Environment.
718 731 - Enable the ``WSGIScriptAlias`` directive for the WSGI dispatch script,
719 732 as in the following example. Once again, check the paths are
720 733 correctly specified.
721 734
722 Here is a sample excerpt from an Apache Virtual Host configuration file::
735 Here is a sample excerpt from an Apache Virtual Host configuration file:
736
737
738 .. code-block:: apache
723 739
724 740 WSGIDaemonProcess kallithea \
725 741 processes=1 threads=4 \
726 742 python-path=/srv/kallithea/pyenv/lib/python2.7/site-packages
727 743 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
728 744 WSGIPassAuthorization On
729 745
730 Or if using a dispatcher WSGI script with proper virtualenv activation::
746 Or if using a dispatcher WSGI script with proper virtualenv activation:
747
748 .. code-block:: apache
731 749
732 750 WSGIDaemonProcess kallithea processes=1 threads=4
733 751 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
734 752 WSGIPassAuthorization On
735 753
736 754
737 755 .. note::
738 756 When running apache as root, please make sure it doesn't run Kallithea as
739 757 root, for examply by adding: ``user=www-data group=www-data`` to the configuration.
740 758
741 759 .. note::
742 760 If running Kallithea in multiprocess mode,
743 761 make sure you set ``instance_id = *`` in the configuration so each process
744 762 gets it's own cache invalidation key.
745 763
746 764
747 Example WSGI dispatch script::
765 Example WSGI dispatch script:
766
767 .. code-block:: python
748 768
749 769 import os
750 770 os.environ["HGENCODING"] = "UTF-8"
751 771 os.environ['PYTHON_EGG_CACHE'] = '/srv/kallithea/.egg-cache'
752 772
753 773 # sometimes it's needed to set the curent dir
754 774 os.chdir('/srv/kallithea/')
755 775
756 776 import site
757 777 site.addsitedir("/srv/kallithea/pyenv/lib/python2.7/site-packages")
758 778
759 779 from paste.deploy import loadapp
760 780 from paste.script.util.logging_config import fileConfig
761 781
762 782 fileConfig('/srv/kallithea/my.ini')
763 783 application = loadapp('config:/srv/kallithea/my.ini')
764 784
765 Or using proper virtualenv activation::
785 Or using proper virtualenv activation:
786
787 .. code-block:: python
766 788
767 789 activate_this = '/srv/kallithea/venv/bin/activate_this.py'
768 790 execfile(activate_this,dict(__file__=activate_this))
769 791
770 792 import os
771 793 os.environ['HOME'] = '/srv/kallithea'
772 794
773 795 ini = '/srv/kallithea/kallithea.ini'
774 796 from paste.script.util.logging_config import fileConfig
775 797 fileConfig(ini)
776 798 from paste.deploy import loadapp
777 799 application = loadapp('config:' + ini)
778 800
779 801
780 802 Other configuration files
781 803 -------------------------
782 804
783 Some example init.d scripts can be found in the ``init.d`` directory:
784 https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
805 A number of `example init.d scripts`__ can be found in
806 the ``init.d`` directory of the Kallithea source.
807
808 .. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
785 809
786 810 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
787 811 .. _python: http://www.python.org/
788 812 .. _Mercurial: http://mercurial.selenic.com/
789 813 .. _Celery: http://celeryproject.org/
790 814 .. _Celery documentation: http://docs.celeryproject.org/en/latest/getting-started/index.html
791 815 .. _RabbitMQ: http://www.rabbitmq.com/
792 816 .. _Redis: http://redis.io/
793 817 .. _python-ldap: http://www.python-ldap.org/
794 818 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
795 819 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
@@ -1,178 +1,181 b''
1 1 .. _general:
2 2
3 3 =======================
4 4 General Kallithea usage
5 5 =======================
6 6
7 7
8 Repository deleting
8 Repository deletion
9 9 -------------------
10 10
11 11 Currently when an admin or owner deletes a repository, Kallithea does
12 12 not physically delete said repository from the filesystem, but instead
13 13 renames it in a special way so that it is not possible to push, clone
14 14 or access the repository.
15 15
16 There is a special command for cleaning up such archived repos::
16 There is a special command for cleaning up such archived repositories::
17 17
18 18 paster cleanup-repos --older-than=30d my.ini
19 19
20 20 This command scans for archived repositories that are older than
21 21 30 days, displays them, and asks if you want to delete them (unless given
22 22 the ``--dont-ask`` flag). If you host a large amount of repositories with
23 23 forks that are constantly being deleted, it is recommended that you run this
24 24 command via crontab.
25 25
26 26 It is worth noting that even if someone is given administrative access to
27 27 Kallithea and deletes a repository, you can easily restore such an action by
28 28 renaming the repository directory, removing the ``rm__<date>`` prefix.
29 29
30 30 File view: follow current branch
31 31 --------------------------------
32 32
33 33 In the file view, left and right arrows allow to jump to the previous and next
34 34 revision. Depending on the way revisions were created in the repository, this
35 35 could jump to a different branch. When the checkbox ``Follow current branch``
36 36 is checked, these arrows will only jump to revisions on the same branch as the
37 37 currently visible revision. So for example, if someone is viewing files in the
38 38 ``beta`` branch and marks the `Follow current branch` checkbox, the < and >
39 39 arrows will only show revisions on the ``beta`` branch.
40 40
41 41
42 42 Changelog features
43 43 ------------------
44 44
45 45 The core feature of a repository's ``changelog`` page is to show the revisions
46 46 in a repository. However, there are several other features available from the
47 47 changelog.
48 48
49 49 Branch filter
50 50 By default, the changelog shows revisions from all branches in the
51 51 repository. Use the branch filter to restrict to a given branch.
52 52
53 53 Viewing a changeset
54 54 A particular changeset can be opened by clicking on either the changeset
55 55 hash or the commit message, or by ticking the checkbox and clicking the
56 56 ``Show selected changeset`` button at the top.
57 57
58 58 Viewing all changes between two changesets
59 59 To get a list of all changesets between two selected changesets, along with
60 60 the changes in each one of them, tick the checkboxes of the first and
61 61 last changeset in the desired range and click the ``Show selected changesets``
62 62 button at the top. You can only show the range between the first and last
63 63 checkbox (no cherry-picking).
64 64
65 65 From that page, you can proceed to viewing the overall delta between the
66 66 selected changesets, by clicking the ``Compare revisions`` button.
67 67
68 68 Creating a pull request
69 69 You can create a new pull request for the changes of a particular changeset
70 70 (and its ancestors) by selecting it and clicking the ``Open new pull request
71 71 for selected changesets`` button.
72 72
73
73 74 Permanent repository URLs
74 75 -------------------------
75 76
76 77 Due to the complicated nature of repository grouping, URLs of repositories
77 78 can often change. For example, a repository originally accessible from::
78 79
79 http://server.com/repo_name
80 http://example.com/repo_name
80 81
81 82 would get a new URL after moving it to test_group::
82 83
83 http://server.com/test_group/repo_name
84 http://example.com/test_group/repo_name
84 85
85 86 Such moving of a repository to a group can be an issue for build systems and
86 87 other scripts where the repository paths are hardcoded. To mitigate this,
87 88 Kallithea provides permanent URLs using the repository ID prefixed with an
88 89 underscore. In all Kallithea URLs, for example those for the changelog and the
89 90 file view, a repository name can be replaced by this ``_ID`` string. Since IDs
90 91 are always the same, moving the repository to a different group will not affect
91 92 such URLs.
92 93
93 94 In the example, the repository could also be accessible as::
94 95
95 http://server.com/_<ID>
96 http://example.com/_<ID>
96 97
97 98 The ID of a given repository can be shown from the repository ``Summary`` page,
98 99 by selecting the ``Show by ID`` button next to ``Clone URL``.
99 100
101
100 102 Email notifications
101 103 -------------------
102 104
103 When the administrator correctly specified the email settings in the Kallithea
105 With email settings properly configured in the Kallithea
104 106 configuration file, Kallithea will send emails on user registration and when
105 107 errors occur.
106 108
107 109 Emails are also sent for comments on changesets. In this case, an email is sent
108 110 to the committer of the changeset (if known to Kallithea), to all reviewers of
109 111 the pull request (if applicable) and to all people mentioned in the comment
110 112 using @mention notation.
111 113
112 114
113 115 Trending source files
114 116 ---------------------
115 117
116 118 Trending source files are calculated based on a predefined dictionary of known
117 119 types and extensions. If an extension is missing or you would like to scan
118 120 custom files, it is possible to extend the ``LANGUAGES_EXTENSIONS_MAP``
119 121 dictionary located in ``kallithea/config/conf.py`` with new types.
120 122
121 123
122 124 Cloning remote repositories
123 125 ---------------------------
124 126
125 127 Kallithea has the ability to clone repositories from given remote locations.
126 128 Currently it supports the following options:
127 129
128 130 - hg -> hg clone
129 131 - svn -> hg clone
130 132 - git -> git clone
131 133
132 134
133 135 .. note:: svn -> hg cloning requires the ``hgsubversion`` library to be
134 136 installed.
135 137
136 138 If you need to clone repositories that are protected via basic authentication,
137 139 you can pass the credentials in the URL, e.g.
138 140 ``http://user:passw@remote.server/repo``. Kallithea will then try to login and
139 141 clone using the given credentials. Please note that the given credentials will
140 142 be stored as plaintext inside the database. However, the authentication
141 143 information will not be shown in the clone URL on the summary page.
142 144
143 145
144 146 Specific features configurable in the Admin settings
145 147 ----------------------------------------------------
146 148
147 149 In general, the Admin settings should be self-explanatory and will not be
148 150 described in more detail in this documentation. However, there are a few
149 151 features that merit further explanation.
150 152
151 153 Repository extra fields
152 154 ~~~~~~~~~~~~~~~~~~~~~~~
153 155
154 In the `Visual` tab, there is an option `Use repository extra
155 fields`, which allows to set custom fields for each repository in the system.
156 Each new field consists of 3 attributes: ``field key``, ``field label``,
157 ``field description``.
156 In the *Visual* tab, there is an option "Use repository extra
157 fields", which allows to set custom fields for each repository in the system.
158
159 Once enabled site-wide, the custom fields can be edited per-repository under
160 *Options* | *Settings* | *Extra Fields*.
158 161
159 162 Example usage of such fields would be to define company-specific information
160 163 into repositories, e.g., defining a ``repo_manager`` key that would give info
161 164 about a manager of each repository. There's no limit for adding custom fields.
162 165 Newly created fields are accessible via the API.
163 166
164 167 Meta tagging
165 168 ~~~~~~~~~~~~
166 169
167 In the `Visual` tab, option `Stylify recognised meta tags` will cause Kallithea
168 to turn certain meta-tags, detected in repository and repository group
169 descriptions, into colored tags. Currently recognised tags are::
170 In the *Visual* tab, option "Stylify recognised meta tags" will cause Kallithea
171 to turn certain text fragments in repository and repository group
172 descriptions into colored tags. Currently recognised tags are::
170 173
171 174 [featured]
172 175 [stale]
173 176 [dead]
174 177 [lang => lang]
175 178 [license => License]
176 179 [requires => Repo]
177 180 [recommends => Repo]
178 181 [see => URI]
@@ -1,28 +1,28 b''
1 1 .. _locking:
2 2
3 3 ==================
4 4 Repository locking
5 5 ==================
6 6
7 Kallithea has a ``repository locking`` feature, disabled by default. When
7 Kallithea has a *repository locking* feature, disabled by default. When
8 8 enabled, every initial clone and every pull gives users (with write permission)
9 9 the exclusive right to do a push.
10 10
11 When repository locking is enabled, repositories get a ``locked`` state that
12 can be true or false. The hg/git commands ``hg/git clone``, ``hg/git pull``,
11 When repository locking is enabled, repositories get a ``locked`` flag.
12 The hg/git commands ``hg/git clone``, ``hg/git pull``,
13 13 and ``hg/git push`` influence this state:
14 14
15 - A ``clone`` or ``pull`` action on the repository locks it (``locked=true``)
15 - A ``clone`` or ``pull`` action locks the target repository
16 16 if the user has write/admin permissions on this repository.
17 17
18 18 - Kallithea will remember the user who locked the repository so only this
19 specific user can unlock the repo (``locked=false``) by performing a ``push``
19 specific user can unlock the repo by performing a ``push``
20 20 command.
21 21
22 22 - Every other command on a locked repository from this user and every command
23 23 from any other user will result in an HTTP return code 423 (Locked).
24 Additionally, the HTTP error includes the <user> that locked the repository
24 Additionally, the HTTP error will mention the user that locked the repository
25 25 (e.g., “repository <repo> locked by user <user>”).
26 26
27 27 Each repository can be manually unlocked by an administrator from the
28 28 repository settings menu.
@@ -1,57 +1,57 b''
1 1 .. _performance:
2 2
3 3 ================================
4 4 Optimizing Kallithea performance
5 5 ================================
6 6
7 7 When serving a large amount of big repositories, Kallithea can start
8 8 performing slower than expected. Because of the demanding nature of handling large
9 9 amounts of data from version control systems, here are some tips on how to get
10 10 the best performance.
11 11
12 * Kallithea will perform better on machines with faster disks (SSD/SAN). It's
13 more important to have a faster disk than a faster CPU.
12 * Kallithea is often I/O bound, and hence a fast disk (SSD/SAN) is
13 usually more important than a fast CPU.
14 14
15 * Slowness on initial page can be easily fixed by grouping repositories, and/or
15 * Sluggish loading of the front page can easily be fixed by grouping repositories or by
16 16 increasing cache size (see below). This includes using the lightweight dashboard
17 option and ``vcs_full_cache`` setting in .ini file
17 option and ``vcs_full_cache`` setting in .ini file.
18 18
19 19
20 20 Follow these few steps to improve performance of Kallithea system.
21 21
22 22
23 23 1. Increase cache
24 24
25 25 Tweak beaker cache settings in the ini file. The actual effect of that
26 26 is questionable.
27 27
28 2. Switch from sqlite to postgres or mysql
28 2. Switch from SQLite to PostgreSQL or MySQL
29 29
30 sqlite is a good option when having a small load on the system. But due to
31 locking issues with sqlite, it is not recommended to use it for larger
32 deployments. Switching to mysql or postgres will result in an immediate
30 SQLite is a good option when having a small load on the system. But due to
31 locking issues with SQLite, it is not recommended to use it for larger
32 deployments. Switching to MySQL or PostgreSQL will result in an immediate
33 33 performance increase. A tool like SQLAlchemyGrate_ can be used for
34 34 migrating to another database platform.
35 35
36 36 3. Scale Kallithea horizontally
37 37
38 Scaling horizontally can give huge performance increases when dealing with
39 large traffic (large amount of users, CI servers etc). Kallithea can be
38 Scaling horizontally can give huge performance benefits when dealing with
39 large amounts of traffic (many users, CI servers, etc.). Kallithea can be
40 40 scaled horizontally on one (recommended) or multiple machines. In order
41 41 to scale horizontally you need to do the following:
42 42
43 43 - Each instance needs its own .ini file and unique ``instance_id`` set.
44 44 - Each instance's ``data`` storage needs to be configured to be stored on a
45 45 shared disk storage, preferably together with repositories. This ``data``
46 46 dir contains template caches, sessions, whoosh index and is used for
47 47 task locking (so it is safe across multiple instances). Set the
48 48 ``cache_dir``, ``index_dir``, ``beaker.cache.data_dir``, ``beaker.cache.lock_dir``
49 49 variables in each .ini file to a shared location across Kallithea instances
50 50 - If celery is used each instance should run a separate Celery instance, but
51 51 the message broker should be common to all of them (e.g., one
52 52 shared RabbitMQ server)
53 53 - Load balance using round robin or IP hash, recommended is writing LB rules
54 54 that will separate regular user traffic from automated processes like CI
55 55 servers or build bots.
56 56
57 57 .. _SQLAlchemyGrate: https://github.com/shazow/sqlalchemygrate
@@ -1,31 +1,31 b''
1 1 .. _statistics:
2 2
3 3 =====================
4 4 Repository statistics
5 5 =====================
6 6
7 Kallithea has a ``repository statistics`` feature, disabled by default. When
7 Kallithea has a *repository statistics* feature, disabled by default. When
8 8 enabled, the amount of commits per committer is visualized in a timeline. This
9 9 feature can be enabled using the ``Enable statistics`` checkbox on the
10 10 repository ``Settings`` page.
11 11
12 12 The statistics system makes heavy demands on the server resources, so
13 13 in order to keep a balance between usability and performance, statistics are
14 14 cached inside the database and gathered incrementally.
15 15
16 16 When Celery is disabled:
17 17
18 18 On each first visit to the summary page a set of 250 commits are parsed and
19 19 added to the statistics cache. This incremental gathering also happens on each
20 20 visit to the statistics page, until all commits are fetched.
21 21
22 22 Statistics are kept cached until additional commits are added to the
23 23 repository. In such a case Kallithea will only fetch the new commits when
24 24 updating its statistics cache.
25 25
26 26 When Celery is enabled:
27 27
28 28 On the first visit to the summary page, Kallithea will create tasks that will
29 29 execute on Celery workers. These tasks will gather all of the statistics until
30 30 all commits are parsed. Each task parses 250 commits, then launches a new
31 31 task.
@@ -1,75 +1,76 b''
1 1 .. _troubleshooting:
2 2
3
3 4 ===============
4 5 Troubleshooting
5 6 ===============
6 7
7 8 :Q: **Missing static files?**
8 9 :A: Make sure either to set the ``static_files = true`` in the .ini file or
9 10 double check the root path for your http setup. It should point to
10 11 for example:
11 12 ``/home/my-virtual-python/lib/python2.7/site-packages/kallithea/public``
12 13
13 14 |
14 15
15 16 :Q: **Can't install celery/rabbitmq?**
16 17 :A: Don't worry. Kallithea works without them, too. No extra setup is required.
17 18 Try out the great Celery docs for further help.
18 19
19 20 |
20 21
21 22 :Q: **Long lasting push timeouts?**
22 23 :A: Make sure you set a longer timeout in your proxy/fcgi settings. Timeouts
23 24 are caused by the http server and not Kallithea.
24 25
25 26 |
26 27
27 28 :Q: **Large pushes timeouts?**
28 29 :A: Make sure you set a proper ``max_body_size`` for the http server. Very often
29 30 Apache, Nginx, or other http servers kill the connection due to to large
30 31 body.
31 32
32 33 |
33 34
34 35 :Q: **Apache doesn't pass basicAuth on pull/push?**
35 36 :A: Make sure you added ``WSGIPassAuthorization true``.
36 37
37 38 |
38 39
39 40 :Q: **Git fails on push/pull?**
40 41 :A: Make sure you're using a WSGI http server that can handle chunked encoding
41 42 such as ``waitress`` or ``gunicorn``.
42 43
43 44 |
44 45
45 46 :Q: **How can I use hooks in Kallithea?**
46 47 :A: It's easy if they are Python hooks: just use advanced link in
47 48 hooks section in Admin panel, that works only for Mercurial. If
48 49 you want to use Git hooks, just install th proper one in the repository,
49 50 e.g., create a file `/gitrepo/hooks/pre-receive`. You can also use
50 51 Kallithea-extensions to connect to callback hooks, for both Git
51 52 and Mercurial.
52 53
53 54 |
54 55
55 56 :Q: **Kallithea is slow for me, how can I make it faster?**
56 57 :A: See the :ref:`performance` section.
57 58
58 59 |
59 60
60 61 :Q: **UnicodeDecodeError on Apache mod_wsgi**
61 62 :A: Please read: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#if-you-get-a-unicodeencodeerror.
62 63
63 64 |
64 65
65 66 :Q: **Requests hanging on Windows**
66 67 :A: Please try out with disabled Antivirus software, there are some known problems with Eset Anitivirus. Make sure
67 68 you have installed the latest Windows patches (especially KB2789397).
68 69
69 70
70 71 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
71 72 .. _python: http://www.python.org/
72 73 .. _mercurial: http://mercurial.selenic.com/
73 74 .. _celery: http://celeryproject.org/
74 75 .. _rabbitmq: http://www.rabbitmq.com/
75 76 .. _python-ldap: http://www.python-ldap.org/
General Comments 0
You need to be logged in to leave comments. Login now