liquid_feedback_frontend

view INSTALL.mkd @ 1190:9700ce0d5541

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

Impressum / About Us