[graphite-web/f17] Initial import.

Jonathan Steffan jsteffan at fedoraproject.org
Sun Dec 30 23:30:55 UTC 2012


commit e5227166966ca4ff64bbdf0769edbe30658d02f6
Author: Jonathan Steffan <jsteffan at fedoraproject.org>
Date:   Sun Dec 30 16:30:52 2012 -0700

    Initial import.

 .gitignore                               |    1 +
 graphite-web-0.9.10-fhs-thirdparty.patch |  185 ++++++++++++++++++++++++++++++
 graphite-web-README.fedora               |    7 +
 graphite-web-README.selinux              |    4 +
 graphite-web-logrotate.fedora            |    8 ++
 graphite-web-vhost.conf                  |   23 ++++
 graphite-web.spec                        |  149 ++++++++++++++++++++++++
 sources                                  |    1 +
 8 files changed, 378 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..9f6e78d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/graphite-web-0.9.10.tar.gz
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-README.fedora b/graphite-web-README.fedora
new file mode 100644
index 0000000..6b22706
--- /dev/null
+++ b/graphite-web-README.fedora
@@ -0,0 +1,7 @@
+=========== README.fedora ===========
+
+You must first run a syncdb to configure the webapp:
+
+# python /usr/lib/python2.6/site-packages/graphite/manage.py syncdb
+
+If you are using SELinux, install the selinux subpackage.
diff --git a/graphite-web-README.selinux b/graphite-web-README.selinux
new file mode 100644
index 0000000..af7fbb5
--- /dev/null
+++ b/graphite-web-README.selinux
@@ -0,0 +1,4 @@
+== SELinux Support ==
+The graphite-web-selinux package ensures the proper context for files on
+a system that needs SELinux labeling. As SELinux is not a requirement,
+this needs to be in a subpackage.
diff --git a/graphite-web-logrotate.fedora b/graphite-web-logrotate.fedora
new file mode 100644
index 0000000..155767d
--- /dev/null
+++ b/graphite-web-logrotate.fedora
@@ -0,0 +1,8 @@
+/var/log/graphite-web/*.log {
+        rotate 7
+        missingok
+        notifempty
+        copytruncate
+        daily
+        compress
+}
diff --git a/graphite-web-vhost.conf b/graphite-web-vhost.conf
new file mode 100644
index 0000000..8d3737b
--- /dev/null
+++ b/graphite-web-vhost.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.spec b/graphite-web.spec
new file mode 100644
index 0000000..04c661d
--- /dev/null
+++ b/graphite-web.spec
@@ -0,0 +1,149 @@
+Name:           graphite-web
+Version:        0.9.10
+Release:        5%{?dist}
+Summary:        A Django webapp for enterprise scalable realtime graphing
+
+License:        ASL 2.0
+URL:            https://launchpad.net/graphite/
+Source0:        https://github.com/downloads/graphite-project/graphite-web/graphite-web-0.9.10.tar.gz
+Source1:        graphite-web-vhost.conf
+Source2:        graphite-web-README.fedora
+Source3:        graphite-web-logrotate.fedora
+Source4:        graphite-web-README.selinux
+Patch0:         graphite-web-0.9.10-fhs-thirdparty.patch
+BuildRoot:      %{_tmppath}/graphite-web-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      noarch
+BuildRequires:  python-devel
+Requires:       python-whisper, mod_wsgi, pytz, pyparsing, python-simplejson
+Requires:       dejavu-fonts-common, pycairo, django-tagging
+
+%if 0%{?fedora} <= 17
+Requires:       python-sqlite2, Django
+%else
+Requires:       python-django
+%endif
+
+
+%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.
+
+
+%package selinux
+Summary:        SELinux labeling for graphite files
+Requires:       %name = %version-%release
+Requires(post): policycoreutils-python
+Requires(postun): policycoreutils-python
+
+
+%description selinux
+SELinux labeling for graphite files.
+
+
+%prep
+%setup -q -n graphite-web-%{version}
+# Patch for Filesystem Hierarchy Standard
+# Remove thridparty libs
+# https://github.com/hggh/graphite-web-upstream/commit/47361a2707f904a8b817ca96deeddabcdbaaa534.patch
+%patch0 -p1
+%{__install} -m 644 %{SOURCE2} README.fedora
+%{__install} -m 644 %{SOURCE4} README.selinux
+
+
+%build
+%{__python} setup.py build
+
+
+%install
+rm -rf %{buildroot}
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+
+# Create directories 
+%{__mkdir_p} %{buildroot}%{_localstatedir}/lib/graphite-web
+%{__mkdir_p} %{buildroot}%{_localstatedir}/log/graphite-web
+%{__mkdir_p} %{buildroot}%{_localstatedir}/logrotate.d
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/graphite-web
+
+# Install some default configurations and wsgi
+%{__install} -Dp -m0644 conf/dashboard.conf.example %{buildroot}%{_sysconfdir}/graphite-web/dashboard.conf
+%{__install} -Dp -m0644 webapp/graphite/local_settings.py.example %{buildroot}%{_sysconfdir}/graphite-web/local_settings.py
+%{__install} -Dp -m0644 conf/graphite.wsgi.example %{buildroot}%{_datarootdir}/graphite/graphite-web.wsgi
+%{__install} -Dp -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/graphite-web.conf
+%{__install} -Dp -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/graphite-web
+
+# Configure django /media/ location
+sed -i 's|##PYTHON_SITELIB##|%{python_sitelib}|' %{buildroot}%{_sysconfdir}/httpd/conf.d/graphite-web.conf
+
+# Create local_settings symlink
+pushd %{buildroot}%{python_sitelib}/graphite
+%{__ln_s} %{_sysconfdir}/graphite-web/local_settings.py
+popd
+
+# Don't ship bins that are not needed for prodcution
+%{__rm} %{buildroot}%{_bindir}/{build-index.sh,run-graphite-devel-server.py}
+
+# Fix permissions
+%{__chmod} 0644 %{buildroot}%{_datarootdir}/graphite/webapp/content/js/window/*
+%{__chmod} 0644 conf/graphite.wsgi.example
+%{__chmod} 0755 %{buildroot}%{python_sitelib}/graphite/manage.py
+
+# Don't ship thirdparty
+%{__rm} -rf %{buildroot}%{python_sitelib}/graphite/thirdparty
+
+
+%post selinux
+semanage fcontext -a -t httpd_sys_content_t '%{_localstatedir}/lib/graphite-web(/.*)?' 2>/dev/null || :
+restorecon -R %{_localstatedir}/lib/graphite-web || :
+
+
+%postun selinux
+if [ $1 -eq 0 ] ; then
+semanage fcontext -d -t httpd_sys_content_t '%{_localstatedir}/lib/graphite-web(/.*)?' 2>/dev/null || :
+fi
+
+
+%files
+%doc README.fedora LICENSE conf/* examples/*
+%{python_sitelib}/graphite*
+%{_datarootdir}/graphite
+%config(noreplace) %{_sysconfdir}/logrotate.d/graphite-web
+%config(noreplace) %{_sysconfdir}/httpd/conf.d/graphite-web.conf
+%config(noreplace) %{_sysconfdir}/graphite-web/local_settings.py
+%ghost %{_sysconfdir}/graphite-web/local_settings.pyc
+%ghost %{_sysconfdir}/graphite-web/local_settings.pyo
+%config(noreplace) %{_sysconfdir}/graphite-web/dashboard.conf
+%attr(-,apache,apache) %dir %{_localstatedir}/log/graphite-web
+%attr(-,apache,apache) %dir %{_sharedstatedir}/graphite-web
+
+%files selinux
+%doc README.selinux
+
+%changelog
+* Sun Dec 30 2012 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.10-5
+- Conditionally require python-sqlite2
+- Conditionally require new Django namespace
+
+* Sat Dec 29 2012 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.10-4
+- Update to use mod_wsgi
+- Update vhost configuration file to correctly work on multiple python
+  versions
+
+* Sat Nov 24 2012 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.10-3
+- Address all rpmlint errors
+- Add SELinux subpackage README
+- Patch out thirdparty code, Require it instead
+
+* Fri Nov 09 2012 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.10-2
+- Add logrotate
+
+* Thu May 31 2012 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.10-1
+- Initial Package
diff --git a/sources b/sources
index e69de29..0fa30cf 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+f54bf784139c7aef441f5cc1bc66dab4  graphite-web-0.9.10.tar.gz


More information about the scm-commits mailing list