Skip to content

Commit a84443d

Browse files
authored
Add bulidbot setup info for systemd based distros (#583)
Provide examples for managing the buildbot-worker service through systemd unit files for systemd based distributions.
1 parent 6b8a1ea commit a84443d

File tree

1 file changed

+66
-3
lines changed

1 file changed

+66
-3
lines changed

testing/new-buildbot-worker.rst

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ For Linux:
7272

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

@@ -125,7 +125,70 @@ machine reboots:
125125

126126
For Linux:
127127

128-
* Add the following line to ``/etc/crontab``::
128+
* For systemd based distributions, you can create a systemd unit file in order
129+
to manage the service. Create the unit file named ``buildbot-worker.service``
130+
under ``/home/buildbot/.config/systemd/user/`` and change the paths according to where the
131+
buildbot-worker binary resides. You can verify its location by running
132+
``which buildbot-worker``.
133+
If you installed the buildbot-worker through
134+
your package manager it would be::
135+
136+
[Unit]
137+
Description=Buildbot Worker
138+
Wants=network-online.target
139+
After=network-online.target local-fs.target
140+
141+
[Service]
142+
Type=forking
143+
PIDFile=/home/buildbot/buildarea/twistd.pid
144+
WorkingDirectory=/home/buildbot/buildarea
145+
ExecStart=/usr/bin/buildbot-worker start
146+
ExecReload=/usr/bin/buildbot-worker restart
147+
ExecStop=/usr/bin/buildbot-worker stop
148+
Restart=always
149+
User=buildbot
150+
151+
[Install]
152+
WantedBy=multi-user.target
153+
154+
155+
If you installed the buildbot-worker through pip, the systemd unit
156+
file should look like this::
157+
158+
[Unit]
159+
Description=Buildbot Worker
160+
Wants=network-online.target
161+
After=network-online.target local-fs.target
162+
163+
[Service]
164+
Type=forking
165+
PIDFile=/home/buildbot/buildarea/twistd.pid
166+
WorkingDirectory=/home/buildbot/buildarea
167+
ExecStart=/usr/local/bin/buildbot-worker start
168+
ExecReload=/usr/local/bin/buildbot-worker restart
169+
ExecStop=/usr/local/bin/buildbot-worker stop
170+
Restart=always
171+
User=buildbot
172+
173+
[Install]
174+
WantedBy=multi-user.target
175+
176+
177+
Then enable lingering for the buildbot user via the
178+
``loginctl enable-linger buildbot`` command and you can start
179+
the service through a login shell of the buildbot user
180+
via the ``systemctl --user enable --now buildbot-worker.service``
181+
command.
182+
183+
Note that using a systemd unit file, might produce some selinux warnings on systems
184+
where the enforcing mode is enabled, usually related to the twistd.pid file.
185+
If the service fails to start, you should check the output of
186+
``systemctl status buildbot-worker.service`` as well as the
187+
``/var/log/audit/audit.log`` file (e.g. through
188+
``sealert -a /var/log/audit/audit.log``) for potential issues and remedies.
189+
190+
191+
* Alternatively you can create a cronjob. Add the following line to ``/etc/crontab``::
129192

130193
@reboot buildbot-worker restart /path/to/buildarea
131194

0 commit comments

Comments
 (0)