aboutsummaryrefslogtreecommitdiffstats
path: root/doc/admin/administrator_guide.html
blob: c0a5212ec997f11937f3af34e6019e60a91521f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<p><strong>Table of Contents</strong></p>

<p></p><ul id="admin-guide-toc"><li><a href="/help/admin/administrator_guide#Overview">Overview</a></li><li><a href="/help/admin/administrator_guide#Where_to_find_more_help">Where to find more help</a></li><li><a href="/help/admin/administrator_guide#Before_you_begin">Before you begin</a><ul><li><a href="/help/admin/administrator_guide#Choose_a_domain_name_or_subdomain_name_for_your_server">Choose a domain name or subdomain name for your server</a></li><li><a href="/help/admin/administrator_guide#Decide_if_you_will_use_SSL_and_obtain_an_SSL_certificate_before_software_installation">Decide if you will use SSL and obtain an SSL certificate before software installation</a></li></ul></li><li><a href="/help/admin/administrator_guide#Deployment">Deployment</a></li><li><a href="/help/admin/administrator_guide#Requirements">Requirements</a></li><li><a href="/help/admin/administrator_guide#Manual_Installation">Manual Installation</a><ul><li><a href="/help/admin/administrator_guide#Unpack_the_Hubzilla_files_into_the_root_of_your_web_server_document_area">Unpack the Hubzilla files into the root of your web server document area</a></li><li><a href="/help/admin/administrator_guide#Official_addons">Official addons</a><ul><li><a href="/help/admin/administrator_guide#Installation">Installation</a></li><li><a href="/help/admin/administrator_guide#Updating">Updating</a></li></ul></li></ul></li><li><a href="/help/admin/administrator_guide#Automated_installation_via_the_homeinstall_shell_script">Automated installation via the .homeinstall shell script</a><ul><li><a href="/help/admin/administrator_guide#Requirements">Requirements</a></li><li><a href="/help/admin/administrator_guide#Overview_of_installation_steps">Overview of installation steps</a></li></ul></li><li><a href="/help/admin/administrator_guide#Service_Classes">Service Classes</a></li><li><a href="/help/admin/administrator_guide#Theme_management">Theme management</a><ul><li><a href="/help/admin/administrator_guide#Repo_management_example">Repo management example</a></li></ul></li><li><a href="/help/admin/administrator_guide#Channel_Directory">Channel Directory</a><ul><li><a href="/help/admin/administrator_guide#Keywords">Keywords</a></li></ul></li><li><a href="/help/admin/administrator_guide#Upgrading_from_RedMatrix_to_Hubzilla">Upgrading from RedMatrix to Hubzilla</a><ul><li><a href="/help/admin/administrator_guide#How_to_migrate_an_individual_channel_from_RedMatrix_to_Hubzilla">How to migrate an individual channel from RedMatrix to Hubzilla</a></li></ul></li><li><a href="/help/admin/administrator_guide#Troubleshooting">Troubleshooting</a><ul><li><a href="/help/admin/administrator_guide#Log_files">Log files</a><ul><li><a href="/help/admin/administrator_guide#Rotating_log_files">Rotating log files</a></li></ul></li></ul></li></ul><p></p>

<hr><h1 id="Overview">Overview</h1>

<p>Hubzilla is more than a simple web application. It is a
complex communications system which more closely resembles an email server
than a web server. For reliability and performance, messages are delivered in
the background and are queued for later delivery when sites are down. This
kind of functionality requires a bit more of the host system than the typical
blog. Not every PHP/MySQL hosting provider will be able to support
Hubzilla. Many will but please review the requirements and confirm these
with your hosting provider prior to installation.</p>

<p>We've tried very hard to ensure that Hubzilla will run on commodity
hosting platforms such as those used to host Wordpress blogs and Drupal
websites. It will run on most any Linux VPS system. Windows LAMP platforms
such as XAMPP and WAMP are not officially supported at this time however
we welcome patches if you manage to get it working.</p>

<h1 id="Where_to_find_more_help">Where to find more help</h1>

<p>If you encounter problems or have issues not addressed in this documentation, 
please let us know via the <a href="https://github.com/redmatrix/hubzilla/issues">Github issue
tracker</a>. Please be as clear as you
can about your operating environment and provide as much detail as possible
about any error messages you may see, so that we can prevent it from happening
in the future. Due to the large variety of operating systems and PHP platforms
in existence we may have only limited ability to debug your PHP installation or
acquire any missing modules * but we will do our best to solve any general code
issues.</p>

<h1 id="Before_you_begin">Before you begin</h1>

<h2 id="Choose_a_domain_name_or_subdomain_name_for_your_server">Choose a domain name or subdomain name for your server</h2>

<p>Hubzilla can only be installed into the root of a domain or sub-domain, and can 
not be installed using alternate TCP ports.</p>

<h2 id="Decide_if_you_will_use_SSL_and_obtain_an_SSL_certificate_before_software_installation">Decide if you will use SSL and obtain an SSL certificate before software installation</h2>

<p>You SHOULD use SSL. If you use SSL, you MUST use a "browser-valid" certificate.<br><em>You MUST NOT use self-signed certificates!</em></p>

<p>Please test your certificate prior to installation. A web tool for testing your 
certificate is available at "http://www.digicert.com/help/". When visiting your 
site for the first time, please use the SSL ("https://") URL if SSL is available. 
This will avoid problems later. The installation routine will not allow you to 
use a non browser-valid certificate.</p>

<p>This restriction is incorporated because public posts from you may contain 
references to images on your own hub. Other members viewing their stream on
other hubs will get warnings if your certificate is not trusted by their web
browser. This will confuse many people because this is a decentralised network
and they will get the warning about your hub while viewing their own hub and may 
think their own hub has an issue. These warnings are very technical and scary to 
some folks, many of whom will not know how to proceed except to follow the browser
advice. This is disruptive to the community. That said, we recognise the issues
surrounding the current certificate infrastructure and agree there are many
problems, but that doesn't change the requirement.</p>

<p>Free "browser-valid" certificates are available from providers such as StartSSL
and LetsEncrypt.</p>

<p>If you do NOT use SSL, there may be a delay of up to a minute for the initial
install script * while we check the SSL port to see if anything responds there.
When communicating with new sites, Hubzilla always attempts connection on the
SSL port first, before falling back to a less secure connection.  If you do not
use SSL, your webserver MUST NOT listen on port 443 at all.</p>

<p>If you use LetsEncrypt to provide certificates and create a file under 
.well-known/acme-challenge so that LetsEncrypt can verify your domain ownership, 
please remove or rename the .well-known directory as soon as the certificate is 
generated. Hubzilla will provide its own handler for ".well-known" services when
it is installed, and an existing directory in this location may prevent some of 
these services from working correctly. This should not be a problem with Apache,
but may be an issue with nginx or other web server platforms.</p>

<h1 id="Deployment">Deployment</h1>

<p>There are several ways to deploy a new hub.</p>

<ul><li>Manual installation on an existing server</li>
<li>Automated installation on an existing server using a shell script</li>
<li>Automated deployment using an OpenShift virtual private server (VPS)</li>
</ul><h1 id="Requirements">Requirements</h1>

<ul><li><p>Apache with mod-rewrite enabled and "AllowOverride All" so you can use a 
local .htaccess file. Some folks have successfully used nginx and lighttpd.
Example config scripts are available for these platforms in doc/install.
Apache and nginx have the most support.</p></li>
<li><p>PHP 5.5 or later.</p>

<ul><li>Note that on some shared hosting environments, the <em>command line</em> version of 
PHP might differ from the <em>webserver</em> version</li>
</ul></li>
<li><p>PHP <em>command line</em> access with register_argc_argv set to true in the 
php.ini file * and with no hosting provider restrictions on the use of 
exec() and proc_open().</p></li>
<li><p>curl, gd (with at least jpeg and png support), mysqli, mbstring, mcrypt, 
and openssl extensions. The imagick extension is not required but desirable.</p></li>
<li><p>xml extension is required if you want webdav to work.</p></li>
<li><p>some form of email server or email gateway such that PHP mail() works.</p></li>
<li><p>Mysql 5.x or MariaDB or postgres database server.</p></li>
<li><p>ability to schedule jobs with cron.</p></li>
<li><p>Installation into a top-level domain or sub-domain (without a 
directory/path component in the URL) is REQUIRED.</p></li>
</ul><h1 id="Manual_Installation">Manual Installation</h1>

<h2 id="Unpack_the_Hubzilla_files_into_the_root_of_your_web_server_document_area">Unpack the Hubzilla files into the root of your web server document area</h2>

<p>If you copy the directory tree to your webserver, make sure that you include the
hidden files like .htaccess.</p>

<p>If you are able to do so, we recommend using git to clone the source 
repository rather than to use a packaged tar or zip file.  This makes the 
software much easier to update. The Linux command to clone the repository 
into a directory "mywebsite" would be:</p>

<pre><code>git clone https://github.com/redmatrix/hubzilla.git mywebsite
</code></pre>

<p>and then you can pick up the latest changes at any time with:</p>

<pre><code>git pull
</code></pre>

<p>make sure folders <code class="inline-code">store/[data]/smarty3</code> and <code class="inline-code">store</code> exist and are 
writable by the webserver:</p>

<pre><code>mkdir -p "store/[data]/smarty3"
chmod -R 777 store

This permission (777) is very dangerous and if you have sufficient
privilege and knowledge you should make these directories writeable
only by the webserver and, if different, the user that will run the
cron job (see below). In many shared hosting environments this may be
difficult without opening a trouble ticket with your provider. The
above permissions will allow the software to work, but are not
optimal.
</code></pre>

<p>The following directories also need to be writable by the webserver in order for certain
web-based administrative tools to function:</p>

<ul><li><code class="inline-code">addon</code></li>
<li><code class="inline-code">extend</code></li>
<li><code class="inline-code">view/theme</code></li>
<li><code class="inline-code">widget</code></li>
</ul><h2 id="Official_addons">Official addons</h2>

<h3 id="Installation">Installation</h3>

<p>Navigate to your webThen you should clone the addon repository (separately). We'll give this repository a nickname of 'hzaddons'. You can pull in other hubzilla addon repositories by giving them different nicknames::</p>

<pre><code>cd mywebsite
util/add_addon_repo https://github.com/redmatrix/hubzilla-addons.git hzaddons
</code></pre>

<h3 id="Updating">Updating</h3>

<p>For keeping the addon tree updated, you should be on your top level website directory and issue an update command for that repository::</p>

<pre><code>cd mywebsite
util/update_addon_repo hzaddons
</code></pre>

<p>Create searchable representations of the online documentation. You may do this 
    any time that the documentation is updated :</p>

<pre><code>cd mywebsite
util/importdoc
</code></pre>

<h1 id="Automated_installation_via_the_homeinstall_shell_script">Automated installation via the .homeinstall shell script</h1>

<p>There is a shell script in (<code class="inline-code">.homeinstall/hubzilla-setup.sh</code>) that will install Hubzilla and its dependencies on a fresh installation of Debian 8.3 stable (Jessie). It should work on similar Linux systems but your results may vary.</p>

<h2 id="Requirements">Requirements</h2>

<p>The installation script was originally designed for a small hardware server behind your home router. However, it has been tested on several systems running Debian 8.3:</p>

<ul><li><p>Home-PC (Debian-8.3.0-amd64)</p>

<ul><li>Internet connection and router at home</li>
<li>Mini-pc connected to your router</li>
<li>USB drive for backups</li>
<li>Fresh installation of Debian on your mini-pc</li>
<li>Router with open ports 80 and 443 for your Debian</li>
</ul></li>
<li><p>DigitalOcean droplet (Debian 8.3 x64 / 512 MB Memory / 20 GB Disk / NYC3)</p></li>
</ul><h2 id="Overview_of_installation_steps">Overview of installation steps</h2>

<ol><li><code class="inline-code">apt-get install git</code></li>
<li><code class="inline-code">mkdir -p /var/www/html</code></li>
<li><code class="inline-code">cd /var/www/html</code></li>
<li><code class="inline-code">git clone https://github.com/redmatrix/hubzilla.git .</code></li>
<li><code class="inline-code">nano .homeinstall/hubzilla-config.txt</code></li>
<li><code class="inline-code">cd .homeinstall/</code></li>
<li><code class="inline-code">./hubzilla-setup.sh</code></li>
<li><code class="inline-code">sed -i "s/^upload_max_filesize =.*/upload_max_filesize = 100M/g" /etc/php5/apache2/php.ini</code></li>
<li><code class="inline-code">sed -i "s/^post_max_size =.*/post_max_size = 100M/g" /etc/php5/apache2/php.ini</code></li>
<li><code class="inline-code">service apache2 reload</code></li>
<li>Open your domain with a browser and step throught the initial configuration of Hubzilla.</li>
</ol><h1 id="Service_Classes">Service Classes</h1>

<p>Service classes allow you to set limits on system resources by limiting what individual
accounts can do, including file storage and top-level post limits. Define custom service 
classes according to your needs in the <code class="inline-code">.htconfig.php</code> file. For example, create 
a <em>standard</em> and <em>premium</em> class using the following lines:</p>

<pre><code>// Service classes

App::$config['system']['default_service_class']='standard'; // this is the default service class that is attached to every new account

