Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 2.87 KB

install-virtualenv.rst

File metadata and controls

75 lines (52 loc) · 2.87 KB

Installing in Virtualenv

Virtualenv provides an isolated Python environment to run Graphite in.

Installing in the Default Location

To install Graphite in the :ref:`default location <default-installation-layout>`, /opt/graphite/, create a virtualenv in /opt/graphite and activate it:

virtualenv /opt/graphite
source /opt/graphite/bin/activate

Once the virtualenv is activated, Graphite and Carbon can be installed :doc:`from source <install-source>` or :doc:`via pip <install-pip>`. Note that dependencies will need to be installed while the virtualenv is activated unless --system-site-packages is specified at virtualenv creation time.

Installing in a Custom Location

To install from source activate the virtualenv and see the instructions for :ref:`graphite-web <graphite-web-custom-location-source>` and :ref:`carbon <carbon-custom-location-source>`

Running Carbon Within Virtualenv

Carbon may be run within Virtualenv by activating virtualenv before Carbon is started

Running Graphite-web Within Virtualenv

Running Django's django-admin.py within a virtualenv requires using the full path of the virtualenv:

/path/to/env/bin/django-admin.py <command> --settings=graphite.settings

The method of running Graphite-web within Virtualenv depends on the WSGI server used:

Apache mod_wsgi

Note

The version Python used to compile mod_wsgi must match the Python installed in the virtualenv (generally the system Python)

To the Apache mod_wsgi config, add the root of the virtualenv as WSGIPythonHome, /opt/graphite in this example:

WSGIPythonHome /opt/graphite

and add the virtualenv's python site-packages to the graphite.wsgi file, python 2.6 in /opt/graphite in this example:

site.addsitedir('/opt/graphite/lib/python2.6/site-packages')

See the mod_wsgi documentation on Virtual Environments <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments> for more details.

Gunicorn

Ensure Gunicorn is installed in the activated virtualenv and execute as normal. If gunicorn is installed system-wide, it may be necessary to execute it from the virtualenv's bin path

uWSGI

Execute uWSGI using the -H option to specify the virtualenv root. See the uWSGI documentation on virtualenv for more details.