From e3c8c6afff14d8f8fec396709117b30cfd207aae Mon Sep 17 00:00:00 2001 From: Mario Preksavec Date: Sat, 28 Feb 2015 03:30:02 +0700 Subject: system/graphite-web: Added (Enterprise Scalable Realtime Graphing). Signed-off-by: Willy Sudiarto Raharjo --- .../patches/graphite.wsgi.example.diff | 9 +++ system/graphite-web/patches/local_settings.patch | 85 ++++++++++++++++++++++ .../patches/remove_internal_logrotate.patch | 45 ++++++++++++ system/graphite-web/patches/settings_debian.patch | 25 +++++++ system/graphite-web/patches/setup.cfg.diff | 23 ++++++ system/graphite-web/patches/setup.py.diff | 13 ++++ 6 files changed, 200 insertions(+) create mode 100644 system/graphite-web/patches/graphite.wsgi.example.diff create mode 100644 system/graphite-web/patches/local_settings.patch create mode 100644 system/graphite-web/patches/remove_internal_logrotate.patch create mode 100644 system/graphite-web/patches/settings_debian.patch create mode 100644 system/graphite-web/patches/setup.cfg.diff create mode 100644 system/graphite-web/patches/setup.py.diff (limited to 'system/graphite-web/patches') diff --git a/system/graphite-web/patches/graphite.wsgi.example.diff b/system/graphite-web/patches/graphite.wsgi.example.diff new file mode 100644 index 0000000000..d4f436ae7a --- /dev/null +++ b/system/graphite-web/patches/graphite.wsgi.example.diff @@ -0,0 +1,9 @@ +--- graphite-web-0.9.13-pre1/conf/graphite.wsgi.example.orig 2014-12-31 17:51:36.000000000 +0100 ++++ graphite-web-0.9.13-pre1/conf/graphite.wsgi.example 2015-02-19 18:26:43.753661979 +0100 +@@ -1,5 +1,5 @@ + import os, sys +-sys.path.append('/opt/graphite/webapp') ++sys.path.append('/usr/share/graphite/static') + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings') + + import django diff --git a/system/graphite-web/patches/local_settings.patch b/system/graphite-web/patches/local_settings.patch new file mode 100644 index 0000000000..f5f647f5bf --- /dev/null +++ b/system/graphite-web/patches/local_settings.patch @@ -0,0 +1,85 @@ +Description: Other defaults for Debian +Author: Jonas Genannt +Forwarded: not-needed + +diff --git a/webapp/graphite/local_settings.py.example b/webapp/graphite/local_settings.py.example +index 73a0c57..c40b1e0 100644 +--- a/webapp/graphite/local_settings.py.example ++++ b/webapp/graphite/local_settings.py.example +@@ -26,9 +26,10 @@ + #DOCUMENTATION_URL = "http://graphite.readthedocs.org/" + + # Logging +-#LOG_RENDERING_PERFORMANCE = True +-#LOG_CACHE_PERFORMANCE = True +-#LOG_METRIC_ACCESS = True ++# True see: https://answers.launchpad.net/graphite/+question/159731 ++LOG_RENDERING_PERFORMANCE = True ++LOG_CACHE_PERFORMANCE = True ++LOG_METRIC_ACCESS = True + + # Enable full debug page display on exceptions (Internal Server Error pages) + #DEBUG = True +@@ -54,14 +55,14 @@ + ##################################### + # 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-web' + + # 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' ++STORAGE_DIR = '/var/lib/graphite/whisper' ++CONTENT_DIR = '/usr/share/graphite-web/static' + + # 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 +@@ -72,11 +73,11 @@ + + ## Data directories + # NOTE: If any directory is unreadable in DATA_DIRS it will break metric browsing +-#WHISPER_DIR = '/opt/graphite/storage/whisper' ++WHISPER_DIR = '/var/lib/graphite/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 ++LOG_DIR = '/var/log/graphite' ++INDEX_FILE = '/var/lib/graphite/search_index' # Search index file + + + ##################################### +@@ -147,17 +148,17 @@ + # The default is 'django.db.backends.sqlite3' with file 'graphite.db' + # located in STORAGE_DIR + # +-#DATABASES = { +-# 'default': { +-# 'NAME': '/opt/graphite/storage/graphite.db', +-# 'ENGINE': 'django.db.backends.sqlite3', +-# 'USER': '', +-# 'PASSWORD': '', +-# 'HOST': '', +-# 'PORT': '' +-# } +-#} +-# ++DATABASES = { ++ 'default': { ++ 'NAME': '/var/lib/graphite/graphite.db', ++ 'ENGINE': 'django.db.backends.sqlite3', ++ 'USER': '', ++ 'PASSWORD': '', ++ 'HOST': '', ++ 'PORT': '' ++ } ++} ++ + + + ######################### diff --git a/system/graphite-web/patches/remove_internal_logrotate.patch b/system/graphite-web/patches/remove_internal_logrotate.patch new file mode 100644 index 0000000000..a78c56f11e --- /dev/null +++ b/system/graphite-web/patches/remove_internal_logrotate.patch @@ -0,0 +1,45 @@ +Description: disable internal logroate +Author: Jonas Genannt +Forwarded: not-needed + +diff --git a/webapp/graphite/logger.py b/webapp/graphite/logger.py +index afa43f4..44456ac 100644 +--- a/webapp/graphite/logger.py ++++ b/webapp/graphite/logger.py +@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and + limitations under the License.""" + + import os, logging +-from logging.handlers import TimedRotatingFileHandler as Rotater ++from logging import FileHandler as LogFileHandler + from django.conf import settings + + logging.addLevelName(30,"rendering") +@@ -37,22 +37,22 @@ class GraphiteLogger: + self.metricAccessLogger = logging.getLogger("metric_access") + #Setup formatter & handlers + self.formatter = logging.Formatter("%(asctime)s :: %(message)s","%a %b %d %H:%M:%S %Y") +- self.infoHandler = Rotater(self.infoLogFile,when="midnight",backupCount=1) ++ self.infoHandler = LogFileHandler(self.infoLogFile) + self.infoHandler.setFormatter(self.formatter) + self.infoLogger.addHandler(self.infoHandler) +- self.exceptionHandler = Rotater(self.exceptionLogFile,when="midnight",backupCount=1) ++ self.exceptionHandler = LogFileHandler(self.exceptionLogFile) + self.exceptionHandler.setFormatter(self.formatter) + self.exceptionLogger.addHandler(self.exceptionHandler) + if settings.LOG_CACHE_PERFORMANCE: +- self.cacheHandler = Rotater(self.cacheLogFile,when="midnight",backupCount=1) ++ self.cacheHandler = LogFileHandler(self.cacheLogFile) + self.cacheHandler.setFormatter(self.formatter) + self.cacheLogger.addHandler(self.cacheHandler) + if settings.LOG_RENDERING_PERFORMANCE: +- self.renderingHandler = Rotater(self.renderingLogFile,when="midnight",backupCount=1) ++ self.renderingHandler = LogFileHandler(self.renderingLogFile) + self.renderingHandler.setFormatter(self.formatter) + self.renderingLogger.addHandler(self.renderingHandler) + if settings.LOG_METRIC_ACCESS: +- self.metricAccessHandler = Rotater(self.metricAccessLogFile,when="midnight",backupCount=10) ++ self.metricAccessHandler = LogFileHandler(self.metricAccessLogFile) + self.metricAccessHandler.setFormatter(self.formatter) + self.metricAccessLogger.addHandler(self.metricAccessHandler) + diff --git a/system/graphite-web/patches/settings_debian.patch b/system/graphite-web/patches/settings_debian.patch new file mode 100644 index 0000000000..ab66647263 --- /dev/null +++ b/system/graphite-web/patches/settings_debian.patch @@ -0,0 +1,25 @@ +Description: Add etc/graphite to sys.path to load config from /etc/graphite +Author: Jonas Genannt +Forwarded: not-needed + +--- a/webapp/graphite/settings.py ++++ b/webapp/graphite/settings.py +@@ -20,6 +20,9 @@ + from os.path import abspath, dirname, join + from warnings import warn + ++# Debian add etc/graphite into path ++sys.path.append('/etc/graphite') ++ + try: + import rrdtool + except ImportError: +@@ -128,7 +131,7 @@ + + ## Load our local_settings + try: +- from graphite.local_settings import * ++ from local_settings import * + except ImportError: + print >> sys.stderr, "Could not import graphite.local_settings, using defaults!" + diff --git a/system/graphite-web/patches/setup.cfg.diff b/system/graphite-web/patches/setup.cfg.diff new file mode 100644 index 0000000000..f7ca20c9ba --- /dev/null +++ b/system/graphite-web/patches/setup.cfg.diff @@ -0,0 +1,23 @@ +--- graphite-web-0.9.13-pre1/setup.cfg.orig 2014-12-31 17:51:36.000000000 +0100 ++++ graphite-web-0.9.13-pre1/setup.cfg 2015-02-19 16:45:23.526959108 +0100 +@@ -1,20 +0,0 @@ +-[install] +-prefix = /opt/graphite +-install-lib = %(prefix)s/webapp +- +-[bdist_rpm] +-requires = Django => 1.1.4 +- django-tagging +- carbon +- whisper +- mod_wsgi +- pycairo +- pycairo-devel +- python-simplejson +- python-sqlite2 +- python-hashlib +- +-post-install = distro/redhat/misc/postinstall +- +-provides = graphite +-obsoletes = graphite <= 0.9.9 diff --git a/system/graphite-web/patches/setup.py.diff b/system/graphite-web/patches/setup.py.diff new file mode 100644 index 0000000000..f300210bb8 --- /dev/null +++ b/system/graphite-web/patches/setup.py.diff @@ -0,0 +1,13 @@ +--- graphite-web-0.9.13-pre1/setup.py.orig 2014-12-31 17:51:36.000000000 +0100 ++++ graphite-web-0.9.13-pre1/setup.py 2015-02-19 18:45:25.173599991 +0100 +@@ -58,8 +58,7 @@ + 'graphite.thirdparty.pytz', + ], + package_data={'graphite' : +- ['templates/*', 'local_settings.py.example']}, +- scripts=glob('bin/*'), +- data_files=webapp_content.items() + storage_dirs + conf_files + examples, ++ ['templates/*']}, ++ data_files=webapp_content.items() + conf_files, + **setup_kwargs + ) -- cgit v1.2.3