From 7f4e6aaafa1796ce55d3c0e15b3e69436bafc6af Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Mon, 24 Feb 2014 19:31:14 +0100 Subject: [PATCH 1/4] Introduce new config option common_config('queue','daemon').Allows to dynamically enable scripts/queuedaemon.php into scripts/getvaliddaemons.php --- lib/default.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/default.php b/lib/default.php index cedce64563..c5794565a3 100644 --- a/lib/default.php +++ b/lib/default.php @@ -85,6 +85,7 @@ $default = 'facility' => LOG_USER), 'queue' => array('enabled' => true, + 'daemon' => false, # Use queuedaemon. Default to false 'subsystem' => 'db', # default to database, or 'stomp' 'stomp_server' => null, 'queue_basename' => '/queue/statusnet/', From 88c463006308c1a8377a8554b69b952950c40458 Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Mon, 24 Feb 2014 19:32:29 +0100 Subject: [PATCH 2/4] Dynamically enable scripts/queuedaemon.php into scripts/getvaliddaemons.php depending on common_config('queue', 'daemon') value. True = enabled, False=disabled. Default is false (see previous commit) --- scripts/getvaliddaemons.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php index b4e1e57e43..9090607224 100755 --- a/scripts/getvaliddaemons.php +++ b/scripts/getvaliddaemons.php @@ -37,7 +37,9 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; $daemons = array(); -#$daemons[] = INSTALLDIR.'/scripts/queuedaemon.php'; +if (common_config('queue', 'daemon')) { + $daemons[] = INSTALLDIR.'/scripts/queuedaemon.php'; +} if (Event::handle('GetValidDaemons', array(&$daemons))) { foreach ($daemons as $daemon) { From c6243bceea492a7595e41610477c6d979b00b4e7 Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Mon, 24 Feb 2014 23:11:37 +0100 Subject: [PATCH 3/4] Update documentation to reflect queueadmon changes. Also add basic opportunisticqm description --- CONFIGURE | 2 ++ INSTALL | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/CONFIGURE b/CONFIGURE index c4a43a3dc8..8abc0513a9 100644 --- a/CONFIGURE +++ b/CONFIGURE @@ -182,6 +182,8 @@ sending out SMS email or XMPP messages, for off-line processing. See 'Queues and daemons' above for how to set this up. enabled: Whether to uses queues. Defaults to false. +daemon: Wather to use queuedaemon. Defaults to false, which means + you'll use OpportunisticQM plugin. subsystem: Which kind of queueserver to use. Values include "db" for our hacked-together database queuing (no other server required) and "stomp" for a stomp server. diff --git a/INSTALL b/INSTALL index bac8d34005..0fa6634810 100644 --- a/INSTALL +++ b/INSTALL @@ -368,12 +368,39 @@ Queues and daemons ------------------ Some activities that StatusNet needs to do, like broadcast OStatus, SMS, -and XMPP messages, can be 'queued' and done by off-line bots instead. -For this to work, you must be able to run long-running offline -processes, either on your main Web server or on another server you -control. (Your other server will still need all the above -prerequisites, with the exception of Apache.) Installing on a separate -server is probably a good idea for high-volume sites. +XMPP messages and TwitterBridge operations, can be 'queued' and done by +off-line bots instead. + +Two mechanisms are available to achieve offline operations: + +* New embedded OpportunisticQM plugin, which is enabled by default +* Legacy queuedaemon script, which can be enabled via config file. + +### OpportunisticQM plugin + +This plugin is enabled by default. It tries its best to do background +job during regular HTTP requests, like API or HTML pages calls. + +Since queueing system is enabled by default, notices to be broadcasted +will be stored, by default, into DB (table queue_items). + +Each time it casn, OpportunisticQM will try to handle some of them. + +This is a good solution wether you: + +* have no access to command line (shared hosting) +* do not want to deal with long-running PHP process +* run a low trffic GnuSocial instance + +In other case, you really should consider using queuedaemon. + +### queuedaemon + +If you want to use legacy queuedaemon, you must be able to run +long-running offline processes, either on your main Web server or on +another server you control. (Your other server will still need all the +above prerequisites, with the exception of Apache.) Installing on a +separate server is probably a good idea for high-volume sites. 1. You'll need the "CLI" (command-line interface) version of PHP installed on whatever server you use. @@ -399,6 +426,7 @@ server is probably a good idea for high-volume sites. server!), set the following variable: $config['queue']['enabled'] = true; + $config['queue']['daemon'] = true; You may also want to look at the 'daemon' section of this file for more daemon options. Note that if you set the 'user' and/or 'group' @@ -412,7 +440,7 @@ This will run the queue handlers: * queuedaemon.php - polls for queued items for inbox processing and pushing out to OStatus, SMS, XMPP, etc. * imdaemon.php - if an IM plugin is enabled (like XMPP) -* other daemons that you may have enabled +* other daemons, like TwitterBridge ones, that you may have enabled These daemons will automatically restart in most cases of failure including memory leaks (if a memory_limit is set), but may still die From 989d6df1e80879772c5997b242bcc44dda276d09 Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Tue, 25 Feb 2014 23:27:24 +0100 Subject: [PATCH 4/4] Fix typo in INSTALL. Thanks @postblue for reporting --- INSTALL | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 0fa6634810..f9fce18a7b 100644 --- a/INSTALL +++ b/INSTALL @@ -384,13 +384,13 @@ job during regular HTTP requests, like API or HTML pages calls. Since queueing system is enabled by default, notices to be broadcasted will be stored, by default, into DB (table queue_items). -Each time it casn, OpportunisticQM will try to handle some of them. +Each time it can, OpportunisticQM will try to handle some of them. This is a good solution wether you: * have no access to command line (shared hosting) * do not want to deal with long-running PHP process -* run a low trffic GnuSocial instance +* run a low traffic GnuSocial instance In other case, you really should consider using queuedaemon.