Skip to content

Instantly share code, notes, and snippets.

@alej0varas
Created July 8, 2012 19:32
Show Gist options
  • Save alej0varas/3072456 to your computer and use it in GitHub Desktop.
Save alej0varas/3072456 to your computer and use it in GitHub Desktop.
LiquidFeedback 2.0 installation script
################
# Installation #
################
WWW_USER="" # use the same name as your webserver user "www-data" "lighttpd", the one who connects to the database
WWW_PATH="" # must be accesible by your webserver "/var/www/liquidfeedback
POSTGRES_USERNAME="" # use the same name as your webserver user "www-data" "lighttpd"
INSTALL_PATH="/opt"
TMP_PATH="/tmp"
DB_NAME="liquid_feedback"
DB_ROLE="liquid_feedback" # the owner of the database
ROCKETWIKI_VERSION="0.4"
LIQUID_FEEDBACK_CORE_VERSION="2.0.11"
LIQUID_FEEDBACK_FRONTEND_VERSION="2.0.0"
if [ -z $WWW_USER ];
then
echo "You must define WWW_USER"
exit 1
fi
if [ -z $WWW_PATH ];
then
echo "You must define WWW_PATH"
exit 1
fi
if [ -z $POSTGRES_USERNAME ];
then
echo "You must define POSTGRES_USERNAME"
exit 1
fi
if ! [ -d $WWW_PATH ];
then
echo "WWW_PATH '$WWW_PATH' does not exist or is not a directory"
exit 1
fi
if ! [ -d $TMP_PATH ];
then
echo "TMP_PATH '$TMP_PATH' does not exist or is not a directory"
exit 1
fi
# Get the repositories of the core, the frondend and the web
# application framework WebMCP:
echo
cd $TMP_PATH
wget http://www.public-software-group.org/pub/projects/liquid_feedback/backend/v$LIQUID_FEEDBACK_CORE_VERSION/liquid_feedback_core-v$LIQUID_FEEDBACK_CORE_VERSION.tar.gz
tar -xvzf liquid_feedback_core-v$LIQUID_FEEDBACK_CORE_VERSION.tar.gz
cd liquid_feedback_core-v$LIQUID_FEEDBACK_CORE_VERSION
make
sudo mkdir $INSTALL_PATH/liquid_feedback_core
sudo cp core.sql lf_update $INSTALL_PATH/liquid_feedback_core/
# Compile WebMCP
echo
echo -n "You need lua interpreter, http://www.lua.org/. Continue?"
read _
cd $TMP_PATH
wget http://www.public-software-group.org/pub/projects/webmcp/v1.2.3/webmcp-v1.2.3.tar.gz
tar -xvzf webmcp-v1.2.3.tar.gz
cd webmcp-v1.2.3
#vi Makefile.options # append -I /usr/include/lua5.1 at end of CFLAGS line
make
sudo mkdir $INSTALL_PATH/webmcp
sudo cp -RL framework/* $INSTALL_PATH/webmcp/
echo
cd $TMP_PATH
sudo wget http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/v$LIQUID_FEEDBACK_FRONTEND_VERSION/liquid_feedback_frontend-v$LIQUID_FEEDBACK_FRONTEND_VERSION.tar.gz
sudo tar -xvzf liquid_feedback_frontend-v$LIQUID_FEEDBACK_FRONTEND_VERSION.tar.gz
sudo mv liquid_feedback_frontend-v$LIQUID_FEEDBACK_FRONTEND_VERSION $WWW_PATH/liquid_feedback_frontend
sudo chown -R $WWW_USER:$WWW_USER $WWW_PATH/liquid_feedback_frontend
# Create database user
# su - postgres
echo -n "Create database user? [y/N]: "
read do_init
if [ $do_init ] && [ $do_init == "y" ];
then
sudo -u $POSTGRES_USERNAME createuser -S -d -R $DB_ROLE
fi
# Install LiquidFeedback Core:
echo
sudo -u $POSTGRES_USERNAME createdb -U $WWW_USER liquid_feedback
# echo "You need to create plpgsql language in your database, http://www.faqs.org/docs/ppbook/c19610.htm."
echo
sudo -u $POSTGRES_USERNAME createlang -U $WWW_USER plpgsql liquid_feedback
echo
psql -q -U $WWW_USER -v ON_ERROR_STOP=1 -f $INSTALL_PATH/liquid_feedback_core/core.sql liquid_feedback
# You should initiatize your database using the command
# "psql liquid_feedback" and the examples shown in file "init.sql".
echo
echo -n "Load default values from init.sql? [y/N]: "
read do_init
if [ $do_init ] && [ $do_init == y ];
then
psql -q -U $WWW_USER liquid_feedback -f $TMP_PATH/liquid_feedback_core-v$LIQUID_FEEDBACK_CORE_VERSION/init.sql
fi
# If you experience trouble during compilation, you might want to edit the
# file "Makefile.options" (i.e. to add -fPIC to compiler options) and then
# retry:
# vi Makefile.options
# make clean
# make
# Install Wiki-to-HTML converters
# Download latest LiquidFeedback Edition of RocketWiki from
# http://www.public-software-group.org/pub/projects/rocketwiki/liquid_feedback_edition/
# Compile the binaries by calling make, and copy them to a place of your
# choice, e.g. /opt/rocketwiki-lqfb/
echo
echo -n "You need ghc compiler, http://www.haskell.org/ghc/. Continue?"
read _
echo
echo -n "You need Text.ParserCombinators.Parsec, http://www.cs.uu.nl/~daan/parsec.html. Continue?"
read _
echo
cd $TMP_PATH
sudo wget http://www.public-software-group.org/pub/projects/rocketwiki/liquid_feedback_edition/v$ROCKETWIKI_VERSION/rocketwiki-lqfb-v$ROCKETWIKI_VERSION.tar.gz
tar -xvf rocketwiki-lqfb-v$ROCKETWIKI_VERSION.tar.gz
cd rocketwiki-lqfb-v$ROCKETWIKI_VERSION
make
sudo mkdir $INSTALL_PATH/rocketwiki-lqfb
sudo cp rocketwiki-lqfb rocketwiki-lqfb-compat $INSTALL_PATH/rocketwiki-lqfb
#sudo chown -R $WWW_USER:$WWW_USER $INSTALL_PATH/rocketwiki-lqfb/*
# Compile help messages from wiki to html
echo
export LANG="en_US.utf8"
cd $WWW_PATH/liquid_feedback_frontend/locale
sudo PATH=$INSTALL_PATH/rocketwiki-lqfb:$PATH -u $WWW_USER make
# or by hand:
# for file in *.txt; do /opt/rocketwiki-lqfb/rocketwiki-lqfb < $file > $file.html; done
# Configure the LiquidFeedback Frontend application:
sudo -u $WWW_USER cp $WWW_PATH/liquid_feedback_frontend/config/example.lua $WWW_PATH/liquid_feedback_frontend/config/myconfig.lua
echo "Edit $WWW_PATH/liquid_feedback_frontend/config/myconfig.lua"
echo "add host='localhost' to config.database in myconfig.lua . Continue?"
read _
# Configure the webserver
echo
echo "Configure the webserver"
echo "Use lighttpd example from $WWW_PATH/webmcp/doc/lighttpd.example.conf"
# Use $WWW_PATH/webmcp/doc/lighttpd.example.conf (or
# apache.sample.conf) to setup your webserver appropriatly.
# INSERT INTO system_setting (member_ttl) VALUES ('1 year');
# INSERT INTO contingent (time_frame, text_entry_limit, initiative_limit) VALUES ('1 hour', 20, 6);
# INSERT INTO contingent (time_frame, text_entry_limit, initiative_limit) VALUES ('1 day', 80, 12);
# 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) VALUES (1, 'Default policy', '8 days', '15 days', '8 days', '15 days', 10, 100, 10, 100);
# INSERT INTO unit (name) VALUES ('Our organization');
# INSERT INTO area (unit_id, name) VALUES (1, 'Default area');
# INSERT INTO member (login, name, admin, invite_code) VALUES ('admin', 'Administrator', TRUE, _INSERT_ADMIN_INVITE_CODE_IN_SINGLE_QUOTES_HERE_);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment