comparison docs/setup.rst @ 5789:8c479b274e03 stable

docs: improve mod_wsgi documentation (Issue #203) Based on feedback from Graham Dumpleton. * Recommend setting global Apache config WSGIRestrictEmbedded On * Don't set the default value for processes=1 - it has side effects * Use python-home instead of python-path * Fix confusing mentioning of root and clarify the use of specifying user and group * Include WSGIProcessGroup in configuration excerpt
author Mads Kiilerich <madski@unity3d.com>
date Sun, 03 Apr 2016 22:45:37 +0200
parents 2d89d49c30e8
children 73493ddc8c9e
comparison
equal deleted inserted replaced
5788:2d89d49c30e8 5789:8c479b274e03
716 716
717 - Enable mod_wsgi:: 717 - Enable mod_wsgi::
718 718
719 a2enmod wsgi 719 a2enmod wsgi
720 720
721 - Add global Apache configuration to tell mod_wsgi that Python only will be
722 used in the WSGI processes and shouldn't be initialized in the Apache
723 processes::
724
725 WSGIRestrictEmbedded On
726
721 - Create a wsgi dispatch script, like the one below. Make sure you 727 - Create a wsgi dispatch script, like the one below. Make sure you
722 check that the paths correctly point to where you installed Kallithea 728 check that the paths correctly point to where you installed Kallithea
723 and its Python Virtual Environment. 729 and its Python Virtual Environment.
724 - Enable the ``WSGIScriptAlias`` directive for the WSGI dispatch script, 730 - Enable the ``WSGIScriptAlias`` directive for the WSGI dispatch script,
725 as in the following example. Once again, check the paths are 731 as in the following example. Once again, check the paths are
728 Here is a sample excerpt from an Apache Virtual Host configuration file: 734 Here is a sample excerpt from an Apache Virtual Host configuration file:
729 735
730 .. code-block:: apache 736 .. code-block:: apache
731 737
732 WSGIDaemonProcess kallithea \ 738 WSGIDaemonProcess kallithea \
733 processes=1 threads=4 \ 739 threads=4 \
734 python-path=/srv/kallithea/venv/lib/python2.7/site-packages 740 python-home=/srv/kallithea/venv
741 WSGIProcessGroup kallithea
735 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi 742 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
736 WSGIPassAuthorization On 743 WSGIPassAuthorization On
737 744
738 Or if using a dispatcher WSGI script with proper virtualenv activation: 745 Or if using a dispatcher WSGI script with proper virtualenv activation:
739 746
740 .. code-block:: apache 747 .. code-block:: apache
741 748
742 WSGIDaemonProcess kallithea processes=1 threads=4 749 WSGIDaemonProcess kallithea threads=4
750 WSGIProcessGroup kallithea
743 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi 751 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
744 WSGIPassAuthorization On 752 WSGIPassAuthorization On
745 753
746 .. note:: 754 Apache will by default run as a special Apache user, on Linux systems
747 When running apache as root, please make sure it doesn't run Kallithea as 755 usually ``www-data`` or ``apache``. If you need to have the repositories
748 root, for examply by adding: ``user=www-data group=www-data`` to the configuration. 756 directory owned by a different user, use the user and group options to
757 WSGIDaemonProcess to set the name of the user and group. """
749 758
750 .. note:: 759 .. note::
751 If running Kallithea in multiprocess mode, 760 If running Kallithea in multiprocess mode,
752 make sure you set ``instance_id = *`` in the configuration so each process 761 make sure you set ``instance_id = *`` in the configuration so each process
753 gets it's own cache invalidation key. 762 gets it's own cache invalidation key.
764 os.chdir('/srv/kallithea/') 773 os.chdir('/srv/kallithea/')
765 774
766 import site 775 import site
767 site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages") 776 site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
768 777
778 ini = '/srv/kallithea/my.ini'
779 from paste.script.util.logging_config import fileConfig
780 fileConfig(ini)
769 from paste.deploy import loadapp 781 from paste.deploy import loadapp
770 from paste.script.util.logging_config import fileConfig 782 application = loadapp('config:' + ini)
771
772 fileConfig('/srv/kallithea/my.ini')
773 application = loadapp('config:/srv/kallithea/my.ini')
774 783
775 Or using proper virtualenv activation: 784 Or using proper virtualenv activation:
776 785
777 .. code-block:: python 786 .. code-block:: python
778 787