diff options
author | crees <crees@FreeBSD.org> | 2012-11-07 04:50:05 +0800 |
---|---|---|
committer | crees <crees@FreeBSD.org> | 2012-11-07 04:50:05 +0800 |
commit | 88f8fb117e13ac7e2b5a033c29162c198f22fac6 (patch) | |
tree | de7ee2986fa35d14695e8fa3a9e551bd43508f9e /www | |
parent | 545c881fd881806544125c19c6e92c29e14f1199 (diff) | |
download | freebsd-ports-gnome-88f8fb117e13ac7e2b5a033c29162c198f22fac6.tar.gz freebsd-ports-gnome-88f8fb117e13ac7e2b5a033c29162c198f22fac6.tar.zst freebsd-ports-gnome-88f8fb117e13ac7e2b5a033c29162c198f22fac6.zip |
- Clean up the defaults to match our installation layout
- Add a pkg-message to explain more about how to set things up
PR: ports/172960
Submitted by: brd
Approved by: maintainer timeout (bsdports@wayfair.com, >2w)
While here, use sed instead of perl to avoid breakage on systems
without perl (...)
Feature safe: yes
Diffstat (limited to 'www')
-rw-r--r-- | www/py-graphite-web/Makefile | 13 | ||||
-rw-r--r-- | www/py-graphite-web/files/patch-bin-build-index.sh | 30 | ||||
-rw-r--r-- | www/py-graphite-web/files/patch-conf-graphite.wsgi.example | 9 | ||||
-rw-r--r-- | www/py-graphite-web/files/patch-webapp-graphite-local__settings.py.example | 54 | ||||
-rw-r--r-- | www/py-graphite-web/pkg-message | 58 |
5 files changed, 159 insertions, 5 deletions
diff --git a/www/py-graphite-web/Makefile b/www/py-graphite-web/Makefile index e98bd3ff3af3..74ec8e3ac8a5 100644 --- a/www/py-graphite-web/Makefile +++ b/www/py-graphite-web/Makefile @@ -1,9 +1,5 @@ -# New ports collection makefile for: py-graphite-web -# Date created: 2012-02-18 -# Whom: Evan Sarmiento <esarmiento@wayfair.com> -# +# Created by: Evan Sarmiento <esarmiento@wayfair.com> # $FreeBSD$ -# PORTNAME= graphite-web PORTVERSION= 0.9.10 @@ -28,5 +24,12 @@ USE_PYDISTUTILS=yes post-patch: @${MKDIR} ${WRKSRC}/graphite/webapp/ @${CP} -LR ${WRKSRC}/webapp/content ${WRKSRC}/graphite/webapp + @${RM} ${WRKSRC}/bin/build-index.sh.orig + +post-install: + @${ECHO} ${PYTHON_SITELIBDIR} + ${CHOWN} ${WWWOWN} ${PREFIX}/graphite/storage + ${CHOWN} ${WWWOWN} ${PREFIX}/graphite/storage/log/webapp + @${CAT} pkg-message .include <bsd.port.mk> diff --git a/www/py-graphite-web/files/patch-bin-build-index.sh b/www/py-graphite-web/files/patch-bin-build-index.sh new file mode 100644 index 000000000000..7266bb84aac6 --- /dev/null +++ b/www/py-graphite-web/files/patch-bin-build-index.sh @@ -0,0 +1,30 @@ +--- bin/build-index.sh.orig 2012-05-31 07:28:54.000000000 +0100 ++++ bin/build-index.sh 2012-11-06 20:13:04.887047813 +0000 +@@ -1,8 +1,8 @@ +-#!/bin/bash ++#!/bin/sh + + if [ "$GRAPHITE_ROOT" = "" ] + then +- GRAPHITE_ROOT="/opt/graphite" ++ GRAPHITE_ROOT="/usr/local/graphite" + fi + + if [ "$GRAPHITE_STORAGE_DIR" = "" ] +@@ -11,7 +11,7 @@ + fi + + +-WHISPER_DIR="${GRAPHITE_STORAGE_DIR}/whisper" ++WHISPER_DIR="/usr/local/storage/whisper" + + if [ ! -d "$WHISPER_DIR" ] + then +@@ -26,6 +26,6 @@ + cd $WHISPER_DIR + touch $INDEX_FILE + echo "[`date`] building index..." +-find -L . -name '*.wsp' | perl -pe 's!^[^/]+/(.+)\.wsp$!$1!; s!/!.!g' > $TMP_INDEX ++find -L . -name '*.wsp' | sed -E 's!^[^/]+/(.+)\.wsp$!\1!; s!/!.!g' > $TMP_INDEX + echo "[`date`] complete, switching to new index file" + mv -f $TMP_INDEX $INDEX_FILE diff --git a/www/py-graphite-web/files/patch-conf-graphite.wsgi.example b/www/py-graphite-web/files/patch-conf-graphite.wsgi.example new file mode 100644 index 000000000000..e0c2090eb166 --- /dev/null +++ b/www/py-graphite-web/files/patch-conf-graphite.wsgi.example @@ -0,0 +1,9 @@ +--- conf/graphite.wsgi.example.ori 2012-10-12 19:34:56.000000000 -0600 ++++ conf/graphite.wsgi.example 2012-10-12 19:35:07.000000000 -0600 +@@ -1,5 +1,5 @@ + import os, sys +-sys.path.append('/opt/graphite/webapp') ++sys.path.append('/usr/local/graphite/webapp') + os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings' + + import django.core.handlers.wsgi diff --git a/www/py-graphite-web/files/patch-webapp-graphite-local__settings.py.example b/www/py-graphite-web/files/patch-webapp-graphite-local__settings.py.example new file mode 100644 index 000000000000..ff5bfa539607 --- /dev/null +++ b/www/py-graphite-web/files/patch-webapp-graphite-local__settings.py.example @@ -0,0 +1,54 @@ +--- webapp/graphite/local_settings.py.example.orig 2012-05-31 00:28:54.000000000 -0600 ++++ webapp/graphite/local_settings.py.example 2012-10-12 19:39:54.000000000 -0600 +@@ -44,6 +44,7 @@ + # Change only GRAPHITE_ROOT if your install is merely shifted from /opt/graphite + # to somewhere else + #GRAPHITE_ROOT = '/opt/graphite' ++GRAPHITE_ROOT = '/usr/local/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 +@@ -51,6 +52,9 @@ + #CONF_DIR = '/opt/graphite/conf' + #STORAGE_DIR = '/opt/graphite/storage' + #CONTENT_DIR = '/opt/graphite/webapp/content' ++CONF_DIR = '/usr/local/etc/graphite' ++STORAGE_DIR = '/usr/local/storage' ++CONTENT_DIR = '/usr/local/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 +@@ -58,6 +62,8 @@ + ## Webapp config files + #DASHBOARD_CONF = '/opt/graphite/conf/dashboard.conf' + #GRAPHTEMPLATES_CONF = '/opt/graphite/conf/graphTemplates.conf' ++DASHBOARD_CONF = '/usr/local/etc/graphite/dashboard.conf' ++GRAPHTEMPLATES_CONF = '/usr/local/etc/graphite/graphTemplates.conf' + + ## Data directories + # NOTE: If any directory is unreadable in DATA_DIRS it will break metric browsing +@@ -66,6 +72,11 @@ + #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 = '/usr/local/storage/whisper' ++RRD_DIR = '/usr/local/graphite/storage/rrd' ++DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables ++LOG_DIR = '/usr/local/graphite/storage/log/webapp' ++INDEX_FILE = '/usr/local/graphite/storage/index' # Search index file + + + ##################################### +@@ -156,6 +167,12 @@ + #DATABASE_PASSWORD = 'graphite-is-awesome' + #DATABASE_HOST = 'mysql.mycompany.com' + #DATABASE_PORT = '3306' ++DATABASES = { ++ 'default': { ++ 'NAME': '/usr/local/graphite/storage/graphite.db', ++ 'ENGINE': 'django.db.backends.sqlite3', ++ } ++} + + + ######################### diff --git a/www/py-graphite-web/pkg-message b/www/py-graphite-web/pkg-message new file mode 100644 index 000000000000..5f322d741d63 --- /dev/null +++ b/www/py-graphite-web/pkg-message @@ -0,0 +1,58 @@ +============================================================================== + +In /usr/local/etc/graphite/ copy the graphite.wsgi.example to graphite.wsgi + +To run graphite, you will need to setup Apache by creating a vhost similar to +the following: + +WSGIImportScript /usr/local/etc/graphite/graphite.wsgi process-group=graphite application-group=%{GLOBAL} +<VirtualHost *:80> + ServerName graphite + DocumentRoot "/usr/local/graphite/webapp" + + # I've found that an equal number of processes & threads tends + # to show the best performance for Graphite (ymmv). + WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 + WSGIProcessGroup graphite + WSGIApplicationGroup %{GLOBAL} + + # XXX You will need to create this file! There is a graphite.wsgi.example + # file in this directory that you can safely use, just copy it to graphite.wgsi + WSGIScriptAlias / /usr/local/etc/graphite/graphite.wsgi + + Alias /content/ /usr/local/graphite/webapp/content/ + <Location "/content/"> + SetHandler None + </Location> + + # XXX In order for the django admin site media to work you + # must change @DJANGO_ROOT@ to be the path to your django + # installation, which is probably something like: + # /usr/lib/python2.6/site-packages/django + #Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/" + Alias /media/ ${${PYTHON_SITELIBDIR}}/django + <Location "/media/"> + SetHandler None + </Location> + + # The graphite.wsgi file has to be accessible by apache. It won't + # be visible to clients because of the DocumentRoot though. + <Directory /usr/local/etc/graphite/> + Order deny,allow + Allow from all + </Directory> +</VirtualHost> + + +Then initialize the sqllite user database and create the admin user: + + python ${PYTHON_SITELIBDIR}/graphite/manage.py syncdb + +Change the ownership of the user database so the webapp can write to it: + + chown ${WWWOWN} ${PREFIX}/graphite/storage/graphite.db + +Now you should be able to access the graphite virtual host you created in the +first step. + +============================================================================== |