liquid_feedback_frontend

view INSTALL.mkd @ 1196:5f9cf5a1d12f

Added missing "lf_update_suggestion_order" file to "cp" command in INSTALL.mkd and INSTALL.html
author jbe
date Mon Jun 01 15:11:32 2015 +0200 (2015-06-01)
parents bf158c59f827
children ae9812d9f653
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 (``apt-get install python-pip; pip install markdown2``)
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 -s $SHELL
38 createuser --no-superuser --createdb --no-createrole www-data
39 exit
42 3. Install and configure LiquidFeedback-Core
43 --------------------------------------------
45 We recommend to create the database with the same user as your webserver
46 (usually `www-data`) to avoid having to setup database privileges.
48 The example below installs the database as `www-data` and stores the two
49 executables `lf_update` and `lf_update_issue_order` in the directory
50 `/opt/liquid_feedback_core/`:
52 # Download and unpack LiquidFeedback-Core
53 # from http://www.public-software-group.org/pub/projects/liquid_feedback/backend/
54 make
55 mkdir /opt/liquid_feedback_core
56 cp core.sql lf_update lf_update_issue_order lf_update_suggestion_order /opt/liquid_feedback_core
57 su www-data -s $SHELL
58 cd /opt/liquid_feedback_core
59 createdb liquid_feedback
60 createlang plpgsql liquid_feedback # command may be omitted, depending on PostgreSQL version
61 psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback
63 A simple configuration may look as follows:
65 psql liquid_feedback
67 INSERT INTO system_setting (member_ttl) VALUES ('1 year');
68 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
69 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
70 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
71 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
72 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);
73 INSERT INTO unit (name) VALUES ('Our organization');
74 INSERT INTO area (unit_id, name) VALUES (1, 'Default area');
75 INSERT INTO allowed_policy (area_id, policy_id, default_policy) VALUES (1, 1, TRUE);
77 If you want to create an admin user with an empty password (CAUTION!), then execute the following SQL statement:
79 INSERT INTO member (login, name, admin, password) VALUES ('admin', 'Administrator', TRUE, '$1$/EMPTY/$NEWt7XJg2efKwPm4vectc1');
81 Exit the `psql` interface by typing:
83 \q
85 And don't forget to quit the `www-data` shell:
87 exit
90 4. Install Moonbridge (only for WebMCP 2.x)
91 -------------------------------------------
93 # Download and unpack Moonbridge
94 # from http://www.public-software-group.org/pub/projects/moonbridge/
95 pmake MOONBR_LUA_PATH=/opt/moonbridge/?.lua
96 mkdir /opt/moonbridge
97 cp moonbridge /opt/moonbridge/
98 cp moonbridge_http.lua /opt/moonbridge/
101 5. Install WebMCP
102 -----------------
104 Note: Using Debian, it may be necessary to append `-I /usr/include/lua5.2` at
105 the end of the CFLAGS line in `Makefile.options` of the WebMCP source
106 distibution:
108 # 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.2 at end of CFLAGS line
111 make
112 mkdir /opt/webmcp
113 cp -RL framework/* /opt/webmcp/
116 6. Install the LiquidFeedback-Frontend
117 --------------------------------------
119 Unpack source tree into appropriate directory, e.g. `/opt/liquid_feedback_frontend`:
121 # Download LiquidFeedback-Frontend
122 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/
123 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend
125 Make `tmp/` directory of LiquidFeedback-Frontend writable for webserver:
127 chown www-data /opt/liquid_feedback_frontend/tmp
129 Compile binary for fast delivery of member images (only necessary for WebMCP 1.2.x):
131 cd /opt/liquid_feedback_frontend/fastpath
132 vi getpic.c # check and modify #define commands as necessary
133 make
136 7. Configure mail system
137 ------------------------
139 It may be necessary to configure your server's mail system, e.g. running
140 `dpkg-reconfigure exim4-config` on a Debian system.
143 8. Configure the Webserver for LiquidFeedback (only for WebMCP 1.2.x)
144 ---------------------------------------------------------------------
146 A sample configuration for `lighttpd` is given below (assuming `mod_alias` has
147 been included elsewhere):
149 server.modules += ("mod_cgi", "mod_rewrite", "mod_redirect", "mod_setenv")
151 # Enable CGI-Execution of *.lua files through lua binary
152 cgi.assign += ( ".lua" => "/usr/bin/lua5.1" )
154 alias.url += ( "/lf/fastpath/" => "/opt/liquid_feedback_frontend/fastpath/",
155 "/lf/static" => "/opt/liquid_feedback_frontend/static",
156 "/lf" => "/opt/webmcp/cgi-bin" )
158 # Configure environment for demo application
159 $HTTP["url"] =~ "^/lf" {
160 setenv.add-environment += (
161 "LANG" => "en_US.UTF-8",
162 "WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback_frontend/",
163 "WEBMCP_CONFIG_NAME" => "myconfig")
164 }
166 # URL beautification
167 url.rewrite-once += (
168 # do not rewrite static URLs
169 "^/lf/fastpath/(.*)$" => "/lf/fastpath/$1",
170 "^/lf/static/(.*)$" => "/lf/static/$1",
172 # dynamic URLs
173 "^/lf/([^\?]*)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_path=$1&$3",
175 )
177 $HTTP["url"] =~ "^/lf/fastpath/" {
178 cgi.assign = ( "" => "" )
179 setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
180 }
182 If you're using Debian, you may want to create a file with the name
183 `/etc/lighttpd/conf-available/60-liquidfeedback.conf` and create a softlink in
184 `/etc/lighttpd/conf-enabled/`.
187 9. Configure the LiquidFeedback-Frontend
188 ----------------------------------------
190 cd /opt/liquid_feedback_frontend/config
191 cp example.lua myconfig.lua
192 # edit myconfig.lua according to your needs
194 Use the following option in your configuration file to enable fast image
195 loading (only for WebMCP 1.2.x):
197 config.fastpath_url_func = function(member_id, image_type)
198 return request.get_absolute_baseurl() .. "fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
199 end
202 10. Setup regular execution of `lf_update` and related commands
203 ---------------------------------------------------------------
205 The executables `lf_update`, `lf_update_issue_order`, and
206 `lf_update_suggestion_order` must be executed regularly. This may be achieved
207 by creating a file named `/opt/liquid_feedback_core/lf_updated` with the
208 following contents:
210 #!/bin/sh
212 PIDFILE="/var/run/lf_updated.pid"
213 PID=$$
215 if [ -f "${PIDFILE}" ] && kill -CONT $( cat "${PIDFILE}" ); then
216 echo "lf_updated is already running."
217 exit 1
218 fi
220 echo "${PID}" > "${PIDFILE}"
222 while true; do
223 su - www-data -s /bin/sh -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
224 su - www-data -s /bin/sh -c 'nice /opt/liquid_feedback_core/lf_update_issue_order dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
225 su - www-data -s /bin/sh -c 'nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
226 sleep 5
227 done
229 This file must be marked as executable:
231 chmod +x /opt/liquid_feedback_core/lf_updated
233 And this file should be started automatically at system boot.
236 11. Setup notification loop in background (only for WebMCP 1.2.x)
237 -----------------------------------------------------------------
239 In addition to regular execution of `lf_update` and
240 `lf_update_suggestion_order`, the following commands should be executed in
241 background:
243 su www-data -s $SHELL
244 cd /opt/liquid_feedback_frontend/
245 echo "Event:send_notifications_loop()" | ../webmcp/bin/webmcp_shell myconfig
248 12. Start the system
249 --------------------
251 After `lf_update` has been executed at least once and (in case of WebMCP 1.2.x)
252 the webserver has been restarted (using the configuration above), you should be
253 able to access your LiquidFeedback system.
255 If you use WebMCP 2.x, the server is started by calling:
257 su www-data -s $SHELL
258 /opt/moonbridge/moonbridge /opt/webmcp/bin/mcp.lua /opt/webmcp/ /opt/liquid_feedback_frontend/ main myconfig
260 In the latter case, the Moonbridge server will open a TCP port according to
261 your configuration. Directly accessing this TCP port through your webbrowser
262 is helpful for development purposes. For real-life deployment, however, it is
263 recommended to further proxy the application (e.g. using nginx). The proxy can
264 also add HTTPS and/or HTTP/2 support (which is not supported by Moonbridge
265 itself).
267 To start the Moonbridge as a background process, please refer to the Moonbridge
268 command line options:
270 Get this help message: moonbridge {-h|--help}
271 Usage: moonbridge \
272 [-b|--background] \
273 [-d|--debug] \
274 [-f|--logfacility {DAEMON|USER|0|1|...|7}] \
275 [-i|--logident <syslog ident> \
276 [-l|--logfile <logfile>] \
277 [-p|--pidfile <pidfile>] \
278 [-s|--stats] \
279 -- <Lua script> [<cmdline options for Lua script>]

Impressum / About Us