| rev | line source | 
| bsw@1657 | 1 <html><head><title>LiquidFeedback Installation Instructions</title></head><body> | 
| jbe@1046 | 2 <h1>LiquidFeedback Installation Instructions</h1> | 
| jbe@1046 | 3 | 
| jbe@1046 | 4 <p>This document gives a short outline about the necessary steps to setup a | 
| jbe@1046 | 5 LiquidFeedback system.</p> | 
| jbe@1046 | 6 | 
| jbe@1046 | 7 <h2>1. Install necessary dependencies</h2> | 
| jbe@1046 | 8 | 
| jbe@1046 | 9 <p>If you're using a Debian system, make sure that the following packages are | 
| jbe@1046 | 10 installed:</p> | 
| jbe@1046 | 11 | 
| bsw@1045 | 12 <ul> | 
| jbe@1156 | 13 <li>build-essential</li> | 
| bsw@1657 | 14 <li>postgresql</li> | 
| bsw@1657 | 15 <li>postgresql-server-dev-12</li> | 
| jbe@1308 | 16 <li>libbsd-dev</li> | 
| bsw@1657 | 17 <li>lua5.3</li> | 
| bsw@1657 | 18 <li>liblua5.3-dev</li> | 
| bsw@1657 | 19 <li>mercurial</li> | 
| bsw@1657 | 20 <li>bmake</li> | 
| bsw@1657 | 21 <li>lsb-release</li> | 
| bsw@1045 | 22 <li>imagemagick</li> | 
| bsw@1045 | 23 </ul> | 
| jbe@1046 | 24 | 
| jbe@1046 | 25 <p>If you're using any other Linux distribution or BSD system, install the | 
| jbe@1046 | 26 necessary software components accordingly.</p> | 
| jbe@1046 | 27 | 
| jbe@1046 | 28 <h2>2. Ensure that the user account of your webserver has access to the database</h2> | 
| jbe@1046 | 29 | 
| bsw@1657 | 30 <p>The useraccount of Moonbridge server process needs to have access to your | 
| bsw@1657 | 31 PostgreSQL installation. This is done by executing PostgreSQL's shell command | 
| bsw@1657 | 32 <code>createuser</code> as database superuser (usually <code>pgsql</code>, or <code>postgres</code> for | 
| bsw@1657 | 33 Debian installations):</p> | 
| jbe@1046 | 34 | 
| bsw@1657 | 35 <pre><code>su - postgres -s $SHELL | 
| jbe@1191 | 36 createuser --no-superuser --createdb --no-createrole www-data | 
| jbe@1046 | 37 exit | 
| jbe@1046 | 38 </code></pre> | 
| jbe@1046 | 39 | 
| jbe@1046 | 40 <h2>3. Install and configure LiquidFeedback-Core</h2> | 
| jbe@1046 | 41 | 
| jbe@1046 | 42 <p>We recommend to create the database with the same user as your webserver | 
| jbe@1046 | 43 (usually <code>www-data</code>) to avoid having to setup database privileges.</p> | 
| jbe@1046 | 44 | 
| bsw@1657 | 45 <p>The example below installs the database as <code>www-data</code> and stores the three | 
| bsw@1657 | 46 executables <code>lf_update</code>, <code>lf_update_issue_order</code> and | 
| bsw@1657 | 47 <code>lf_update_suggestion_order</code> in the directory <code>/opt/liquid_feedback_core/</code>:</p> | 
| jbe@1046 | 48 | 
| bsw@1045 | 49 <pre><code># Download and unpack LiquidFeedback-Core | 
| bsw@1045 | 50 # from http://www.public-software-group.org/pub/projects/liquid_feedback/backend/ | 
| bsw@1045 | 51 make | 
| bsw@1045 | 52 mkdir /opt/liquid_feedback_core | 
| jbe@1196 | 53 cp core.sql lf_update lf_update_issue_order lf_update_suggestion_order /opt/liquid_feedback_core | 
| jbe@1191 | 54 su www-data -s $SHELL | 
| bsw@1045 | 55 cd /opt/liquid_feedback_core | 
| bsw@1045 | 56 createdb liquid_feedback | 
| jbe@1046 | 57 psql -v ON_ERROR_STOP=1 -f core.sql liquid_feedback | 
| jbe@1046 | 58 </code></pre> | 
| jbe@1046 | 59 | 
| bsw@1045 | 60 <p>A simple configuration may look as follows:</p> | 
| jbe@1046 | 61 | 
| bsw@1045 | 62 <pre><code>psql liquid_feedback | 
| bsw@1045 | 63 | 
| jbe@1046 | 64 INSERT INTO system_setting (member_ttl) VALUES ('1 year'); | 
| jbe@1046 | 65 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6); | 
| jbe@1046 | 66 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12); | 
| jbe@1046 | 67 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60); | 
| jbe@1046 | 68 INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120); | 
| jbe@1046 | 69 </code></pre> | 
| jbe@1046 | 70 | 
| bsw@1657 | 71 <p>Create an invite code for an admin user:</p> | 
| jbe@1046 | 72 | 
| bsw@1657 | 73 <pre><code>INSERT INTO member (invite_code, admin) VALUES ('sesam', true); | 
| jbe@1046 | 74 </code></pre> | 
| jbe@1046 | 75 | 
| bsw@1045 | 76 <p>Exit the <code>psql</code> interface by typing:</p> | 
| jbe@1046 | 77 | 
| jbe@1046 | 78 <pre><code>\q | 
| jbe@1046 | 79 </code></pre> | 
| jbe@1046 | 80 | 
| bsw@1045 | 81 <p>And don't forget to quit the <code>www-data</code> shell:</p> | 
| jbe@1046 | 82 | 
| jbe@1046 | 83 <pre><code>exit | 
| jbe@1046 | 84 </code></pre> | 
| jbe@1046 | 85 | 
| jbe@1244 | 86 <h2>4. Install Moonbridge</h2> | 
| jbe@1046 | 87 | 
| jbe@1156 | 88 <pre><code># Download and unpack Moonbridge | 
| jbe@1156 | 89 # from http://www.public-software-group.org/pub/projects/moonbridge/ | 
| jbe@1156 | 90 pmake MOONBR_LUA_PATH=/opt/moonbridge/?.lua | 
| jbe@1156 | 91 mkdir /opt/moonbridge | 
| jbe@1156 | 92 cp moonbridge /opt/moonbridge/ | 
| jbe@1156 | 93 cp moonbridge_http.lua /opt/moonbridge/ | 
| jbe@1156 | 94 </code></pre> | 
| jbe@1156 | 95 | 
| jbe@1156 | 96 <h2>5. Install WebMCP</h2> | 
| jbe@1156 | 97 | 
| bsw@1045 | 98 <pre><code># Download and unpack WebMCP | 
| bsw@1045 | 99 # from http://www.public-software-group.org/pub/projects/webmcp/ | 
| bsw@1045 | 100 make | 
| bsw@1045 | 101 mkdir /opt/webmcp | 
| jbe@1046 | 102 cp -RL framework/* /opt/webmcp/ | 
| jbe@1046 | 103 </code></pre> | 
| bsw@1045 | 104 | 
| jbe@1156 | 105 <h2>6. Install the LiquidFeedback-Frontend</h2> | 
| bsw@1045 | 106 | 
| bsw@1045 | 107 <p>Unpack source tree into appropriate directory, e.g. <code>/opt/liquid_feedback_frontend</code>:</p> | 
| jbe@1046 | 108 | 
| bsw@1045 | 109 <pre><code># Download LiquidFeedback-Frontend | 
| bsw@1045 | 110 # from http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/ | 
| jbe@1046 | 111 mv liquid_feedback_frontend-vX.X.X /opt/liquid_feedback_frontend | 
| jbe@1046 | 112 </code></pre> | 
| jbe@1046 | 113 | 
| bsw@1045 | 114 <p>Make <code>tmp/</code> directory of LiquidFeedback-Frontend writable for webserver:</p> | 
| jbe@1046 | 115 | 
| jbe@1046 | 116 <pre><code>chown www-data /opt/liquid_feedback_frontend/tmp | 
| jbe@1046 | 117 </code></pre> | 
| jbe@1046 | 118 | 
| jbe@1156 | 119 <h2>7. Configure mail system</h2> | 
| jbe@1046 | 120 | 
| bsw@1657 | 121 <p>It may be necessary to configure your server's mail system.</p> | 
| jbe@1046 | 122 | 
| jbe@1244 | 123 <h2>8. Configure the LiquidFeedback-Frontend</h2> | 
| jbe@1046 | 124 | 
| bsw@1045 | 125 <pre><code>cd /opt/liquid_feedback_frontend/config | 
| bsw@1045 | 126 cp example.lua myconfig.lua | 
| jbe@1046 | 127 # edit myconfig.lua according to your needs | 
| jbe@1046 | 128 </code></pre> | 
| jbe@1046 | 129 | 
| jbe@1244 | 130 <h2>9. Setup regular execution of <code>lf_update</code> and related commands </h2> | 
| jbe@1046 | 131 | 
| jbe@1051 | 132 <p>The executables <code>lf_update</code>, <code>lf_update_issue_order</code>, and | 
| jbe@1051 | 133 <code>lf_update_suggestion_order</code> must be executed regularly. This may be achieved | 
| bsw@1657 | 134 by creating a file named <code>/opt/liquid_feedback_core/lf_update.sh</code> with the | 
| jbe@1051 | 135 following contents:</p> | 
| jbe@1046 | 136 | 
| bsw@1045 | 137 <pre><code>#!/bin/sh | 
| bsw@1045 | 138 | 
| bsw@1045 | 139 while true; do | 
| bsw@1661 | 140   nice /opt/liquid_feedback_core/lf_update dbname=liquid_feedback 2>&1 | logger -t "lf_core" | 
| bsw@1661 | 141   nice /opt/liquid_feedback_core/lf_update_issue_order dbname=liquid_feedback 2>&1 | logger -t "lf_core" | 
| bsw@1661 | 142   nice /opt/liquid_feedback_core/lf_update_suggestion_order dbname=liquid_feedback 2>&1 | logger -t "lf_core" | 
| bsw@1045 | 143   sleep 5 | 
| jbe@1046 | 144 done | 
| jbe@1046 | 145 </code></pre> | 
| jbe@1046 | 146 | 
| bsw@1045 | 147 <p>This file must be marked as executable:</p> | 
| jbe@1046 | 148 | 
| jbe@1046 | 149 <pre><code>chmod +x /opt/liquid_feedback_core/lf_updated | 
| jbe@1046 | 150 </code></pre> | 
| jbe@1046 | 151 | 
| bsw@1657 | 152 <p>And this file should be started automatically at system boot. On systems with | 
| bsw@1657 | 153 systemd, create a file named <code>/etc/systemd/system/liquid_feedback_core.service</code>:</p> | 
| bsw@1657 | 154 | 
| bsw@1657 | 155 <pre><code>[Unit] | 
| bsw@1657 | 156 Description=LiquidFeedback Core update | 
| bsw@1657 | 157 | 
| bsw@1657 | 158 [Service] | 
| bsw@1661 | 159 User=www-data | 
| bsw@1657 | 160 ExecStart=/opt/liquid_feedback_core/lf_update.sh | 
| jbe@1046 | 161 | 
| bsw@1657 | 162 [Install] | 
| bsw@1657 | 163 WantedBy=multi-user.target | 
| bsw@1657 | 164 </code></pre> | 
| bsw@1657 | 165 | 
| bsw@1673 | 166 <p>Enable and start the service:</p> | 
| bsw@1673 | 167 | 
| bsw@1673 | 168 <pre><code>systemctl start liquid_feedback_core | 
| bsw@1673 | 169 systemctl enable liquid_feedback_core | 
| bsw@1673 | 170 </code></pre> | 
| bsw@1657 | 171 | 
| bsw@1657 | 172 <h2>10. Start the frontend</h2> | 
| jbe@1046 | 173 | 
| jbe@1244 | 174 <p>After <code>lf_update</code> has been executed at least once, you should be able to use | 
| jbe@1244 | 175 your LiquidFeedback system.</p> | 
| jbe@1046 | 176 | 
| bsw@1674 | 177 <p>Create a file named <code>/opt/liquid_feedback_frontend/run.sh</code>:</p> | 
| bsw@1657 | 178 | 
| bsw@1657 | 179 <pre><code>#/bin/bash | 
| bsw@1657 | 180 | 
| bsw@1661 | 181 /opt/moonbridge/moonbridge /opt/webmcp/bin/mcp.lua /opt/webmcp/ /opt/liquid_feedback_frontend/ main myconfig  2>&1 | logger -t "lf_frontend" | 
| bsw@1657 | 182 </code></pre> | 
| bsw@1657 | 183 | 
| bsw@1657 | 184 <p>Make it executable:</p> | 
| bsw@1657 | 185 | 
| bsw@1657 | 186 <pre><code>chmod +x /opt/liquid_feedback_frontend/run.sh | 
| bsw@1657 | 187 </code></pre> | 
| bsw@1657 | 188 | 
| bsw@1657 | 189 <p>On systemd based systems, create a file named | 
| bsw@1657 | 190 <code>/etc/systemd/system/liquid_feedback_frontend.service</code>:</p> | 
| jbe@1156 | 191 | 
| bsw@1657 | 192 <pre><code>[Unit] | 
| bsw@1657 | 193 Description=LiquidFeedback Frontend | 
| bsw@1657 | 194 | 
| bsw@1657 | 195 [Service] | 
| bsw@1661 | 196 User=www-data | 
| bsw@1657 | 197 ExecStart=/opt/liquid_feedback_frontend/run.sh | 
| bsw@1657 | 198 | 
| bsw@1657 | 199 [Install] | 
| bsw@1657 | 200 WantedBy=multi-user.target | 
| jbe@1156 | 201 </code></pre> | 
| jbe@1162 | 202 | 
| bsw@1673 | 203 <p>Enable and start the service:</p> | 
| bsw@1673 | 204 | 
| bsw@1673 | 205 <pre><code>systemctl start liquid_feedback_frontend | 
| bsw@1673 | 206 systemctl enable liquid_feedback_frontend | 
| bsw@1673 | 207 </code></pre> | 
| bsw@1657 | 208 | 
| jbe@1162 | 209 <p>In the latter case, the Moonbridge server will open a TCP port according to | 
| jbe@1162 | 210 your configuration. Directly accessing this TCP port through your webbrowser | 
| jbe@1162 | 211 is helpful for development purposes. For real-life deployment, however, it is | 
| jbe@1162 | 212 recommended to further proxy the application (e.g. using nginx). The proxy can | 
| jbe@1190 | 213 also add HTTPS and/or HTTP/2 support (which is not supported by Moonbridge | 
| jbe@1190 | 214 itself).</p> | 
| bsw@1657 | 215 </body></html> |