liquid_feedback_frontend

view INSTALL.html @ 1308:7ea154c9238a

Added libbsd-dev and postgresql server-dev package to list of necessary packages to be installed for compiling/running on Debian
author jbe
date Thu Jun 23 03:30:57 2016 +0200 (2016-06-23)
parents 78d3be54cfe0
children 4d5f30d8df4a
line source
1 <html>
2 <head>
3 <title>LiquidFeedback Installation Instructions</title>
4 </head>
5 <body>
6 <h1>LiquidFeedback Installation Instructions</h1>
8 <p>This document gives a short outline about the necessary steps to setup a
9 LiquidFeedback system.</p>
11 <h2>1. Install necessary dependencies</h2>
13 <p>If you're using a Debian system, make sure that the following packages are
14 installed:</p>
16 <ul>
17 <li>build-essential</li>
18 <li>lua5.2</li>
19 <li>liblua5.2-dev</li>
20 <li>postgresql (including the corresponding server-dev package)</li>
21 <li>libpq-dev</li>
22 <li>libbsd-dev</li>
23 <li>pmake or bmake</li>
24 <li>imagemagick</li>
25 <li>exim4</li>
26 <li>markdown2 (<code>apt-get install python-pip; pip install markdown2</code>)</li>
27 </ul>
29 <p>If you're using any other Linux distribution or BSD system, install the
30 necessary software components accordingly.</p>
32 <h2>2. Ensure that the user account of your webserver has access to the database</h2>
34 <p>The useraccount of the webserver (usually <code>www-data</code>) or the Moonbridge server
35 process needs to have access to your PostgreSQL installation. This is done by
36 executing PostgreSQL's shell command <code>createuser</code> as database superuser
37 (usually <code>pgsql</code>, or <code>postgres</code> for Debian installations):</p>
39 <pre><code>su postgres -s $SHELL
40 createuser --no-superuser --createdb --no-createrole www-data
41 exit
42 </code></pre>
44 <h2>3. Install and configure LiquidFeedback-Core</h2>
46 <p>We recommend to create the database with the same user as your webserver
47 (usually <code>www-data</code>) to avoid having to setup database privileges.</p>
49 <p>The example below installs the database as <code>www-data</code> and stores the two
50 executables <code>lf_update</code> and <code>lf_update_issue_order</code> in the directory
51 <code>/opt/liquid_feedback_core/</code>:</p>
53 <pre><code># Download and unpack LiquidFeedback-Core
54 # from http://www.public-software-group.org/pub/projects/liquid_feedback/backend/
55 make
56 mkdir /opt/liquid_feedback_core
57 cp core.sql lf_update lf_update_issue_order lf_update_suggestion_order /opt/liquid_feedback_core
58 su www-data -s $SHELL
59 cd /opt/liquid_feedback_core
60 createdb liquid_feedback
61 createlang plpgsql liquid_feedback # command may be omitted, depending on PostgreSQL version
62 psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback
63 </code></pre>
65 <p>A simple configuration may look as follows:</p>
67 <pre><code>psql liquid_feedback
69 INSERT INTO system_setting (member_ttl) VALUES ('1 year');
70 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
71 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
72 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
73 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
74 INSERT INTO policy (index, name, min_admission_time, max_admission_time, discussion_time, verification_time, voting_time, issue_quorum_num, issue_quorum_den, initiative_quorum_num, initiative_quorum_den) VALUES (1, 'Default policy', '4 days', '8 days', '15 days', '8 days', '15 days', 10, 100, 10, 100);
75 INSERT INTO unit (name) VALUES ('Our organization');
76 INSERT INTO area (unit_id, name) VALUES (1, 'Default area');
77 INSERT INTO allowed_policy (area_id, policy_id, default_policy) VALUES (1, 1, TRUE);
78 </code></pre>
80 <p>If you want to create an admin user with an empty password (CAUTION!), then execute the following SQL statement:</p>
82 <pre><code>INSERT INTO member (login, name, admin, password) VALUES ('admin', 'Administrator', TRUE, '$1$/EMPTY/$NEWt7XJg2efKwPm4vectc1');
83 </code></pre>
85 <p>Exit the <code>psql</code> interface by typing:</p>
87 <pre><code>\q
88 </code></pre>
90 <p>And don't forget to quit the <code>www-data</code> shell:</p>
92 <pre><code>exit
93 </code></pre>
95 <h2>4. Install Moonbridge</h2>
97 <pre><code># Download and unpack Moonbridge
98 # from http://www.public-software-group.org/pub/projects/moonbridge/
99 pmake MOONBR_LUA_PATH=/opt/moonbridge/?.lua
100 mkdir /opt/moonbridge
101 cp moonbridge /opt/moonbridge/
102 cp moonbridge_http.lua /opt/moonbridge/
103 </code></pre>
105 <h2>5. Install WebMCP</h2>
107 <p>Note: Using Debian, it may be necessary to append <code>-I /usr/include/lua5.2</code> at
108 the end of the CFLAGS line in <code>Makefile.options</code> of the WebMCP source
109 distibution:</p>
111 <pre><code># Download and unpack WebMCP
112 # from http://www.public-software-group.org/pub/projects/webmcp/
113 vi Makefile.options # Debian requires -I /usr/include/lua5.2 at end of CFLAGS line
114 make
115 mkdir /opt/webmcp
116 cp -RL framework/* /opt/webmcp/
117 </code></pre>
119 <h2>6. Install the LiquidFeedback-Frontend</h2>
121 <p>Unpack source tree into appropriate directory, e.g. <code>/opt/liquid_feedback_frontend</code>:</p>
123 <pre><code># Download LiquidFeedback-Frontend
124 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/
125 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend
126 </code></pre>
128 <p>Make <code>tmp/</code> directory of LiquidFeedback-Frontend writable for webserver:</p>
130 <pre><code>chown www-data /opt/liquid_feedback_frontend/tmp
131 </code></pre>
133 <h2>7. Configure mail system</h2>
135 <p>It may be necessary to configure your server's mail system, e.g. running
136 <code>dpkg-reconfigure exim4-config</code> on a Debian system.</p>
138 <h2>8. Configure the LiquidFeedback-Frontend</h2>
140 <pre><code>cd /opt/liquid_feedback_frontend/config
141 cp example.lua myconfig.lua
142 # edit myconfig.lua according to your needs
143 </code></pre>
145 <h2>9. Setup regular execution of <code>lf_update</code> and related commands </h2>
147 <p>The executables <code>lf_update</code>, <code>lf_update_issue_order</code>, and
148 <code>lf_update_suggestion_order</code> must be executed regularly. This may be achieved
149 by creating a file named <code>/opt/liquid_feedback_core/lf_updated</code> with the
150 following contents:</p>
152 <pre><code>#!/bin/sh
154 PIDFILE="/var/run/lf_updated.pid"
155 PID=$$
157 if [ -f "${PIDFILE}" ] &amp;&amp; kill -CONT $( cat "${PIDFILE}" ); then
158 echo "lf_updated is already running."
159 exit 1
160 fi
162 echo "${PID}" &gt; "${PIDFILE}"
164 while true; do
165 su - www-data -s /bin/sh -c 'nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2&gt;&amp;1 | logger -t "lf_updated"'
166 su - www-data -s /bin/sh -c 'nice /opt/liquid_feedback_core/lf_update_issue_order dbname=liquid_feedback 2&gt;&amp;1 | logger -t "lf_updated"'
167 su - www-data -s /bin/sh -c 'nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2&gt;&amp;1 | logger -t "lf_updated"'
168 sleep 5
169 done
170 </code></pre>
172 <p>This file must be marked as executable:</p>
174 <pre><code>chmod +x /opt/liquid_feedback_core/lf_updated
175 </code></pre>
177 <p>And this file should be started automatically at system boot.</p>
179 <h2>10. Start the system</h2>
181 <p>After <code>lf_update</code> has been executed at least once, you should be able to use
182 your LiquidFeedback system.</p>
184 <p>The server is started by calling:</p>
186 <pre><code>su www-data -s $SHELL
187 /opt/moonbridge/moonbridge /opt/webmcp/bin/mcp.lua /opt/webmcp/ /opt/liquid_feedback_frontend/ main myconfig
188 </code></pre>
190 <p>In the latter case, the Moonbridge server will open a TCP port according to
191 your configuration. Directly accessing this TCP port through your webbrowser
192 is helpful for development purposes. For real-life deployment, however, it is
193 recommended to further proxy the application (e.g. using nginx). The proxy can
194 also add HTTPS and/or HTTP/2 support (which is not supported by Moonbridge
195 itself).</p>
197 <p>To start the Moonbridge as a background process, please refer to the Moonbridge
198 command line options:</p>
200 <pre><code>Get this help message: moonbridge {-h|--help}
201 Usage: moonbridge \
202 [-b|--background] \
203 [-d|--debug] \
204 [-f|--logfacility {DAEMON|USER|0|1|...|7}] \
205 [-i|--logident &lt;syslog ident&gt; \
206 [-l|--logfile &lt;logfile&gt;] \
207 [-p|--pidfile &lt;pidfile&gt;] \
208 [-s|--stats] \
209 -- &lt;Lua script&gt; [&lt;cmdline options for Lua script&gt;]
210 </code></pre>
211 </body>
212 </html>

Impressum / About Us