Skip to content

Commit be6a64f

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 7a7dc92 commit be6a64f

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

buildworker.rst

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

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

@@ -111,7 +111,64 @@ machine reboots:
111111

112112
For Linux:
113113

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

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

0 commit comments

Comments
 (0)