Info16.fr

Le blog de B@rtounet

tableau

#Gnu/Linux, Planet Libre

Scrumblr : Tableau collaboratif en ligne

srumblr
  scrumblr logo

Scrumblr vous offre la possibilité de créer un tableau blanc collaboratif sous forme de Post-it de toutes les couleurs.
L'application en ligne sur vos serveur offre un environnement graphique simple d'utilisation sans enregistrement préalable.

Plateforme Materielle :



Comme d'habitude, j'ai monté mon prototype sur ma plateforme de virtualisation:

Dedibox Pro HP
Plateforme logicielle hyperviseur:
  • Dom0 Ubuntu 12.04 X86_64 Xen 4.1
Plateforme Virtuelle:

  • DomU Xen Ubuntu 12.04 X86_64 Paravirtualisé
  • 2 vcpus 
  • 512 Mo de Ram
  • HDD 16GB


Installation:

Scrumblr demande quelques prérequis:
redis v2.2.2
node.js >= 0.4.7

En effet scrumblr se base sur redis : Redis (de l'anglais REmote DIctionary Server qui peut-être traduit par « serveur de dictionnaire distant » et jeu de mot avec Redistribute1) est un système de gestion de base de données clef-valeur scalable, très hautes performances, écrit avec le langage de programmation C ANSI et distribué sous licence BSD. Il fait partie de la mouvance NoSQL et vise à fournir les performances les plus élevées possibles.

  • Installation des prérequis
root@antony-linux:/home/antony# apt-get install git-core build-essential

  • Installation de node.js
On télécharge la dernière version de node.js et on la compile
Attention, ethercalc n'est pour l'instant pas compatible avec node.js v9
On utilise la version packagée dans ubuntu 12.04 : nodejs_0.6.12
    root@antony-linux:/home/antony# apt-get install nodejs npm

    root@ubuntu:/# node --version
    v0.6.12
    root@ubuntu:/# npm --version
    1.1.4

  • Installation de redis
On télécharge la version 2.6.4 sur http://redis.io/download

root@ubuntu:/opt#cd /opt
root@ubuntu:/opt# wget http://redis.googlecode.com/files/redis-2.6.4.tar.gz
root@ubuntu:/opt# tar xvfz redis-2.6.4.tar.gz
mv redis-2.6.4 redis
root@ubuntu:/opt# cd /opt/redis/

root@ubuntu:/opt/redis# make

root@ubuntu:/opt/redis# cd src/
root@ubuntu:/opt/redis/src# ./redis-server
[18712] 12 Nov 16:21:00.849 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
[18712] 12 Nov 16:21:00.850 * Max number of open files set to 10032
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.6.4 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 18712
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'

[18712] 12 Nov 16:21:00.851 # Server started, Redis version 2.6.4
[18712] 12 Nov 16:21:00.851 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[18712] 12 Nov 16:21:00.851 * The server is now ready to accept connections on port 6379

Bon ok redis tourne
Cf Wikipedia: Une des principales caractéristiques de Redis est de conserver l'intégralité des données en RAM. Cela permet d'obtenir d'excellentes performances en évitant les accès disques, particulièrement coûteux.

Lorsque la taille des données est trop importante pour tenir en mémoire, Redis peut également utiliser de la mémoire virtuelle.

Afin d'assurer la conservation des données en cas d'incident — la mémoire vive étant volatile — Redis offre la possibilité de « capturer » l'état de la base dans un fichier. Cette technique ne permettant pas de garantir la conservation des manipulations effectuées entre deux captures, il est également possible de conserver une trace de toutes ces manipulations. En cas d'incident, la base peut être restaurée en les ré-appliquant dans l'ordre.

On va donc modifier la conf pour le rendre persistent:
On modifie le redis.conf
daemonize yes
pidfile /var/run/redis.pid
logfile /var/log/redis.log

port 6379
bind 127.0.0.1
timeout 300

loglevel notice

## Default configuration options
databases 16

save 900 1
save 300 10
save 60 10000

rdbcompression yes
dbfilename dump.rdb

dir /opt/redis/

glueoutputbuf yes


##Persistence
appendonly yes
appendfsync everysec


root@antony-linux:/home/antony# /opt/redis/redis-cli bgrewriteaof

Redis de base ne démarre pas automatiquement... c'est un peu balot.
Il faut créer un  script d'init.
On crée d'abord un user "redis"
root@ubuntu:/etc/init.d# adduser --system --no-create-home --disabled-login --disabled-password --group redis

root@ubuntu:/etc/init.d# chown -R redis /opt/redis

Mon script d'init:

#!/bin/sh

### BEGIN INIT INFO
# Provides: ethercalc
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts ethercalc
# Description: starts ethercalc lite using start-stop-daemon
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/redis.log"
CONFFILE="/opt/redis/redis.conf"
EPLITE_DIR="/opt/redis/src/redis-server"
USER="redis"
GROUP="redis"
DESC="redis"
NAME="redis"

set -e

. /lib/lsb/init-functions

start() {
echo "Starting $DESC... "

start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR -- $CONFFILE || true
echo "done"
}

#We need this function to ensure the whole process tree will be killed
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}

