forked from graphite-project/graphite-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
INSTALL
150 lines (107 loc) · 5.99 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
ExtJS
-------------------------------------------------------------------------------
Graphite used to require an external Ext installation but now Ext is bundled
with Graphite as allowed by the Ext FLOSS license exemption described here:
http://extjs.com/products/floss-exception.php
Run check-dependencies.py
-------------------------------------------------------------------------------
This will check for graphite's runtime dependencies and let
you know which you are missing. Download and install these modules and re-run
check-dependencies.py until it detects all the required modules.
Graphite requires:
python2.4 or greater (python 2.5 or greater is required for AMQP support)
whisper (available for download on the graphite project page)
pycairo (with PNG backend support)
django
json (standard in python2.6) or simplejson
mod_wsgi (optional, recommended) or mod_python (optional)
python-ldap (optional - needed for ldap-based webapp authentication)
python-memcached (optional - needed for webapp caching, big performance boost)
python-sqlite2 (optional - a django-supported database module is required)
Twisted (required only for carbon)
Run setup.py
-------------------------------------------------------------------------------
First take a look at the 'prefix' option in the setup.cfg file. This specifies
where the graphite application will be installed. Note that if you plan on
installing carbon on the same server you should use the same prefix for it.
The prefix where graphite is installed under where be referred to as
$GRAPHITE_ROOT from here on.
Also, do NOT change the 'install-lib' option unless you really know what
you are doing.
Initialize the Database
------------------------------------------------------------------------------
Once you have installed graphite you must initialize its database like so:
export PYTHONPATH=$PYTHONPATH:$GRAPHITE_ROOT/webapp
cd $GRAPHITE_ROOT/webapp/graphite/
sudo python manage.py syncdb
Note that if you wish to use a custom database setup (like MySQL or Postgres)
you will need to make those configuration changes first. See the "Custom
Database Configuration" section below for details.
Setup Filesystem Ownership
------------------------------------------------------------------------------
The user that apache runs as will need write access to the following directories:
$GRAPHITE_ROOT/storage/
$GRAPHITE_ROOT/storage/log/webapp/
As well as write access to the following files:
$GRAPHITE_ROOT/storage/graphite.db
The apache user must also have read access to $GRAPHITE_ROOT/storage/whisper/
Apache Configuration
-------------------------------------------------------------------------------
When using apache there are two modules available to provide support for python
web application.
Graphite currently provides example configurations for both of these modules.
Of the two mod_wsgi is the most up to date and actively maintained so it's
highly recommended if you are starting afresh.
Apache Configuration for Mod_wsgi (recommended)
-------------------------------------------------------------------------------
If you are using mod_wsgi, Apache has to have mod_wsgi configured,
this is usually done by including a line like the following in your
httpd.conf:
LoadModule wsgi_module modules/mod_wsgi.so
Apache Configuration for Mod_python
-------------------------------------------------------------------------------
If you choose to use mod_python, Apache has to have mod_python configured,
this is usually done by including a line like the following in your
httpd.conf:
LoadModule python_module modules/mod_python.so
General Apache Configuration
-------------------------------------------------------------------------------
Once you have configured the apache module you are using you should configure
a vhost for graphite (technically it doesn't have to be a vhost but its good
practice). This can be done one of two ways.
The first way (highly preferred) is to include independent vhost configs.
# This goes in httpd.conf
Include /usr/local/apache2/conf/vhosts.d/*.conf
Then simply drop your graphite vhost conf file into the vhosts.d/ directory
(or whatever directory your system uses) and apache is ready. You can use
either of the example vhost confs as a starting point (See the examples
directory of this package and choose the correct one based on whether you
are using mod_wsgi or mod_python.)
The second approach is to copy the contents of your chosen graphite vhost conf file
and insert it down at the end of your httpd.conf.
Custom Database Configuration
-------------------------------------------------------------------------------
By default, the graphite webapp uses a sqlite database. As long as you have the
appropriate sqlite module installed, you should not need to do any additional
database configuration. But if you wish to use a different database such as
MySQL or Postgres, read on.
After you setup your database server, create a database and a user with full
privileges on that database. Now we put that information into the graphite
webapp local_settings.py file.
Edit the $GRAPHITE_ROOT/webapp/graphite/local_settings.py
In particular you will need to uncomment and modify all of the settings
that begin with "DATABASE_". Once you have done this, we need to tell
Django to create our tables.
cd $GRAPHITE_ROOT/webapp/graphite/
sudo python manage.py syncdb
# you will be prompted to create an admin user, this is a good idea
Restart apache and you should see the graphite webapp on the main page.
If you encounter problems, you can increase the verbosity of error output
by adding a "DEBUG = True" line to local_settings.py
Next Steps - setup the backend (carbon)
-------------------------------------------------------------------------------
Now you have finished installing the graphite webapp, the next thing to do is put some
real data into it. This is accomplished by running the carbon-cache.py daemon
and send it some data as demonstrated in the included
./examples/example-client.py
Instructions for doing this in the README file.