GNU social

From Organic Design wiki
Revision as of 14:30, 1 July 2018 by Nad (talk | contribs) (Category:Federated)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installation

I found installation to be fairly straight forward, it's a basic LAMP system that requires a database to be created prior that can be referred to in the installation procedure. Simple clone the repo of their source code in your web space and then browser to the install.php script.

For friendly URLs use a rule such as the following:

rewrite ^(.*)$ /social/index.php?p=$1 last;

For some reason after the installation procedure had finished, the link it gave me to the site included a /social at the start of the path which shouldn't have been there. I noticed that it had given the values "social" to $config['site']['path'] so I set it to an empty string and then things mostly worked. But still many things such as avatars and email confirmation still included this incorrect prefix. I was able to fix some instances of the problem by editing some paths in the admin/paths screen, but still some instances of this problem persisted, so in the end I had to add a rewrite rule in the web-server configuration:

rewrite ^/social(.*)$ $1;

I raise an issue about this problem, but I don't have much hope for this being dealt with any time soon, because a couple of other minor issues I had had already been raised - over a year ago!

Some other recommended settings in config.php to make things more responsive are as follows:

$config['site']['theme'] = 'neo-rudism';
$config['queue']['enabled'] = true;
$config['queue']['subsystem'] = 'db';
$config['queue']['daemon'] = true;

You then need to start the background daemons as follows:

sh scripts/startdaemons.sh

And you should also have this run on reboot by adding the following to you crontab:

@reboot /bin/sh /var/www/domains/social/scripts/startdaemonts.sh >/dev/null

Remote connections

For some reason remote follows don't work when I use the email form of my ID, but if I use the URL form it works fine.

Connecting to Twitter

There are many plugins available for GNU social, most are shipped with the system but are not enabled by default. The TwitterBridge allows you to sign in with Twitter and to have your GNU social posts go onto your Twitter stream and your Twitter contact's posts show in your GNU social stream.

First enable the application in your config.php as follows:

addPlugin(
    'TwitterBridge',
    array(
        'consumer_key'    => 'YOUR_CONSUMER_KEY',
        'consumer_secret' => 'YOUR_CONSUMER_SECRET'
    )
);
$config['twitterimport']['enabled'] = true;
$config['integration']['source'] = 'YOUR_APP';

To get your consumer key and secret, you need to add GNU social as a new app in Twitter from https://apps.twitter.com/app/new. The name for your app needs to be globally unique, e.g. "OrganicDesign GNU social connection", and this is also used where it says YOUR_APP in the GNU social config shown above. Set the URL to the base URL of your site and the callback to URL/twitter/authorization. You'll need to have your Twitter account connected to your mobile to add an app - just one more reason for leaving!

Then in GNU social, go to the Twitter menu item in the admin settings and click on the "connect my twitter account" link, and then make sure the app name in the same as the name you used for the app you created in Twitter. And then in your user settings, go to the Twitter menu and set the "Automatically send my notices to Twitter" and "Subscribe to my Twitter friends here" options.

You then need to restart the daemons to add the new ones to the background jobs:

sh scripts/startdaemons.sh

Plugins

The plugin system is very intuitive. Simple make a new directory of the name of your new plugin in the plugins directory, and have a file of the same name followed by Plugin.php. The PHP file must contain a class of the name followed by Plugin which extends the Plugin class. You then subscribe your extension to various events by defining methods in your class of the event names prefixed by on.

There is a sample extension in the plugins directory, as well as developer documentation and a list of all the available events. I made this simple extension which adds a new CSS so we can customise our GNU social without rebuilding the entire theme.

See also the community plugins list, community development guide and the official code docs.

Issues

400 error when posting: This seems to be a session expiry issue and the post will work if you refresh the page and post again.

See also