stop() {
echo "Stopping $DESC... "
while test -d /proc/$(cat /var/run/$NAME.pid); do
killtree $(cat /var/run/$NAME.pid) 15
sleep 0.5
done
rm /var/run/$NAME.pid
echo "done"
}

status() {
status_of_proc -p /var/run/$NAME.pid "" "$NAME" && exit 0 || exit $?
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac

exit 0

root@ubuntu:/etc/init.d# update-rc.d redis defaults
Adding system startup for /etc/init.d/redis ...
/etc/rc0.d/K20redis -> ../init.d/redis
/etc/rc1.d/K20redis -> ../init.d/redis
/etc/rc6.d/K20redis -> ../init.d/redis
/etc/rc2.d/S20redis -> ../init.d/redis
/etc/rc3.d/S20redis -> ../init.d/redis
/etc/rc4.d/S20redis -> ../init.d/redis
/etc/rc5.d/S20redis -> ../init.d/redis



root@ubuntu:/etc/init.d# /etc/init.d/redis start

root@ubuntu:/etc/init.d# ps aux | grep redis
redis 19666 0.3 0.3 34900 1724 ? Ssl 17:05 0:00 /opt/redis/src/redis-server /opt/redis/redis.conf


Une bonne chose de faite.
Redis se lance
 
  • Installation de Scrumblr
On utilse git pour récupérer la dernière version.
root@ubuntu:~# cd /opt/
git clone https://github.com/aliasaria/scrumblr.git

Avant toute chose modifier le package.json ("express": ">2.4.x",)
{
"name": "scrumblr",
"description": "Web-based simulation of a physical agile sprint board that supports real-time collaboration.",
"version": "0.1.0",
"repository": {
"url": "http://github.com/aliasaria/scrumblr"
},
"author": "Ali Asaria",
"main": "server.js",
"directories": {
"lib": "lib/"
},
"engines": {
"node": "0.4.7"
},
"dependencies": {
"async": "0.1.x",
"connect": "1.7.x",
"redis-client": "0.3.x",
"redis": "0.6.x",
"sanitizer": "0.0.x",
"socket.io": "0.8.x",
"simplesets": "1.1.x",
"connect-redis":"1.0.x",
"express": ">2.4.x",
"jade": "0.14.x"
}
}




root@ubuntu:~# cd /opt/scrumblr

root@ubuntu:/opt/scrumblr# npm install
npm http GET https://registry.npmjs.org/redis-client
npm http GET https://registry.npmjs.org/sanitizer
npm http GET https://registry.npmjs.org/express/2.4.5
npm http GET https://registry.npmjs.org/jade
npm http GET https://registry.npmjs.org/simplesets
npm http GET https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/connect-redis
npm http GET https://registry.npmjs.org/redis
npm http GET https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/redis-client
npm WARN redis-client@0.3.5 package.json: bugs['web'] should probably be bugs['url']
npm http 304 https://registry.npmjs.org/sanitizer
npm http 304 https://registry.npmjs.org/simplesets
npm http 304 https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/connect/-/connect-1.7.3.tgz
npm http 304 https://registry.npmjs.org/connect-redis
npm http GET https://registry.npmjs.org/connect-redis/-/connect-redis-1.0.7.tgz
npm http 304 https://registry.npmjs.org/redis
npm http 200 https://registry.npmjs.org/express/2.4.5
npm http GET https://registry.npmjs.org/redis/-/redis-0.6.7.tgz
npm http GET https://registry.npmjs.org/express/-/express-2.4.5.tgz
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/socket.io/-/socket.io-0.8.7.tgz
npm http 304 https://registry.npmjs.org/async
npm http 200 https://registry.npmjs.org/connect/-/connect-1.7.3.tgz
npm http GET https://registry.npmjs.org/async/-/async-0.1.22.tgz
npm http 200 https://registry.npmjs.org/connect-redis/-/connect-redis-1.0.7.tgz
npm http 200 https://registry.npmjs.org/redis/-/redis-0.6.7.tgz
npm http 200 https://registry.npmjs.org/express/-/express-2.4.5.tgz
npm http 200 https://registry.npmjs.org/socket.io/-/socket.io-0.8.7.tgz
npm http 200 https://registry.npmjs.org/jade
npm http 200 https://registry.npmjs.org/async/-/async-0.1.22.tgz
npm http GET https://registry.npmjs.org/jade/-/jade-0.14.2.tgz
npm http 200 https://registry.npmjs.org/jade/-/jade-0.14.2.tgz

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: express@2.4.5
npm ERR! Required: {"node":">= 0.4.1 < 0.5.0"}
npm ERR! Actual: {"npm":"1.1.4","node":"0.6.12"}
npm ERR!
npm ERR! System Linux 3.2.0-32-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /opt/scrumblr
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}
npm http GET https://registry.npmjs.org/socket.io-client/0.8.7
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/mime
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/scrumblr/npm-debug.log
npm not ok
root@ubuntu:/opt/scrumblr# vi package.json ^C
root@ubuntu:/opt/scrumblr# vi README.markdown
root@ubuntu:/opt/scrumblr# vi package.json
root@ubuntu:/opt/scrumblr# npm install
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/jade
npm http 304 https://registry.npmjs.org/express
npm http 304 https://registry.npmjs.org/jade
npm http GET https://registry.npmjs.org/express/-/express-3.0.2.tgz
npm http 200 https://registry.npmjs.org/express/-/express-3.0.2.tgz
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mkdirp/0.3.3
npm http GET https://registry.npmjs.org/cookie/0.0.4
npm http GET https://registry.npmjs.org/crc/0.2.0
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/cookie-signature/0.0.1
npm http GET https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/connect/2.6.2
npm http GET https://registry.npmjs.org/commander/0.6.1
npm http 200 https://registry.npmjs.org/cookie/0.0.4
npm http 200 https://registry.npmjs.org/mkdirp/0.3.3
npm http GET https://registry.npmjs.org/cookie/-/cookie-0.0.4.tgz
npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.3.tgz
npm http 200 https://registry.npmjs.org/crc/0.2.0
npm http 200 https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/crc/-/crc-0.2.0.tgz
npm http GET https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http 200 https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http 200 https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/methods/-/methods-0.0.1.tgz
npm http 200 https://registry.npmjs.org/cookie-signature/0.0.1
npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-0.0.1.tgz
npm http 200 https://registry.npmjs.org/cookie/-/cookie-0.0.4.tgz
npm http 200 https://registry.npmjs.org/send/0.1.0
npm http 200 https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/send/-/send-0.1.0.tgz
npm http GET https://registry.npmjs.org/debug/-/debug-0.7.0.tgz
npm http 200 https://registry.npmjs.org/connect/2.6.2
npm http GET https://registry.npmjs.org/connect/-/connect-2.6.2.tgz
npm http 200 https://registry.npmjs.org/commander/0.6.1
npm http GET https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
npm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.3.tgz
npm http 200 https://registry.npmjs.org/crc/-/crc-0.2.0.tgz
npm http 200 https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http 200 https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http 200 https://registry.npmjs.org/methods/-/methods-0.0.1.tgz
npm http 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-0.0.1.tgz
npm http 200 https://registry.npmjs.org/send/-/send-0.1.0.tgz
npm http 200 https://registry.npmjs.org/debug/-/debug-0.7.0.tgz
npm http 200 https://registry.npmjs.org/connect/-/connect-2.6.2.tgz
npm http 200 https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
npm http GET https://registry.npmjs.org/mime/1.2.6
npm http GET https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/formidable/1.0.11
npm http GET https://registry.npmjs.org/bytes/0.1.0
npm http GET https://registry.npmjs.org/pause/0.0.1
npm http 200 https://registry.npmjs.org/pause/0.0.1
npm http GET https://registry.npmjs.org/pause/-/pause-0.0.1.tgz
npm http 200 https://registry.npmjs.org/mime/1.2.6
npm http GET https://registry.npmjs.org/mime/-/mime-1.2.6.tgz
npm http 200 https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/qs/-/qs-0.5.1.tgz
npm http 200 https://registry.npmjs.org/formidable/1.0.11
npm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.11.tgz
npm http 200 https://registry.npmjs.org/bytes/0.1.0
npm http GET https://registry.npmjs.org/bytes/-/bytes-0.1.0.tgz
npm http 200 https://registry.npmjs.org/pause/-/pause-0.0.1.tgz
npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.6.tgz
npm http 200 https://registry.npmjs.org/qs/-/qs-0.5.1.tgz
npm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.11.tgz
npm http 200 https://registry.npmjs.org/bytes/-/bytes-0.1.0.tgz
jade@0.14.2 ./node_modules/jade
express@3.0.2 ./node_modules/express
├── methods@0.0.1
├── fresh@0.1.0
├── cookie-signature@0.0.1
├── range-parser@0.0.4
├── cookie@0.0.4
├── crc@0.2.0
├── commander@0.6.1
├── debug@0.7.0
├── mkdirp@0.3.3
├── send@0.1.0 (mime@1.2.6)
└── connect@2.6.2