// configuration for parent service class
App::$config['service_class']['standard'] =
array('photo_upload_limit'=&gt;2097152, // total photo storage limit per channel (here 2MB)
'total_identities' =&gt;1, // number of channels an account can create
'total_items' =&gt;0, // number of top level posts a channel can create. Applies only to top level posts of the channel user, other posts and comments are unaffected
'total_pages' =&gt;100, // number of pages a channel can create
'total_channels' =&gt;100, // number of channels the user can add, other users can still add this channel, even if the limit is reached
'attach_upload_limit' =&gt;2097152, // total attachment storage limit per channel (here 2MB)
'chatters_inroom' =&gt;20);

// configuration for teacher service class
App::$config['service_class']['premium'] =
array('photo_upload_limit'=&gt;20000000000, // total photo storage limit per channel (here 20GB)
'total_identities' =&gt;20, // number of channels an account can create
'total_items' =&gt;20000, // number of top level posts a channel can create. Applies only to top level posts of the channel user, other posts and comments are unaffected
'total_pages' =&gt;400, // number of pages a channel can create
'total_channels' =&gt;2000, // number of channels the user can add, other users can still add this channel, even if the limit is reached
'attach_upload_limit' =&gt;20000000000, // total attachment storage limit per channel (here 20GB)
'chatters_inroom' =&gt;100);
</code></pre>

<p>To apply a service class to an existing account, use the command line utility from the 
web root:</p>

<p><code class="inline-code">util/service_class</code>
list service classes</p>

<p><code class="inline-code">util/config system default_service_class firstclass</code>
set the default service class to 'firstclass'</p>

<p><code class="inline-code">util/service_class firstclass</code>
list the services that are part of 'firstclass' service class</p>

<p><code class="inline-code">util/service_class firstclass photo_upload_limit 10000000</code>
set firstclass total photo disk usage to 10 million bytes</p>

<p><code class="inline-code">util/service_class --account=5 firstclass</code>
set account id 5 to service class 'firstclass' (with confirmation)</p>

<p><code class="inline-code">util/service_class --channel=blogchan firstclass</code>
set the account that owns channel 'blogchan' to service class 'firstclass' (with confirmation)</p>

<p><strong>Service class limit options</strong></p>

<ul><li>photo_upload_limit - maximum total bytes for photos</li>
<li>total_items - maximum total toplevel posts</li>
<li>total_pages - maximum comanche pages</li>
<li>total_identities - maximum number of channels owned by account</li>
<li>total_channels - maximum number of connections</li>
<li>total_feeds - maximum number of rss feed connections</li>
<li>attach_upload_limit - maximum file upload storage (bytes)</li>
<li>minimum_feedcheck_minutes - lowest setting allowed for polling rss feeds</li>
<li>chatrooms - maximum chatrooms</li>
<li>chatters_inroom - maximum chatters per room</li>
<li>access_tokens - maximum number of Guest Access Tokens per channel</li>
</ul><h1 id="Theme_management">Theme management</h1>

<h2 id="Repo_management_example">Repo management example</h2>

<ol><li><p>Navigate to your hub web root</p>

<p><code class="inline-code">root@hub:/root# cd /var/www</code></p></li>
<li><p>Add the theme repo and give it a name</p>

<p><code class="inline-code">root@hub:/var/www# util/add_theme_repo https://github.com/DeadSuperHero/redmatrix-themes.git DeadSuperHero</code></p></li>
<li><p>Update the repo by using</p>

<p><code class="inline-code">root@hub:/var/www#  util/update_theme_repo DeadSuperHero</code></p></li>
</ol><h1 id="Channel_Directory">Channel Directory</h1>

<h2 id="Keywords">Keywords</h2>

<p>There is a "tag cloud" of keywords that can appear on the channel directory page. 
If you wish to hide these keywords, which are drawn from the directory server, you 
can use the <em>config</em> tool:</p>

<pre><code>util/config system disable_directory_keywords 1
</code></pre>

<p>If your hub is in the standalone mode because you do not wish to connect to the 
global grid, you may instead ensure the the <em>directory_server</em> system option is 
empty:</p>

<pre><code>util/config system directory_server ""
</code></pre>

<h1 id="Upgrading_from_RedMatrix_to_Hubzilla">Upgrading from RedMatrix to Hubzilla</h1>

<h2 id="How_to_migrate_an_individual_channel_from_RedMatrix_to_Hubzilla">How to migrate an individual channel from RedMatrix to Hubzilla</h2>

