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