Show More
@@ -1,150 +1,154 b'' | |||||
1 | .. _installation: |
|
1 | .. _installation: | |
2 |
|
2 | |||
3 | ========================== |
|
3 | ========================== | |
4 | Installation on Unix/Linux |
|
4 | Installation on Unix/Linux | |
5 | ========================== |
|
5 | ========================== | |
6 |
|
6 | |||
7 | The following describes three different ways of installing Kallithea: |
|
7 | The following describes three different ways of installing Kallithea: | |
8 |
|
8 | |||
9 | - :ref:`installation-source`: The simplest way to keep the installation |
|
9 | - :ref:`installation-source`: The simplest way to keep the installation | |
10 | up-to-date and track any local customizations is to run directly from |
|
10 | up-to-date and track any local customizations is to run directly from | |
11 | source in a Kallithea repository clone, preferably inside a virtualenv |
|
11 | source in a Kallithea repository clone, preferably inside a virtualenv | |
12 | virtual Python environment. |
|
12 | virtual Python environment. | |
13 |
|
13 | |||
14 | - :ref:`installation-virtualenv`: If you prefer to only use released versions |
|
14 | - :ref:`installation-virtualenv`: If you prefer to only use released versions | |
15 | of Kallithea, the recommended method is to install Kallithea in a virtual |
|
15 | of Kallithea, the recommended method is to install Kallithea in a virtual | |
16 | Python environment using `virtualenv`. The advantages of this method over |
|
16 | Python environment using `virtualenv`. The advantages of this method over | |
17 | direct installation is that Kallithea and its dependencies are completely |
|
17 | direct installation is that Kallithea and its dependencies are completely | |
18 | contained inside the virtualenv (which also means you can have multiple |
|
18 | contained inside the virtualenv (which also means you can have multiple | |
19 | installations side by side or remove it entirely by just removing the |
|
19 | installations side by side or remove it entirely by just removing the | |
20 | virtualenv directory) and does not require root privileges. |
|
20 | virtualenv directory) and does not require root privileges. | |
21 |
|
21 | |||
22 | - :ref:`installation-without-virtualenv`: The alternative method of installing |
|
22 | - :ref:`installation-without-virtualenv`: The alternative method of installing | |
23 | a Kallithea release is using standard pip. The package will be installed in |
|
23 | a Kallithea release is using standard pip. The package will be installed in | |
24 | the same location as all other Python packages you have ever installed. As a |
|
24 | the same location as all other Python packages you have ever installed. As a | |
25 | result, removing it is not as straightforward as with a virtualenv, as you'd |
|
25 | result, removing it is not as straightforward as with a virtualenv, as you'd | |
26 | have to remove its dependencies manually and make sure that they are not |
|
26 | have to remove its dependencies manually and make sure that they are not | |
27 | needed by other packages. |
|
27 | needed by other packages. | |
28 |
|
28 | |||
29 | Regardless of the installation method you may need to make sure you have |
|
29 | Regardless of the installation method you may need to make sure you have | |
30 | appropriate development packages installed, as installation of some of the |
|
30 | appropriate development packages installed, as installation of some of the | |
31 | Kallithea dependencies requires a working C compiler and libffi library |
|
31 | Kallithea dependencies requires a working C compiler and libffi library | |
32 | headers. Depending on your configuration, you may also need to install |
|
32 | headers. Depending on your configuration, you may also need to install | |
33 | Git and development packages for the database of your choice. |
|
33 | Git and development packages for the database of your choice. | |
34 |
|
34 | |||
35 | For Debian and Ubuntu, the following command will ensure that a reasonable |
|
35 | For Debian and Ubuntu, the following command will ensure that a reasonable | |
36 | set of dependencies is installed:: |
|
36 | set of dependencies is installed:: | |
37 |
|
37 | |||
38 | sudo apt-get install build-essential git libffi-dev python3-dev |
|
38 | sudo apt-get install build-essential git libffi-dev python3-dev | |
39 |
|
39 | |||
40 | For Fedora and RHEL-derivatives, the following command will ensure that a |
|
40 | For Fedora and RHEL-derivatives, the following command will ensure that a | |
41 | reasonable set of dependencies is installed:: |
|
41 | reasonable set of dependencies is installed:: | |
42 |
|
42 | |||
43 | sudo yum install gcc git libffi-devel python3-devel |
|
43 | sudo yum install gcc git libffi-devel python3-devel | |
44 |
|
44 | |||
45 | .. _installation-source: |
|
45 | .. _installation-source: | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | Installation from repository source |
|
48 | Installation from repository source | |
49 | ----------------------------------- |
|
49 | ----------------------------------- | |
50 |
|
50 | |||
51 | To install Kallithea in a virtualenv using the stable branch of the development |
|
51 | To install Kallithea in a virtualenv using the stable branch of the development | |
52 | repository, use the following commands in your bash shell:: |
|
52 | repository, use the following commands in your bash shell:: | |
53 |
|
53 | |||
54 | hg clone https://kallithea-scm.org/repos/kallithea -u stable |
|
54 | hg clone https://kallithea-scm.org/repos/kallithea -u stable | |
55 | cd kallithea |
|
55 | cd kallithea | |
56 | python3 -m venv ../kallithea-venv |
|
56 | python3 -m venv ../kallithea-venv | |
57 | . ../kallithea-venv/bin/activate |
|
57 | . ../kallithea-venv/bin/activate | |
58 | pip install --upgrade pip setuptools |
|
58 | pip install --upgrade pip setuptools | |
59 | pip install --upgrade -e . |
|
59 | pip install --upgrade -e . | |
60 | python3 setup.py compile_catalog # for translation of the UI |
|
60 | python3 setup.py compile_catalog # for translation of the UI | |
61 |
|
61 | |||
62 | You can now proceed to :ref:`install-front-end`. |
|
62 | You can now proceed to :ref:`install-front-end`. | |
63 |
|
63 | |||
64 | .. _installation-virtualenv: |
|
64 | .. _installation-virtualenv: | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | Installing a released version in a virtualenv |
|
67 | Installing a released version in a virtualenv | |
68 | --------------------------------------------- |
|
68 | --------------------------------------------- | |
69 |
|
69 | |||
70 | It is highly recommended to use a separate virtualenv for installing Kallithea. |
|
70 | It is highly recommended to use a separate virtualenv for installing Kallithea. | |
71 | This way, all libraries required by Kallithea will be installed separately from your |
|
71 | This way, all libraries required by Kallithea will be installed separately from your | |
72 | main Python installation and other applications and things will be less |
|
72 | main Python installation and other applications and things will be less | |
73 | problematic when upgrading the system or Kallithea. |
|
73 | problematic when upgrading the system or Kallithea. | |
74 | An additional benefit of virtualenv is that it doesn't require root privileges. |
|
74 | An additional benefit of virtualenv is that it doesn't require root privileges. | |
75 |
|
75 | |||
76 | - Assuming you have installed virtualenv, create a new virtual environment |
|
76 | - Assuming you have installed virtualenv, create a new virtual environment | |
77 | for example, in `/srv/kallithea/venv`, using the venv command:: |
|
77 | for example, in `/srv/kallithea/venv`, using the venv command:: | |
78 |
|
78 | |||
79 | python3 -m venv /srv/kallithea/venv |
|
79 | python3 -m venv /srv/kallithea/venv | |
80 |
|
80 | |||
81 | - Activate the virtualenv in your current shell session and make sure the |
|
81 | - Activate the virtualenv in your current shell session and make sure the | |
82 | basic requirements are up-to-date by running the following commands in your |
|
82 | basic requirements are up-to-date by running the following commands in your | |
83 | bash shell:: |
|
83 | bash shell:: | |
84 |
|
84 | |||
85 | . /srv/kallithea/venv/bin/activate |
|
85 | . /srv/kallithea/venv/bin/activate | |
86 | pip install --upgrade pip setuptools |
|
86 | pip install --upgrade pip setuptools | |
87 |
|
87 | |||
88 | .. note:: You can't use UNIX ``sudo`` to source the ``virtualenv`` script; it |
|
88 | .. note:: You can't use UNIX ``sudo`` to source the ``virtualenv`` script; it | |
89 | will "activate" a shell that terminates immediately. It is also perfectly |
|
89 | will "activate" a shell that terminates immediately. It is also perfectly | |
90 | acceptable (and desirable) to create a virtualenv as a normal user. |
|
90 | acceptable (and desirable) to create a virtualenv as a normal user. | |
91 |
|
91 | |||
92 | - Make a folder for Kallithea data files, and configuration somewhere on the |
|
92 | - Make a folder for Kallithea data files, and configuration somewhere on the | |
93 | filesystem. For example:: |
|
93 | filesystem. For example:: | |
94 |
|
94 | |||
95 | mkdir /srv/kallithea |
|
95 | mkdir /srv/kallithea | |
96 |
|
96 | |||
97 | - Go into the created directory and run this command to install Kallithea:: |
|
97 | - Go into the created directory and run this command to install Kallithea:: | |
98 |
|
98 | |||
99 | pip install --upgrade kallithea |
|
99 | pip install --upgrade kallithea | |
100 |
|
100 | |||
101 | .. note:: Some dependencies are optional. If you need them, install them in |
|
101 | .. note:: Some dependencies are optional. If you need them, install them in | |
102 | the virtualenv too:: |
|
102 | the virtualenv too:: | |
103 |
|
103 | |||
104 | pip install --upgrade kallithea python-ldap python-pam psycopg2 |
|
104 | pip install --upgrade kallithea python-ldap python-pam psycopg2 | |
105 |
|
105 | |||
106 | This might require installation of development packages using your |
|
106 | This might require installation of development packages using your | |
107 | distribution's package manager. |
|
107 | distribution's package manager. | |
108 |
|
108 | |||
109 | Alternatively, download a .tar.gz from http://pypi.python.org/pypi/Kallithea, |
|
109 | Alternatively, download a .tar.gz from http://pypi.python.org/pypi/Kallithea, | |
110 | extract it and install from source by running:: |
|
110 | extract it and install from source by running:: | |
111 |
|
111 | |||
112 | pip install --upgrade . |
|
112 | pip install --upgrade . | |
113 |
|
113 | |||
114 | - This will install Kallithea together with all other required |
|
114 | - This will install Kallithea together with all other required | |
115 | Python libraries into the activated virtualenv. |
|
115 | Python libraries into the activated virtualenv. | |
116 |
|
116 | |||
117 | You can now proceed to :ref:`install-front-end`. |
|
117 | You can now proceed to :ref:`install-front-end`. | |
118 |
|
118 | |||
119 | .. _installation-without-virtualenv: |
|
119 | .. _installation-without-virtualenv: | |
120 |
|
120 | |||
121 |
|
121 | |||
122 | Installing a released version without virtualenv |
|
122 | Installing a released version without virtualenv | |
123 | ------------------------------------------------ |
|
123 | ------------------------------------------------ | |
124 |
|
124 | |||
125 | For installation without virtualenv, 'just' use:: |
|
125 | For installation without virtualenv, 'just' use:: | |
126 |
|
126 | |||
127 | pip install kallithea |
|
127 | pip install kallithea | |
128 |
|
128 | |||
129 | Note that this method requires root privileges and will install packages |
|
129 | Note that this method requires root privileges and will install packages | |
130 | globally without using the system's package manager. |
|
130 | globally without using the system's package manager. | |
131 |
|
131 | |||
132 | To install as a regular user in ``~/.local``, you can use:: |
|
132 | To install as a regular user in ``~/.local``, you can use:: | |
133 |
|
133 | |||
134 | pip install --user kallithea |
|
134 | pip install --user kallithea | |
135 |
|
135 | |||
136 | You can now proceed to :ref:`install-front-end`. |
|
136 | You can now proceed to :ref:`install-front-end`. | |
137 |
|
137 | |||
138 | .. _install-front-end: |
|
138 | .. _install-front-end: | |
139 |
|
139 | |||
140 |
|
140 | |||
141 | Prepare front-end files |
|
141 | Prepare front-end files | |
142 | ----------------------- |
|
142 | ----------------------- | |
143 |
|
143 | |||
144 |
Finally, the front-end files must be prepared. This |
|
144 | Finally, the front-end files with CSS and JavaScript must be prepared. This | |
145 | or later, which needs ``node.js`` (version 12 or later). Prepare the front-end |
|
145 | depends on having some commands available in the shell search path: ``npm`` | |
146 | by running:: |
|
146 | version 6 or later, and ``node.js`` (version 12 or later) available as | |
|
147 | ``node``. The installation method for these dependencies varies between | |||
|
148 | operating systems and distributions. | |||
|
149 | ||||
|
150 | Prepare the front-end by running:: | |||
147 |
|
151 | |||
148 | kallithea-cli front-end-build |
|
152 | kallithea-cli front-end-build | |
149 |
|
153 | |||
150 | You can now proceed to :ref:`setup`. |
|
154 | You can now proceed to :ref:`setup`. |
@@ -1,236 +1,236 b'' | |||||
1 | .. _overview: |
|
1 | .. _overview: | |
2 |
|
2 | |||
3 | ===================== |
|
3 | ===================== | |
4 | Installation overview |
|
4 | Installation overview | |
5 | ===================== |
|
5 | ===================== | |
6 |
|
6 | |||
7 | Some overview and some details that can help understanding the options when |
|
7 | Some overview and some details that can help understanding the options when | |
8 | installing Kallithea. |
|
8 | installing Kallithea. | |
9 |
|
9 | |||
10 | 1. **Prepare environment and external dependencies.** |
|
10 | 1. **Prepare environment and external dependencies.** | |
11 | Kallithea needs: |
|
11 | Kallithea needs: | |
12 |
|
12 | |||
13 | * A filesystem where the Mercurial and Git repositories can be stored. |
|
13 | * A filesystem where the Mercurial and Git repositories can be stored. | |
14 | * A database where meta data can be stored. |
|
14 | * A database where meta data can be stored. | |
15 | * A Python environment where the Kallithea application and its dependencies |
|
15 | * A Python environment where the Kallithea application and its dependencies | |
16 | can be installed. |
|
16 | can be installed. | |
17 | * A web server that can host the Kallithea web application using the WSGI |
|
17 | * A web server that can host the Kallithea web application using the WSGI | |
18 | API. |
|
18 | API. | |
19 |
|
19 | |||
20 | 2. **Install Kallithea software.** |
|
20 | 2. **Install Kallithea software.** | |
21 | This makes the ``kallithea-cli`` command line tool available. |
|
21 | This makes the ``kallithea-cli`` command line tool available. | |
22 |
|
22 | |||
23 | 3. **Prepare front-end files** |
|
23 | 3. **Prepare front-end files** | |
24 |
Some front-end files must be fetched or created using ``npm`` |
|
24 | Some front-end files must be fetched or created using ``npm`` and ``node`` | |
25 | they can be served to the client as static files. |
|
25 | tooling so they can be served to the client as static files. | |
26 |
|
26 | |||
27 | 4. **Create low level configuration file.** |
|
27 | 4. **Create low level configuration file.** | |
28 | Use ``kallithea-cli config-create`` to create a ``.ini`` file with database |
|
28 | Use ``kallithea-cli config-create`` to create a ``.ini`` file with database | |
29 | connection info, mail server information, configuration for the specified |
|
29 | connection info, mail server information, configuration for the specified | |
30 | web server, etc. |
|
30 | web server, etc. | |
31 |
|
31 | |||
32 | 5. **Populate the database.** |
|
32 | 5. **Populate the database.** | |
33 | Use ``kallithea-cli db-create`` with the ``.ini`` file to create the |
|
33 | Use ``kallithea-cli db-create`` with the ``.ini`` file to create the | |
34 | database schema and insert the most basic information: the location of the |
|
34 | database schema and insert the most basic information: the location of the | |
35 | repository store and an initial local admin user. |
|
35 | repository store and an initial local admin user. | |
36 |
|
36 | |||
37 | 6. **Configure the web server.** |
|
37 | 6. **Configure the web server.** | |
38 | The web server must invoke the WSGI entrypoint for the Kallithea software |
|
38 | The web server must invoke the WSGI entrypoint for the Kallithea software | |
39 | using the ``.ini`` file (and thus the database). This makes the web |
|
39 | using the ``.ini`` file (and thus the database). This makes the web | |
40 | application available so the local admin user can log in and tweak the |
|
40 | application available so the local admin user can log in and tweak the | |
41 | configuration further. |
|
41 | configuration further. | |
42 |
|
42 | |||
43 | 7. **Configure users.** |
|
43 | 7. **Configure users.** | |
44 | The initial admin user can create additional local users, or configure how |
|
44 | The initial admin user can create additional local users, or configure how | |
45 | users can be created and authenticated from other user directories. |
|
45 | users can be created and authenticated from other user directories. | |
46 |
|
46 | |||
47 | See the subsequent sections, the separate OS-specific instructions, and |
|
47 | See the subsequent sections, the separate OS-specific instructions, and | |
48 | :ref:`setup` for details on these steps. |
|
48 | :ref:`setup` for details on these steps. | |
49 |
|
49 | |||
50 |
|
50 | |||
51 | Python environment |
|
51 | Python environment | |
52 | ------------------ |
|
52 | ------------------ | |
53 |
|
53 | |||
54 | **Kallithea** is written entirely in Python_ and requires Python version |
|
54 | **Kallithea** is written entirely in Python_ and requires Python version | |
55 | 3.6 or higher. |
|
55 | 3.6 or higher. | |
56 |
|
56 | |||
57 | Given a Python installation, there are different ways of providing the |
|
57 | Given a Python installation, there are different ways of providing the | |
58 | environment for running Python applications. Each of them pretty much |
|
58 | environment for running Python applications. Each of them pretty much | |
59 | corresponds to a ``site-packages`` directory somewhere where packages can be |
|
59 | corresponds to a ``site-packages`` directory somewhere where packages can be | |
60 | installed. |
|
60 | installed. | |
61 |
|
61 | |||
62 | Kallithea itself can be run from source or be installed, but even when running |
|
62 | Kallithea itself can be run from source or be installed, but even when running | |
63 | from source, there are some dependencies that must be installed in the Python |
|
63 | from source, there are some dependencies that must be installed in the Python | |
64 | environment used for running Kallithea. |
|
64 | environment used for running Kallithea. | |
65 |
|
65 | |||
66 | - Packages *could* be installed in Python's ``site-packages`` directory ... but |
|
66 | - Packages *could* be installed in Python's ``site-packages`` directory ... but | |
67 | that would require running pip_ as root and it would be hard to uninstall or |
|
67 | that would require running pip_ as root and it would be hard to uninstall or | |
68 | upgrade and is probably not a good idea unless using a package manager. |
|
68 | upgrade and is probably not a good idea unless using a package manager. | |
69 |
|
69 | |||
70 | - Packages could also be installed in ``~/.local`` ... but that is probably |
|
70 | - Packages could also be installed in ``~/.local`` ... but that is probably | |
71 | only a good idea if using a dedicated user per application or instance. |
|
71 | only a good idea if using a dedicated user per application or instance. | |
72 |
|
72 | |||
73 | - Finally, it can be installed in a virtualenv. That is a very lightweight |
|
73 | - Finally, it can be installed in a virtualenv. That is a very lightweight | |
74 | "container" where each Kallithea instance can get its own dedicated and |
|
74 | "container" where each Kallithea instance can get its own dedicated and | |
75 | self-contained virtual environment. |
|
75 | self-contained virtual environment. | |
76 |
|
76 | |||
77 | We recommend using virtualenv for installing Kallithea. |
|
77 | We recommend using virtualenv for installing Kallithea. | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | Locale environment |
|
80 | Locale environment | |
81 | ------------------ |
|
81 | ------------------ | |
82 |
|
82 | |||
83 | In order to ensure a correct functioning of Kallithea with respect to non-ASCII |
|
83 | In order to ensure a correct functioning of Kallithea with respect to non-ASCII | |
84 | characters in user names, file paths, commit messages, etc., it is very |
|
84 | characters in user names, file paths, commit messages, etc., it is very | |
85 | important that Kallithea is run with a correct `locale` configuration. |
|
85 | important that Kallithea is run with a correct `locale` configuration. | |
86 |
|
86 | |||
87 | On Unix, environment variables like ``LANG`` or ``LC_ALL`` can specify a language (like |
|
87 | On Unix, environment variables like ``LANG`` or ``LC_ALL`` can specify a language (like | |
88 | ``en_US``) and encoding (like ``UTF-8``) to use for code points outside the ASCII |
|
88 | ``en_US``) and encoding (like ``UTF-8``) to use for code points outside the ASCII | |
89 | range. The flexibility of supporting multiple encodings of Unicode has the flip |
|
89 | range. The flexibility of supporting multiple encodings of Unicode has the flip | |
90 | side of having to specify which encoding to use - especially for Mercurial. |
|
90 | side of having to specify which encoding to use - especially for Mercurial. | |
91 |
|
91 | |||
92 | It depends on the OS distribution and system configuration which locales are |
|
92 | It depends on the OS distribution and system configuration which locales are | |
93 | available. For example, some Docker containers based on Debian default to only |
|
93 | available. For example, some Docker containers based on Debian default to only | |
94 | supporting the ``C`` language, while other Linux environments have ``en_US`` but not |
|
94 | supporting the ``C`` language, while other Linux environments have ``en_US`` but not | |
95 | ``C``. The ``locale -a`` command will show which values are available on the |
|
95 | ``C``. The ``locale -a`` command will show which values are available on the | |
96 | current system. Regardless of the actual language, you should normally choose a |
|
96 | current system. Regardless of the actual language, you should normally choose a | |
97 | locale that has the ``UTF-8`` encoding (note that spellings ``utf8``, ``utf-8``, |
|
97 | locale that has the ``UTF-8`` encoding (note that spellings ``utf8``, ``utf-8``, | |
98 | ``UTF8``, ``UTF-8`` are all referring to the same thing) |
|
98 | ``UTF8``, ``UTF-8`` are all referring to the same thing) | |
99 |
|
99 | |||
100 | For technical reasons, the locale configuration **must** be provided in the |
|
100 | For technical reasons, the locale configuration **must** be provided in the | |
101 | environment in which Kallithea runs - it cannot be specified in the ``.ini`` file. |
|
101 | environment in which Kallithea runs - it cannot be specified in the ``.ini`` file. | |
102 | How to practically do this depends on the web server that is used and the way it |
|
102 | How to practically do this depends on the web server that is used and the way it | |
103 | is started. For example, gearbox is often started by a normal user, either |
|
103 | is started. For example, gearbox is often started by a normal user, either | |
104 | manually or via a script. In this case, the required locale environment |
|
104 | manually or via a script. In this case, the required locale environment | |
105 | variables can be provided directly in that user's environment or in the script. |
|
105 | variables can be provided directly in that user's environment or in the script. | |
106 | However, web servers like Apache are often started at boot via an init script or |
|
106 | However, web servers like Apache are often started at boot via an init script or | |
107 | service file. Modifying the environment for this case would thus require |
|
107 | service file. Modifying the environment for this case would thus require | |
108 | root/administrator privileges. Moreover, that environment would dictate the |
|
108 | root/administrator privileges. Moreover, that environment would dictate the | |
109 | settings for all web services running under that web server, Kallithea being |
|
109 | settings for all web services running under that web server, Kallithea being | |
110 | just one of them. Specifically in the case of Apache with ``mod_wsgi``, the |
|
110 | just one of them. Specifically in the case of Apache with ``mod_wsgi``, the | |
111 | locale can be set for a specific service in its ``WSGIDaemonProcess`` directive, |
|
111 | locale can be set for a specific service in its ``WSGIDaemonProcess`` directive, | |
112 | using the ``lang`` parameter. |
|
112 | using the ``lang`` parameter. | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | Installation methods |
|
115 | Installation methods | |
116 | -------------------- |
|
116 | -------------------- | |
117 |
|
117 | |||
118 | Kallithea must be installed on a server. Kallithea is installed in a Python |
|
118 | Kallithea must be installed on a server. Kallithea is installed in a Python | |
119 | environment so it can use packages that are installed there and make itself |
|
119 | environment so it can use packages that are installed there and make itself | |
120 | available for other packages. |
|
120 | available for other packages. | |
121 |
|
121 | |||
122 | Two different cases will pretty much cover the options for how it can be |
|
122 | Two different cases will pretty much cover the options for how it can be | |
123 | installed. |
|
123 | installed. | |
124 |
|
124 | |||
125 | - The Kallithea source repository can be cloned and used -- it is kept stable and |
|
125 | - The Kallithea source repository can be cloned and used -- it is kept stable and | |
126 | can be used in production. The Kallithea maintainers use the development |
|
126 | can be used in production. The Kallithea maintainers use the development | |
127 | branch in production. The advantage of installation from source and regularly |
|
127 | branch in production. The advantage of installation from source and regularly | |
128 | updating it is that you take advantage of the most recent improvements. Using |
|
128 | updating it is that you take advantage of the most recent improvements. Using | |
129 | it directly from a DVCS also means that it is easy to track local customizations. |
|
129 | it directly from a DVCS also means that it is easy to track local customizations. | |
130 |
|
130 | |||
131 | Running ``pip install -e .`` in the source will use pip to install the |
|
131 | Running ``pip install -e .`` in the source will use pip to install the | |
132 | necessary dependencies in the Python environment and create a |
|
132 | necessary dependencies in the Python environment and create a | |
133 | ``.../site-packages/Kallithea.egg-link`` file there that points at the Kallithea |
|
133 | ``.../site-packages/Kallithea.egg-link`` file there that points at the Kallithea | |
134 | source. |
|
134 | source. | |
135 |
|
135 | |||
136 | - Kallithea can also be installed from ready-made packages using a package manager. |
|
136 | - Kallithea can also be installed from ready-made packages using a package manager. | |
137 | The official released versions are available on PyPI_ and can be downloaded and |
|
137 | The official released versions are available on PyPI_ and can be downloaded and | |
138 | installed with all dependencies using ``pip install kallithea``. |
|
138 | installed with all dependencies using ``pip install kallithea``. | |
139 |
|
139 | |||
140 | With this method, Kallithea is installed in the Python environment as any |
|
140 | With this method, Kallithea is installed in the Python environment as any | |
141 | other package, usually as a ``.../site-packages/Kallithea-X-py3.8.egg/`` |
|
141 | other package, usually as a ``.../site-packages/Kallithea-X-py3.8.egg/`` | |
142 | directory with Python files and everything else that is needed. |
|
142 | directory with Python files and everything else that is needed. | |
143 |
|
143 | |||
144 | (``pip install kallithea`` from a source tree will do pretty much the same |
|
144 | (``pip install kallithea`` from a source tree will do pretty much the same | |
145 | but build the Kallithea package itself locally instead of downloading it.) |
|
145 | but build the Kallithea package itself locally instead of downloading it.) | |
146 |
|
146 | |||
147 | .. note:: |
|
147 | .. note:: | |
148 | Kallithea includes front-end code that needs to be processed to prepare |
|
148 | Kallithea includes front-end code that needs to be processed to prepare | |
149 | static files that can be served at run time and used on the client side. The |
|
149 | static files that can be served at run time and used on the client side. The | |
150 | tool npm_ is used to download external dependencies and orchestrate the |
|
150 | tool npm_ is used to download external dependencies and orchestrate the | |
151 | processing. The ``npm`` binary must thus be available at install time but is |
|
151 | processing. The ``npm`` binary must thus be available at install time but is | |
152 | not used at run time. |
|
152 | not used at run time. | |
153 |
|
153 | |||
154 |
|
154 | |||
155 | Web server |
|
155 | Web server | |
156 | ---------- |
|
156 | ---------- | |
157 |
|
157 | |||
158 | Kallithea is (primarily) a WSGI_ application that must be run from a web |
|
158 | Kallithea is (primarily) a WSGI_ application that must be run from a web | |
159 | server that serves WSGI applications over HTTP. |
|
159 | server that serves WSGI applications over HTTP. | |
160 |
|
160 | |||
161 | Kallithea itself is not serving HTTP (or HTTPS); that is the web server's |
|
161 | Kallithea itself is not serving HTTP (or HTTPS); that is the web server's | |
162 | responsibility. Kallithea does however need to know its own user facing URL |
|
162 | responsibility. Kallithea does however need to know its own user facing URL | |
163 | (protocol, address, port and path) for each HTTP request. Kallithea will |
|
163 | (protocol, address, port and path) for each HTTP request. Kallithea will | |
164 | usually use its own HTML/cookie based authentication but can also be configured |
|
164 | usually use its own HTML/cookie based authentication but can also be configured | |
165 | to use web server authentication. |
|
165 | to use web server authentication. | |
166 |
|
166 | |||
167 | There are several web server options: |
|
167 | There are several web server options: | |
168 |
|
168 | |||
169 | - Kallithea uses the Gearbox_ tool as command line interface. Gearbox provides |
|
169 | - Kallithea uses the Gearbox_ tool as command line interface. Gearbox provides | |
170 | ``gearbox serve`` as a convenient way to launch a Python WSGI / web server |
|
170 | ``gearbox serve`` as a convenient way to launch a Python WSGI / web server | |
171 | from the command line. That is perfect for development and evaluation. |
|
171 | from the command line. That is perfect for development and evaluation. | |
172 | Actual use in production might have different requirements and need extra |
|
172 | Actual use in production might have different requirements and need extra | |
173 | work to make it manageable as a scalable system service. |
|
173 | work to make it manageable as a scalable system service. | |
174 |
|
174 | |||
175 | Gearbox comes with its own built-in web server for development but Kallithea |
|
175 | Gearbox comes with its own built-in web server for development but Kallithea | |
176 | defaults to using Waitress_. Gunicorn_ and Gevent_ are also options. These |
|
176 | defaults to using Waitress_. Gunicorn_ and Gevent_ are also options. These | |
177 | web servers have different limited feature sets. |
|
177 | web servers have different limited feature sets. | |
178 |
|
178 | |||
179 | The web server used by ``gearbox serve`` is configured in the ``.ini`` file. |
|
179 | The web server used by ``gearbox serve`` is configured in the ``.ini`` file. | |
180 | Create it with ``config-create`` using for example ``http_server=waitress`` |
|
180 | Create it with ``config-create`` using for example ``http_server=waitress`` | |
181 | to get a configuration starting point for your choice of web server. |
|
181 | to get a configuration starting point for your choice of web server. | |
182 |
|
182 | |||
183 | (Gearbox will do like ``paste`` and use the WSGI application entry point |
|
183 | (Gearbox will do like ``paste`` and use the WSGI application entry point | |
184 | ``kallithea.config.application:make_app`` as specified in ``setup.py``.) |
|
184 | ``kallithea.config.application:make_app`` as specified in ``setup.py``.) | |
185 |
|
185 | |||
186 | - `Apache httpd`_ can serve WSGI applications directly using mod_wsgi_ and a |
|
186 | - `Apache httpd`_ can serve WSGI applications directly using mod_wsgi_ and a | |
187 | simple Python file with the necessary configuration. This is a good option if |
|
187 | simple Python file with the necessary configuration. This is a good option if | |
188 | Apache is an option. |
|
188 | Apache is an option. | |
189 |
|
189 | |||
190 | - uWSGI_ is also a full web server with built-in WSGI module. Use |
|
190 | - uWSGI_ is also a full web server with built-in WSGI module. Use | |
191 | ``config-create`` with ``http_server=uwsgi`` to get a ``.ini`` file with |
|
191 | ``config-create`` with ``http_server=uwsgi`` to get a ``.ini`` file with | |
192 | uWSGI configuration. |
|
192 | uWSGI configuration. | |
193 |
|
193 | |||
194 | - IIS_ can also server WSGI applications directly using isapi-wsgi_. |
|
194 | - IIS_ can also server WSGI applications directly using isapi-wsgi_. | |
195 |
|
195 | |||
196 | - A `reverse HTTP proxy <https://en.wikipedia.org/wiki/Reverse_proxy>`_ |
|
196 | - A `reverse HTTP proxy <https://en.wikipedia.org/wiki/Reverse_proxy>`_ | |
197 | can be put in front of another web server which has WSGI support. |
|
197 | can be put in front of another web server which has WSGI support. | |
198 | Such a layered setup can be complex but might in some cases be the right |
|
198 | Such a layered setup can be complex but might in some cases be the right | |
199 | option, for example to standardize on one internet-facing web server, to add |
|
199 | option, for example to standardize on one internet-facing web server, to add | |
200 | encryption or special authentication or for other security reasons, to |
|
200 | encryption or special authentication or for other security reasons, to | |
201 | provide caching of static files, or to provide load balancing or fail-over. |
|
201 | provide caching of static files, or to provide load balancing or fail-over. | |
202 | Nginx_, Varnish_ and HAProxy_ are often used for this purpose, often in front |
|
202 | Nginx_, Varnish_ and HAProxy_ are often used for this purpose, often in front | |
203 | of a ``gearbox serve`` that somehow is wrapped as a service. |
|
203 | of a ``gearbox serve`` that somehow is wrapped as a service. | |
204 |
|
204 | |||
205 | The best option depends on what you are familiar with and the requirements for |
|
205 | The best option depends on what you are familiar with and the requirements for | |
206 | performance and stability. Also, keep in mind that Kallithea mainly is serving |
|
206 | performance and stability. Also, keep in mind that Kallithea mainly is serving | |
207 | dynamically generated pages from a relatively slow Python process. Kallithea is |
|
207 | dynamically generated pages from a relatively slow Python process. Kallithea is | |
208 | also often used inside organizations with a limited amount of users and thus no |
|
208 | also often used inside organizations with a limited amount of users and thus no | |
209 | continuous hammering from the internet. |
|
209 | continuous hammering from the internet. | |
210 |
|
210 | |||
211 | .. note:: |
|
211 | .. note:: | |
212 | Kallithea, the libraries it uses, and Python itself do in several places use |
|
212 | Kallithea, the libraries it uses, and Python itself do in several places use | |
213 | simple caching in memory. Caches and memory are not always released in a way |
|
213 | simple caching in memory. Caches and memory are not always released in a way | |
214 | that is suitable for long-running processes. They might appear to be leaking |
|
214 | that is suitable for long-running processes. They might appear to be leaking | |
215 | memory. The worker processes should thus regularly be restarted - for |
|
215 | memory. The worker processes should thus regularly be restarted - for | |
216 | example after 1000 requests and/or one hour. This can usually be done by the |
|
216 | example after 1000 requests and/or one hour. This can usually be done by the | |
217 | web server or the tool used for running it as a system service. |
|
217 | web server or the tool used for running it as a system service. | |
218 |
|
218 | |||
219 |
|
219 | |||
220 | .. _Python: http://www.python.org/ |
|
220 | .. _Python: http://www.python.org/ | |
221 | .. _Gunicorn: http://gunicorn.org/ |
|
221 | .. _Gunicorn: http://gunicorn.org/ | |
222 | .. _Gevent: http://www.gevent.org/ |
|
222 | .. _Gevent: http://www.gevent.org/ | |
223 | .. _Waitress: https://docs.pylonsproject.org/projects/waitress/ |
|
223 | .. _Waitress: https://docs.pylonsproject.org/projects/waitress/ | |
224 | .. _Gearbox: https://turbogears.readthedocs.io/en/latest/turbogears/gearbox.html |
|
224 | .. _Gearbox: https://turbogears.readthedocs.io/en/latest/turbogears/gearbox.html | |
225 | .. _PyPI: https://pypi.python.org/pypi |
|
225 | .. _PyPI: https://pypi.python.org/pypi | |
226 | .. _Apache httpd: http://httpd.apache.org/ |
|
226 | .. _Apache httpd: http://httpd.apache.org/ | |
227 | .. _mod_wsgi: https://modwsgi.readthedocs.io/ |
|
227 | .. _mod_wsgi: https://modwsgi.readthedocs.io/ | |
228 | .. _isapi-wsgi: https://github.com/hexdump42/isapi-wsgi |
|
228 | .. _isapi-wsgi: https://github.com/hexdump42/isapi-wsgi | |
229 | .. _uWSGI: https://uwsgi-docs.readthedocs.io/ |
|
229 | .. _uWSGI: https://uwsgi-docs.readthedocs.io/ | |
230 | .. _nginx: http://nginx.org/en/ |
|
230 | .. _nginx: http://nginx.org/en/ | |
231 | .. _iis: http://en.wikipedia.org/wiki/Internet_Information_Services |
|
231 | .. _iis: http://en.wikipedia.org/wiki/Internet_Information_Services | |
232 | .. _pip: http://en.wikipedia.org/wiki/Pip_%28package_manager%29 |
|
232 | .. _pip: http://en.wikipedia.org/wiki/Pip_%28package_manager%29 | |
233 | .. _WSGI: http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface |
|
233 | .. _WSGI: http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface | |
234 | .. _HAProxy: http://www.haproxy.org/ |
|
234 | .. _HAProxy: http://www.haproxy.org/ | |
235 | .. _Varnish: https://www.varnish-cache.org/ |
|
235 | .. _Varnish: https://www.varnish-cache.org/ | |
236 | .. _npm: https://www.npmjs.com/ |
|
236 | .. _npm: https://www.npmjs.com/ |
General Comments 0
You need to be logged in to leave comments.
Login now