diff --git a/conf/default.conf.php b/conf/default.conf.php --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -944,10 +944,21 @@ // Directory that the Phabricator daemons should use to store the log file 'phd.log-directory' => '/var/tmp/phd/log', - // Number of "TaskMaster" daemons that "phd start" should start. You can - // raise this if you have a task backlog, or explicitly launch more with - // "phd launch taskmaster". - 'phd.start-taskmasters' => 4, + // Daemons that "phd start" should start. + 'phd.start-daemons' => array( + 'taskmaster' => array( + 'type' => 'PhabricatorTaskmasterDaemon', + 'count' => 4, + ), + 'repository-pull' => array( + 'type' => 'PhabricatorRepositoryPullLocalDaemon', + 'count' => 1, + ), + 'garbage-collector' => array( + 'type' => 'PhabricatorGarbageCollectorDaemon', + 'count' => 1, + ), + ), // Launch daemons in "verbose" mode by default. This creates a lot of output, // but can help debug issues. Daemons launched in debug mode with "phd debug" diff --git a/src/applications/config/option/PhabricatorPHDConfigOptions.php b/src/applications/config/option/PhabricatorPHDConfigOptions.php --- a/src/applications/config/option/PhabricatorPHDConfigOptions.php +++ b/src/applications/config/option/PhabricatorPHDConfigOptions.php @@ -21,13 +21,27 @@ ->setDescription( pht( "Directory that the daemons should use to store log files.")), - $this->newOption('phd.start-taskmasters', 'int', 4) - ->setSummary(pht("Number of TaskMaster daemons to start by default.")) + $this->newOption( + 'phd.start-daemons', + 'map', + array( + 'taskmaster' => array( + 'type' => 'PhabricatorTaskmasterDaemon', + 'count' => 4, + ), + 'repository-pull' => array( + 'type' => 'PhabricatorRepositoryPullLocalDaemon', + 'count' => 1, + ), + 'garbage-collector' => array( + 'type' => 'PhabricatorGarbageCollectorDaemon', + 'count' => 1, + ), + )) + ->setLocked(true) + ->setSummary(pht('Daemons to start by default.')) ->setDescription( - pht( - "Number of 'TaskMaster' daemons that 'phd start' should start. ". - "You can raise this if you have a task backlog, or explicitly ". - "launch more with 'phd launch taskmaster'.")), + pht('Number and type of daemons that `phd start` should start.')), $this->newOption('phd.verbose', 'bool', false) ->setBoolOptions( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php @@ -256,14 +256,26 @@ pht('Freed %s task lease(s).', new PhutilNumber($count))); } - $daemons = array( - array('PhabricatorRepositoryPullLocalDaemon', array()), - array('PhabricatorGarbageCollectorDaemon', array()), - ); - - $taskmasters = PhabricatorEnv::getEnvConfig('phd.start-taskmasters'); - for ($ii = 0; $ii < $taskmasters; $ii++) { - $daemons[] = array('PhabricatorTaskmasterDaemon', array()); + $daemons = array(); + $start_daemons = PhabricatorEnv::getEnvConfig('phd.start-daemons'); + + foreach ($start_daemons as $daemon) { + $spec = array( + 'type' => 'string', + 'args' => 'optional list', + 'count' => 'optional int', + ); + PhutilTypeSpec::checkMap($daemon, $spec); + } + + foreach ($start_daemons as $daemon) { + $type = idx($daemon, 'type'); + $args = idx($daemon, 'args', array()); + $count = idx($daemon, 'count', 1); + + for ($ii = 0; $ii < $count; $ii++) { + $daemons[] = array($type, $args); + } } $this->willLaunchDaemons();