Setting up my personal StatusNet instance

This post was initially a page on my wiki site, but was changed into a blog post during the last re-shuffling of my web site.

At some point when identi.ca had a lot of downtime I decided to setup my own StatusNet instance. I got a Debian 6.0 VPS from gandi, downloaded StatusNet release 1.0.1, and followed the installation instructions from the INSTALL file.

If you want fancy URLs (you probably do) set them up immediately - once you have started following others and denting you’ll have a lot of trouble if your instance’s URLs change. I did set up SSL later, but left non-SSL open as well, so that all links work.

I did not set up any of the SMS and XMPP thingies at this point.

BTW, my instance is at http://status.saz.im/.

install.php

After running install.php (as per the INSTALL file), it is probably a good idea to move away the install.php file, or change it’s permissions so that it cannot be accessed from the web. Thanks to @boneidol and @parlementum for informing about this.

Daemons

It is a good idea to use the queue daemon, in the scripts directory there is a startdaemons.sh, but since I didn’t use XMPP in the beginning I commented that line out from the getvaliddaemons.php script. You can then stop them with stopdaemons.sh, but again I found that I needed to do some editing: to add the daemons I was using to its list. Initially I used just the queuedaemon. In addition I’ve got these settings for the daemons in my config.php:

$config['queue']['enabled'] = true;
$config['daemon']['piddir'] = '/var/run/';
$config['daemon']['user'] = 'www-data';
$config['daemon']['group'] = 'www-data';

This causes StatusNet to use the queue and places the pid files in /var/run and run the daemons as the www-data user (same as apache). If you are running something other than Debian the apache user might be called something else.

NOTE: Be careful to check that the www-data user has read and write access to the avatar directory in your StatusNet install directory. If you are using PHP in safe-mode make sure that www-data is also the owner of the avatar directory since the PHP rename function will not work otherwise! (See PHP safe mode functions). If it cannot move files there you will see “Permission denied” errors in your StatusNet log file.

Logs

For logging I have the following:

$config['site']['logdebug'] = true;
$config['site']['logfile'] = '/var/log/statusnet.log';

addPlugin('LogFilter', array(
   'priority' => array(LOG_DEBUG => false)
));

The LogFilter plugin is handy for filtering out stuff you don’t want in your log. I found that the LOG_DEBUG things were too verbose, e.g. notices every 10 seconds about nothing happening. You can also use regular expressions to filter the log. Check out the example in the comment in plugins/LogFilter/LogFilterPlugin.php.

Remote groups

I follow a lot of groups remotely (most of them on identi.ca) and I and others noticed that even though you posted with !groupname, for some groups it just didn’t activate. @jpope told me that these groups needed to be added to the group_alias table in MySQL, and he also has a way of doing it more systematically. I prefer doing it more incrementally - also I’m not much of an SQL expert so I prefer to do only minimal things that I actually understand :) So now if I notice that a certain group doesn’t work, e.g. “listening”, I just add it manually via the MySQL command line interface:

insert into group_alias (group_id, alias) select distinct id, nickname \
from user_group where nickname='listening';

These two status.net bug reports seem to be related: #3092, #3507.

XMPP

I later decided I wanted to get the XMPP (i.e. chat or Jabber) support going. I added the XMPP plugin, started the imdaemon (see daemons above), and added this to my config:

addPlugin('xmpp', array(
    'user'=>'yourXMPPUser',
    'server'=>'yourXMPPServer',
    'password'=>'yourSikritPassword',
    'encryption'=>true,
));

Here you need to change to whatever xmpp server, user and password you are using. Unfortunately this was not enough because there seemed to be a bug in the XMPP plugin that comes with StatusNet. I believe this bug report (#3232) is essentially the same thing as I was experiencing, i.e. the log was flooded with stuck queue notices.

Unfortunately, at that time status.net was in the process of moving their servers so I could not access the patches suggested in that thread, but I was able to implement the same from reading the descriptions from the Google cache of the bug report :) Basically I added return true; at the end of the two if blocks in receiveRawMessage in plugins/Xmpp/XmppPlugin.php (the same as this patch). This thread might also be interesting to read. I also cleared the queue_item table which had some stuck messages in it.

Theme

I haven’t yet had time to make my own custom visual theme, but I’m currently using the very nice neo-kafei theme by Ryan Weal. Just untar/unzip the package into the theme directory in your StatusNet directory. After that the theme directory should contain the neo-kafei directory. Then just add this line to you config (and make sure there are no old theme settings from before!):

$config['site']['theme'] = 'neo-kafei';

Subscription problems

Occasionally subscribing to remote users (users on other instances) fails, especially if they have recently made any changes in their setup. The problem seems to be that old entries in the ostatus_profile database table remain and are causing problems. The problem can be fixed by the subscriber deleting the old entry from the database. E.g. when I recently had problems subscribing to @vk7hse, it was solved by first checking for old subscriptions in the MySQL console:

select uri from ostatus_profile where uri like '%vk7hse%';

The string between the percent signs should be anything that is sure to be in the URL of that persons instance. Then if I find URLs related to that subscription I can delete them by running this command in the MySQL console:

delete from ostatus_profile where uri = 'http://vk7hse.hobby-site.org/status/user/1';

After this subscribing works as it should. This problem is discussed in this bug report as well: http://status.net/open-source/issues/3219

If this doesn’t help you need to do some more hard core StatusNet subscription hacking.

United Federated Dentizens of the World

A lot of people are running their personal StatusNet instances, or small instances for a few people. I suggest joining the !feds group where a lot of helpful fellow federators can help you out with problems! I know I sure got a lot of help from my fellow dentizens.

Some other resources, from fellow “feds” that might be helpful:

Posted by Mats Sjöberg.