liquid_feedback_frontend

view INSTALL.mkd @ 1045:701a5cf6b067

Imported LiquidFeedback Frontend 3.0 branch
author bsw
date Thu Jul 10 01:19:48 2014 +0200 (2014-07-10)
parents
children b9300c2e75da
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
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 Whichever useraccount is used by the webserver (usually `www-data`) needs to
33 have access to your PostgreSQL installation. This is done by executing
34 PostgreSQL's shell command `createuser` as database superuser (usually `pgsql`,
35 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 WebMCP
97 -----------------
99 Note: Using Debian, it may be necessary to append `-I /usr/include/lua5.1` at
100 the end of the CFLAGS line in `Makefile.options` of the WebMCP source
101 distibution:
103 # Download and unpack WebMCP
104 # from http://www.public-software-group.org/pub/projects/webmcp/
105 vi Makefile.options # Debian requires -I /usr/include/lua5.1 at end of CFLAGS line
106 make
107 mkdir /opt/webmcp
108 cp -RL framework/* /opt/webmcp/
111 5. Install RocketWiki LqFb-Edition
112 ----------------------------------
114 # Download and unpack "RocketWiki LqFb-Edition"
115 # from http://www.public-software-group.org/pub/projects/rocketwiki/liquid_feedback_edition/
116 make
117 mkdir /opt/rocketwiki-lqfb
118 cp rocketwiki-lqfb rocketwiki-lqfb-compat /opt/rocketwiki-lqfb/
120 If you experience problems with multi-byte encoding (UTF-8) later, then apply
121 the following patch to both `rocketwiki-lqfb.hs` and
122 `rocketwiki-lqfb-compat.hs` prior compilation:
124 --- rocketwiki-lqfb.hs
125 +++ rocketwiki-lqfb.hs
126 @@ -1,4 +1,6 @@
128 +import System.IO (hSetEncoding, stdin, stdout, utf8)
129 +
130 import Text.ParserCombinators.Parsec
131 import Control.Applicative ((<$>), (<*>))
132 import Data.List (intercalate)
133 @@ -405,7 +407,10 @@
134 return htmlEntity
137 -main = interact wikiParse
138 +main = do
139 + hSetEncoding stdin utf8
140 + hSetEncoding stdout utf8
141 + interact wikiParse
143 wikiParse str
144 | success parseResult = html
147 6. Install the LiquidFeedback-Frontend
148 --------------------------------------
150 Unpack source tree into appropriate directory, e.g. `/opt/liquid_feedback_frontend`:
152 # Download LiquidFeedback-Frontend
153 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/
154 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend
156 Create HTML code for help texts:
158 cd /opt/liquid_feedback_frontend/locale
159 PATH=/opt/rocketwiki-lqfb:$PATH make
161 Make `tmp/` directory of LiquidFeedback-Frontend writable for webserver:
163 chown www-data /opt/liquid_feedback_frontend/tmp
165 Compile binary for fast delivery of member images:
167 cd /opt/liquid_feedback_frontend/fastpath
168 vi getpic.c # check and modify #define commands as necessary
169 make
172 7. Configure mail system
173 ------------------------
175 It may be necessary to configure your server's mail system, e.g. running
176 `dpkg-reconfigure exim4-config` on a Debian system.
179 8. Configure the Webserver for LiquidFeedback:
180 ----------------------------------------------
182 A sample configuration for `lighttpd` is given below (assuming `mod_alias` has
183 been included elsewhere):
185 server.modules += ("mod_cgi", "mod_rewrite", "mod_redirect", "mod_setenv")
187 # Enable CGI-Execution of *.lua files through lua binary
188 cgi.assign += ( ".lua" => "/usr/bin/lua5.1" )
190 alias.url += ( "/lf/fastpath/" => "/opt/liquid_feedback_frontend/fastpath/",
191 "/lf/static" => "/opt/liquid_feedback_frontend/static",
192 "/lf" => "/opt/webmcp/cgi-bin" )
194 # Configure environment for demo application
195 $HTTP["url"] =~ "^/lf" {
196 setenv.add-environment += (
197 "LANG" => "en_US.UTF-8",
198 "WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback_frontend/",
199 "WEBMCP_CONFIG_NAME" => "myconfig")
200 }
202 # URL beautification
203 url.rewrite-once += (
204 # do not rewrite static URLs
205 "^/lf/fastpath/(.*)$" => "/lf/fastpath/$1",
206 "^/lf/static/(.*)$" => "/lf/static/$1",
208 # dynamic URLs
209 "^/lf/([^\?]*)(\?(.*))?$" => "/lf/webmcp-wrapper.lua?_webmcp_path=$1&$3",
211 )
213 $HTTP["url"] =~ "^/lf/fastpath/" {
214 cgi.assign = ( "" => "" )
215 setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
216 }
218 If you're using Debian, you may want to create a file with the name
219 `/etc/lighttpd/conf-available/60-liquidfeedback.conf` and create a softlink in
220 `/etc/lighttpd/conf-enabled/`.
223 9. Configure the LiquidFeedback-Frontend:
224 -----------------------------------------
226 cd /opt/liquid_feedback_frontend/config
227 cp example.lua myconfig.lua
228 # edit myconfig.lua according to your needs
230 Use the following option in your configuration file to enable fast image
231 loading:
233 config.fastpath_url_func = function(member_id, image_type)
234 return request.get_absolute_baseurl() .. "fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
235 end
238 10. Setup regular execution of `lf_update` and `lf_update_suggestion_order`
239 ---------------------------------------------------------------------------
241 The executables `lf_update` and `lf_update_suggestion_order` must be executed
242 regularly. This may be achieved by creating a file named
243 `/opt/liquid_feedback_core/lf_updated` with the following contents:
245 #!/bin/sh
247 PIDFILE="/var/run/lf_updated.pid"
248 PID=$$
250 if [ -f "${PIDFILE}" ] && kill -CONT $( cat "${PIDFILE}" ); then
251 echo "lf_updated is already running."
252 exit 1
253 fi
255 echo "${PID}" > "${PIDFILE}"
257 while true; do
258 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
259 su - www-data -c 'nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2>&1 | logger -t "lf_updated"'
260 sleep 5
261 done
263 This file must be marked as executable:
265 chmod +x /opt/liquid_feedback_core/lf_updated
267 And this file should be started automatically at system boot.
270 11. Setup notification loop in background
271 -----------------------------------------
273 In addition to regular execution of `lf_update` and
274 `lf_update_suggestion_order`, the following commands should be executed in
275 background:
277 su - www-data
278 cd /opt/liquid_feedback_frontend/
279 echo "Event:send_notifications_loop()" | ../webmcp/bin/webmcp_shell myconfig
282 12. Start the sytem
283 -------------------
285 After `lf_update` has been executed at least once, and the webserver has been
286 restarted (using the configuration above), you should be able to access your
287 LiquidFeedback system.

Impressum / About Us