summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe2013-04-09 20:15:09 (GMT)
committerElan Ruusamäe2013-04-09 20:17:53 (GMT)
commit2c0ea58e76e2a4d0dac891d3b5ed6699d97144dd (patch)
tree984fa291976ce2350955dbb0eeba5dbca1aaf35a
downloadgraphite-web-2c0ea58e76e2a4d0dac891d3b5ed6699d97144dd.zip
graphite-web-2c0ea58e76e2a4d0dac891d3b5ed6699d97144dd.tar.gz
new, version 0.9.10
based on fedora package 3f91f727bd381e70192b5f07453b33f0a8510931
-rw-r--r--apache.conf23
-rw-r--r--graphite-web-0.9.10-fhs-thirdparty.patch185
-rw-r--r--graphite-web.logrotate8
-rw-r--r--graphite-web.spec133
4 files changed, 349 insertions, 0 deletions
diff --git a/apache.conf b/apache.conf
new file mode 100644
index 0000000..670fc0a
--- /dev/null
+++ b/apache.conf
@@ -0,0 +1,23 @@
+# Graphite Web Basic mod_wsgi vhost
+
+<VirtualHost *:80>
+
+ ServerName graphite-web
+ DocumentRoot "/usr/share/graphite/webapp"
+ ErrorLog /var/log/httpd/graphite-web-error.log
+ CustomLog /var/log/httpd/graphite-web-access.log common
+ Alias /media/ "##PYTHON_SITELIB##/django/contrib/admin/media/"
+
+ WSGIScriptAlias / /usr/share/graphite/graphite-web.wsgi
+ WSGIImportScript /usr/share/graphite/graphite-web.wsgi process-group=%{GLOBAL} application-group=%{GLOBAL}
+
+ <Location "/content/">
+ SetHandler None
+ </Location>
+
+ <Location "/media/">
+ SetHandler None
+ </Location>
+
+</VirtualHost>
+
diff --git a/graphite-web-0.9.10-fhs-thirdparty.patch b/graphite-web-0.9.10-fhs-thirdparty.patch
new file mode 100644
index 0000000..7f0535a
--- /dev/null
+++ b/graphite-web-0.9.10-fhs-thirdparty.patch
@@ -0,0 +1,185 @@
+diff -up ./check-dependencies.py.orig ./check-dependencies.py
+--- ./check-dependencies.py.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./check-dependencies.py 2012-11-24 14:09:50.040701191 -0700
+@@ -58,6 +58,19 @@ except:
+ django = None
+ fatal += 1
+
++# Test for pytz
++try:
++ import pytz
++except:
++ print "[FATAL] Unable to import the 'pytz' module, do you have pytz module installed for python %s?\n" % py_version
++ fatal += 1
++
++# Test for pyparsing
++try:
++ import pyparsing
++except:
++ print "[FATAL] Unable to import the 'pyparsing' module, do you have pyparsing module installed for python %s?\n" % py_version
++ fatal += 1
+
+ # Test for django-tagging
+ try:
+diff -up ./conf/graphite.wsgi.example.orig ./conf/graphite.wsgi.example
+--- ./conf/graphite.wsgi.example.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./conf/graphite.wsgi.example 2012-11-24 14:10:08.310633299 -0700
+@@ -1,5 +1,5 @@
+ import os, sys
+-sys.path.append('/opt/graphite/webapp')
++sys.path.append('/usr/share/graphite/webapp')
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'
+
+ import django.core.handlers.wsgi
+diff -up ./MANIFEST.in.orig ./MANIFEST.in
+--- ./MANIFEST.in.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./MANIFEST.in 2012-11-24 14:09:50.039701194 -0700
+@@ -5,7 +5,6 @@ include check-dependencies.py
+ include examples/*
+ include conf/*.example
+ include webapp/graphite/local_settings.py.example
+-include webapp/graphite/thirdparty/pytz/pytz-LICENSE.txt
+ recursive-include distro/ *
+ recursive-include webapp/graphite/ *.html
+ recursive-include webapp/content/ *
+diff -up ./setup.cfg.orig ./setup.cfg
+--- ./setup.cfg.orig 2012-11-24 14:09:51.776694909 -0700
++++ ./setup.cfg 2012-11-24 14:10:08.311633295 -0700
+@@ -1,6 +1,7 @@
+ [install]
+-prefix = /opt/graphite
+-install-lib = %(prefix)s/webapp
++#prefix = /opt/graphite
++#install-lib = %(prefix)s/webapp
++install-data = /usr/share/graphite
+
+ [bdist_rpm]
+ requires = Django => 1.1.4
+diff -up ./setup.py.orig ./setup.py
+--- ./setup.py.orig 2012-11-24 14:09:51.776694909 -0700
++++ ./setup.py 2012-11-24 14:10:08.312633291 -0700
+@@ -58,6 +58,7 @@ setup(
+ package_data={'graphite' :
+ ['templates/*', 'local_settings.py.example']},
+ scripts=glob('bin/*'),
+- data_files=webapp_content.items() + storage_dirs + conf_files + examples,
++ #data_files=webapp_content.items() + storage_dirs + conf_files + examples,
++ data_files=webapp_content.items(),
+ **setup_kwargs
+ )
+diff -up ./webapp/graphite/cli/parser.py.orig ./webapp/graphite/cli/parser.py
+--- ./webapp/graphite/cli/parser.py.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./webapp/graphite/cli/parser.py 2012-11-24 14:09:51.777694906 -0700
+@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ See the License for the specific language governing permissions and
+ limitations under the License."""
+
+-from graphite.thirdparty.pyparsing import *
++from pyparsing import *
+
+ grammar = Forward()
+
+diff -up ./webapp/graphite/local_settings.py.example.orig ./webapp/graphite/local_settings.py.example
+--- ./webapp/graphite/local_settings.py.example.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./webapp/graphite/local_settings.py.example 2012-11-24 14:10:08.313633288 -0700
+@@ -43,29 +43,29 @@
+ #####################################
+ # Change only GRAPHITE_ROOT if your install is merely shifted from /opt/graphite
+ # to somewhere else
+-#GRAPHITE_ROOT = '/opt/graphite'
++GRAPHITE_ROOT = '/usr/share/graphite'
+
+ # Most installs done outside of a separate tree such as /opt/graphite will only
+ # need to change these three settings. Note that the default settings for each
+ # of these is relative to GRAPHITE_ROOT
+-#CONF_DIR = '/opt/graphite/conf'
+-#STORAGE_DIR = '/opt/graphite/storage'
+-#CONTENT_DIR = '/opt/graphite/webapp/content'
++CONF_DIR = '/etc/graphite-web'
++STORAGE_DIR = '/var/lib/graphite-web'
++CONTENT_DIR = '/usr/share/graphite/webapp/content'
+
+ # To further or fully customize the paths, modify the following. Note that the
+ # default settings for each of these are relative to CONF_DIR and STORAGE_DIR
+ #
+ ## Webapp config files
+-#DASHBOARD_CONF = '/opt/graphite/conf/dashboard.conf'
+-#GRAPHTEMPLATES_CONF = '/opt/graphite/conf/graphTemplates.conf'
++#DASHBOARD_CONF = '/etc/graphite-web/dashboard.conf'
++#GRAPHTEMPLATES_CONF = '/etc/graphite-web/graphTemplates.conf'
+
+ ## Data directories
+ # NOTE: If any directory is unreadable in DATA_DIRS it will break metric browsing
+-#WHISPER_DIR = '/opt/graphite/storage/whisper'
+-#RRD_DIR = '/opt/graphite/storage/rrd'
+-#DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
+-#LOG_DIR = '/opt/graphite/storage/log/webapp'
+-#INDEX_FILE = '/opt/graphite/storage/index' # Search index file
++WHISPER_DIR = '/var/lib/carbon/whisper/'
++RRD_DIR = '/var/lib/carbon/rrd'
++DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
++LOG_DIR = '/var/log/graphite-web/'
++INDEX_FILE = '/var/lib/graphite-web/index' # Search index file
+
+
+ #####################################
+diff -up ./webapp/graphite/render/attime.py.orig ./webapp/graphite/render/attime.py
+--- ./webapp/graphite/render/attime.py.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./webapp/graphite/render/attime.py 2012-11-24 14:09:51.777694906 -0700
+@@ -16,11 +16,7 @@ from datetime import datetime,timedelta
+ from time import daylight
+ from django.conf import settings
+
+-try: # See if there is a system installation of pytz first
+- import pytz
+-except ImportError: # Otherwise we fall back to Graphite's bundled version
+- from graphite.thirdparty import pytz
+-
++import pytz
+
+ months = ['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']
+ weekdays = ['sun','mon','tue','wed','thu','fri','sat']
+diff -up ./webapp/graphite/render/glyph.py.orig ./webapp/graphite/render/glyph.py
+--- ./webapp/graphite/render/glyph.py.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./webapp/graphite/render/glyph.py 2012-11-24 14:09:51.779694900 -0700
+@@ -22,10 +22,7 @@ from graphite.render.datalib import Time
+ from graphite.util import json
+
+
+-try: # See if there is a system installation of pytz first
+- import pytz
+-except ImportError: # Otherwise we fall back to Graphite's bundled version
+- from graphite.thirdparty import pytz
++import pytz
+
+ INFINITY = float('inf')
+
+diff -up ./webapp/graphite/render/grammar.py.orig ./webapp/graphite/render/grammar.py
+--- ./webapp/graphite/render/grammar.py.orig 2012-05-31 00:28:54.000000000 -0600
++++ ./webapp/graphite/render/grammar.py 2012-11-24 14:09:51.779694900 -0700
+@@ -1,4 +1,4 @@
+-from graphite.thirdparty.pyparsing import *
++from pyparsing import *
+
+ ParserElement.enablePackrat()
+ grammar = Forward()
+diff -up ./webapp/graphite/settings.py.orig ./webapp/graphite/settings.py
+--- ./webapp/graphite/settings.py.orig 2012-05-31 14:30:23.000000000 -0600
++++ ./webapp/graphite/settings.py 2012-11-24 14:09:51.780694897 -0700
+@@ -31,7 +31,6 @@ JAVASCRIPT_DEBUG = False
+ WEB_DIR = dirname( abspath(__file__) )
+ WEBAPP_DIR = dirname(WEB_DIR)
+ GRAPHITE_ROOT = dirname(WEBAPP_DIR)
+-THIRDPARTY_DIR = join(WEB_DIR,'thirdparty')
+ # Initialize additional path variables
+ # Defaults for these are set after local_settings is imported
+ CONTENT_DIR = ''
+@@ -50,8 +49,6 @@ DATA_DIRS = []
+ CLUSTER_SERVERS = []
+
+ sys.path.insert(0, WEBAPP_DIR)
+-# Allow local versions of the libs shipped in thirdparty to take precedence
+-sys.path.append(THIRDPARTY_DIR)
+
+ # Memcache settings
+ MEMCACHE_HOSTS = []
diff --git a/graphite-web.logrotate b/graphite-web.logrotate
new file mode 100644
index 0000000..155767d
--- /dev/null
+++ b/graphite-web.logrotate
@@ -0,0 +1,8 @@
+/var/log/graphite-web/*.log {
+ rotate 7
+ missingok
+ notifempty
+ copytruncate
+ daily
+ compress
+}
diff --git a/graphite-web.spec b/graphite-web.spec
new file mode 100644
index 0000000..810ccb3
--- /dev/null
+++ b/graphite-web.spec
@@ -0,0 +1,133 @@
+Summary: A Django webapp for enterprise scalable realtime graphing
+Name: graphite-web
+Version: 0.9.10
+Release: 0.1
+License: Apache v2.0
+Group: Applications/WWW
+Source0: https://github.com/downloads/graphite-project/graphite-web/%{name}-%{version}.tar.gz
+Source1: apache.conf
+Source2: %{name}.logrotate
+Patch0: %{name}-0.9.10-fhs-thirdparty.patch
+URL: https://launchpad.net/graphite/
+BuildRequires: python-devel
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.658
+Requires: apache-mod_wsgi
+Requires: fonts-TTF-DejaVu
+Requires: python-django
+Requires: python-django_tagging
+Requires: python-pycairo
+Requires: python-pyparsing
+Requires: python-pytz
+Requires: python-simplejson
+Requires: python-whisper
+Requires: webapps
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define _webapps /etc/webapps
+%define _webapp %{name}
+%define _sysconfdir %{_webapps}/%{_webapp}
+%define _appdir %{_datadir}/%{_webapp}
+
+%description
+Graphite consists of a storage backend and a web-based visualization
+frontend. Client applications send streams of numeric time-series data
+to the Graphite backend (called carbon), where it gets stored in
+fixed-size database files similar in design to RRD. The web frontend
+provides user interfaces for visualizing this data in graphs as well
+as a simple URL-based API for direct graph generation.
+
+Graphite's design is focused on providing simple interfaces (both to
+users and applications), real-time visualization, high-availability,
+and enterprise scalability.
+
+%prep
+%setup -q
+# Patch for Filesystem Hierarchy Standard
+# Remove thridparty libs
+# https://github.com/hggh/graphite-web-upstream/commit/47361a2707f904a8b817ca96deeddabcdbaaa534.patch
+%patch0 -p1
+
+%build
+%{__python} setup.py build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__python} setup.py install \
+ --skip-build \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
+
+%py_postclean -x manage.py
+
+# Create directories
+install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}
+install -d $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
+install -d $RPM_BUILD_ROOT%{_sysconfdir}
+
+# Install some default configurations and wsgi
+install -Dp conf/dashboard.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dashboard.conf
+mv $RPM_BUILD_ROOT{%{py_sitescriptdir}/graphite/local_settings.py.example,%{_sysconfdir}/local_settings.py}
+touch $RPM_BUILD_ROOT%{_sysconfdir}/local_settings.py{c,o}
+install -Dp conf/graphite.wsgi.example $RPM_BUILD_ROOT%{_datadir}/graphite/%{name}.wsgi
+install -Dp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
+install -Dp %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+
+# Configure django /media/ location
+sed -i 's|##PYTHON_SITELIB##|%{py_sitescriptdir}|' $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
+
+# Create local_settings symlink
+ln -s %{_sysconfdir}/local_settings.py $RPM_BUILD_ROOT%{py_sitescriptdir}/graphite
+
+# Don't ship bins that are not needed for prodcution
+%{__rm} $RPM_BUILD_ROOT%{_bindir}/{build-index.sh,run-graphite-devel-server.py}
+
+# Fix permissions
+%{__chmod} 0755 $RPM_BUILD_ROOT%{py_sitescriptdir}/graphite/manage.py
+
+# Don't ship thirdparty
+rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/graphite/thirdparty
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%triggerin -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%files
+%defattr(644,root,root,755)
+%doc conf/* examples/*
+%config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
+%dir %attr(750,root,http) %{_sysconfdir}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dashboard.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/local_settings.py
+%ghost %{_sysconfdir}/local_settings.pyc
+%ghost %{_sysconfdir}/local_settings.pyo
+
+%dir %{py_sitescriptdir}/graphite
+%{py_sitescriptdir}/graphite/*.py[co]
+%{py_sitescriptdir}/graphite/local_settings.py
+%attr(755,root,root) %{py_sitescriptdir}/graphite/manage.py
+%{py_sitescriptdir}/graphite/account
+%{py_sitescriptdir}/graphite/browser
+%{py_sitescriptdir}/graphite/cli
+%{py_sitescriptdir}/graphite/composer
+%{py_sitescriptdir}/graphite/dashboard
+%{py_sitescriptdir}/graphite/events
+%{py_sitescriptdir}/graphite/graphlot
+%{py_sitescriptdir}/graphite/metrics
+%{py_sitescriptdir}/graphite/render
+%{py_sitescriptdir}/graphite/templates
+%{py_sitescriptdir}/graphite/version
+%{py_sitescriptdir}/graphite/whitelist
+%{py_sitescriptdir}/graphite_web-%{version}-py*.egg-info
+
+%{_datadir}/graphite
+
+%attr(775,root,http) %dir %{_localstatedir}/log/%{name}
+%attr(775,root,http) %dir %{_sharedstatedir}/%{name}