liquid_feedback_frontend
view INSTALL.html @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
author | bsw |
---|---|
date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
parents | |
children | b9300c2e75da |
line source
1 <html>
2 <head>
3 <title>LiquidFeedback Installation Instructions</title>
4 <style type="text/css">code{white-space: pre;}</style>
5 </head>
6 <body>
7 <h1 id="liquidfeedback-installation-instructions">LiquidFeedback Installation Instructions</h1>
8 <p>This document gives a short outline about the necessary steps to setup a LiquidFeedback system.</p>
9 <h2 id="install-necessary-dependencies">1. Install necessary dependencies</h2>
10 <p>If you're using a Debian system, make sure that the following packages are installed:</p>
11 <ul>
12 <li>lua5.1</li>
13 <li>postgresql</li>
14 <li>build-essential</li>
15 <li>libpq-dev</li>
16 <li>liblua5.1-0-dev</li>
17 <li>lighttpd</li>
18 <li>ghc</li>
19 <li>libghc6-parsec3-dev</li>
20 <li>imagemagick</li>
21 <li>exim4</li>
22 </ul>
23 <p>If you're using any other Linux distribution or BSD system, install the necessary software components accordingly.</p>
24 <h2 id="ensure-that-the-user-account-of-your-webserver-has-access-to-the-database">2. Ensure that the user account of your webserver has access to the database</h2>
25 <p>Whichever useraccount is used by the webserver (usually <code>www-data</code>) needs to have access to your PostgreSQL installation. This is done by executing PostgreSQL's shell command <code>createuser</code> as database superuser (usually <code>pgsql</code>, or <code>postgres</code> for Debian installations):</p>
26 <pre><code>su - postgres
27 createuser
29 Enter name of role to add: www-data
30 Shall the new role be a superuser? (y/n) n
31 Shall the new role be allowed to create databases? (y/n) y
32 Shall the new role be allowed to create more new roles? (y/n) n
34 exit</code></pre>
35 <h2 id="install-and-configure-liquidfeedback-core">3. Install and configure LiquidFeedback-Core</h2>
36 <p>We recommend to create the database with the same user as your webserver (usually <code>www-data</code>) to avoid having to setup database privileges.</p>
37 <p>The example below installs the database as <code>www-data</code> and stores the two executables <code>lf_update</code> and <code>lf_update_issue_order</code> in the directory <code>/opt/liquid_feedback_core/</code>:</p>
38 <pre><code># Download and unpack LiquidFeedback-Core
39 # from http://www.public-software-group.org/pub/projects/liquid_feedback/backend/
40 make
41 mkdir /opt/liquid_feedback_core
42 cp core.sql lf_update lf_update_issue_order /opt/liquid_feedback_core
43 su - www-data
44 cd /opt/liquid_feedback_core
45 createdb liquid_feedback
46 createlang plpgsql liquid_feedback # command may be omitted, depending on PostgreSQL version
47 psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback</code></pre>
48 <p>A simple configuration may look as follows:</p>
49 <pre><code>psql liquid_feedback
51 INSERT INTO system_setting (member_ttl) VALUES ('1 year');
52 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
53 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
54 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
55 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
56 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);
57 INSERT INTO unit (name) VALUES ('Our organization');
58 INSERT INTO area (unit_id, name) VALUES (1, 'Default area');
59 INSERT INTO allowed_policy (area_id, policy_id, default_policy) VALUES (1, 1, TRUE);</code></pre>
60 <p>If you want to create an admin user with an empty password (CAUTION!), then execute the following SQL statement:</p>
61 <pre><code>INSERT INTO member (login, name, admin, password) VALUES ('admin', 'Administrator', TRUE, '$1$/EMPTY/$NEWt7XJg2efKwPm4vectc1');</code></pre>
62 <p>Exit the <code>psql</code> interface by typing:</p>
63 <pre><code>\q</code></pre>
64 <p>And don't forget to quit the <code>www-data</code> shell:</p>
65 <pre><code>exit</code></pre>
66 <h2 id="install-webmcp">4. Install WebMCP</h2>
67 <p>Note: Using Debian, it may be necessary to append <code>-I /usr/include/lua5.1</code> at the end of the CFLAGS line in <code>Makefile.options</code> of the WebMCP source distibution:</p>
68 <pre><code># Download and unpack WebMCP
69 # from http://www.public-software-group.org/pub/projects/webmcp/
70 vi Makefile.options # Debian requires -I /usr/include/lua5.1 at end of CFLAGS line
71 make
72 mkdir /opt/webmcp
73 cp -RL framework/* /opt/webmcp/</code></pre>
74 <h2 id="install-rocketwiki-lqfb-edition">5. Install RocketWiki LqFb-Edition</h2>
75 <pre><code># Download and unpack "RocketWiki LqFb-Edition"
76 # from http://www.public-software-group.org/pub/projects/rocketwiki/liquid_feedback_edition/
77 make
78 mkdir /opt/rocketwiki-lqfb
79 cp rocketwiki-lqfb rocketwiki-lqfb-compat /opt/rocketwiki-lqfb/</code></pre>
80 <p>If you experience problems with multi-byte encoding (UTF-8) later, then apply the following patch to both <code>rocketwiki-lqfb.hs</code> and <code>rocketwiki-lqfb-compat.hs</code> prior compilation:</p>
81 <pre><code>--- rocketwiki-lqfb.hs
82 +++ rocketwiki-lqfb.hs
83 @@ -1,4 +1,6 @@
85 +import System.IO (hSetEncoding, stdin, stdout, utf8)
86 +
87 import Text.ParserCombinators.Parsec
88 import Control.Applicative ((<$>), (<*>))
89 import Data.List (intercalate)
90 @@ -405,7 +407,10 @@
91 return htmlEntity
94 -main = interact wikiParse
95 +main = do
96 + hSetEncoding stdin utf8
97 + hSetEncoding stdout utf8
98 + interact wikiParse
100 wikiParse str
101 | success parseResult = html</code></pre>
102 <h2 id="install-the-liquidfeedback-frontend">6. Install the LiquidFeedback-Frontend</h2>
103 <p>Unpack source tree into appropriate directory, e.g. <code>/opt/liquid_feedback_frontend</code>:</p>
104 <pre><code># Download LiquidFeedback-Frontend
105 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/
106 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend</code></pre>
107 <p>Create HTML code for help texts:</p>
108 <pre><code>cd /opt/liquid_feedback_frontend/locale
109 PATH=/opt/rocketwiki-lqfb:$PATH make</code></pre>
110 <p>Make <code>tmp/</code> directory of LiquidFeedback-Frontend writable for webserver:</p>
111 <pre><code>chown www-data /opt/liquid_feedback_frontend/tmp</code></pre>
112 <p>Compile binary for fast delivery of member images:</p>
113 <pre><code>cd /opt/liquid_feedback_frontend/fastpath
114 vi getpic.c # check and modify #define commands as necessary
115 make</code></pre>
116 <h2 id="configure-mail-system">7. Configure mail system</h2>
117 <p>It may be necessary to configure your server's mail system, e.g. running <code>dpkg-reconfigure exim4-config</code> on a Debian system.</p>
118 <h2 id="configure-the-webserver-for-liquidfeedback">8. Configure the Webserver for LiquidFeedback:</h2>
119 <p>A sample configuration for <code>lighttpd</code> is given below (assuming <code>mod_alias</code> has been included elsewhere):</p>
120 <pre><code>server.modules += ("mod_cgi", "mod_rewrite", "mod_redirect", "mod_setenv")
122 # Enable CGI-Execution of *.lua files through lua binary
123 cgi.assign += ( ".lua" => "/usr/bin/lua5.1" )
125 alias.url += ( "/lf/fastpath/" => "/opt/liquid_feedback_frontend/fastpath/",
126 "/lf/static" => "/opt/liquid_feedback_frontend/static",
127 "/lf" => "/opt/webmcp/cgi-bin" )
129 # Configure environment for demo application
130 $HTTP["url"] =~ "^/lf" {
131 setenv.add-environment += (
132 "LANG" => "en_US.UTF-8",
133 "WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback_frontend/",
134 "WEBMCP_CONFIG_NAME" => "myconfig")
135 }
137 # URL beautification
138 url.rewrite-once += (
139 # do not rewrite static URLs
140 "^/lf/fastpath/(.*)$" => "/lf/fastpath/$1",
141 "^/lf/static/(.*)$" => "/lf/static/$1",
143 # dynamic URLs
144 "^/lf/([^\?]*)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_path=$1&$3",
146 )
148 $HTTP["url"] =~ "^/lf/fastpath/" {
149 cgi.assign = ( "" => "" )
150 setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
151 }</code></pre>
152 <p>If you're using Debian, you may want to create a file with the name <code>/etc/lighttpd/conf-available/60-liquidfeedback.conf</code> and create a softlink in <code>/etc/lighttpd/conf-enabled/</code>.</p>
153 <h2 id="configure-the-liquidfeedback-frontend">9. Configure the LiquidFeedback-Frontend:</h2>
154 <pre><code>cd /opt/liquid_feedback_frontend/config
155 cp example.lua myconfig.lua
156 # edit myconfig.lua according to your needs</code></pre>
157 <p>Use the following option in your configuration file to enable fast image loading:</p>
158 <pre><code>config.fastpath_url_func = function(member_id, image_type)
159 return request.get_absolute_baseurl() .. "fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
160 end</code></pre>
161 <h2 id="setup-regular-execution-of-lf_update-and-lf_update_suggestion_order">10. Setup regular execution of <code>lf_update</code> and <code>lf_update_suggestion_order</code></h2>
162 <p>The executables <code>lf_update</code> and <code>lf_update_suggestion_order</code> must be executed regularly. This may be achieved by creating a file named <code>/opt/liquid_feedback_core/lf_updated</code> with the following contents:</p>
163 <pre><code>#!/bin/sh
165 PIDFILE="/var/run/lf_updated.pid"
166 PID=$$
168 if [ -f "${PIDFILE}" ] && kill -CONT $( cat "${PIDFILE}" ); then
169 echo "lf_updated is already running."
170 exit 1
171 fi
173 echo "${PID}" > "${PIDFILE}"
175 while true; do
176 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
177 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
178 sleep 5
179 done</code></pre>
180 <p>This file must be marked as executable:</p>
181 <pre><code>chmod +x /opt/liquid_feedback_core/lf_updated</code></pre>
182 <p>And this file should be started automatically at system boot.</p>
183 <h2 id="setup-notification-loop-in-background">11. Setup notification loop in background</h2>
184 <p>In addition to regular execution of <code>lf_update</code> and <code>lf_update_suggestion_order</code>, the following commands should be executed in background:</p>
185 <pre><code>su - www-data
186 cd /opt/liquid_feedback_frontend/
187 echo "Event:send_notifications_loop()" | ../webmcp/bin/webmcp_shell myconfig</code></pre>
188 <h2 id="start-the-sytem">12. Start the sytem</h2>
189 <p>After <code>lf_update</code> has been executed at least once, and the webserver has been restarted (using the configuration above), you should be able to access your LiquidFeedback system.</p>
190 </body>
191 </html>