Managing Daemons with phdPhorge User Documentation (Configuration)
Explains Phorge daemons and the daemon control program phd.
Phorge uses daemons (background processing scripts) to handle a number of tasks:
- tracking repositories, discovering new commits, and importing and parsing commits;
- sending email; and
- collecting garbage, like old logs and caches.
Daemons are started and stopped with phd (the Phabricator Daemon launcher). Daemons can be monitored via a web console.
You do not need to run daemons for most parts of Phorge to work, but some features (principally, repository tracking with Diffusion) require them and several features will benefit in performance or stability if you configure daemons.
phd is a command-line script (located at phorge/bin/phd). To get a list of commands, run phd help:
phorge/ $ ./bin/phd help NAME phd - phorge daemon launcher ...
Generally, you will use:
- phd start to launch all daemons;
- phd restart to restart all daemons;
- phd status to get a list of running daemons; and
- phd stop to stop all daemons.
If you want finer-grained control, you can use:
- phd launch to launch individual daemons; and
- phd debug to debug problems with daemons.
You can view status and debugging information for daemons in the Daemon Console via the web interface. Go to /daemon/ in your install or click Daemon Console from "More Stuff".
The Daemon Console shows a list of all the daemons that have ever launched, and allows you to view log information for them. If you have issues with daemons, you may be able to find error information that will help you resolve the problem in the console.
You can get a list of launchable daemons with phd list:
- test daemons are not generally useful unless you are developing daemon infrastructure or debugging a daemon problem;
- PhabricatorTaskmasterDaemon performs work from a task queue;
- PhabricatorRepositoryPullLocalDaemon daemons track repositories, for more information see Diffusion User Guide; and
- PhabricatorTriggerDaemon schedules event triggers and cleans up old logs and caches.
In most cases, phd start handles launching all the daemons you need. However, you may want to use more granular daemon controls to debug daemons, launch custom daemons, or launch special daemons like the IRC bot.
To debug a daemon, use phd debug:
phorge/bin/ $ ./phd debug <daemon>
You can pass arguments like this (normal arguments are passed to the daemon control mechanism, not to the daemon itself):
phorge/bin/ $ ./phd debug <daemon> -- --flavor apple
In debug mode, daemons do not daemonize, and they print additional debugging output to the console. This should make it easier to debug problems. You can terminate the daemon with ^C.
To launch a nonstandard daemon, use phd launch:
phorge/bin/ $ ./phd launch <daemon>
This daemon will daemonize and run normally.
- You can set the maximum number of taskmasters that will run at once by adjusting phd.taskmasters. If you have a task backlog, try increasing it.
- When you phd launch or phd debug a daemon, you can type any unique substring of its name, so phd launch pull will work correctly.
- phd stop and phd restart stop all of the daemons on the machine, not just those started with phd start. If you're writing a restart script, have it launch any custom daemons explicitly after phd restart.
- You can write your own daemons and manage them with phd by extending PhabricatorDaemon. See Adding New Classes.
- See Diffusion User Guide for details about tuning the repository daemon.
For information about running daemons on multiple hosts, see Cluster: Daemons.