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