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