On va tenter de lancer Scrumblr

root@ubuntu:/opt/scrumblr# node server.js 80
The "sys" module is now called "util". It should have a similar interface.
Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:

var express = require("express");
var app = express();

info - socket.io started

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'url' of undefined
at Function.handle (/opt/scrumblr/node_modules/express/node_modules/connect/lib/proto.js:104:18)
at Server.app (/opt/scrumblr/node_modules/express/node_modules/connect/lib/connect.js:66:31)
at Server.serverListening (/opt/scrumblr/node_modules/socket.io/node_modules/policyfile/lib/server.js:136:16)
at Server.g (events.js:156:14)
at Server.emit (events.js:64:17)
at Array.1 (net.js:753:10)
at EventEmitter._tickCallback (node.js:192:41)


Arghhh error !!!!!!
Bon j'ai passer un bon moment à me gratter la tête et j'ai réussi à trouver la solution.
Je vous l'offre sur un plateau.
Il semblerait que la version de express installé avec ubuntu 12.04 pose des problème.
On va installer express 2.5.9

root@ubuntu:/opt/scrumblr# npm uninstall express
root@ubuntu:/opt/scrumblr# npm install express@2.5.9

On tente de lancer Srumblr

root@ubuntu:/opt/scrumblr# node server.js 80
The "sys" module is now called "util". It should have a similar interface.
info - socket.io started
Youpi ca se lance.