<ol><li>Clone the channel by opening an account on a Hubzilla hub and performing a basic import (not content) from the original RedMatrix hub. Give your new clone time to sync connections and settings.</li>
<li>Export individual channel content from your RedMatrix hub to a set of JSON text files using the red.hub/uexport tool. Do this in monthly increments if necessary.</li>
<li>Import the JSON data files sequentially in chronological order into the Hubzilla clone using the new.hub/import_items tool.</li>
<li>Inform your Friendica and Diaspora contacts that your channel moves. They need to reconnect to your new address.  </li>
<li>After successful import (check!) delete your channel on the old RedMatrix Server.</li>
<li>On the Hubzilla server visit new.hub/locs and upgrade to your channel to a primary one. And when the old Redmatrix server is still listed delete them here as well. Press "Sync" to inform all other server in the grid.</li>
</ol><h1 id="Troubleshooting">Troubleshooting</h1>

<h2 id="Log_files">Log files</h2>

<p><a href="https://macgirvin.com/display/044c72684b95c46a77ac7560656d1dc38504244dc649626c637193f6dd7c7dc4@macgirvin.com">Allow me to elaborate on logfiles...</a></p>

<p>There are three different log facilities.</p>

<p><strong>The first is the database failure log</strong>. This is only used if you create a file called specifically 'dbfail.out' in the root folder of your website and make it write-able by the web server. If we have any database failed queries, they are all reported here. They generally indicate typos in our queries, but also occur if the database server disconnects or tables get corrupted. On rare occasions we'll see race conditions in here where two processes tried to create an xchan or cache entry with the same ID. Any other errors (especially persistent errors) should be investigated.</p>

<p><strong>The second is the PHP error log</strong>. This is created by the language processor and only reports issues in the language environment. Again these can be syntax errors or programming errors, but these generally are fatal and result in a "white screen of death"; e.g. PHP terminates. You should probably look at this file if something goes wrong that doesn't result in a white screen of death, but it isn't uncommon for this file to be empty for days on end.</p>

<p>There are some lines at the bottom of the supplied .htconfig.php file; which if uncommented will enable a PHP error log (<em>extremely</em> useful for finding the source of white screen failures). This isn't done by default due to potential issues with logfile ownership and write permissions and the fact that there is no logfile rotation by default.</p>

<p><strong>The third is the "application log"</strong>. This is used by Hubzilla to report what is going on in the program and usually reports any difficulties or unexpected data we received. It also occasionally reports "heartbeat" status messages to indicate that we reached a certain point in a script. <strong>This</strong> is the most important log file to us, as we create it ourself for the sole purpose of reporting the status of background tasks and anything that seems weird or out of place. It may not be fatal, but maybe just unexpected. If you're performing a task and there's a problem, let us know what is in this file when the problem occurred. (Please don't send me 100M dumps you'll only piss me off). Just a few relevant lines so I can rule out a few hundred thousand lines of code and concentrate on where the problem starts showing up.</p>

<p>These are your site logs, not mine. We report serious issues at any log level. I highly recommend 'DEBUG' log level for most sites - which provides a bit of additional info and doesn't create huge logfiles. When there's a problem which defies all attempts to track, you might wish to use DATA log level for a short period of time to capture all the detail of what structures we were dealing with at the time. This log level will use a lot of space so is recommended only for brief periods or for developer test sites.</p>

<p>I recommend configuring logrotate for both the php log and the application log. I usually have a look at dbfail.out every week or two, fix any issues reported and then starting over with a fresh file. Likewise with the PHP logfile. I refer to it once in a while to see if there's something that needs fixing.</p>

<p>If something goes wrong, and it's not a fatal error, I look at the application logfile. Often I will
<code class="inline-code">tail -f logfile.out</code></p>

<p>While repeating an operation that has problems. Often I'll insert extra logging statements in the code if there isn't any hint what's going wrong. Even something as simple as "got here" or printing out the value of a variable that might be suspect. You can do this too - in fact I encourage you to do so. Once you've found what you need to find, you can</p>

<p><code class="inline-code">git checkout file.php</code></p>

<p>To immediately clear out all the extra logging stuff you added.  Use the information from this log and any detail you can provide from your investigation of the problem to file your bug report - unless your analysis points to the source of the problem. In that case, just fix it.</p>

<h3 id="Rotating_log_files">Rotating log files</h3>

<ol><li>Enable the <strong>logrot</strong> addon in the official <a href="https://github.com/redmatrix/hubzilla-addons">hubzilla-addons</a> repo</li>
<li>Create a directory in your web root called <code class="inline-code">log</code> with webserver write permissions</li>
<li>Go to the <strong>logrot</strong> admin settings and enter this folder name as well as the max size and number of retained log files.</li>
</ol>