- 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
This commit is contained in:
parent
a17bd43f2f
commit
bfacd85933
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=307095
5 changed files with 159 additions and 5 deletions
|
@ -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>
|
||||
|
|
30
www/py-graphite-web/files/patch-bin-build-index.sh
Normal file
30
www/py-graphite-web/files/patch-bin-build-index.sh
Normal file
|
@ -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
|
|
@ -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
|
|
@ -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',
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
#########################
|
58
www/py-graphite-web/pkg-message
Normal file
58
www/py-graphite-web/pkg-message
Normal file
|
@ -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.
|
||||
|
||||
==============================================================================
|
Loading…
Reference in a new issue