Maintenant on va aussi faire un script pour lancer Scrumblr en tant que daemon au boot du serveur.

On va utiliser le script /opt/scrumblr/forever.sh
Pour cela il faut install le module forever avec npm


root@ubuntu:/opt/scrumblr# npm install forever -g

root@ubuntu:/opt/scrumblr# vi /etc/init.d/scrumblr

#!/bin/sh

### BEGIN INIT INFO
# Provides: Scrumblr
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts Scrumblr
# Description: starts Scrumblr lite using start-stop-daemon
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/scrumblr.log"
EPLITE_BIN="/opt/scrumblr/forever.sh"
USER="scrumblr"
GROUP="scrumblr"
DESC="scrumblr"
NAME="scrumblr"
PORT="80"

set -e

. /lib/lsb/init-functions

start() {
echo "Starting $DESC... "
$EPLITE_BIN
echo "done"
}


stop() {
echo "Stopping $DESC... "
PIDS=$(pgrep node)
for i in $PIDS;
do
kill -9 $i
done
echo "done"
}

status() {
PIDS=$(pgrep node)
if [ -z "$PID" ]
then
echo "$NAME is running"
else
echo "$NAME is not running"
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart


On le rend executable.
root@ubuntults:/var/log# chmod +x /etc/init.d/scrumblr

On active le script au démmarage:

 root@ubuntu:/opt/scrumblr# update-rc.d scrumblr defaults
Adding system startup for /etc/init.d/scrumblr ...
/etc/rc0.d/K20scrumblr -> ../init.d/scrumblr
/etc/rc1.d/K20scrumblr -> ../init.d/scrumblr
/etc/rc6.d/K20scrumblr -> ../init.d/scrumblr
/etc/rc2.d/S20scrumblr -> ../init.d/scrumblr
/etc/rc3.d/S20scrumblr -> ../init.d/scrumblr
/etc/rc4.d/S20scrumblr -> ../init.d/scrumblr
/etc/rc5.d/S20scrumblr -> ../init.d/scrumblr


root@ubuntults:/var/log# /etc/init.d/scrumblr start

Notre scrumblr est bien lancé

root@ubuntu:/opt/scrumblr# ps aux | grep node
root 3541 0.0 2.6 721084 13412 ? Ssl 12:30 0:00 node /usr/local/bin/forever start -o out.log -e err.log server.js 80
root 3542 0.2 3.7 782720 18608 ? Sl 12:30 0:00 node /opt/scrumblr/server.js 80

L'interface:
Notre node écoute sur le port 80

on arrive donc sur notre board à partir de : http://votre_serveur

scrumblr 1
Ho que c'est joli par contre c'est en Anglais.
Moi j'aime mieux le français.

Il suffit de modifier le fichier: /opt/scrumblr/views/home.jade

Et hop :)

Scrumblr 2

La belle interface, ou vous pouvez créer des notes, des sections, et même coller des gommettes :)

scrumblr3
13 novembre 2012 97 commentaires