diff --git a/conf/default.conf.php b/conf/default.conf.php index 7a1fba7add..e3746a857a 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -1095,7 +1095,10 @@ return array( // Directory that phd (the Phabricator daemon control script) should use to // track running daemons. - 'phd.pid-directory' => '/var/tmp/phd', + 'phd.pid-directory' => '/var/tmp/phd/pid', + + // 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 diff --git a/scripts/daemon/phabricator_daemon_launcher.php b/scripts/daemon/phabricator_daemon_launcher.php index b01140d1e2..b7724290a1 100755 --- a/scripts/daemon/phabricator_daemon_launcher.php +++ b/scripts/daemon/phabricator_daemon_launcher.php @@ -225,7 +225,7 @@ function will_launch($control, $with_logs = true) { echo "Staging launch...\n"; $control->pingConduit(); if ($with_logs) { - $log_dir = $control->getControlDirectory('log').'/daemons.log'; + $log_dir = $control->getLogDirectory().'/daemons.log'; echo "NOTE: Logs will appear in '{$log_dir}'.\n\n"; } } diff --git a/src/infrastructure/daemon/PhabricatorDaemonControl.php b/src/infrastructure/daemon/PhabricatorDaemonControl.php index 743df8d936..bd2cf929a4 100644 --- a/src/infrastructure/daemon/PhabricatorDaemonControl.php +++ b/src/infrastructure/daemon/PhabricatorDaemonControl.php @@ -254,11 +254,11 @@ EOHELP $flags[] = csprintf('--conduit-uri=%s', PhabricatorEnv::getURI('/api/')); if (!$debug) { - $log_dir = $this->getControlDirectory('log').'/daemons.log'; - $flags[] = csprintf('--log=%s', $log_dir); + $log_file = $this->getLogDirectory().'/daemons.log'; + $flags[] = csprintf('--log=%s', $log_file); } - $pid_dir = $this->getControlDirectory('pid'); + $pid_dir = $this->getPIDDirectory(); // TODO: This should be a much better user experience. Filesystem::assertExists($pid_dir); @@ -295,21 +295,30 @@ EOHELP return; } - public function getControlDirectory($dir) { - $path = PhabricatorEnv::getEnvConfig('phd.pid-directory').'/'.$dir; + private function getControlDirectory($path) { if (!Filesystem::pathExists($path)) { list($err) = exec_manual('mkdir -p %s', $path); if ($err) { throw new Exception( "phd requires the directory '{$path}' to exist, but it does not ". "exist and could not be created. Create this directory or update ". - "'phd.pid-directory' in your configuration to point to an existing ". - "directory."); + "'phd.pid-directory' / 'phd.log-directory' in your configuration ". + "to point to an existing directory."); } } return $path; } + public function getPIDDirectory() { + $path = PhabricatorEnv::getEnvConfig('phd.pid-directory'); + return $this->getControlDirectory($path); + } + + public function getLogDirectory() { + $path = PhabricatorEnv::getEnvConfig('phd.log-directory'); + return $this->getControlDirectory($path); + } + protected function loadAvailableDaemonClasses() { $loader = new PhutilSymbolLoader(); return $loader @@ -321,7 +330,7 @@ EOHELP public function loadRunningDaemons() { $results = array(); - $pid_dir = $this->getControlDirectory('pid'); + $pid_dir = $this->getPIDDirectory(); $pid_files = Filesystem::listDirectory($pid_dir); if (!$pid_files) { return $results;