liquid_feedback_frontend

view INSTALL.html @ 1084:6c9198d84e7c

merge
author jbe
date Wed Jul 23 23:09:53 2014 +0200 (2014-07-23)
parents 53b0139ed930
children 08adef9f05b9
line source
1 <html>
2 <head>
3 <title>LiquidFeedback Installation Instructions</title>
4 </head>
5 <body>
6 <h1>LiquidFeedback Installation Instructions</h1>
8 <p>This document gives a short outline about the necessary steps to setup a
9 LiquidFeedback system.</p>
11 <h2>1. Install necessary dependencies</h2>
13 <p>If you're using a Debian system, make sure that the following packages are
14 installed:</p>
16 <ul>
17 <li>lua5.1</li>
18 <li>postgresql</li>
19 <li>build-essential</li>
20 <li>libpq-dev</li>
21 <li>liblua5.1-0-dev</li>
22 <li>lighttpd</li>
23 <li>ghc</li>
24 <li>libghc6-parsec3-dev</li>
25 <li>imagemagick</li>
26 <li>exim4</li>
27 <li>markdown2 (install with Python's pip)</li>
28 </ul>
30 <p>If you're using any other Linux distribution or BSD system, install the
31 necessary software components accordingly.</p>
33 <h2>2. Ensure that the user account of your webserver has access to the database</h2>
35 <p>Whichever useraccount is used by the webserver (usually <code>www-data</code>) needs to
36 have access to your PostgreSQL installation. This is done by executing
37 PostgreSQL's shell command <code>createuser</code> as database superuser (usually <code>pgsql</code>,
38 or <code>postgres</code> for Debian installations):</p>
40 <pre><code>su - postgres
41 createuser
43 Enter name of role to add: www-data
44 Shall the new role be a superuser? (y/n) n
45 Shall the new role be allowed to create databases? (y/n) y
46 Shall the new role be allowed to create more new roles? (y/n) n
48 exit
49 </code></pre>
51 <h2>3. Install and configure LiquidFeedback-Core</h2>
53 <p>We recommend to create the database with the same user as your webserver
54 (usually <code>www-data</code>) to avoid having to setup database privileges.</p>
56 <p>The example below installs the database as <code>www-data</code> and stores the two
57 executables <code>lf_update</code> and <code>lf_update_issue_order</code> in the directory
58 <code>/opt/liquid_feedback_core/</code>:</p>
60 <pre><code># Download and unpack LiquidFeedback-Core
61 # from http://www.public-software-group.org/pub/projects/liquid_feedback/backend/
62 make
63 mkdir /opt/liquid_feedback_core
64 cp core.sql lf_update lf_update_issue_order /opt/liquid_feedback_core
65 su - www-data
66 cd /opt/liquid_feedback_core
67 createdb liquid_feedback
68 createlang plpgsql liquid_feedback # command may be omitted, depending on PostgreSQL version
69 psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback
70 </code></pre>
72 <p>A simple configuration may look as follows:</p>
74 <pre><code>psql liquid_feedback
76 INSERT INTO system_setting (member_ttl) VALUES ('1 year');
77 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
78 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
79 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
80 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
81 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);
82 INSERT INTO unit (name) VALUES ('Our organization');
83 INSERT INTO area (unit_id, name) VALUES (1, 'Default area');
84 INSERT INTO allowed_policy (area_id, policy_id, default_policy) VALUES (1, 1, TRUE);
85 </code></pre>
87 <p>If you want to create an admin user with an empty password (CAUTION!), then execute the following SQL statement:</p>
89 <pre><code>INSERT INTO member (login, name, admin, password) VALUES ('admin', 'Administrator', TRUE, '$1$/EMPTY/$NEWt7XJg2efKwPm4vectc1');
90 </code></pre>
92 <p>Exit the <code>psql</code> interface by typing:</p>
94 <pre><code>\q
95 </code></pre>
97 <p>And don't forget to quit the <code>www-data</code> shell:</p>
99 <pre><code>exit
100 </code></pre>
102 <h2>4. Install WebMCP</h2>
104 <p>Note: Using Debian, it may be necessary to append <code>-I /usr/include/lua5.1</code> at
105 the end of the CFLAGS line in <code>Makefile.options</code> of the WebMCP source
106 distibution:</p>
108 <pre><code># Download and unpack WebMCP
109 # from http://www.public-software-group.org/pub/projects/webmcp/
110 vi Makefile.options # Debian requires -I /usr/include/lua5.1 at end of CFLAGS line
111 make
112 mkdir /opt/webmcp
113 cp -RL framework/* /opt/webmcp/
114 </code></pre>
116 <h2>5. Install the LiquidFeedback-Frontend</h2>
118 <p>Unpack source tree into appropriate directory, e.g. <code>/opt/liquid_feedback_frontend</code>:</p>
120 <pre><code># Download LiquidFeedback-Frontend
121 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/
122 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend
123 </code></pre>
125 <p>Create HTML code for help texts:</p>
127 <pre><code>cd /opt/liquid_feedback_frontend/locale
128 PATH=/opt/rocketwiki-lqfb:$PATH make
129 </code></pre>
131 <p>Make <code>tmp/</code> directory of LiquidFeedback-Frontend writable for webserver:</p>
133 <pre><code>chown www-data /opt/liquid_feedback_frontend/tmp
134 </code></pre>
136 <p>Compile binary for fast delivery of member images:</p>
138 <pre><code>cd /opt/liquid_feedback_frontend/fastpath
139 vi getpic.c # check and modify #define commands as necessary
140 make
141 </code></pre>
143 <h2>6. Configure mail system</h2>
145 <p>It may be necessary to configure your server's mail system, e.g. running
146 <code>dpkg-reconfigure exim4-config</code> on a Debian system.</p>
148 <h2>7. Configure the Webserver for LiquidFeedback:</h2>
150 <p>A sample configuration for <code>lighttpd</code> is given below (assuming <code>mod_alias</code> has
151 been included elsewhere):</p>
153 <pre><code>server.modules += ("mod_cgi", "mod_rewrite", "mod_redirect", "mod_setenv")
155 # Enable CGI-Execution of *.lua files through lua binary
156 cgi.assign += ( ".lua" =&gt; "/usr/bin/lua5.1" )
158 alias.url += ( "/lf/fastpath/" =&gt; "/opt/liquid_feedback_frontend/fastpath/",
159 "/lf/static" =&gt; "/opt/liquid_feedback_frontend/static",
160 "/lf" =&gt; "/opt/webmcp/cgi-bin" )
162 # Configure environment for demo application
163 $HTTP["url"] =~ "^/lf" {
164 setenv.add-environment += (
165 "LANG" =&gt; "en_US.UTF-8",
166 "WEBMCP_APP_BASEPATH" =&gt; "/opt/liquid_feedback_frontend/",
167 "WEBMCP_CONFIG_NAME" =&gt; "myconfig")
168 }
170 # URL beautification
171 url.rewrite-once += (
172 # do not rewrite static URLs
173 "^/lf/fastpath/(.*)$" =&gt; "/lf/fastpath/$1",
174 "^/lf/static/(.*)$" =&gt; "/lf/static/$1",
176 # dynamic URLs
177 "^/lf/([^\?]*)(\?(.*))?$" =&gt; "/lf/webmcp-wrapper.lua?_webmcp_path=$1&amp;$3",
179 )
181 $HTTP["url"] =~ "^/lf/fastpath/" {
182 cgi.assign = ( "" =&gt; "" )
183 setenv.add-response-header = ( "Cache-Control" =&gt; "private; max-age=86400" )
184 }
185 </code></pre>
187 <p>If you're using Debian, you may want to create a file with the name
188 <code>/etc/lighttpd/conf-available/60-liquidfeedback.conf</code> and create a softlink in
189 <code>/etc/lighttpd/conf-enabled/</code>.</p>
191 <h2>8. Configure the LiquidFeedback-Frontend:</h2>
193 <pre><code>cd /opt/liquid_feedback_frontend/config
194 cp example.lua myconfig.lua
195 # edit myconfig.lua according to your needs
196 </code></pre>
198 <p>Use the following option in your configuration file to enable fast image
199 loading:</p>
201 <pre><code>config.fastpath_url_func = function(member_id, image_type)
202 return request.get_absolute_baseurl() .. "fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
203 end
204 </code></pre>
206 <h2>9. Setup regular execution of <code>lf_update</code> and related commands </h2>
208 <p>The executables <code>lf_update</code>, <code>lf_update_issue_order</code>, and
209 <code>lf_update_suggestion_order</code> must be executed regularly. This may be achieved
210 by creating a file named <code>/opt/liquid_feedback_core/lf_updated</code> with the
211 following contents:</p>
213 <pre><code>#!/bin/sh
215 PIDFILE="/var/run/lf_updated.pid"
216 PID=$$
218 if [ -f "${PIDFILE}" ] &amp;&amp; kill -CONT $( cat "${PIDFILE}" ); then
219 echo "lf_updated is already running."
220 exit 1
221 fi
223 echo "${PID}" &gt; "${PIDFILE}"
225 while true; do
226 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2&gt;&amp;1 | logger -t "lf_updated"'
227 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update_issue_order dbname=liquid_feedback 2&gt;&amp;1 | logger -t "lf_updated"'
228 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2&gt;&amp;1 | logger -t "lf_updated"'
229 sleep 5
230 done
231 </code></pre>
233 <p>This file must be marked as executable:</p>
235 <pre><code>chmod +x /opt/liquid_feedback_core/lf_updated
236 </code></pre>
238 <p>And this file should be started automatically at system boot.</p>
240 <h2>10. Setup notification loop in background</h2>
242 <p>In addition to regular execution of <code>lf_update</code> and
243 <code>lf_update_suggestion_order</code>, the following commands should be executed in
244 background:</p>
246 <pre><code>su - www-data
247 cd /opt/liquid_feedback_frontend/
248 echo "Event:send_notifications_loop()" | ../webmcp/bin/webmcp_shell myconfig
249 </code></pre>
251 <h2>11. Start the sytem</h2>
253 <p>After <code>lf_update</code> has been executed at least once, and the webserver has been
254 restarted (using the configuration above), you should be able to access your
255 LiquidFeedback system.</p>
256 </body>
257 </html>

Impressum / About Us