liquid_feedback_frontend

view INSTALL.mkd @ 1084:6c9198d84e7c

merge
author jbe
date Wed Jul 23 23:09:53 2014 +0200 (2014-07-23)
parents 53b0139ed930
children 08adef9f05b9
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 * lua5.1
15 * postgresql
16 * build-essential
17 * libpq-dev
18 * liblua5.1-0-dev
19 * lighttpd
20 * ghc
21 * libghc6-parsec3-dev
22 * imagemagick
23 * exim4
24 * markdown2 (install with Python's pip)
26 If you're using any other Linux distribution or BSD system, install the
27 necessary software components accordingly.
30 2. Ensure that the user account of your webserver has access to the database
31 ----------------------------------------------------------------------------
33 Whichever useraccount is used by the webserver (usually `www-data`) needs to
34 have access to your PostgreSQL installation. This is done by executing
35 PostgreSQL's shell command `createuser` as database superuser (usually `pgsql`,
36 or `postgres` for Debian installations):
38 su - postgres
39 createuser
41 Enter name of role to add: www-data
42 Shall the new role be a superuser? (y/n) n
43 Shall the new role be allowed to create databases? (y/n) y
44 Shall the new role be allowed to create more new roles? (y/n) n
46 exit
49 3. Install and configure LiquidFeedback-Core
50 --------------------------------------------
52 We recommend to create the database with the same user as your webserver
53 (usually `www-data`) to avoid having to setup database privileges.
55 The example below installs the database as `www-data` and stores the two
56 executables `lf_update` and `lf_update_issue_order` in the directory
57 `/opt/liquid_feedback_core/`:
59 # Download and unpack LiquidFeedback-Core
60 # from http://www.public-software-group.org/pub/projects/liquid_feedback/backend/
61 make
62 mkdir /opt/liquid_feedback_core
63 cp core.sql lf_update lf_update_issue_order /opt/liquid_feedback_core
64 su - www-data
65 cd /opt/liquid_feedback_core
66 createdb liquid_feedback
67 createlang plpgsql liquid_feedback # command may be omitted, depending on PostgreSQL version
68 psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback
70 A simple configuration may look as follows:
72 psql liquid_feedback
74 INSERT INTO system_setting (member_ttl) VALUES ('1 year');
75 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
76 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
77 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
78 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
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);
80 INSERT INTO unit (name) VALUES ('Our organization');
81 INSERT INTO area (unit_id, name) VALUES (1, 'Default area');
82 INSERT INTO allowed_policy (area_id, policy_id, default_policy) VALUES (1, 1, TRUE);
84 If you want to create an admin user with an empty password (CAUTION!), then execute the following SQL statement:
86 INSERT INTO member (login, name, admin, password) VALUES ('admin', 'Administrator', TRUE, '$1$/EMPTY/$NEWt7XJg2efKwPm4vectc1');
88 Exit the `psql` interface by typing:
90 \q
92 And don't forget to quit the `www-data` shell:
94 exit
97 4. Install WebMCP
98 -----------------
100 Note: Using Debian, it may be necessary to append `-I /usr/include/lua5.1` at
101 the end of the CFLAGS line in `Makefile.options` of the WebMCP source
102 distibution:
104 # Download and unpack WebMCP
105 # from http://www.public-software-group.org/pub/projects/webmcp/
106 vi Makefile.options # Debian requires -I /usr/include/lua5.1 at end of CFLAGS line
107 make
108 mkdir /opt/webmcp
109 cp -RL framework/* /opt/webmcp/
112 5. Install the LiquidFeedback-Frontend
113 --------------------------------------
115 Unpack source tree into appropriate directory, e.g. `/opt/liquid_feedback_frontend`:
117 # Download LiquidFeedback-Frontend
118 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/
119 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend
121 Create HTML code for help texts:
123 cd /opt/liquid_feedback_frontend/locale
124 PATH=/opt/rocketwiki-lqfb:$PATH make
126 Make `tmp/` directory of LiquidFeedback-Frontend writable for webserver:
128 chown www-data /opt/liquid_feedback_frontend/tmp
130 Compile binary for fast delivery of member images:
132 cd /opt/liquid_feedback_frontend/fastpath
133 vi getpic.c # check and modify #define commands as necessary
134 make
137 6. Configure mail system
138 ------------------------
140 It may be necessary to configure your server's mail system, e.g. running
141 `dpkg-reconfigure exim4-config` on a Debian system.
144 7. Configure the Webserver for LiquidFeedback:
145 ----------------------------------------------
147 A sample configuration for `lighttpd` is given below (assuming `mod_alias` has
148 been included elsewhere):
150 server.modules += ("mod_cgi", "mod_rewrite", "mod_redirect", "mod_setenv")
152 # Enable CGI-Execution of *.lua files through lua binary
153 cgi.assign += ( ".lua" => "/usr/bin/lua5.1" )
155 alias.url += ( "/lf/fastpath/" => "/opt/liquid_feedback_frontend/fastpath/",
156 "/lf/static" => "/opt/liquid_feedback_frontend/static",
157 "/lf" => "/opt/webmcp/cgi-bin" )
159 # Configure environment for demo application
160 $HTTP["url"] =~ "^/lf" {
161 setenv.add-environment += (
162 "LANG" => "en_US.UTF-8",
163 "WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback_frontend/",
164 "WEBMCP_CONFIG_NAME" => "myconfig")
165 }
167 # URL beautification
168 url.rewrite-once += (
169 # do not rewrite static URLs
170 "^/lf/fastpath/(.*)$" => "/lf/fastpath/$1",
171 "^/lf/static/(.*)$" => "/lf/static/$1",
173 # dynamic URLs
174 "^/lf/([^\?]*)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_path=$1&$3",
176 )
178 $HTTP["url"] =~ "^/lf/fastpath/" {
179 cgi.assign = ( "" => "" )
180 setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
181 }
183 If you're using Debian, you may want to create a file with the name
184 `/etc/lighttpd/conf-available/60-liquidfeedback.conf` and create a softlink in
185 `/etc/lighttpd/conf-enabled/`.
188 8. Configure the LiquidFeedback-Frontend:
189 -----------------------------------------
191 cd /opt/liquid_feedback_frontend/config
192 cp example.lua myconfig.lua
193 # edit myconfig.lua according to your needs
195 Use the following option in your configuration file to enable fast image
196 loading:
198 config.fastpath_url_func = function(member_id, image_type)
199 return request.get_absolute_baseurl() .. "fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
200 end
203 9. Setup regular execution of `lf_update` and related commands
204 --------------------------------------------------------------
206 The executables `lf_update`, `lf_update_issue_order`, and
207 `lf_update_suggestion_order` must be executed regularly. This may be achieved
208 by creating a file named `/opt/liquid_feedback_core/lf_updated` with the
209 following contents:
211 #!/bin/sh
213 PIDFILE="/var/run/lf_updated.pid"
214 PID=$$
216 if [ -f "${PIDFILE}" ] && kill -CONT $( cat "${PIDFILE}" ); then
217 echo "lf_updated is already running."
218 exit 1
219 fi
221 echo "${PID}" > "${PIDFILE}"
223 while true; do
224 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
225 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update_issue_order dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
226 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
227 sleep 5
228 done
230 This file must be marked as executable:
232 chmod +x /opt/liquid_feedback_core/lf_updated
234 And this file should be started automatically at system boot.
237 10. Setup notification loop in background
238 -----------------------------------------
240 In addition to regular execution of `lf_update` and
241 `lf_update_suggestion_order`, the following commands should be executed in
242 background:
244 su - www-data
245 cd /opt/liquid_feedback_frontend/
246 echo "Event:send_notifications_loop()" | ../webmcp/bin/webmcp_shell myconfig
249 11. Start the sytem
250 -------------------
252 After `lf_update` has been executed at least once, and the webserver has been
253 restarted (using the configuration above), you should be able to access your
254 LiquidFeedback system.

Impressum / About Us