From f060d8eb8fc133bc64eccd6e5f65251e3941f300 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 14 Jan 2014 13:22:40 -0800 Subject: [PATCH] Warn if daemons are not running Summary: Currently, we try to mostly-kind-of-work if daemons aren't running (for example, we send mail in-process). I want to stop doing this. A major motivator is that `metamta.send-immediately` is confusing for a lot of users and frequently the cause of performance problems. Increasingly, functionality of applications depends on the daemons (Harbormaster, Drydock, Nuance all require daemons to do anything at all). They're also fairly stable/robust/well-tested and no reasonable install should be running without them. This will let us simplify or remove some flags (like `metamta.send-immediately`) and simplify some other processes like search indexing. Test Plan: Stopped daemons, loaded warnings, saw daemon warning. Started daemons, reloade, no warning. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3857 Differential Revision: https://secure.phabricator.com/D7964 --- src/__phutil_library_map__.php | 2 + .../check/PhabricatorSetupCheckDaemons.php | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/applications/config/check/PhabricatorSetupCheckDaemons.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9af220754f..0ba6091953 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1924,6 +1924,7 @@ phutil_register_library_map(array( 'PhabricatorSetupCheckAuth' => 'applications/config/check/PhabricatorSetupCheckAuth.php', 'PhabricatorSetupCheckBaseURI' => 'applications/config/check/PhabricatorSetupCheckBaseURI.php', 'PhabricatorSetupCheckBinaries' => 'applications/config/check/PhabricatorSetupCheckBinaries.php', + 'PhabricatorSetupCheckDaemons' => 'applications/config/check/PhabricatorSetupCheckDaemons.php', 'PhabricatorSetupCheckDatabase' => 'applications/config/check/PhabricatorSetupCheckDatabase.php', 'PhabricatorSetupCheckExtensions' => 'applications/config/check/PhabricatorSetupCheckExtensions.php', 'PhabricatorSetupCheckExtraConfig' => 'applications/config/check/PhabricatorSetupCheckExtraConfig.php', @@ -4564,6 +4565,7 @@ phutil_register_library_map(array( 'PhabricatorSetupCheckAuth' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckBaseURI' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckBinaries' => 'PhabricatorSetupCheck', + 'PhabricatorSetupCheckDaemons' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckDatabase' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckExtensions' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckExtraConfig' => 'PhabricatorSetupCheck', diff --git a/src/applications/config/check/PhabricatorSetupCheckDaemons.php b/src/applications/config/check/PhabricatorSetupCheckDaemons.php new file mode 100644 index 0000000000..df3fe6d89d --- /dev/null +++ b/src/applications/config/check/PhabricatorSetupCheckDaemons.php @@ -0,0 +1,46 @@ +setViewer(PhabricatorUser::getOmnipotentUser()) + ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) + ->withDaemonClasses(array('PhabricatorTaskmasterDaemon')) + ->setLimit(1) + ->execute(); + + if (!$task_daemon) { + $doc_href = PhabricatorEnv::getDocLink( + 'article/Managing_Daemons_with_phd.html'); + + $summary = pht( + 'You must start the Phabricator daemons to send email, rebuild '. + 'search indexes, and do other background processing.'); + + $message = pht( + 'The Phabricator daemons are not running, so Phabricator will not '. + 'be able to perform background processing (including sending email, '. + 'rebuilding search indexes, importing commits, cleaning up old data, '. + 'running builds, etc.).'. + "\n\n". + 'Use %s to start daemons. See %s for more information.', + phutil_tag('tt', array(), 'bin/phd start'), + phutil_tag( + 'a', + array( + 'href' => $doc_href, + ), + pht('Managing Daemons with phd'))); + + $this->newIssue('daemons.not-running') + ->setShortName(pht('Daemons Not Running')) + ->setName(pht('Phabricator Daemons Are Not Running')) + ->setSummary($summary) + ->setMessage($message) + ->addCommand('phabricator/ $ ./bin/phd start'); + } + + } +}