2014-02-07 14:58:40 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* CakeResque configuration file
|
|
|
|
*
|
|
|
|
* Default settings for Resque workers and queues.
|
|
|
|
*
|
|
|
|
* PHP version 5
|
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @author Wan Qi Chen <kami@kamisama.me>
|
|
|
|
* @copyright Copyright 2012, Wan Qi Chen <kami@kamisama.me>
|
|
|
|
* @link http://cakeresque.kamisama.me
|
|
|
|
* @package CakeResque
|
|
|
|
* @subpackage CakeResque.Config
|
|
|
|
* @since 3.4.0
|
|
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configure the default value for Resque
|
|
|
|
*
|
|
|
|
* ## Mandatory indexes :
|
|
|
|
* Redis
|
2016-06-04 01:14:25 +02:00
|
|
|
* Redis server settings
|
2014-02-07 14:58:40 +01:00
|
|
|
* Worker
|
2016-06-04 01:14:25 +02:00
|
|
|
* Workers default settings
|
2014-02-07 14:58:40 +01:00
|
|
|
* Resque
|
2016-06-04 01:14:25 +02:00
|
|
|
* Default values used to init the php-resque library path
|
2014-02-07 14:58:40 +01:00
|
|
|
*
|
|
|
|
* ## Optional indexes :
|
|
|
|
* Queues
|
2016-06-04 01:14:25 +02:00
|
|
|
* An array of queues to start with Resque::load()
|
|
|
|
* Used when you have multiple queues, as you don't need
|
|
|
|
* to start each queues individually each time you start Resque
|
2014-02-07 14:58:40 +01:00
|
|
|
* Env
|
2016-06-04 01:14:25 +02:00
|
|
|
* Additional environment variables to pass to Resque
|
2014-02-07 14:58:40 +01:00
|
|
|
* Log
|
2016-06-04 01:14:25 +02:00
|
|
|
* Log handler and its arguments, to save the log with Monolog
|
2014-02-07 14:58:40 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* There are many ways to configure the plugin:
|
|
|
|
*
|
|
|
|
* 1. This file is automagically loaded by the bootstrapping process, when no 'CakeResque'
|
|
|
|
* configuration key exists.
|
|
|
|
*
|
|
|
|
* CakePlugin::load('CakeResque', array('bootstrap' => true));
|
|
|
|
*
|
|
|
|
* 2. If a 'CakeResque' configuration key already exists, the default configuration will not be loaded,
|
|
|
|
* and the 'CakeResque' key is expected to contain all the values present in the default configuration.
|
|
|
|
*
|
|
|
|
* Configure::load('my_cakeresque_config');
|
|
|
|
* CakePlugin::load('CakeResque', array('bootstrap' => true));
|
|
|
|
*
|
|
|
|
* 3. Another way to configure the plugin is to load it using a custom bootstrap file.
|
|
|
|
*
|
|
|
|
* CakePlugin::load('CakeResque', array('bootstrap' => 'my_bootstrap'));
|
|
|
|
*
|
|
|
|
* // APP/Plugin/CakeResque/Config/my_bootstrap.php
|
|
|
|
* require_once dirname(__DIR__) . DS . 'Lib' . DS . 'CakeResque.php';
|
|
|
|
* $config = array(); // Custom configuration
|
|
|
|
* CakeResque::init($config);
|
|
|
|
*
|
|
|
|
* @see CakeResque::init(), CakeResque::loadConfig().
|
|
|
|
*/
|
|
|
|
$config['CakeResque'] = array(
|
|
|
|
'Redis' => array(
|
2020-11-16 23:12:00 +01:00
|
|
|
'host' => '127.0.0.1', // Redis server hostname
|
2014-02-07 14:58:40 +01:00
|
|
|
'port' => 6379, // Redis server port
|
|
|
|
'database' => 0, // Redis database number
|
2014-09-12 13:29:30 +02:00
|
|
|
'namespace' => 'resque', // Redis keys namespace
|
|
|
|
'password' => null // Redis password
|
2014-02-07 14:58:40 +01:00
|
|
|
),
|
|
|
|
|
|
|
|
'Worker' => array(
|
|
|
|
'queue' => 'default', // Name of the default queue
|
|
|
|
'interval' => 5, // Number of second between each poll
|
|
|
|
'workers' => 1, // Number of workers to create
|
2016-06-04 01:14:25 +02:00
|
|
|
// 'user' => 'www-data' // User running the worker process
|
2014-02-07 14:58:40 +01:00
|
|
|
|
|
|
|
// Path to the log file
|
|
|
|
// Can be an
|
|
|
|
// - absolute path,
|
|
|
|
// - an relative path, that will be relative to
|
2016-06-04 01:54:19 +02:00
|
|
|
// app/tmp/logs folder
|
2014-02-07 14:58:40 +01:00
|
|
|
// - a simple filename, file will be created inside app/tmp/logs
|
|
|
|
'log' => TMP . 'logs' . DS . 'resque-worker-error.log',
|
|
|
|
|
|
|
|
// Log Verbose mode
|
|
|
|
// true to log more debugging informations
|
|
|
|
// Can also be enabled per worker, by starting with --verbose
|
|
|
|
'verbose' => false
|
|
|
|
),
|
|
|
|
'Job' => array(
|
|
|
|
// Whether to track job status
|
|
|
|
// Enabling this will allow you to track a job status by its ID
|
|
|
|
// Job status are purged after 24 hours
|
|
|
|
//
|
|
|
|
// You can also define per-job tracking by passing true/false when calling
|
|
|
|
// CakeResque::enqueue(), CakeResque::enqueueAt() or CakeResque::enqueueIn()
|
2014-09-12 13:29:30 +02:00
|
|
|
'track' => false
|
2014-02-07 14:58:40 +01:00
|
|
|
),
|
|
|
|
/*
|
|
|
|
'Queues' => array(
|
|
|
|
array(
|
|
|
|
'queue' => 'default', // Use default values from above for missing interval and count indexes
|
|
|
|
'user' => 'www-data' // If PHP is running as a different user on you webserver
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'queue' => 'my-second-queue',
|
|
|
|
'interval' => 10
|
|
|
|
)
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
'Resque' => array(
|
|
|
|
// Path to the directory containing the worker PID files
|
|
|
|
'tmpdir' => App::pluginPath('CakeResque') . 'tmp' . DS
|
|
|
|
),
|
|
|
|
|
|
|
|
// Other usefull environment variable you wish to set
|
|
|
|
// Passing a key only will search for its value in the $_SERVER scope
|
|
|
|
// eg : array('SERVER_NAME'); => will search for the value in $_SERVER['SERVER_NAME']
|
|
|
|
// Passing a key and a value will set the env variable to this value
|
|
|
|
// eg : array('ARCH' => 'x64')
|
|
|
|
'Env' => array(),
|
|
|
|
|
|
|
|
// Log Handler
|
|
|
|
// If saving the logs in a plain text file doesn't suit you
|
|
|
|
// you can send them to Mysql, or MongoDB, etc ...
|
|
|
|
// In that case, you'll need a handler to manage your logs
|
|
|
|
// All logs outputted by resque will go to the handler.
|
|
|
|
// The classic log file (above) will still be used, for logging
|
|
|
|
// stuff likes php error, or other STDOUT outputted by your job classses
|
|
|
|
//
|
|
|
|
// php-resque-ex uses Monolog to manage all the logging stuff
|
|
|
|
// If you uses the original php-resque library, these settings
|
|
|
|
// will be ignored
|
|
|
|
//
|
|
|
|
// handler
|
|
|
|
// Name of the Handler (the handler classname, without the 'Handler' part)
|
|
|
|
// target
|
|
|
|
// Arguments taken by the handler constructor. If the handler required
|
|
|
|
// multiple arguments, separate them with a comma
|
|
|
|
//
|
|
|
|
// As of now, the following handler are supported:
|
|
|
|
//
|
|
|
|
// [HANDLER] [TARGET]
|
2016-06-04 01:14:25 +02:00
|
|
|
// Cube Cube server address (e.g: udp://127.0.0.1:1180)
|
|
|
|
// RotatingFile Path to the log file (e.g: /path/to/resque.log)
|
|
|
|
// Syslog Facility name
|
|
|
|
// Socket Address (e.g: udp://127.0.0.1:23)
|
|
|
|
// MongoDB MongoDB server address (e.g: mongodb://localhost:27017)
|
2014-02-07 14:58:40 +01:00
|
|
|
'Log' => array(
|
|
|
|
'handler' => 'RotatingFile',
|
|
|
|
'target' => TMP . 'logs' . DS . 'resque.log'
|
|
|
|
),
|
|
|
|
|
|
|
|
// Scheduler Worker
|
|
|
|
// It's the worker handling all the scheduled jobs
|
|
|
|
// Only one scheduler worker is permitted to run at one time
|
|
|
|
// It can be paused, resumed and stopped like any other workers
|
|
|
|
// It can be started only with the `startscheduler` command,
|
|
|
|
// or with `load` if Scheduler Worker is enabled.
|
|
|
|
//
|
|
|
|
// Scheduled jobs requires the php-resque-ex-scheduler library,
|
|
|
|
// that should be installed with automatically via the
|
|
|
|
// `composer update` or `composer install` command
|
|
|
|
//
|
|
|
|
// The Scheduler Worker have its own default settings
|
|
|
|
//
|
|
|
|
// @since 2.3.0
|
|
|
|
//
|
|
|
|
'Scheduler' => array(
|
|
|
|
// Enable or disable delayed job
|
|
|
|
'enabled' => true,
|
|
|
|
|
|
|
|
// Path to the log file
|
|
|
|
'log' => TMP . 'logs' . DS . 'resque-scheduler-error.log',
|
|
|
|
|
|
|
|
// Optional
|
|
|
|
// Will not default to settings defined in the global scope above
|
|
|
|
'Env' => array(),
|
|
|
|
|
|
|
|
// Optional
|
|
|
|
// Will default to settings defined in the global scope above
|
|
|
|
// Only available setting is `interval`
|
|
|
|
// The worker will always poll a fixed special queue, and only one worker can run at one time
|
|
|
|
'Worker' => array(
|
|
|
|
'interval' => 3
|
|
|
|
),
|
|
|
|
|
|
|
|
// Optional
|
|
|
|
// Will default to settings defined in the global scope above
|
|
|
|
'Log' => array(
|
|
|
|
'handler' => 'RotatingFile',
|
|
|
|
'target' => TMP . 'logs' . DS . 'resque-scheduler.log'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|