This commit is contained in:
parent
9d0672f2be
commit
de2aa7299c
|
@ -1,24 +0,0 @@
|
|||
update:
|
||||
./manage.py collectstatic --noinput
|
||||
./manage.py syncdb --migrate
|
||||
|
||||
dump-metadata:
|
||||
@echo creating dump of metadata in metadata,json
|
||||
./manage.py docbow_dumpdata -n -a \
|
||||
-e south \
|
||||
-e docbow.deletedmailbox \
|
||||
-e docbow.document \
|
||||
-e docbow.documentforwarded \
|
||||
-e docbow.notification \
|
||||
-e docbow.attachedfile \
|
||||
-e docbow.mailbox \
|
||||
-e docbow.inbox \
|
||||
-e docbow.outbox \
|
||||
-e django_journal \
|
||||
-e admin.logentry \
|
||||
-e contenttypes.contenttype \
|
||||
-e sessions.session \
|
||||
-e auth.permission \
|
||||
| bzip2 >metadata-`date --rfc-3339=seconds | sed 's/ /T/'`.json.bz2
|
||||
|
||||
|
|
@ -1,181 +0,0 @@
|
|||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: docbow
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Service de courrier du Parlement wallon
|
||||
# Description: Service de courrier du Parlement wallon
|
||||
# basé sur docbow
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
|
||||
|
||||
# Do NOT "set -e"
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Secure message platform"
|
||||
NAME=docbow
|
||||
DAEMON=/home/docbow/env/bin/gunicorn_django
|
||||
CTL="/home/docbow/env/bin/python /home/docbow/source/docbow-ctl"
|
||||
PIDFILE=/var/run/$NAME/gunicorn.pid
|
||||
# set timeout to 10800 seconds, as apache2 mod_proxy ProxyTimeout default value
|
||||
# put error log into /var/log/docbow.gunicorn.error.log
|
||||
# put access log into /var/log/docbow.gunicorn.access.log
|
||||
# use 4 workers
|
||||
DAEMON_ARGS="-D -p $PIDFILE \
|
||||
-t 10800 \
|
||||
-u docbow
|
||||
-g docbow
|
||||
--error-logfile /var/log/$NAME/gunicorn.error.log \
|
||||
--access-logfile /var/log/$NAME/gunicorn.access.log \
|
||||
-w 10"
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
export PYTHONPATH=/etc/docbow:/home/docbow/source/
|
||||
export LANG=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8
|
||||
|
||||
if [ -f /etc/gunicorn/$NAME.py ]; then
|
||||
DAEMON_ARGS="$DAEMON_ARGS -c /etc/gunicorn/$NAME.py"
|
||||
fi
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||
# and status_of_proc is working.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet $START_STOP_OPTIONS --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet $START_STOP_OPTIONS --exec $DAEMON -- \
|
||||
$DAEMON_ARGS docbow_project.settings \
|
||||
|| return 2
|
||||
# Add code here, if necessary, that waits for the process to be ready
|
||||
# to handle requests from services started subsequently which depend
|
||||
# on this one. As a last resort, sleep for some time.
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" = 2 ] && return 2
|
||||
# Wait for children to finish too if this is a daemon that forks
|
||||
# and if the daemon is only ever run from this initscript.
|
||||
# If the above conditions are not satisfied then add some other code
|
||||
# that waits for the process to drop all resources that could be
|
||||
# needed by services started subsequently. A last resort is to
|
||||
# sleep for some time.
|
||||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||
[ "$?" = 2 ] && return 2
|
||||
# Many daemons don't delete their pidfiles when they exit.
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
#
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
#
|
||||
do_reload() {
|
||||
#
|
||||
# If the daemon can reload its configuration without
|
||||
# restarting (for example, when it is sent a SIGHUP),
|
||||
# then implement that here.
|
||||
#
|
||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
reload|force-reload)
|
||||
#
|
||||
# If do_reload() is not implemented then leave this commented out
|
||||
# and leave 'force-reload' as an alias for 'restart'.
|
||||
#
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
#
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
manage)
|
||||
shift
|
||||
if [ $(id -un) != 'docbow' ]; then
|
||||
sudo -u docbow PYTHONPATH=/etc/docbow:/home/docbow/source/ LANG=fr_FR.UTF-8 -E -- $CTL "$@"
|
||||
else
|
||||
$CTL "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
|
@ -1,110 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This hook does two things:
|
||||
#
|
||||
# 1. update the "info" files that allow the list of references to be
|
||||
# queries over dumb transports such as http
|
||||
#
|
||||
# 2. if this repository looks like it is a non-bare repository, and
|
||||
# the checked-out branch is pushed to, then update the working copy.
|
||||
# This makes "push" function somewhat similarly to darcs and bzr.
|
||||
#
|
||||
# To enable this hook, make this file executable by "chmod +x post-update".
|
||||
|
||||
git-update-server-info
|
||||
|
||||
is_bare=$(git-config --get --bool core.bare)
|
||||
|
||||
if [ -z "$is_bare" ]
|
||||
then
|
||||
# for compatibility's sake, guess
|
||||
git_dir_full=$(cd $GIT_DIR; pwd)
|
||||
case $git_dir_full in */.git) is_bare=false;; *) is_bare=true;; esac
|
||||
fi
|
||||
|
||||
update_wc() {
|
||||
ref=$1
|
||||
echo "Push to checked out branch $ref" >&2
|
||||
if [ ! -f $GIT_DIR/logs/HEAD ]
|
||||
then
|
||||
echo "E:push to non-bare repository requires a HEAD reflog" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (cd $GIT_WORK_TREE; git-diff-files -q --exit-code >/dev/null)
|
||||
then
|
||||
wc_dirty=0
|
||||
else
|
||||
echo "W:unstaged changes found in working copy" >&2
|
||||
wc_dirty=1
|
||||
desc="working copy"
|
||||
fi
|
||||
if git diff-index --cached HEAD@{1} >/dev/null
|
||||
then
|
||||
index_dirty=0
|
||||
else
|
||||
echo "W:uncommitted, staged changes found" >&2
|
||||
index_dirty=1
|
||||
if [ -n "$desc" ]
|
||||
then
|
||||
desc="$desc and index"
|
||||
else
|
||||
desc="index"
|
||||
fi
|
||||
fi
|
||||
if [ "$wc_dirty" -ne 0 -o "$index_dirty" -ne 0 ]
|
||||
then
|
||||
new=$(git rev-parse HEAD)
|
||||
echo "W:stashing dirty $desc - see git-stash(1)" >&2
|
||||
( trap 'echo trapped $$; git symbolic-ref HEAD "'"$ref"'"' 2 3 13 15 ERR EXIT
|
||||
git-update-ref --no-deref HEAD HEAD@{1}
|
||||
cd $GIT_WORK_TREE
|
||||
git stash save "dirty $desc before update to $new";
|
||||
git-symbolic-ref HEAD "$ref"
|
||||
)
|
||||
fi
|
||||
|
||||
# eye candy - show the WC updates :)
|
||||
echo "Updating working copy" >&2
|
||||
(cd $GIT_WORK_TREE
|
||||
git-diff-index -R --name-status HEAD >&2
|
||||
git-reset --hard HEAD)
|
||||
}
|
||||
|
||||
if [ "$is_bare" = "false" ]
|
||||
then
|
||||
active_branch=`git-symbolic-ref HEAD`
|
||||
export GIT_DIR=$(cd $GIT_DIR; pwd)
|
||||
GIT_WORK_TREE=${GIT_WORK_TREE-..}
|
||||
for ref
|
||||
do
|
||||
if [ "$ref" = "$active_branch" ]
|
||||
then
|
||||
update_wc $ref
|
||||
fi
|
||||
done
|
||||
fi
|
||||
NOTIFY_EMAILS=`git config --get post-update.email`
|
||||
if [ "$NOTIFY_EMAILS" ];
|
||||
then
|
||||
WHERE=$(readlink -f ../..)
|
||||
( echo Following branches have been updated:
|
||||
for ref
|
||||
do
|
||||
/bin/echo -ne " $ref to "
|
||||
echo `git log --oneline $ref~.. | cut -f1 -d\ `
|
||||
done ) | mail -s "Update to $WHERE on `uname -n`" $NOTIFY_EMAILS
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
PYTHON=/home/docbow/env/bin/python
|
||||
cd `dirname $0`/../../docbow_project/
|
||||
$PYTHON manage.py syncdb --migrate
|
||||
$PYTHON manage.py collectstatic --noinput
|
||||
$PYTHON manage.py compilemessages
|
||||
if ../docbow.init status >/dev/null; then
|
||||
../docbow.init reload
|
||||
else
|
||||
../docbow.init start
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
/etc/init.d/docbow manage sendmail "$@"
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd /home/docbow/source/
|
||||
su docbow -c 'git pull'
|
||||
cd docbow_project/docbow
|
||||
su docbow -c '/home/docbow/env/bin/pip install -r ../../requirements.txt'
|
||||
su docbow -c '/home/docbow/env/bin/python ../../docbow-ctl compilemessages'
|
||||
/etc/init.d/docbow manage syncdb --migrate
|
||||
/etc/init.d/docbow manage collectstatic --noinput
|
||||
/etc/init.d/docbow restart
|
|
@ -1,98 +0,0 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>Candlestick Chart</title>
|
||||
<script type="text/javascript" src="http://cachedcommons.org/cache/protovis/3.2.0/javascripts/protovis.js"></script>
|
||||
<script type="text/javascript" src="vix.js"></script>
|
||||
<style type="text/css">
|
||||
|
||||
#fig {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
width: 900px;
|
||||
height: 220px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Path</th>
|
||||
<th>Min</th>
|
||||
<th>Mean</th>
|
||||
<th>Std</th>
|
||||
<th>Max</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<script>
|
||||
for (var i = 0; i < vix.length; i++) {
|
||||
var d = vix[i];
|
||||
document.write("<tr><td>" + d.path + "</td><td>" + d.min + "</td><td>" + d.mean + "</td><td>" + d.std + "</td><td>" + d.max + "</td></tr>");
|
||||
}
|
||||
</script>
|
||||
|
||||
</tbody>
|
||||
<caption>Datas</caption>
|
||||
</table>
|
||||
|
||||
<div id="center"><div id="fig">
|
||||
<script type="text/javascript+protovis">
|
||||
|
||||
/* Scales. */
|
||||
var w = 840,
|
||||
h = 200,
|
||||
x = pv.Scale.ordinal(vix, function(d) d.path).split(20, w-20),
|
||||
y = pv.Scale.linear(vix, function(d) d.min, function(d) d.max).range(0, h).nice();
|
||||
|
||||
var vis = new pv.Panel()
|
||||
.width(w)
|
||||
.height(h)
|
||||
.margin(10)
|
||||
.left(30);
|
||||
|
||||
/* Paths. */
|
||||
vis.add(pv.Rule)
|
||||
.data(vix)
|
||||
.strokeStyle("#eee")
|
||||
.anchor("bottom").add(pv.Label)
|
||||
.left(function (d) x(d.path))
|
||||
.text(function (d) d.path);
|
||||
|
||||
/* Time. */
|
||||
vis.add(pv.Rule)
|
||||
.data(y.ticks(7))
|
||||
.bottom(y)
|
||||
.left(-10)
|
||||
.right(-10)
|
||||
.strokeStyle(function(d) d % 10 ? "#ccc" : "#333")
|
||||
.anchor("left").add(pv.Label)
|
||||
.textStyle(function(d) d % 10 ? "#999" : "#333")
|
||||
.text(y.tickFormat)
|
||||
.anchor("top").add(pv.Label)
|
||||
.top(-12)
|
||||
.left(-20)
|
||||
.font("bold 10px sans-serif")
|
||||
.text("ms");
|
||||
|
||||
/* Candlestick. */
|
||||
vis.add(pv.Rule)
|
||||
.data(vix)
|
||||
.left(function(d) x(d.path))
|
||||
.bottom(function(d) y(d.mean - 2*Math.sqrt(d.std)))
|
||||
.height(function(d) 4*Math.sqrt(d.std))
|
||||
.strokeStyle("#ae13ff")
|
||||
.lineWidth(10)
|
||||
.add(pv.Rule)
|
||||
.bottom(function(d) y(Math.min(d.min, d.max)))
|
||||
.height(function(d) Math.abs(y(d.max) - y(d.min)))
|
||||
.strokeStyle("#ae1325")
|
||||
.lineWidth(3);
|
||||
|
||||
vis.render();
|
||||
|
||||
</script>
|
||||
</div></div></body>
|
||||
</html>
|
99
tools/vix.js
99
tools/vix.js
|
@ -1,99 +0,0 @@
|
|||
var vix =
|
||||
[
|
||||
{
|
||||
"std": 6.2838809338783808,
|
||||
"min": 48.87890815734863,
|
||||
"max": 117.35892295837402,
|
||||
"median": 51.397800445556641,
|
||||
"path": "/inbox/",
|
||||
"mean": 52.986168217014622
|
||||
},
|
||||
{
|
||||
"std": 5.0712567658069432,
|
||||
"min": 25.820016860961914,
|
||||
"max": 93.6269760131836,
|
||||
"median": 27.652978897094727,
|
||||
"path": "/outbox/",
|
||||
"mean": 28.302782935065192
|
||||
},
|
||||
{
|
||||
"std": 17.959943957167141,
|
||||
"min": 9.320974349975586,
|
||||
"max": 77.15797424316406,
|
||||
"median": 13.239860534667969,
|
||||
"path": "/inbox/66/",
|
||||
"mean": 22.619637927493535
|
||||
},
|
||||
{
|
||||
"std": 16.905766906795069,
|
||||
"min": 9.452104568481445,
|
||||
"max": 104.50601577758789,
|
||||
"median": 55.394887924194336,
|
||||
"path": "/inbox/28/",
|
||||
"mean": 53.443717956542969
|
||||
},
|
||||
{
|
||||
"std": 20.719964490781539,
|
||||
"min": 9.491920471191406,
|
||||
"max": 110.88180541992188,
|
||||
"median": 14.102935791015625,
|
||||
"path": "/inbox/55/",
|
||||
"mean": 24.875629270398939
|
||||
},
|
||||
{
|
||||
"std": 19.056132820228122,
|
||||
"min": 9.421825408935547,
|
||||
"max": 74.40400123596191,
|
||||
"median": 13.787031173706055,
|
||||
"path": "/inbox/73/",
|
||||
"mean": 23.699891889417493
|
||||
},
|
||||
{
|
||||
"std": 19.59120154967297,
|
||||
"min": 9.75489616394043,
|
||||
"max": 70.6789493560791,
|
||||
"median": 14.936923980712891,
|
||||
"path": "/inbox/81/",
|
||||
"mean": 25.634705053793418
|
||||
},
|
||||
{
|
||||
"std": 19.731671888538365,
|
||||
"min": 9.202957153320312,
|
||||
"max": 86.27200126647949,
|
||||
"median": 14.432907104492188,
|
||||
"path": "/inbox/69/",
|
||||
"mean": 24.82308697056126
|
||||
},
|
||||
{
|
||||
"std": 19.466554907855816,
|
||||
"min": 9.569168090820312,
|
||||
"max": 67.42000579833984,
|
||||
"median": 14.648199081420898,
|
||||
"path": "/inbox/45/",
|
||||
"mean": 24.809984258703285
|
||||
},
|
||||
{
|
||||
"std": 20.643612271940331,
|
||||
"min": 10.020017623901367,
|
||||
"max": 77.55303382873535,
|
||||
"median": 15.462160110473633,
|
||||
"path": "/inbox/60/",
|
||||
"mean": 26.355472770897119
|
||||
},
|
||||
{
|
||||
"std": 20.20322737222353,
|
||||
"min": 9.835958480834961,
|
||||
"max": 76.26891136169434,
|
||||
"median": 15.053033828735352,
|
||||
"path": "/inbox/74/",
|
||||
"mean": 25.443387675929714
|
||||
},
|
||||
{
|
||||
"std": 20.45568343764522,
|
||||
"min": 9.819984436035156,
|
||||
"max": 79.49686050415039,
|
||||
"median": 15.069961547851562,
|
||||
"path": "/inbox/62/",
|
||||
"mean": 25.949336387015677
|
||||
}
|
||||
];
|
Loading…
Reference in New Issue