Pirate Feedback/Installation

Aus Piratenwiki
Wechseln zu: Navigation, Suche

How to install Pirate Feedback

This installation is for a Debian 6 (squeeze) or 7 (wheezy) system. Installation on different Linux distributions is possible with little changes.

Debian packages

PostgreSQL 9.6 is tested, but Pirate Feedback should also work with every version up from 8.4.

On Debian 6 (squeeze) add the backports to /etc/apt/sources.list to make PostgreSQL 9.1 available:

# Backports for squeeze
deb http://backports.debian.org/debian-backports squeeze-backports main

Install debian security updates:

apt-get update
apt-get upgrade

This example uses exim as mail transfer agent, but actually you just need any mail transfer agent.

Install the necessary debian packages:

apt-get install lua5.1 postgresql-9.6 postgresql-server-dev-9.6
build-essential libpq-dev liblua5.1-0-dev ghc  imagemagick 

( lighttpd oder Apache ?) ( exim4 ?) ( libghc6-parsec3-dev ??)

Configure mail system:

dpkg-reconfigure exim4-config

Preparation

Create the destination directory as root and set the ownership to your normal user:

# mkdir /opt/pirate_feedback
# chown <user> /opt/pirate_feedback

Create a directory for unpacking source tar balls, from now on as your normal user:

mkdir /opt/pirate_feedback/src

RocketWiki

apt-get install cabal-install
( cabal install transformers-0.4.3.0 -- Abhängigkeit zur genauen Version siehe [1] ??)
cabal install parsec
cabal install dph-seq
cabal install dph-par


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

Files

Note that the patch files from wigbold8 are lost. You may download already patched code at https://bitbucket.org/cmrcx/ which ist nescessary for webcmp but only includes changes up to 2013, or from https://github.com/rudipf/pirate_feedback which includes the code changes from 2017 on.


Download and unpack the archives:

cd /opt/pirate_feedback/src
wget http://www.public-software-group.org/pub/projects/webmcp/v1.2.5/webmcp-v1.2.5.tar.gz
wget http://www.public-software-group.org/pub/projects/liquid_feedback/backend/v2.2.4/liquid_feedback_core-v2.2.4.tar.gz
wget http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/v2.2.3/liquid_feedback_frontend-v2.2.3.tar.gz
wget http://wigbold8.piratenpartei-bayern.de/releases/pirate_feedback-v1.2.2.tar.bz2
rm -rf webmcp-v1.2.5           # remove temporary files from last installation
tar xzf webmcp-v1.2.5.tar.gz
tar xzf liquid_feedback_core-v2.2.4.tar.gz
tar xzf liquid_feedback_frontend-v2.2.3.tar.gz
tar xjf pirate_feedback-v1.2.2.tar.bz2

Apply patches and move files:

cd webmcp-v1.2.5/
patch -p1 < ../pirate_feedback-v1.2.2/webmcp-v1.2.5_pirate_feedback-v1.2.2.diff
make
mkdir ../../webmcp-v1.2.5_pirate_feedback-v1.2.2
cp -RL framework/* ../../webmcp-v1.2.5_pirate_feedback-v1.2.2
cd ../liquid_feedback_core-v2.2.4
patch -p1 < ../pirate_feedback-v1.2.2/liquid_feedback_core-v2.2.4_pirate_feedback-v1.2.2.diff
cd ../liquid_feedback_frontend-v2.2.3
patch -p1 < ../pirate_feedback-v1.2.2/liquid_feedback_frontend-v2.2.3_pirate_feedback-v1.2.2.diff
cd ..
mv liquid_feedback_core-v2.2.4 ../liquid_feedback_core-v2.2.4_pirate_feedback-v1.2.2
mv liquid_feedback_frontend-v2.2.3 ../liquid_feedback_frontend-v2.2.3_pirate_feedback-v1.2.2

In the configuration we use the short paths without the version numbers. We will set the necessary links later.

Prepare and configure the core:

cd ../liquid_feedback_core-v2.2.4_pirate_feedback-v1.2.2
make
chmod +x import_members lf_update lf_update_suggestion_order lf_updated lf_notification lf_update_and_notification.sh lf_export check_sane.sh backup_data.sh recreate_schema.sh
cp config_example config     # copy configuration from example or previous version
vi config

Prepare and configure the frontend:

cd ../liquid_feedback_frontend-v2.2.3_pirate_feedback-v1.2.2
chmod 777 tmp/
cd fastpath
make
cd ../locale
make
cd ../config
cp example.lua myconfig.lua    # copy configuration from example or previous version
vi myconfig.lua

Set links to new version:

cd /opt/pirate_feedback
rm webmcp                       # removes the link to a previous version if you're upgrading
ln -s webmcp-v1.2.5_pirate_feedback-v1.2.2/ webmcp
rm liquid_feedback_core         # removes the link to a previous version if you're upgrading
ln -s liquid_feedback_core-v2.2.4_pirate_feedback-v1.2.2/ liquid_feedback_core
rm liquid_feedback_frontend     # removes the link to a previous version if you're upgrading
ln -s liquid_feedback_frontend-v2.2.3_pirate_feedback-v1.2.2/ liquid_feedback_frontend

Additional directory, if you want to use the export:

cd /opt/pirate_feedback
mkdir export_dump
chmod 777 backup_dump export_dump

Additional directories, if you want to use the member import script:

cd /opt/pirate_feedback
mkdir member_import
mkdir member_import_processed

Database

On Debian the user of the webserver is "www-data". On other Linux distributions this user might have a different name.

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

Set up the database:

# usermod -s /bin/bash www-data
# su www-data
cd /opt/pirate_feedback/liquid_feedback_core
createdb pirate_feedback
createlang plpgsql pirate_feedback
psql -v ON_ERROR_STOP=1 -f core.sql pirate_feedback
psql -v ON_ERROR_STOP=1 -f core_ext.sql pirate_feedback
psql pirate_feedback

Deactivate members after one 3 months of inactivity and delegations 3 months after last confimation:

pirate_feedback=> INSERT INTO system_setting (member_ttl, delegation_ttl) VALUES ('3 mons', '3 mons');

Set amount of text entries or initiatives a user may create within a given time frame:

pirate_feedback=> INSERT INTO contingent (time_frame, text_entry_limit, initiative_limit) VALUES ('1 hour', 20, 6);
pirate_feedback=> INSERT INTO contingent (time_frame, text_entry_limit, initiative_limit) VALUES ('1 day', 80, 12);

Create an administrator account:

pirate_feedback=> INSERT INTO member (login, name, admin, invite_code) VALUES ('admin', 'Administrator', TRUE, _INSERT_ADMIN_INVITE_CODE_IN_SINGLE_QUOTES_HERE_);

Everything else can be done later in the administration area.

Exit from psql and su:

pirate_feedback=> \q
exit

Webserver

This example uses lighttpd. It also works with apache, but the configuration is different.

Copy and adjust the example configuration:

# cp /opt/pirate_feedback/liquid_feedback_core/60-pirate_feedback.conf_example /etc/lighttpd/conf-available/60-pirate_feedback.conf
# vi /etc/lighttpd/conf-available/60-pirate_feedback.conf
# cd /etc/lighttpd/conf-enabled
# ln -s ../conf-available/60-pirate_feedback.conf .

Change the document root:

# vi /etc/lighttpd/lighttpd.conf
server.document-root = "/opt/pirate_feedback/webmcp/cgi-bin"

Restart the webserver:

# /etc/init.d/lighttpd restart

Background processes

Install initscripts:

# cp /opt/pirate_feedback/liquid_feedback_core/lf_updated /etc/init.d/
# update-rc.d lf_updated defaults
# /etc/init.d/lf_updated start
# cp /opt/pirate_feedback/liquid_feedback_core/lf_notification /etc/init.d/
# update-rc.d lf_notification defaults
# /etc/init.d/lf_notification start

If you want to use the export:

www-data$ crontab -e
23 0 * * * /opt/pirate_feedback/liquid_feedback_core/lf_export

If you want to use the member import script:

# crontab -e
*/5 * * * *  /opt/pirate_feedback/liquid_feedback_core/import_members

