User Tools

Site Tools


doc:appunti:linux:sa:liquidfeedback

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
doc:appunti:linux:sa:liquidfeedback [2012/11/11 13:15] – [Core tools, WebMCP, RocketWiki and Frontend] niccolodoc:appunti:linux:sa:liquidfeedback [2012/11/11 13:51] – [LiquidFeedback administration] niccolo
Line 174: Line 174:
 INSERT INTO member (login, name, admin, invite_code) VALUES ('admin', 'Administrator', TRUE, 'vieniqua'); INSERT INTO member (login, name, admin, invite_code) VALUES ('admin', 'Administrator', TRUE, 'vieniqua');
 </code> </code>
-===== Cronjob =====+===== lf_update daemon ===== 
 + 
 +The **''lf_update''** core program must be run regulary:
  
 <code> <code>
Line 181: Line 183:
 </code> </code>
  
 +We must prepare a script that runs in an endless loop, **''/usr/local/sbin/lf_updated''**:
 +
 +<code bash>
 +#!/bin/sh
 +
 +PIDFILE="/var/run/lf_updated.pid"
 +PID=$$
 +
 +if [ -f "${PIDFILE}" ] && kill -CONT $( cat "${PIDFILE}" ); then
 +  echo "lf_updated is already running."
 +  exit 1
 +fi
 +
 +echo "${PID}" > "${PIDFILE}"
 +
 +while true; do
 +  nice /usr/local/lib/liquid_feedback_core/lf_update \
 +      "host=localhost dbname=liquid_feedback user=liquid_feedback password=MySecret" 2>&1 \
 +      | logger -t "lf_updated"
 +  sleep 5
 +done
 +</code>
 +
 +The script contains database credentials, so protect it:
 +
 +<code>
 +chown root:root /usr/local/sbin/lf_updated
 +chmod 750 /usr/local/sbin/lf_updated
 +</code>
 +
 +Then preare a script that start/stop the daemon, **''/etc/init.d/lf_updated''**:
 +
 +<code bash>
 +#! /bin/sh
 +### BEGIN INIT INFO
 +# Provides:          lf_updated
 +# Required-Start:    $syslog
 +# Required-Stop:     $syslog
 +# Default-Start:     2 3 4 5
 +# Default-Stop:      0 1 6
 +# Short-Description: lf_updated
 +# Description:       Calls LiquidFeedback lf_update regulary
 +### END INIT INFO
 +
 +# PATH should only include /usr/* if it runs after the mountnfs.sh script
 +PATH=/sbin:/usr/sbin:/bin:/usr/bin
 +DESC="lf_updated"
 +NAME=lf_updated
 +DAEMON=/usr/local/sbin/lf_updated
 +DAEMON_ARGS=""
 +PIDFILE=/var/run/$NAME.pid
 +SCRIPTNAME=/etc/init.d/$NAME
 +
 +. /lib/lsb/init-functions
 +
 +do_start()
 +{
 +        start-stop-daemon -b --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
 +        start-stop-daemon -b --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS || return 2
 +}
 +
 +do_stop()
 +{
 +        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
 +        RETVAL="$?"
 +        [ "$RETVAL" = 2 ] && return 2
 +        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
 +        [ "$?" = 2 ] && return 2
 +        rm -f $PIDFILE
 +        return "$RETVAL"
 +}
 +
 +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 $?
 +       ;;
 +  restart|force-reload)
 +        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
 +        ;;
 +  *)
 +        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
 +        exit 3
 +        ;;
 +esac
 +
 +:
 +</code>
 +
 +Activate the start/stop script at bootstrap:
 +
 +<code>
 +chmod 755 /etc/init.d/lf_updated
 +insserv lf_updated
 +</code>
 +
 +The daemon logs to syslog with the **''lf_updated''** tag.
 ===== Configuring Apache ===== ===== Configuring Apache =====
  
Line 284: Line 413:
 FIXME Verify if this checklist is complete. FIXME Verify if this checklist is complete.
  
-  - Create another database. +  - Create another **database**
-  - Create another Apache VirtualHost and declare the configuration filename in **''WEBMCP_CONFIG_NAME''**.+  - Create another **Apache VirtualHost** and declare the configuration filename in **''WEBMCP_CONFIG_NAME''**.
   - Create another config file in ''/usr/local/share/liquid_feedback_frontend/config/'' configuring at least **''absolute_base_url''** and **''database''** credentials.   - Create another config file in ''/usr/local/share/liquid_feedback_frontend/config/'' configuring at least **''absolute_base_url''** and **''database''** credentials.
 +  - Add or update the **''lf_updated''** daemon to run on each database instance.
 ===== LiquidFeedback administration ===== ===== LiquidFeedback administration =====
  
-^ unit    | Administrators allow each user partecipate (or not) to the existing units. +^ Eng     ^ Ita      ^ Note  ^ 
-^ area    | An unit can contain one or more areas. An user can partecipate to an area and he can delegate the entire area to someone else.  | +^ unit    ^ sezione  | Administrators allow each user partecipate (or not) to the existing units. 
-^ issue   +^ area    ^          | An unit can contain one or more areas. An user can partecipate to an area and he can delegate the entire area to someone else.  | 
-^ policy  |  |+^ issue   ^          |  | 
 +^ policy  ^          |  |
  
 An user with the admin right can login and click on the **//admin//** link. The first task for an administrator is to create invite codes for new users. When creating a new user the admin define the login name (the identification), an email address, the admin right and the **units** where he can partecipate. An user with the admin right can login and click on the **//admin//** link. The first task for an administrator is to create invite codes for new users. When creating a new user the admin define the login name (the identification), an email address, the admin right and the **units** where he can partecipate.
 +
doc/appunti/linux/sa/liquidfeedback.txt · Last modified: 2012/11/11 13:58 by niccolo