@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phd: add systemd unit files

Summary:
The documentation for many years has included a sample systemd unit for phd.
Save administrators some time and hassle by providing unit files and directing
them to use `systemctl link` to make use of it. This has the benefit of being a
bit faster to configure, and allows updates of the unit file at the same time
as the rest of Phorge.

Test Plan:
Try out the instructions in Diviner and observe a working phd service.

One instance from my multi-tenant install:

```
● phd@spookygirl.service - Phorge Daemons
Loaded: loaded (/etc/systemd/system/phd@spookygirl.service; enabled; preset: disabled)
Active: active (running) since Sat 2025-07-12 19:20:10 UTC; 4 days ago
Invocation: 88cc57a8c0f34b42a5616885bfff8709
Docs: https://we.phorge.it/book/phorge/article/managing_daemons/
Process: 3482251 ExecStart=/srv/phorge/bin/phd start (code=exited, status=0/SUCCESS)
Main PID: 3482256 (php)
Tasks: 1 (limit: 9510)
Memory: 24.7M (peak: 169.8M)
CPU: 1h 28min 39.112s
CGroup: /system.slice/system-phd.slice/phd@spookygirl.service
└─3482256 php /srv/phorge/scripts/daemon/phd-daemon -l spookygirl

Jul 12 19:20:09 phorge phd[3482251]: Freeing active task leases...
Jul 12 19:20:09 phorge phd[3482251]: Freed 0 task leases.
Jul 12 19:20:09 phorge phd[3482251]: Launching daemons:
Jul 12 19:20:09 phorge phd[3482251]: (Logs will appear in "/var/log/phorge/sgb/daemons.log".)
Jul 12 19:20:09 phorge phd[3482251]: (Pool: 1) PhabricatorRepositoryPullLocalDaemon
Jul 12 19:20:09 phorge phd[3482251]: (Pool: 1) PhabricatorTriggerDaemon
Jul 12 19:20:09 phorge phd[3482251]: (Pool: 1) PhabricatorFactDaemon
Jul 12 19:20:09 phorge phd[3482251]: (Pool: 16) PhabricatorTaskmasterDaemon
Jul 12 19:20:10 phorge phd[3482251]: Done.
Jul 12 19:20:10 phorge systemd[1]: Started Phorge Daemons.
```

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D26181

amy bones 7000275c c1b25966

+52 -18
+2 -1
.arclint
··· 3 3 "(^externals/)", 4 4 "(^webroot/rsrc/externals/(?!javelin/))", 5 5 "(/__tests__/data/)", 6 - "(^support/aphlict/server/package-lock.json)" 6 + "(^support/aphlict/server/package-lock.json)", 7 + "(^resources/phd/phorge-phd@.service)" 7 8 ], 8 9 "linters": { 9 10 "chmod": {
+17
resources/phd/phorge-phd.service
··· 1 + [Unit] 2 + Description=Phorge Daemons 3 + Documentation=https://we.phorge.it/book/phorge/article/managing_daemons/ 4 + After=syslog.target network.target 5 + 6 + [Service] 7 + Type=forking 8 + EnvironmentFile=/etc/phorge/environment 9 + User=phd 10 + Group=phd 11 + ExecStart="${PHORGE_ROOT}/bin/phd" start 12 + ExecStop="${PHORGE_ROOT}/bin/phd" stop 13 + 14 + Restart=on-failure 15 + 16 + [Install] 17 + WantedBy=multi-user.target
+19
resources/phd/phorge-phd@.service
··· 1 + [Unit] 2 + Description=Phorge Daemons 3 + Documentation=https://we.phorge.it/book/phorge/article/managing_daemons/ 4 + After=syslog.target network.target 5 + 6 + [Service] 7 + Type=forking 8 + Environment=PHABRICATOR_ENV=%I 9 + EnvironmentFile=/etc/phorge/environment 10 + EnvironmentFile=-/etc/phorge/%I.env 11 + User=phd 12 + Group=phd 13 + ExecStart="${PHORGE_ROOT}/bin/phd" start 14 + ExecStop="${PHORGE_ROOT}/bin/phd" stop 15 + 16 + Restart=on-failure 17 + 18 + [Install] 19 + WantedBy=multi-user.target
+14 -17
src/docs/user/configuration/managing_daemons.diviner
··· 65 65 - you have a dedicated Unix user called `daemon-user` - coming from 66 66 @{article:Diffusion User Guide} 67 67 68 - With the above assumptions, create this configuration file as super-user: 68 + With the above assumptions, link the phd service into your system configuration. 69 + As super-user, run: 69 70 70 - ```lang=ini,name=/etc/systemd/system/phorge-phd.service 71 - [Unit] 72 - Description=Phorge Daemons 73 - Documentation=https://we.phorge.it/book/phorge/article/managing_daemons/ 74 - After=syslog.target network.target mariadb.service 71 + ``` 72 + systemctl link /somewhere/phorge/resources/phd/phorge-phd.service 73 + ``` 75 74 76 - [Service] 77 - Type=forking 78 - User=daemon-user 79 - Group=daemon-user 80 - ExecStart=/somewhere/phorge/bin/phd start 81 - ExecStop=/somewhere/phorge/bin/phd stop 75 + Then, also as super-user, create the following configuration: 82 76 83 - [Install] 84 - WantedBy=multi-user.target 77 + ```lang=ini,name=/etc/phorge/environment 78 + PHORGE_ROOT=/somewhere/phorge 85 79 ``` 86 80 87 - To install this new systemd configuration, execute these commands as 88 - super-user: 81 + To install this new systemd configuration, execute these commands as super-user: 89 82 90 83 ``` 91 - systemctl daemon-reload 92 84 systemctl enable --now phorge-phd 93 85 ``` 94 86 ··· 99 91 ``` 100 92 systemctl status phorge-phd 101 93 ``` 94 + 95 + NOTE: In addition to the basic `phd.service` file, Phorge also ships with a 96 + systemd "template unit" in the same directory as the standard unit, for use with 97 + advanced or multi-tenant installations. This is an advanced feature that the 98 + majority of installations will not need. 102 99 103 100 Anything else can be explored in depth by reading the systemd documentation. 104 101