Skip to content

Commit 1b64a98

Browse files
committed
Add info for systemd based distros
Provide examples for managing the buildbot-worker service through systemd unit files for systemd based distributions.
1 parent 120a4a2 commit 1b64a98

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

testing/new-buildbot-worker.rst

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ For Linux:
7171

7272
* If your package manager provides the buildbot worker software, that is
7373
probably the best way to install it; it may create the buildbot user for
74-
you, in which case you can skip that step. Otherwise, do ``pip install
75-
buildbot-worker``.
74+
you, in which case you can skip the next step. Otherwise, do ``pip install
75+
buildbot-worker`` or ``pip3 install buildbot-worker``.
7676
* Create a ``buildbot`` user (using, eg: ``useradd``) if necessary.
7777
* Log in as the buildbot user.
7878

@@ -112,7 +112,64 @@ machine reboots:
112112

113113
For Linux:
114114

115-
* Add the following line to ``/etc/crontab``::
115+
* For systemd based distributions, you can create a systemd unit file in order
116+
to manage the service. Create the unit file named ``buildbot-worker.service``
117+
under ``/etc/systemd/system`` and change the paths according to where the
118+
buildbot-worker binary resides. You can verify its location by running
119+
``which buildbot-worker``. If you installed the buildbot-worker through
120+
your package manager it would be::
121+
122+
[Unit]
123+
Description=Buildbot Worker
124+
Wants=network.target
125+
After=network.target
126+
127+
[Service]
128+
Type=forking
129+
PIDFile=/home/buildbot/buildarea/twistd.pid
130+
WorkingDirectory=/home/buildbot/buildarea
131+
ExecStart=/usr/bin/buildbot-worker start
132+
ExecReload=/usr/bin/buildbot-worker restart
133+
ExecStop=/usr/bin/buildbot-worker stop
134+
Restart=always
135+
User=buildbot
136+
137+
[Install]
138+
WantedBy=multi-user.target
139+
140+
If you installed the buildbot-worker through pip, the systemd unit
141+
file will look like this::
142+
143+
[Unit]
144+
Description=Buildbot Worker
145+
Wants=network.target
146+
After=network.target
147+
148+
[Service]
149+
Type=forking
150+
PIDFile=/home/buildbot/buildarea/twistd.pid
151+
WorkingDirectory=/home/buildbot/buildarea
152+
ExecStart=/usr/local/bin/buildbot-worker start
153+
ExecReload=/usr/local/bin/buildbot-worker restart
154+
ExecStop=/usr/local/bin/buildbot-worker stop
155+
Restart=always
156+
User=buildbot
157+
158+
[Install]
159+
WantedBy=multi-user.target
160+
161+
Then run ``systemctl enable --now buildbot-worker.service`` to start the service
162+
and have it activated on every reboot.
163+
164+
Note that using a systemd unit file, might produce some selinux warnings on systems
165+
where the enforcing mode is enabled, usually related to the twistd.pid file.
166+
If the service fails to start, you should check the output of
167+
``systemctl status buildbot-worker.service`` as well as the
168+
``/var/log/audit/audit.log`` file for potential issues and remedies.
169+
170+
|
171+
172+
* Alternatively you can create a cronjob. Add the following line to ``/etc/crontab``::
116173

117174
@reboot buildbot-worker restart /path/to/buildarea
118175

0 commit comments

Comments
 (0)