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