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