First login

Take the browser and navigate to your new Pirate Feedback. Go to "Login", then "Registration" and enter the invite code you provided earlier. Register the admin user and then log in. Under "Admin" you will find the administration area where you can add members, units, areas and policies.

Optional https via letsencrypt

Akording to current debian


apt install certbot

apt install python-certbot-apache

a2enmod ssl

sudo certbot --authenticator standalone --installer apache  \
 -d <domain> --pre-hook "service apache2 stop" --post-hook "service apache2 start"

Choose an admin mail adress for the certificate on any domain. Domain ist the FQDN of the installation. You need an existing sites-available/....conf.

Update to a new release

Install the new files like described in the section "Files", but stop before setting the links

Stop the webserver and the background processes:

# /etc/init.d/lf_updated stop
# /etc/init.d/lf_notification stop
# /etc/init.d/lighttpd stop
# crontab -e    # deactivate member import

Check if everything is fine:

# /opt/pirate_feedback/liquid_feedback_core/check_sane.sh

Set the links like described in the section "Files"

Backup the database:

# cd /opt/pirate_feedback/liquid_feedback_core
# ./backup_data.sh

Update the database (only if there are changes and an update file is supplied):

# cd /opt/pirate_feedback/liquid_feedback_core
# su www-data
psql -v ON_ERROR_STOP=1 -f update/core-update.pirate_feedback-v1.1.0.sql pirate_feedback
exit

Recreate the database schema:

# cd /opt/pirate_feedback/liquid_feedback_core
# ./recreate_schema.sh

Start the webserver and the background processes:

# /etc/init.d/lf_updated start
# /etc/init.d/lf_notification start
# /etc/init.d/lighttpd start
# crontab -e    # reactivate member import

Check if everything is fine:

# /opt/pirate_feedback/liquid_feedback_core/check_sane.sh

Convert database from LiquidFeedback

It is possible to convert an existing LiquidFeedback database and then continue with Pirate Feedback. The existing delegation chains will be converted to preference lists.

# su www-data
cd /opt/pirate_feedback/liquid_feedback_core
created pirate_feedback
createlang plpgsql pirate_feedback
psql -v ON_ERROR_STOP=1 -f liquid_feedback.sql pirate_feedback
psql -v ON_ERROR_STOP=1 -f update/core-update.liquid_feedback-pirate_feedback.sql pirate_feedback
exit
# cd /opt/pirate_feedback/liquid_feedback_core
# ./recreate_schema.sh

Then recalculate the vote counts:

# su www-data
cd /opt/pirate_feedback/liquid_feedback_core
psql -v ON_ERROR_STOP=1 -f update/core-update.pirate_feedback-v1.1.0.sql pirate_feedback
exit

Notices

Of course these installation instructions base on the instructions for LiquidFeedback: http://dev.liquidfeedback.org/trac/lf/wiki/installation