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