wiki:installation

Version 10 (modified by jbe, 6 years ago) (diff)

Install RocketWiki before installing LiquidFeedback-Frontend

How to install LiquidFeedback (stable) on a Debian squeeze system with lighttpd

Install debian security updates:

apt-get install update
apt-get install upgrade

Install the neccessary debian packages:

apt-get install lua5.1 postgresql build-essential libpq-dev liblua5.1-0-dev lighttpd ghc libghc6-parsec3-dev imagemagick exim4

Create a database role for www-data:

su - postgres
createuser
Enter name of role to add: www-data
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
exit

Create a directory for unpacking source tarballs:

cd /root
mkdir install

Install and configure LiquidFeedback Core v1.3.1:

cd /root/install
wget http://www.public-software-group.org/pub/projects/liquid_feedback/backend/v1.3.1/liquid_feedback_core-v1.3.1.tar.gz
tar -xvzf liquid_feedback_core-v1.3.1.tar.gz
cd liquid_feedback_core-v1.3.1
make
mkdir /opt/liquid_feedback_core
cp core.sql lf_update /opt/liquid_feedback_core/
su - www-data
cd /opt/liquid_feedback_core
createdb liquid_feedback
createlang plpgsql liquid_feedback
psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback
psql liquid_feedback
psql (8.4.9)
Type "help" for help.

liquid_feedback=> SELECT * FROM liquid_feedback_version;
 string | major | minor | revision 
--------+-------+-------+----------
 1.3.1  |     1 |     3 |        1
(1 row)

liquid_feedback=> SELECT * FROM system_setting;
 member_ttl 
------------
(0 rows)

liquid_feedback=> INSERT INTO system_setting (member_ttl) VALUES ('1 year');
INSERT 0 1
liquid_feedback=> SELECT * FROM contingent;
 time_frame | text_entry_limit | initiative_limit 
------------+------------------+------------------
(0 rows)

liquid_feedback=> INSERT INTO contingent (time_frame, text_entry_limit, initiative_limit) VALUES ('1 hour', 20, 6);
INSERT 0 1
liquid_feedback=> INSERT INTO contingent (time_frame, text_entry_limit, initiative_limit) VALUES ('1 day', 80, 12);
INSERT 0 1
liquid_feedback=> SELECT * FROM policy;
 id | index | active | name | description | admission_time | discussion_time | verification_time | voting_time | issue_quorum_num | issue_quorum_den | initiative_quorum_num | initiative_quorum_den | majority_num | majority_den | majority_strict 
----+-------+--------+------+-------------+----------------+-----------------+-------------------+-------------+------------------+------------------+-----------------------+-----------------------+--------------+--------------+-----------------
(0 rows)

liquid_feedback=> INSERT INTO policy (index, name, admission_time, discussion_time, verification_time, voting_time, issue_quorum_num, issue_quorum_den, initiative_quorum_num, initiative_quorum_den, majority_num, majority_den, majority_strict) VALUES (1, 'Default policy', '8 days', '15 days', '8 days', '15 days', 10, 100, 10, 100, 1, 2, TRUE);
INSERT 0 1

liquid_feedback=> SELECT * FROM policy;
 id | index | active |      name      | description | admission_time | discussion_time | verification_time | voting_time | issue_quorum_num | issue_quorum_den | initiative_quorum_num | initiative_quorum_den | majority_num | majority_den | majority_strict 
----+-------+--------+----------------+-------------+----------------+-----------------+-------------------+-------------+------------------+------------------+-----------------------+-----------------------+--------------+--------------+-----------------
  1 |     1 | t      | Default policy |             | 8 days         | 15 days         | 8 days            | 15 days     |               10 |              100 |                    10 |                   100 |            1 |            2 | t
(1 row)

liquid_feedback=> SELECT * FROM area;
 id | active | name | description | direct_member_count | member_weight | autoreject_weight | text_search_data 
----+--------+------+-------------+---------------------+---------------+-------------------+------------------
(0 rows)

liquid_feedback=> INSERT INTO area (name) VALUES ('Default area');
INSERT 0 1
liquid_feedback=> SELECT * FROM area;
 id | active |     name     | description | direct_member_count | member_weight | autoreject_weight |   text_search_data   
----+--------+--------------+-------------+---------------------+---------------+-------------------+----------------------
  1 | t      | Default area |             |                     |               |                   | 'area':2 'default':1
(1 row)

liquid_feedback=> SELECT * FROM allowed_policy;
 area_id | policy_id | default_policy 
---------+-----------+----------------
(0 rows)

liquid_feedback=> INSERT INTO allowed_policy (area_id, policy_id, default_policy) VALUES (1, 1, TRUE);
INSERT 0 1
liquid_feedback=> \q
could not save history to file "/var/www/.psql_history": No such file or directory
exit

Install WebMCP:

cd /root/install
wget http://www.public-software-group.org/pub/projects/webmcp/v1.1.2/webmcp-v1.1.2.tar.gz
tar -xvzf webmcp-v1.1.2.tar.gz
cd webmcp-v1.1.2
make
mkdir /opt/webmcp
cp -RL framework/* /opt/webmcp/

Install RocketWiki LqFb-Edition:

cd /root/install
wget http://www.public-software-group.org/pub/projects/rocketwiki/liquid_feedback_edition/v0.4/rocketwiki-lqfb-v0.4.tar.gz
tar -xvzf rocketwiki-lqfb-v0.4.tar.gz
cd rocketwiki-lqfb-v0.4
make
mkdir /opt/rocketwiki-lqfb
cp rocketwiki-lqfb rocketwiki-lqfb-compat /opt/rocketwiki-lqfb/

Install LiquidFeedback-Frontend beta33:

cd /root/install
wget http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/beta33/liquid_feedback_frontend-beta33.tar.gz
tar -xvzf liquid_feedback_frontend-beta33.tar.gz
mv liquid_feedback_frontend-beta33 /opt/liquid_feedback_frontend

Create HTML code for help texts:

cd /opt/liquid_feedback_frontend/locale
PATH=/opt/rocketwiki-lqfb:$PATH make

Make tmp directory of LiquidFeedback-Frontend writable for webserver:

chown www-data /opt/liquid_feedback_frontend/tmp

Compile binary for fast delivery of member images:

cd /opt/liquid_feedback_frontend/fastpath
check    #define GETPIC_CONNINFO "dbname=liquid_feedback"
and
replace  #define GETPIC_DEFAULT_AVATAR "/opt/liquid_feedback_testing/app/static/avatar.jpg"
with     #define GETPIC_DEFAULT_AVATAR "/opt/liquid_feedback_frontend/static/avatar.jpg"
make

Configure mail system:

dpkg-reconfigure exim4-config

Create webserver configuration for LiquidFeedback:

cd /etc/lighttpd
vi conf-available/60-liquidfeedback.conf
server.modules += ("mod_cgi", "mod_rewrite", "mod_redirect", "mod_setenv")

# Enable CGI-Execution of *.lua files through lua binary
cgi.assign += ( ".lua" => "/usr/bin/lua5.1" )

alias.url += ( "/lf/fastpath/" => "/opt/liquid_feedback_frontend/fastpath/",
               "/lf/static"    => "/opt/liquid_feedback_frontend/static",
               "/lf"           => "/opt/webmcp/cgi-bin" )

# Configure environment for demo application
$HTTP["url"] =~ "^/lf" {
  setenv.add-environment += (
    "LANG" => "en_US.UTF-8",
    "WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback_frontend/",
    "WEBMCP_CONFIG_NAME"  => "testing")
}

# URL beautification
url.rewrite-once += (
  # do not rewrite static URLs
      "^/lf/fastpath/(.*)$" => "/lf/fastpath/$1",
      "^/lf/static/(.*)$"   => "/lf/static/$1",

  # base URL
      "^/lf/(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_urldepth=0&_webmcp_module=index&_webmcp_view=index&$2",

  # module base URLs
      "^/lf/([^/\?]+)/(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_view=index&$3",
  # actions
      "^/lf/([^/\?]+)/([^/\.\?]+)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_action=$2&$4",

  # views without numeric id or string ident
      "^/lf/([^/\?]+)/([^/\?]+)\.([^/\.\?]+)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_view=$2&_webmcp_suffix=$3&$5",

  # views with numeric id or string ident
      "^/lf/([^/\?]+)/([^/\?]+)/([^/\?]+)\.([^/\.\?]+)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_urldepth=2&_webmcp_module=$1&_webmcp_view=$2&_webmcp_id=$3&_webmcp_suffix=$4&$6",

)

$HTTP["url"] =~ "^/lf/fastpath/" {
  cgi.assign = ( "" => "" )
  setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
}
cd /etc/lighttpd/conf-enabled
ln -s ../conf-available/60-liquidfeedback.conf .

Configure LiquidFeedback-Frontend:

cd /opt/liquid_feedback_frontend/config
vi testing.lua
adjust   config.absolute_base_url
and
replace  rocketwiki= "/opt/liquid_feedback_testing/rocketwiki/rocketwiki-lqfb",
with     rocketwiki = "/opt/rocketwiki-lqfb/rocketwiki-lqfb",
and
replace  compat = "/opt/liquid_feedback_testing/rocketwiki/rocketwiki-lqfb-compat"
with     compat = "/opt/rocketwiki-lqfb/rocketwiki-lqfb-compat"
and
adjust   config.fastpath_url_func

Execute lf_update once:

su - www-data
cd /opt/liquid_feedback_core
./lf_update dbname=liquid_feedback && echo OK
exit

The command "lf_update dbname=liquid_feedback" has to be executed regulary. Create the following shell script to call this command in an endless loop:

vi /opt/liquid_feedback_core/lf_updated
#!/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
  su - www-data -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
  sleep 5
done

Create the following init-script for lf_updated...

vi /etc/init.d/lf_updated
#! /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=/opt/liquid_feedback_core/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

:

... and make the init script executable and let it start automatically at boot time

chmod +x /etc/init.d/lf_updated
update-rc.d-insserv lf_updated defaults

Restart the webserver:

/etc/init.d/lighttpd restart

(this document is not finished yet)