|
@@
-1,599
+1,599
b''
|
|
1
|
.. _setup:
|
|
1
|
.. _setup:
|
|
2
|
|
|
2
|
|
|
3
|
=====
|
|
3
|
=====
|
|
4
|
Setup
|
|
4
|
Setup
|
|
5
|
=====
|
|
5
|
=====
|
|
6
|
|
|
6
|
|
|
7
|
|
|
7
|
|
|
8
|
Preparing front-end
|
|
8
|
Preparing front-end
|
|
9
|
-------------------
|
|
9
|
-------------------
|
|
10
|
|
|
10
|
|
|
11
|
Temporarily, in the current Kallithea version, some extra steps are required to
|
|
11
|
Temporarily, in the current Kallithea version, some extra steps are required to
|
|
12
|
build front-end files:
|
|
12
|
build front-end files:
|
|
13
|
|
|
13
|
|
|
14
|
Find the right ``kallithea/public/less`` path with::
|
|
14
|
Find the right ``kallithea/public/less`` path with::
|
|
15
|
|
|
15
|
|
|
16
|
python -c "import os, kallithea; print os.path.join(os.path.dirname(os.path.abspath(kallithea.__file__)), 'public', 'less')"
|
|
16
|
python -c "import os, kallithea; print os.path.join(os.path.dirname(os.path.abspath(kallithea.__file__)), 'public', 'less')"
|
|
17
|
|
|
17
|
|
|
18
|
Then run::
|
|
18
|
Then run::
|
|
19
|
|
|
19
|
|
|
20
|
npm install
|
|
20
|
npm install
|
|
21
|
npm run less
|
|
21
|
npm run less
|
|
22
|
|
|
22
|
|
|
23
|
|
|
23
|
|
|
24
|
Setting up Kallithea
|
|
24
|
Setting up Kallithea
|
|
25
|
--------------------
|
|
25
|
--------------------
|
|
26
|
|
|
26
|
|
|
27
|
First, you will need to create a Kallithea configuration file. Run the
|
|
27
|
First, you will need to create a Kallithea configuration file. Run the
|
|
28
|
following command to do so::
|
|
28
|
following command to do so::
|
|
29
|
|
|
29
|
|
|
30
|
kallithea-cli config-create my.ini
|
|
30
|
kallithea-cli config-create my.ini
|
|
31
|
|
|
31
|
|
|
32
|
This will create the file ``my.ini`` in the current directory. This
|
|
32
|
This will create the file ``my.ini`` in the current directory. This
|
|
33
|
configuration file contains the various settings for Kallithea, e.g.
|
|
33
|
configuration file contains the various settings for Kallithea, e.g.
|
|
34
|
proxy port, email settings, usage of static files, cache, Celery
|
|
34
|
proxy port, email settings, usage of static files, cache, Celery
|
|
35
|
settings, and logging. Extra settings can be specified like::
|
|
35
|
settings, and logging. Extra settings can be specified like::
|
|
36
|
|
|
36
|
|
|
37
|
kallithea-cli config-create my.ini host=8.8.8.8 "[handler_console]" formatter=color_formatter
|
|
37
|
kallithea-cli config-create my.ini host=8.8.8.8 "[handler_console]" formatter=color_formatter
|
|
38
|
|
|
38
|
|
|
39
|
Next, you need to create the databases used by Kallithea. It is recommended to
|
|
39
|
Next, you need to create the databases used by Kallithea. It is recommended to
|
|
40
|
use PostgreSQL or SQLite (default). If you choose a database other than the
|
|
40
|
use PostgreSQL or SQLite (default). If you choose a database other than the
|
|
41
|
default, ensure you properly adjust the database URL in your ``my.ini``
|
|
41
|
default, ensure you properly adjust the database URL in your ``my.ini``
|
|
42
|
configuration file to use this other database. Kallithea currently supports
|
|
42
|
configuration file to use this other database. Kallithea currently supports
|
|
43
|
PostgreSQL, SQLite and MySQL databases. Create the database by running
|
|
43
|
PostgreSQL, SQLite and MySQL databases. Create the database by running
|
|
44
|
the following command::
|
|
44
|
the following command::
|
|
45
|
|
|
45
|
|
|
46
|
kallithea-cli db-create -c my.ini
|
|
46
|
kallithea-cli db-create -c my.ini
|
|
47
|
|
|
47
|
|
|
48
|
This will prompt you for a "root" path. This "root" path is the location where
|
|
48
|
This will prompt you for a "root" path. This "root" path is the location where
|
|
49
|
Kallithea will store all of its repositories on the current machine. After
|
|
49
|
Kallithea will store all of its repositories on the current machine. After
|
|
50
|
entering this "root" path ``db-create`` will also prompt you for a username
|
|
50
|
entering this "root" path ``db-create`` will also prompt you for a username
|
|
51
|
and password for the initial admin account which ``db-create`` sets
|
|
51
|
and password for the initial admin account which ``db-create`` sets
|
|
52
|
up for you.
|
|
52
|
up for you.
|
|
53
|
|
|
53
|
|
|
54
|
The ``db-create`` values can also be given on the command line.
|
|
54
|
The ``db-create`` values can also be given on the command line.
|
|
55
|
Example::
|
|
55
|
Example::
|
|
56
|
|
|
56
|
|
|
57
|
kallithea-cli db-create -c my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos
|
|
57
|
kallithea-cli db-create -c my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos
|
|
58
|
|
|
58
|
|
|
59
|
The ``db-create`` command will create all needed tables and an
|
|
59
|
The ``db-create`` command will create all needed tables and an
|
|
60
|
admin account. When choosing a root path you can either use a new
|
|
60
|
admin account. When choosing a root path you can either use a new
|
|
61
|
empty location, or a location which already contains existing
|
|
61
|
empty location, or a location which already contains existing
|
|
62
|
repositories. If you choose a location which contains existing
|
|
62
|
repositories. If you choose a location which contains existing
|
|
63
|
repositories Kallithea will add all of the repositories at the chosen
|
|
63
|
repositories Kallithea will add all of the repositories at the chosen
|
|
64
|
location to its database. (Note: make sure you specify the correct
|
|
64
|
location to its database. (Note: make sure you specify the correct
|
|
65
|
path to the root).
|
|
65
|
path to the root).
|
|
66
|
|
|
66
|
|
|
67
|
.. note:: the given path for Mercurial_ repositories **must** be write
|
|
67
|
.. note:: the given path for Mercurial_ repositories **must** be write
|
|
68
|
accessible for the application. It's very important since
|
|
68
|
accessible for the application. It's very important since
|
|
69
|
the Kallithea web interface will work without write access,
|
|
69
|
the Kallithea web interface will work without write access,
|
|
70
|
but when trying to do a push it will fail with permission
|
|
70
|
but when trying to do a push it will fail with permission
|
|
71
|
denied errors unless it has write access.
|
|
71
|
denied errors unless it has write access.
|
|
72
|
|
|
72
|
|
|
73
|
You are now ready to use Kallithea. To run it simply execute::
|
|
73
|
You are now ready to use Kallithea. To run it simply execute::
|
|
74
|
|
|
74
|
|
|
75
|
gearbox serve -c my.ini
|
|
75
|
gearbox serve -c my.ini
|
|
76
|
|
|
76
|
|
|
77
|
- This command runs the Kallithea server. The web app should be available at
|
|
77
|
- This command runs the Kallithea server. The web app should be available at
|
|
78
|
http://127.0.0.1:5000. The IP address and port is configurable via the
|
|
78
|
http://127.0.0.1:5000. The IP address and port is configurable via the
|
|
79
|
configuration file created in the previous step.
|
|
79
|
configuration file created in the previous step.
|
|
80
|
- Log in to Kallithea using the admin account created when running ``db-create``.
|
|
80
|
- Log in to Kallithea using the admin account created when running ``db-create``.
|
|
81
|
- The default permissions on each repository is read, and the owner is admin.
|
|
81
|
- The default permissions on each repository is read, and the owner is admin.
|
|
82
|
Remember to update these if needed.
|
|
82
|
Remember to update these if needed.
|
|
83
|
- In the admin panel you can toggle LDAP, anonymous, and permissions
|
|
83
|
- In the admin panel you can toggle LDAP, anonymous, and permissions
|
|
84
|
settings, as well as edit more advanced options on users and
|
|
84
|
settings, as well as edit more advanced options on users and
|
|
85
|
repositories.
|
|
85
|
repositories.
|
|
86
|
|
|
86
|
|
|
87
|
|
|
87
|
|
|
88
|
Internationalization (i18n support)
|
|
88
|
Internationalization (i18n support)
|
|
89
|
-----------------------------------
|
|
89
|
-----------------------------------
|
|
90
|
|
|
90
|
|
|
91
|
The Kallithea web interface is automatically displayed in the user's preferred
|
|
91
|
The Kallithea web interface is automatically displayed in the user's preferred
|
|
92
|
language, as indicated by the browser. Thus, different users may see the
|
|
92
|
language, as indicated by the browser. Thus, different users may see the
|
|
93
|
application in different languages. If the requested language is not available
|
|
93
|
application in different languages. If the requested language is not available
|
|
94
|
(because the translation file for that language does not yet exist or is
|
|
94
|
(because the translation file for that language does not yet exist or is
|
|
95
|
incomplete), the language specified in setting ``i18n.lang`` in the Kallithea
|
|
95
|
incomplete), the language specified in setting ``i18n.lang`` in the Kallithea
|
|
96
|
configuration file is used as fallback. If no fallback language is explicitly
|
|
96
|
configuration file is used as fallback. If no fallback language is explicitly
|
|
97
|
specified, English is used.
|
|
97
|
specified, English is used.
|
|
98
|
|
|
98
|
|
|
99
|
If you want to disable automatic language detection and instead configure a
|
|
99
|
If you want to disable automatic language detection and instead configure a
|
|
100
|
fixed language regardless of user preference, set ``i18n.enabled = false`` and
|
|
100
|
fixed language regardless of user preference, set ``i18n.enabled = false`` and
|
|
101
|
set ``i18n.lang`` to the desired language (or leave empty for English).
|
|
101
|
set ``i18n.lang`` to the desired language (or leave empty for English).
|
|
102
|
|
|
102
|
|
|
103
|
|
|
103
|
|
|
104
|
Using Kallithea with SSH
|
|
104
|
Using Kallithea with SSH
|
|
105
|
------------------------
|
|
105
|
------------------------
|
|
106
|
|
|
106
|
|
|
107
|
Kallithea currently only hosts repositories using http and https. (The addition
|
|
107
|
Kallithea currently only hosts repositories using http and https. (The addition
|
|
108
|
of ssh hosting is a planned future feature.) However you can easily use ssh in
|
|
108
|
of ssh hosting is a planned future feature.) However you can easily use ssh in
|
|
109
|
parallel with Kallithea. (Repository access via ssh is a standard "out of
|
|
109
|
parallel with Kallithea. (Repository access via ssh is a standard "out of
|
|
110
|
the box" feature of Mercurial_ and you can use this to access any of the
|
|
110
|
the box" feature of Mercurial_ and you can use this to access any of the
|
|
111
|
repositories that Kallithea is hosting. See PublishingRepositories_)
|
|
111
|
repositories that Kallithea is hosting. See PublishingRepositories_)
|
|
112
|
|
|
112
|
|
|
113
|
Kallithea repository structures are kept in directories with the same name
|
|
113
|
Kallithea repository structures are kept in directories with the same name
|
|
114
|
as the project. When using repository groups, each group is a subdirectory.
|
|
114
|
as the project. When using repository groups, each group is a subdirectory.
|
|
115
|
This allows you to easily use ssh for accessing repositories.
|
|
115
|
This allows you to easily use ssh for accessing repositories.
|
|
116
|
|
|
116
|
|
|
117
|
In order to use ssh you need to make sure that your web server and the users'
|
|
117
|
In order to use ssh you need to make sure that your web server and the users'
|
|
118
|
login accounts have the correct permissions set on the appropriate directories.
|
|
118
|
login accounts have the correct permissions set on the appropriate directories.
|
|
119
|
|
|
119
|
|
|
120
|
.. note:: These permissions are independent of any permissions you
|
|
120
|
.. note:: These permissions are independent of any permissions you
|
|
121
|
have set up using the Kallithea web interface.
|
|
121
|
have set up using the Kallithea web interface.
|
|
122
|
|
|
122
|
|
|
123
|
If your main directory (the same as set in Kallithea settings) is for
|
|
123
|
If your main directory (the same as set in Kallithea settings) is for
|
|
124
|
example set to ``/srv/repos`` and the repository you are using is
|
|
124
|
example set to ``/srv/repos`` and the repository you are using is
|
|
125
|
named ``kallithea``, then to clone via ssh you should run::
|
|
125
|
named ``kallithea``, then to clone via ssh you should run::
|
|
126
|
|
|
126
|
|
|
127
|
hg clone ssh://user@kallithea.example.com/srv/repos/kallithea
|
|
127
|
hg clone ssh://user@kallithea.example.com/srv/repos/kallithea
|
|
128
|
|
|
128
|
|
|
129
|
Using other external tools such as mercurial-server_ or using ssh key-based
|
|
129
|
Using other external tools such as mercurial-server_ or using ssh key-based
|
|
130
|
authentication is fully supported.
|
|
130
|
authentication is fully supported.
|
|
131
|
|
|
131
|
|
|
132
|
.. note:: In an advanced setup, in order for your ssh access to use
|
|
132
|
.. note:: In an advanced setup, in order for your ssh access to use
|
|
133
|
the same permissions as set up via the Kallithea web
|
|
133
|
the same permissions as set up via the Kallithea web
|
|
134
|
interface, you can create an authentication hook to connect
|
|
134
|
interface, you can create an authentication hook to connect
|
|
135
|
to the Kallithea db and run check functions for permissions
|
|
135
|
to the Kallithea db and run check functions for permissions
|
|
136
|
against that.
|
|
136
|
against that.
|
|
137
|
|
|
137
|
|
|
138
|
|
|
138
|
|
|
139
|
Setting up Whoosh full text search
|
|
139
|
Setting up Whoosh full text search
|
|
140
|
----------------------------------
|
|
140
|
----------------------------------
|
|
141
|
|
|
141
|
|
|
142
|
Kallithea provides full text search of repositories using `Whoosh`__.
|
|
142
|
Kallithea provides full text search of repositories using `Whoosh`__.
|
|
143
|
|
|
143
|
|
|
144
|
.. __: https://whoosh.readthedocs.io/en/latest/
|
|
144
|
.. __: https://whoosh.readthedocs.io/en/latest/
|
|
145
|
|
|
145
|
|
|
146
|
For an incremental index build, run::
|
|
146
|
For an incremental index build, run::
|
|
147
|
|
|
147
|
|
|
148
|
kallithea-cli index-create -c my.ini
|
|
148
|
kallithea-cli index-create -c my.ini
|
|
149
|
|
|
149
|
|
|
150
|
For a full index rebuild, run::
|
|
150
|
For a full index rebuild, run::
|
|
151
|
|
|
151
|
|
|
152
|
kallithea-cli index-create -c my.ini --full
|
|
152
|
kallithea-cli index-create -c my.ini --full
|
|
153
|
|
|
153
|
|
|
154
|
The ``--repo-location`` option allows the location of the repositories to be overridden;
|
|
154
|
The ``--repo-location`` option allows the location of the repositories to be overridden;
|
|
155
|
usually, the location is retrieved from the Kallithea database.
|
|
155
|
usually, the location is retrieved from the Kallithea database.
|
|
156
|
|
|
156
|
|
|
157
|
The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
|
|
157
|
The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
|
|
158
|
|
|
158
|
|
|
159
|
kallithea-cli index-create -c my.ini --index-only=vcs,kallithea
|
|
159
|
kallithea-cli index-create -c my.ini --index-only=vcs,kallithea
|
|
160
|
|
|
160
|
|
|
161
|
To keep your index up-to-date it is necessary to do periodic index builds;
|
|
161
|
To keep your index up-to-date it is necessary to do periodic index builds;
|
|
162
|
for this, it is recommended to use a crontab entry. Example::
|
|
162
|
for this, it is recommended to use a crontab entry. Example::
|
|
163
|
|
|
163
|
|
|
164
|
0 3 * * * /path/to/virtualenv/bin/kallithea-cli index-create -c /path/to/kallithea/my.ini
|
|
164
|
0 3 * * * /path/to/virtualenv/bin/kallithea-cli index-create -c /path/to/kallithea/my.ini
|
|
165
|
|
|
165
|
|
|
166
|
When using incremental mode (the default), Whoosh will check the last
|
|
166
|
When using incremental mode (the default), Whoosh will check the last
|
|
167
|
modification date of each file and add it to be reindexed if a newer file is
|
|
167
|
modification date of each file and add it to be reindexed if a newer file is
|
|
168
|
available. The indexing daemon checks for any removed files and removes them
|
|
168
|
available. The indexing daemon checks for any removed files and removes them
|
|
169
|
from index.
|
|
169
|
from index.
|
|
170
|
|
|
170
|
|
|
171
|
If you want to rebuild the index from scratch, you can use the ``-f`` flag as above,
|
|
171
|
If you want to rebuild the index from scratch, you can use the ``-f`` flag as above,
|
|
172
|
or in the admin panel you can check the "build from scratch" checkbox.
|
|
172
|
or in the admin panel you can check the "build from scratch" checkbox.
|
|
173
|
|
|
173
|
|
|
174
|
|
|
174
|
|
|
175
|
Integration with issue trackers
|
|
175
|
Integration with issue trackers
|
|
176
|
-------------------------------
|
|
176
|
-------------------------------
|
|
177
|
|
|
177
|
|
|
178
|
Kallithea provides a simple integration with issue trackers. It's possible
|
|
178
|
Kallithea provides a simple integration with issue trackers. It's possible
|
|
179
|
to define a regular expression that will match an issue ID in commit messages,
|
|
179
|
to define a regular expression that will match an issue ID in commit messages,
|
|
180
|
and have that replaced with a URL to the issue.
|
|
180
|
and have that replaced with a URL to the issue.
|
|
181
|
|
|
181
|
|
|
182
|
This is achieved with following three variables in the ini file::
|
|
182
|
This is achieved with following three variables in the ini file::
|
|
183
|
|
|
183
|
|
|
184
|
issue_pat = #(\d+)
|
|
184
|
issue_pat = #(\d+)
|
|
185
|
issue_server_link = https://issues.example.com/{repo}/issue/\1
|
|
185
|
issue_server_link = https://issues.example.com/{repo}/issue/\1
|
|
186
|
issue_sub =
|
|
186
|
issue_sub =
|
|
187
|
|
|
187
|
|
|
188
|
``issue_pat`` is the regular expression describing which strings in
|
|
188
|
``issue_pat`` is the regular expression describing which strings in
|
|
189
|
commit messages will be treated as issue references. The expression can/should
|
|
189
|
commit messages will be treated as issue references. The expression can/should
|
|
190
|
have one or more parenthesized groups that can later be referred to in
|
|
190
|
have one or more parenthesized groups that can later be referred to in
|
|
191
|
``issue_server_link`` and ``issue_sub`` (see below). If you prefer, named groups
|
|
191
|
``issue_server_link`` and ``issue_sub`` (see below). If you prefer, named groups
|
|
192
|
can be used instead of simple parenthesized groups.
|
|
192
|
can be used instead of simple parenthesized groups.
|
|
193
|
|
|
193
|
|
|
194
|
If the pattern should only match if it is preceded by whitespace, add the
|
|
194
|
If the pattern should only match if it is preceded by whitespace, add the
|
|
195
|
following string before the actual pattern: ``(?:^|(?<=\s))``.
|
|
195
|
following string before the actual pattern: ``(?:^|(?<=\s))``.
|
|
196
|
If the pattern should only match if it is followed by whitespace, add the
|
|
196
|
If the pattern should only match if it is followed by whitespace, add the
|
|
197
|
following string after the actual pattern: ``(?:$|(?=\s))``.
|
|
197
|
following string after the actual pattern: ``(?:$|(?=\s))``.
|
|
198
|
These expressions use lookbehind and lookahead assertions of the Python regular
|
|
198
|
These expressions use lookbehind and lookahead assertions of the Python regular
|
|
199
|
expression module to avoid the whitespace to be part of the actual pattern,
|
|
199
|
expression module to avoid the whitespace to be part of the actual pattern,
|
|
200
|
otherwise the link text will also contain that whitespace.
|
|
200
|
otherwise the link text will also contain that whitespace.
|
|
201
|
|
|
201
|
|
|
202
|
Matched issue references are replaced with the link specified in
|
|
202
|
Matched issue references are replaced with the link specified in
|
|
203
|
``issue_server_link``, in which any backreferences are resolved. Backreferences
|
|
203
|
``issue_server_link``, in which any backreferences are resolved. Backreferences
|
|
204
|
can be ``\1``, ``\2``, ... or for named groups ``\g<groupname>``.
|
|
204
|
can be ``\1``, ``\2``, ... or for named groups ``\g<groupname>``.
|
|
205
|
The special token ``{repo}`` is replaced with the full repository path
|
|
205
|
The special token ``{repo}`` is replaced with the full repository path
|
|
206
|
(including repository groups), while token ``{repo_name}`` is replaced with the
|
|
206
|
(including repository groups), while token ``{repo_name}`` is replaced with the
|
|
207
|
repository name (without repository groups).
|
|
207
|
repository name (without repository groups).
|
|
208
|
|
|
208
|
|
|
209
|
The link text is determined by ``issue_sub``, which can be a string containing
|
|
209
|
The link text is determined by ``issue_sub``, which can be a string containing
|
|
210
|
backreferences to the groups specified in ``issue_pat``. If ``issue_sub`` is
|
|
210
|
backreferences to the groups specified in ``issue_pat``. If ``issue_sub`` is
|
|
211
|
empty, then the text matched by ``issue_pat`` is used verbatim.
|
|
211
|
empty, then the text matched by ``issue_pat`` is used verbatim.
|
|
212
|
|
|
212
|
|
|
213
|
The example settings shown above match issues in the format ``#<number>``.
|
|
213
|
The example settings shown above match issues in the format ``#<number>``.
|
|
214
|
This will cause the text ``#300`` to be transformed into a link:
|
|
214
|
This will cause the text ``#300`` to be transformed into a link:
|
|
215
|
|
|
215
|
|
|
216
|
.. code-block:: html
|
|
216
|
.. code-block:: html
|
|
217
|
|
|
217
|
|
|
218
|
<a href="https://issues.example.com/example_repo/issue/300">#300</a>
|
|
218
|
<a href="https://issues.example.com/example_repo/issue/300">#300</a>
|
|
219
|
|
|
219
|
|
|
220
|
The following example transforms a text starting with either of 'pullrequest',
|
|
220
|
The following example transforms a text starting with either of 'pullrequest',
|
|
221
|
'pull request' or 'PR', followed by an optional space, then a pound character
|
|
221
|
'pull request' or 'PR', followed by an optional space, then a pound character
|
|
222
|
(#) and one or more digits, into a link with the text 'PR #' followed by the
|
|
222
|
(#) and one or more digits, into a link with the text 'PR #' followed by the
|
|
223
|
digits::
|
|
223
|
digits::
|
|
224
|
|
|
224
|
|
|
225
|
issue_pat = (pullrequest|pull request|PR) ?#(\d+)
|
|
225
|
issue_pat = (pullrequest|pull request|PR) ?#(\d+)
|
|
226
|
issue_server_link = https://issues.example.com/\2
|
|
226
|
issue_server_link = https://issues.example.com/\2
|
|
227
|
issue_sub = PR #\2
|
|
227
|
issue_sub = PR #\2
|
|
228
|
|
|
228
|
|
|
229
|
The following example demonstrates how to require whitespace before the issue
|
|
229
|
The following example demonstrates how to require whitespace before the issue
|
|
230
|
reference in order for it to be recognized, such that the text ``issue#123`` will
|
|
230
|
reference in order for it to be recognized, such that the text ``issue#123`` will
|
|
231
|
not cause a match, but ``issue #123`` will::
|
|
231
|
not cause a match, but ``issue #123`` will::
|
|
232
|
|
|
232
|
|
|
233
|
issue_pat = (?:^|(?<=\s))#(\d+)
|
|
233
|
issue_pat = (?:^|(?<=\s))#(\d+)
|
|
234
|
issue_server_link = https://issues.example.com/\1
|
|
234
|
issue_server_link = https://issues.example.com/\1
|
|
235
|
issue_sub =
|
|
235
|
issue_sub =
|
|
236
|
|
|
236
|
|
|
237
|
If needed, more than one pattern can be specified by appending a unique suffix to
|
|
237
|
If needed, more than one pattern can be specified by appending a unique suffix to
|
|
238
|
the variables. For example, also demonstrating the use of named groups::
|
|
238
|
the variables. For example, also demonstrating the use of named groups::
|
|
239
|
|
|
239
|
|
|
240
|
issue_pat_wiki = wiki-(?P<pagename>\S+)
|
|
240
|
issue_pat_wiki = wiki-(?P<pagename>\S+)
|
|
241
|
issue_server_link_wiki = https://wiki.example.com/\g<pagename>
|
|
241
|
issue_server_link_wiki = https://wiki.example.com/\g<pagename>
|
|
242
|
issue_sub_wiki = WIKI-\g<pagename>
|
|
242
|
issue_sub_wiki = WIKI-\g<pagename>
|
|
243
|
|
|
243
|
|
|
244
|
With these settings, wiki pages can be referenced as wiki-some-id, and every
|
|
244
|
With these settings, wiki pages can be referenced as wiki-some-id, and every
|
|
245
|
such reference will be transformed into:
|
|
245
|
such reference will be transformed into:
|
|
246
|
|
|
246
|
|
|
247
|
.. code-block:: html
|
|
247
|
.. code-block:: html
|
|
248
|
|
|
248
|
|
|
249
|
<a href="https://wiki.example.com/some-id">WIKI-some-id</a>
|
|
249
|
<a href="https://wiki.example.com/some-id">WIKI-some-id</a>
|
|
250
|
|
|
250
|
|
|
251
|
Refer to the `Python regular expression documentation`_ for more details about
|
|
251
|
Refer to the `Python regular expression documentation`_ for more details about
|
|
252
|
the supported syntax in ``issue_pat``, ``issue_server_link`` and ``issue_sub``.
|
|
252
|
the supported syntax in ``issue_pat``, ``issue_server_link`` and ``issue_sub``.
|
|
253
|
|
|
253
|
|
|
254
|
|
|
254
|
|
|
255
|
Hook management
|
|
255
|
Hook management
|
|
256
|
---------------
|
|
256
|
---------------
|
|
257
|
|
|
257
|
|
|
258
|
Hooks can be managed in similar way to that used in ``.hgrc`` files.
|
|
258
|
Hooks can be managed in similar way to that used in ``.hgrc`` files.
|
|
259
|
To manage hooks, choose *Admin > Settings > Hooks*.
|
|
259
|
To manage hooks, choose *Admin > Settings > Hooks*.
|
|
260
|
|
|
260
|
|
|
261
|
The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section.
|
|
261
|
The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section.
|
|
262
|
|
|
262
|
|
|
263
|
To add another custom hook simply fill in the first textbox with
|
|
263
|
To add another custom hook simply fill in the first textbox with
|
|
264
|
``<name>.<hook_type>`` and the second with the hook path. Example hooks
|
|
264
|
``<name>.<hook_type>`` and the second with the hook path. Example hooks
|
|
265
|
can be found in ``kallithea.lib.hooks``.
|
|
265
|
can be found in ``kallithea.lib.hooks``.
|
|
266
|
|
|
266
|
|
|
267
|
|
|
267
|
|
|
268
|
Changing default encoding
|
|
268
|
Changing default encoding
|
|
269
|
-------------------------
|
|
269
|
-------------------------
|
|
270
|
|
|
270
|
|
|
271
|
By default, Kallithea uses UTF-8 encoding.
|
|
271
|
By default, Kallithea uses UTF-8 encoding.
|
|
272
|
This is configurable as ``default_encoding`` in the .ini file.
|
|
272
|
This is configurable as ``default_encoding`` in the .ini file.
|
|
273
|
This affects many parts in Kallithea including user names, filenames, and
|
|
273
|
This affects many parts in Kallithea including user names, filenames, and
|
|
274
|
encoding of commit messages. In addition Kallithea can detect if the ``chardet``
|
|
274
|
encoding of commit messages. In addition Kallithea can detect if the ``chardet``
|
|
275
|
library is installed. If ``chardet`` is detected Kallithea will fallback to it
|
|
275
|
library is installed. If ``chardet`` is detected Kallithea will fallback to it
|
|
276
|
when there are encode/decode errors.
|
|
276
|
when there are encode/decode errors.
|
|
277
|
|
|
277
|
|
|
278
|
The Mercurial encoding is configurable as ``hgencoding``. It is similar to
|
|
278
|
The Mercurial encoding is configurable as ``hgencoding``. It is similar to
|
|
279
|
setting the ``HGENCODING`` environment variable, but will override it.
|
|
279
|
setting the ``HGENCODING`` environment variable, but will override it.
|
|
280
|
|
|
280
|
|
|
281
|
|
|
281
|
|
|
282
|
Celery configuration
|
|
282
|
Celery configuration
|
|
283
|
--------------------
|
|
283
|
--------------------
|
|
284
|
|
|
284
|
|
|
285
|
Kallithea can use the distributed task queue system Celery_ to run tasks like
|
|
285
|
Kallithea can use the distributed task queue system Celery_ to run tasks like
|
|
286
|
cloning repositories or sending emails.
|
|
286
|
cloning repositories or sending emails.
|
|
287
|
|
|
287
|
|
|
288
|
Kallithea will in most setups work perfectly fine out of the box (without
|
|
288
|
Kallithea will in most setups work perfectly fine out of the box (without
|
|
289
|
Celery), executing all tasks in the web server process. Some tasks can however
|
|
289
|
Celery), executing all tasks in the web server process. Some tasks can however
|
|
290
|
take some time to run and it can be better to run such tasks asynchronously in
|
|
290
|
take some time to run and it can be better to run such tasks asynchronously in
|
|
291
|
a separate process so the web server can focus on serving web requests.
|
|
291
|
a separate process so the web server can focus on serving web requests.
|
|
292
|
|
|
292
|
|
|
293
|
For installation and configuration of Celery, see the `Celery documentation`_.
|
|
293
|
For installation and configuration of Celery, see the `Celery documentation`_.
|
|
294
|
Note that Celery requires a message broker service like RabbitMQ_ (recommended)
|
|
294
|
Note that Celery requires a message broker service like RabbitMQ_ (recommended)
|
|
295
|
or Redis_.
|
|
295
|
or Redis_.
|
|
296
|
|
|
296
|
|
|
297
|
The use of Celery is configured in the Kallithea ini configuration file.
|
|
297
|
The use of Celery is configured in the Kallithea ini configuration file.
|
|
298
|
To enable it, simply set::
|
|
298
|
To enable it, simply set::
|
|
299
|
|
|
299
|
|
|
300
|
use_celery = true
|
|
300
|
use_celery = true
|
|
301
|
|
|
301
|
|
|
302
|
and add or change the ``celery.*`` and ``broker.*`` configuration variables.
|
|
302
|
and add or change the ``celery.*`` and ``broker.*`` configuration variables.
|
|
303
|
|
|
303
|
|
|
304
|
Remember that the ini files use the format with '.' and not with '_' like
|
|
304
|
Remember that the ini files use the format with '.' and not with '_' like
|
|
305
|
Celery. So for example setting `BROKER_HOST` in Celery means setting
|
|
305
|
Celery. So for example setting `BROKER_HOST` in Celery means setting
|
|
306
|
`broker.host` in the configuration file.
|
|
306
|
`broker.host` in the configuration file.
|
|
307
|
|
|
307
|
|
|
308
|
To start the Celery process, run::
|
|
308
|
To start the Celery process, run::
|
|
309
|
|
|
309
|
|
|
310
|
gearbox celeryd -c my.ini
|
|
310
|
kallithea-cli celery-run -c my.ini
|
|
311
|
|
|
311
|
|
|
312
|
Extra options to the Celery worker can be passed after ``--`` - see ``-- -h``
|
|
312
|
Extra options to the Celery worker can be passed after ``--`` - see ``-- -h``
|
|
313
|
for more info.
|
|
313
|
for more info.
|
|
314
|
|
|
314
|
|
|
315
|
.. note::
|
|
315
|
.. note::
|
|
316
|
Make sure you run this command from the same virtualenv, and with the same
|
|
316
|
Make sure you run this command from the same virtualenv, and with the same
|
|
317
|
user that Kallithea runs.
|
|
317
|
user that Kallithea runs.
|
|
318
|
|
|
318
|
|
|
319
|
|
|
319
|
|
|
320
|
HTTPS support
|
|
320
|
HTTPS support
|
|
321
|
-------------
|
|
321
|
-------------
|
|
322
|
|
|
322
|
|
|
323
|
Kallithea will by default generate URLs based on the WSGI environment.
|
|
323
|
Kallithea will by default generate URLs based on the WSGI environment.
|
|
324
|
|
|
324
|
|
|
325
|
Alternatively, you can use some special configuration settings to control
|
|
325
|
Alternatively, you can use some special configuration settings to control
|
|
326
|
directly which scheme/protocol Kallithea will use when generating URLs:
|
|
326
|
directly which scheme/protocol Kallithea will use when generating URLs:
|
|
327
|
|
|
327
|
|
|
328
|
- With ``https_fixup = true``, the scheme will be taken from the
|
|
328
|
- With ``https_fixup = true``, the scheme will be taken from the
|
|
329
|
``X-Url-Scheme``, ``X-Forwarded-Scheme`` or ``X-Forwarded-Proto`` HTTP header
|
|
329
|
``X-Url-Scheme``, ``X-Forwarded-Scheme`` or ``X-Forwarded-Proto`` HTTP header
|
|
330
|
(default ``http``).
|
|
330
|
(default ``http``).
|
|
331
|
- With ``force_https = true`` the default will be ``https``.
|
|
331
|
- With ``force_https = true`` the default will be ``https``.
|
|
332
|
- With ``use_htsts = true``, Kallithea will set ``Strict-Transport-Security`` when using https.
|
|
332
|
- With ``use_htsts = true``, Kallithea will set ``Strict-Transport-Security`` when using https.
|
|
333
|
|
|
333
|
|
|
334
|
.. _nginx_virtual_host:
|
|
334
|
.. _nginx_virtual_host:
|
|
335
|
|
|
335
|
|
|
336
|
|
|
336
|
|
|
337
|
Nginx virtual host example
|
|
337
|
Nginx virtual host example
|
|
338
|
--------------------------
|
|
338
|
--------------------------
|
|
339
|
|
|
339
|
|
|
340
|
Sample config for Nginx using proxy:
|
|
340
|
Sample config for Nginx using proxy:
|
|
341
|
|
|
341
|
|
|
342
|
.. code-block:: nginx
|
|
342
|
.. code-block:: nginx
|
|
343
|
|
|
343
|
|
|
344
|
upstream kallithea {
|
|
344
|
upstream kallithea {
|
|
345
|
server 127.0.0.1:5000;
|
|
345
|
server 127.0.0.1:5000;
|
|
346
|
# add more instances for load balancing
|
|
346
|
# add more instances for load balancing
|
|
347
|
#server 127.0.0.1:5001;
|
|
347
|
#server 127.0.0.1:5001;
|
|
348
|
#server 127.0.0.1:5002;
|
|
348
|
#server 127.0.0.1:5002;
|
|
349
|
}
|
|
349
|
}
|
|
350
|
|
|
350
|
|
|
351
|
## gist alias
|
|
351
|
## gist alias
|
|
352
|
server {
|
|
352
|
server {
|
|
353
|
listen 443;
|
|
353
|
listen 443;
|
|
354
|
server_name gist.example.com;
|
|
354
|
server_name gist.example.com;
|
|
355
|
access_log /var/log/nginx/gist.access.log;
|
|
355
|
access_log /var/log/nginx/gist.access.log;
|
|
356
|
error_log /var/log/nginx/gist.error.log;
|
|
356
|
error_log /var/log/nginx/gist.error.log;
|
|
357
|
|
|
357
|
|
|
358
|
ssl on;
|
|
358
|
ssl on;
|
|
359
|
ssl_certificate gist.your.kallithea.server.crt;
|
|
359
|
ssl_certificate gist.your.kallithea.server.crt;
|
|
360
|
ssl_certificate_key gist.your.kallithea.server.key;
|
|
360
|
ssl_certificate_key gist.your.kallithea.server.key;
|
|
361
|
|
|
361
|
|
|
362
|
ssl_session_timeout 5m;
|
|
362
|
ssl_session_timeout 5m;
|
|
363
|
|
|
363
|
|
|
364
|
ssl_protocols SSLv3 TLSv1;
|
|
364
|
ssl_protocols SSLv3 TLSv1;
|
|
365
|
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;
|
|
365
|
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;
|
|
366
|
ssl_prefer_server_ciphers on;
|
|
366
|
ssl_prefer_server_ciphers on;
|
|
367
|
|
|
367
|
|
|
368
|
rewrite ^/(.+)$ https://kallithea.example.com/_admin/gists/$1;
|
|
368
|
rewrite ^/(.+)$ https://kallithea.example.com/_admin/gists/$1;
|
|
369
|
rewrite (.*) https://kallithea.example.com/_admin/gists;
|
|
369
|
rewrite (.*) https://kallithea.example.com/_admin/gists;
|
|
370
|
}
|
|
370
|
}
|
|
371
|
|
|
371
|
|
|
372
|
server {
|
|
372
|
server {
|
|
373
|
listen 443;
|
|
373
|
listen 443;
|
|
374
|
server_name kallithea.example.com
|
|
374
|
server_name kallithea.example.com
|
|
375
|
access_log /var/log/nginx/kallithea.access.log;
|
|
375
|
access_log /var/log/nginx/kallithea.access.log;
|
|
376
|
error_log /var/log/nginx/kallithea.error.log;
|
|
376
|
error_log /var/log/nginx/kallithea.error.log;
|
|
377
|
|
|
377
|
|
|
378
|
ssl on;
|
|
378
|
ssl on;
|
|
379
|
ssl_certificate your.kallithea.server.crt;
|
|
379
|
ssl_certificate your.kallithea.server.crt;
|
|
380
|
ssl_certificate_key your.kallithea.server.key;
|
|
380
|
ssl_certificate_key your.kallithea.server.key;
|
|
381
|
|
|
381
|
|
|
382
|
ssl_session_timeout 5m;
|
|
382
|
ssl_session_timeout 5m;
|
|
383
|
|
|
383
|
|
|
384
|
ssl_protocols SSLv3 TLSv1;
|
|
384
|
ssl_protocols SSLv3 TLSv1;
|
|
385
|
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;
|
|
385
|
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;
|
|
386
|
ssl_prefer_server_ciphers on;
|
|
386
|
ssl_prefer_server_ciphers on;
|
|
387
|
|
|
387
|
|
|
388
|
## uncomment root directive if you want to serve static files by nginx
|
|
388
|
## uncomment root directive if you want to serve static files by nginx
|
|
389
|
## requires static_files = false in .ini file
|
|
389
|
## requires static_files = false in .ini file
|
|
390
|
#root /srv/kallithea/kallithea/kallithea/public;
|
|
390
|
#root /srv/kallithea/kallithea/kallithea/public;
|
|
391
|
include /etc/nginx/proxy.conf;
|
|
391
|
include /etc/nginx/proxy.conf;
|
|
392
|
location / {
|
|
392
|
location / {
|
|
393
|
try_files $uri @kallithea;
|
|
393
|
try_files $uri @kallithea;
|
|
394
|
}
|
|
394
|
}
|
|
395
|
|
|
395
|
|
|
396
|
location @kallithea {
|
|
396
|
location @kallithea {
|
|
397
|
proxy_pass http://127.0.0.1:5000;
|
|
397
|
proxy_pass http://127.0.0.1:5000;
|
|
398
|
}
|
|
398
|
}
|
|
399
|
|
|
399
|
|
|
400
|
}
|
|
400
|
}
|
|
401
|
|
|
401
|
|
|
402
|
Here's the proxy.conf. It's tuned so it will not timeout on long
|
|
402
|
Here's the proxy.conf. It's tuned so it will not timeout on long
|
|
403
|
pushes or large pushes::
|
|
403
|
pushes or large pushes::
|
|
404
|
|
|
404
|
|
|
405
|
proxy_redirect off;
|
|
405
|
proxy_redirect off;
|
|
406
|
proxy_set_header Host $host;
|
|
406
|
proxy_set_header Host $host;
|
|
407
|
## needed for container auth
|
|
407
|
## needed for container auth
|
|
408
|
#proxy_set_header REMOTE_USER $remote_user;
|
|
408
|
#proxy_set_header REMOTE_USER $remote_user;
|
|
409
|
#proxy_set_header X-Forwarded-User $remote_user;
|
|
409
|
#proxy_set_header X-Forwarded-User $remote_user;
|
|
410
|
proxy_set_header X-Url-Scheme $scheme;
|
|
410
|
proxy_set_header X-Url-Scheme $scheme;
|
|
411
|
proxy_set_header X-Host $http_host;
|
|
411
|
proxy_set_header X-Host $http_host;
|
|
412
|
proxy_set_header X-Real-IP $remote_addr;
|
|
412
|
proxy_set_header X-Real-IP $remote_addr;
|
|
413
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
413
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
414
|
proxy_set_header Proxy-host $proxy_host;
|
|
414
|
proxy_set_header Proxy-host $proxy_host;
|
|
415
|
proxy_buffering off;
|
|
415
|
proxy_buffering off;
|
|
416
|
proxy_connect_timeout 7200;
|
|
416
|
proxy_connect_timeout 7200;
|
|
417
|
proxy_send_timeout 7200;
|
|
417
|
proxy_send_timeout 7200;
|
|
418
|
proxy_read_timeout 7200;
|
|
418
|
proxy_read_timeout 7200;
|
|
419
|
proxy_buffers 8 32k;
|
|
419
|
proxy_buffers 8 32k;
|
|
420
|
client_max_body_size 1024m;
|
|
420
|
client_max_body_size 1024m;
|
|
421
|
client_body_buffer_size 128k;
|
|
421
|
client_body_buffer_size 128k;
|
|
422
|
large_client_header_buffers 8 64k;
|
|
422
|
large_client_header_buffers 8 64k;
|
|
423
|
|
|
423
|
|
|
424
|
.. _apache_virtual_host_reverse_proxy:
|
|
424
|
.. _apache_virtual_host_reverse_proxy:
|
|
425
|
|
|
425
|
|
|
426
|
|
|
426
|
|
|
427
|
Apache virtual host reverse proxy example
|
|
427
|
Apache virtual host reverse proxy example
|
|
428
|
-----------------------------------------
|
|
428
|
-----------------------------------------
|
|
429
|
|
|
429
|
|
|
430
|
Here is a sample configuration file for Apache using proxy:
|
|
430
|
Here is a sample configuration file for Apache using proxy:
|
|
431
|
|
|
431
|
|
|
432
|
.. code-block:: apache
|
|
432
|
.. code-block:: apache
|
|
433
|
|
|
433
|
|
|
434
|
<VirtualHost *:80>
|
|
434
|
<VirtualHost *:80>
|
|
435
|
ServerName kallithea.example.com
|
|
435
|
ServerName kallithea.example.com
|
|
436
|
|
|
436
|
|
|
437
|
<Proxy *>
|
|
437
|
<Proxy *>
|
|
438
|
# For Apache 2.4 and later:
|
|
438
|
# For Apache 2.4 and later:
|
|
439
|
Require all granted
|
|
439
|
Require all granted
|
|
440
|
|
|
440
|
|
|
441
|
# For Apache 2.2 and earlier, instead use:
|
|
441
|
# For Apache 2.2 and earlier, instead use:
|
|
442
|
# Order allow,deny
|
|
442
|
# Order allow,deny
|
|
443
|
# Allow from all
|
|
443
|
# Allow from all
|
|
444
|
</Proxy>
|
|
444
|
</Proxy>
|
|
445
|
|
|
445
|
|
|
446
|
#important !
|
|
446
|
#important !
|
|
447
|
#Directive to properly generate url (clone url) for Kallithea
|
|
447
|
#Directive to properly generate url (clone url) for Kallithea
|
|
448
|
ProxyPreserveHost On
|
|
448
|
ProxyPreserveHost On
|
|
449
|
|
|
449
|
|
|
450
|
#kallithea instance
|
|
450
|
#kallithea instance
|
|
451
|
ProxyPass / http://127.0.0.1:5000/
|
|
451
|
ProxyPass / http://127.0.0.1:5000/
|
|
452
|
ProxyPassReverse / http://127.0.0.1:5000/
|
|
452
|
ProxyPassReverse / http://127.0.0.1:5000/
|
|
453
|
|
|
453
|
|
|
454
|
#to enable https use line below
|
|
454
|
#to enable https use line below
|
|
455
|
#SetEnvIf X-Url-Scheme https HTTPS=1
|
|
455
|
#SetEnvIf X-Url-Scheme https HTTPS=1
|
|
456
|
</VirtualHost>
|
|
456
|
</VirtualHost>
|
|
457
|
|
|
457
|
|
|
458
|
Additional tutorial
|
|
458
|
Additional tutorial
|
|
459
|
http://pylonsbook.com/en/1.1/deployment.html#using-apache-to-proxy-requests-to-pylons
|
|
459
|
http://pylonsbook.com/en/1.1/deployment.html#using-apache-to-proxy-requests-to-pylons
|
|
460
|
|
|
460
|
|
|
461
|
.. _apache_subdirectory:
|
|
461
|
.. _apache_subdirectory:
|
|
462
|
|
|
462
|
|
|
463
|
|
|
463
|
|
|
464
|
Apache as subdirectory
|
|
464
|
Apache as subdirectory
|
|
465
|
----------------------
|
|
465
|
----------------------
|
|
466
|
|
|
466
|
|
|
467
|
Apache subdirectory part:
|
|
467
|
Apache subdirectory part:
|
|
468
|
|
|
468
|
|
|
469
|
.. code-block:: apache
|
|
469
|
.. code-block:: apache
|
|
470
|
|
|
470
|
|
|
471
|
<Location /PREFIX >
|
|
471
|
<Location /PREFIX >
|
|
472
|
ProxyPass http://127.0.0.1:5000/PREFIX
|
|
472
|
ProxyPass http://127.0.0.1:5000/PREFIX
|
|
473
|
ProxyPassReverse http://127.0.0.1:5000/PREFIX
|
|
473
|
ProxyPassReverse http://127.0.0.1:5000/PREFIX
|
|
474
|
SetEnvIf X-Url-Scheme https HTTPS=1
|
|
474
|
SetEnvIf X-Url-Scheme https HTTPS=1
|
|
475
|
</Location>
|
|
475
|
</Location>
|
|
476
|
|
|
476
|
|
|
477
|
Besides the regular apache setup you will need to add the following line
|
|
477
|
Besides the regular apache setup you will need to add the following line
|
|
478
|
into ``[app:main]`` section of your .ini file::
|
|
478
|
into ``[app:main]`` section of your .ini file::
|
|
479
|
|
|
479
|
|
|
480
|
filter-with = proxy-prefix
|
|
480
|
filter-with = proxy-prefix
|
|
481
|
|
|
481
|
|
|
482
|
Add the following at the end of the .ini file::
|
|
482
|
Add the following at the end of the .ini file::
|
|
483
|
|
|
483
|
|
|
484
|
[filter:proxy-prefix]
|
|
484
|
[filter:proxy-prefix]
|
|
485
|
use = egg:PasteDeploy#prefix
|
|
485
|
use = egg:PasteDeploy#prefix
|
|
486
|
prefix = /PREFIX
|
|
486
|
prefix = /PREFIX
|
|
487
|
|
|
487
|
|
|
488
|
then change ``PREFIX`` into your chosen prefix
|
|
488
|
then change ``PREFIX`` into your chosen prefix
|
|
489
|
|
|
489
|
|
|
490
|
.. _apache_mod_wsgi:
|
|
490
|
.. _apache_mod_wsgi:
|
|
491
|
|
|
491
|
|
|
492
|
|
|
492
|
|
|
493
|
Apache with mod_wsgi
|
|
493
|
Apache with mod_wsgi
|
|
494
|
--------------------
|
|
494
|
--------------------
|
|
495
|
|
|
495
|
|
|
496
|
Alternatively, Kallithea can be set up with Apache under mod_wsgi. For
|
|
496
|
Alternatively, Kallithea can be set up with Apache under mod_wsgi. For
|
|
497
|
that, you'll need to:
|
|
497
|
that, you'll need to:
|
|
498
|
|
|
498
|
|
|
499
|
- Install mod_wsgi. If using a Debian-based distro, you can install
|
|
499
|
- Install mod_wsgi. If using a Debian-based distro, you can install
|
|
500
|
the package libapache2-mod-wsgi::
|
|
500
|
the package libapache2-mod-wsgi::
|
|
501
|
|
|
501
|
|
|
502
|
aptitude install libapache2-mod-wsgi
|
|
502
|
aptitude install libapache2-mod-wsgi
|
|
503
|
|
|
503
|
|
|
504
|
- Enable mod_wsgi::
|
|
504
|
- Enable mod_wsgi::
|
|
505
|
|
|
505
|
|
|
506
|
a2enmod wsgi
|
|
506
|
a2enmod wsgi
|
|
507
|
|
|
507
|
|
|
508
|
- Add global Apache configuration to tell mod_wsgi that Python only will be
|
|
508
|
- Add global Apache configuration to tell mod_wsgi that Python only will be
|
|
509
|
used in the WSGI processes and shouldn't be initialized in the Apache
|
|
509
|
used in the WSGI processes and shouldn't be initialized in the Apache
|
|
510
|
processes::
|
|
510
|
processes::
|
|
511
|
|
|
511
|
|
|
512
|
WSGIRestrictEmbedded On
|
|
512
|
WSGIRestrictEmbedded On
|
|
513
|
|
|
513
|
|
|
514
|
- Create a wsgi dispatch script, like the one below. Make sure you
|
|
514
|
- Create a wsgi dispatch script, like the one below. Make sure you
|
|
515
|
check that the paths correctly point to where you installed Kallithea
|
|
515
|
check that the paths correctly point to where you installed Kallithea
|
|
516
|
and its Python Virtual Environment.
|
|
516
|
and its Python Virtual Environment.
|
|
517
|
- Enable the ``WSGIScriptAlias`` directive for the WSGI dispatch script,
|
|
517
|
- Enable the ``WSGIScriptAlias`` directive for the WSGI dispatch script,
|
|
518
|
as in the following example. Once again, check the paths are
|
|
518
|
as in the following example. Once again, check the paths are
|
|
519
|
correctly specified.
|
|
519
|
correctly specified.
|
|
520
|
|
|
520
|
|
|
521
|
Here is a sample excerpt from an Apache Virtual Host configuration file:
|
|
521
|
Here is a sample excerpt from an Apache Virtual Host configuration file:
|
|
522
|
|
|
522
|
|
|
523
|
.. code-block:: apache
|
|
523
|
.. code-block:: apache
|
|
524
|
|
|
524
|
|
|
525
|
WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \
|
|
525
|
WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \
|
|
526
|
python-home=/srv/kallithea/venv
|
|
526
|
python-home=/srv/kallithea/venv
|
|
527
|
WSGIProcessGroup kallithea
|
|
527
|
WSGIProcessGroup kallithea
|
|
528
|
WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
|
|
528
|
WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
|
|
529
|
WSGIPassAuthorization On
|
|
529
|
WSGIPassAuthorization On
|
|
530
|
|
|
530
|
|
|
531
|
Or if using a dispatcher WSGI script with proper virtualenv activation:
|
|
531
|
Or if using a dispatcher WSGI script with proper virtualenv activation:
|
|
532
|
|
|
532
|
|
|
533
|
.. code-block:: apache
|
|
533
|
.. code-block:: apache
|
|
534
|
|
|
534
|
|
|
535
|
WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100
|
|
535
|
WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100
|
|
536
|
WSGIProcessGroup kallithea
|
|
536
|
WSGIProcessGroup kallithea
|
|
537
|
WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
|
|
537
|
WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
|
|
538
|
WSGIPassAuthorization On
|
|
538
|
WSGIPassAuthorization On
|
|
539
|
|
|
539
|
|
|
540
|
Apache will by default run as a special Apache user, on Linux systems
|
|
540
|
Apache will by default run as a special Apache user, on Linux systems
|
|
541
|
usually ``www-data`` or ``apache``. If you need to have the repositories
|
|
541
|
usually ``www-data`` or ``apache``. If you need to have the repositories
|
|
542
|
directory owned by a different user, use the user and group options to
|
|
542
|
directory owned by a different user, use the user and group options to
|
|
543
|
WSGIDaemonProcess to set the name of the user and group.
|
|
543
|
WSGIDaemonProcess to set the name of the user and group.
|
|
544
|
|
|
544
|
|
|
545
|
Example WSGI dispatch script:
|
|
545
|
Example WSGI dispatch script:
|
|
546
|
|
|
546
|
|
|
547
|
.. code-block:: python
|
|
547
|
.. code-block:: python
|
|
548
|
|
|
548
|
|
|
549
|
import os
|
|
549
|
import os
|
|
550
|
os.environ['PYTHON_EGG_CACHE'] = '/srv/kallithea/.egg-cache'
|
|
550
|
os.environ['PYTHON_EGG_CACHE'] = '/srv/kallithea/.egg-cache'
|
|
551
|
|
|
551
|
|
|
552
|
# sometimes it's needed to set the current dir
|
|
552
|
# sometimes it's needed to set the current dir
|
|
553
|
os.chdir('/srv/kallithea/')
|
|
553
|
os.chdir('/srv/kallithea/')
|
|
554
|
|
|
554
|
|
|
555
|
import site
|
|
555
|
import site
|
|
556
|
site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
|
|
556
|
site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
|
|
557
|
|
|
557
|
|
|
558
|
ini = '/srv/kallithea/my.ini'
|
|
558
|
ini = '/srv/kallithea/my.ini'
|
|
559
|
from paste.script.util.logging_config import fileConfig
|
|
559
|
from paste.script.util.logging_config import fileConfig
|
|
560
|
fileConfig(ini)
|
|
560
|
fileConfig(ini)
|
|
561
|
from paste.deploy import loadapp
|
|
561
|
from paste.deploy import loadapp
|
|
562
|
application = loadapp('config:' + ini)
|
|
562
|
application = loadapp('config:' + ini)
|
|
563
|
|
|
563
|
|
|
564
|
Or using proper virtualenv activation:
|
|
564
|
Or using proper virtualenv activation:
|
|
565
|
|
|
565
|
|
|
566
|
.. code-block:: python
|
|
566
|
.. code-block:: python
|
|
567
|
|
|
567
|
|
|
568
|
activate_this = '/srv/kallithea/venv/bin/activate_this.py'
|
|
568
|
activate_this = '/srv/kallithea/venv/bin/activate_this.py'
|
|
569
|
execfile(activate_this, dict(__file__=activate_this))
|
|
569
|
execfile(activate_this, dict(__file__=activate_this))
|
|
570
|
|
|
570
|
|
|
571
|
import os
|
|
571
|
import os
|
|
572
|
os.environ['HOME'] = '/srv/kallithea'
|
|
572
|
os.environ['HOME'] = '/srv/kallithea'
|
|
573
|
|
|
573
|
|
|
574
|
ini = '/srv/kallithea/kallithea.ini'
|
|
574
|
ini = '/srv/kallithea/kallithea.ini'
|
|
575
|
from paste.script.util.logging_config import fileConfig
|
|
575
|
from paste.script.util.logging_config import fileConfig
|
|
576
|
fileConfig(ini)
|
|
576
|
fileConfig(ini)
|
|
577
|
from paste.deploy import loadapp
|
|
577
|
from paste.deploy import loadapp
|
|
578
|
application = loadapp('config:' + ini)
|
|
578
|
application = loadapp('config:' + ini)
|
|
579
|
|
|
579
|
|
|
580
|
|
|
580
|
|
|
581
|
Other configuration files
|
|
581
|
Other configuration files
|
|
582
|
-------------------------
|
|
582
|
-------------------------
|
|
583
|
|
|
583
|
|
|
584
|
A number of `example init.d scripts`__ can be found in
|
|
584
|
A number of `example init.d scripts`__ can be found in
|
|
585
|
the ``init.d`` directory of the Kallithea source.
|
|
585
|
the ``init.d`` directory of the Kallithea source.
|
|
586
|
|
|
586
|
|
|
587
|
.. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
|
|
587
|
.. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
|
|
588
|
|
|
588
|
|
|
589
|
|
|
589
|
|
|
590
|
.. _virtualenv: http://pypi.python.org/pypi/virtualenv
|
|
590
|
.. _virtualenv: http://pypi.python.org/pypi/virtualenv
|
|
591
|
.. _python: http://www.python.org/
|
|
591
|
.. _python: http://www.python.org/
|
|
592
|
.. _Python regular expression documentation: https://docs.python.org/2/library/re.html
|
|
592
|
.. _Python regular expression documentation: https://docs.python.org/2/library/re.html
|
|
593
|
.. _Mercurial: https://www.mercurial-scm.org/
|
|
593
|
.. _Mercurial: https://www.mercurial-scm.org/
|
|
594
|
.. _Celery: http://celeryproject.org/
|
|
594
|
.. _Celery: http://celeryproject.org/
|
|
595
|
.. _Celery documentation: http://docs.celeryproject.org/en/latest/getting-started/index.html
|
|
595
|
.. _Celery documentation: http://docs.celeryproject.org/en/latest/getting-started/index.html
|
|
596
|
.. _RabbitMQ: http://www.rabbitmq.com/
|
|
596
|
.. _RabbitMQ: http://www.rabbitmq.com/
|
|
597
|
.. _Redis: http://redis.io/
|
|
597
|
.. _Redis: http://redis.io/
|
|
598
|
.. _mercurial-server: http://www.lshift.net/mercurial-server.html
|
|
598
|
.. _mercurial-server: http://www.lshift.net/mercurial-server.html
|
|
599
|
.. _PublishingRepositories: https://www.mercurial-scm.org/wiki/PublishingRepositories
|
|
599
|
.. _PublishingRepositories: https://www.mercurial-scm.org/wiki/PublishingRepositories
|