blob: fa72c661500916e11a8a030a90f8f843192d1428 [file] [log] [blame]
James E. Blaireff5a9d2017-06-20 00:00:37 -07001:title: Components
2
3.. _components:
4
5Components
6==========
7
8Zuul is a distributed system consisting of several components, each of
James E. Blaire86abe12017-08-04 14:46:00 -07009which is described below.
10
James E. Blaire86abe12017-08-04 14:46:00 -070011.. graphviz::
12 :align: center
13
14 graph {
15 node [shape=box]
16 Gearman [shape=ellipse]
17 Gerrit [fontcolor=grey]
18 Zookeeper [shape=ellipse]
19 Nodepool
20 GitHub [fontcolor=grey]
21
22 Merger -- Gearman
23 Executor -- Gearman
24 Web -- Gearman
25
26 Gearman -- Scheduler;
27 Scheduler -- Gerrit;
28 Scheduler -- Zookeeper;
29 Zookeeper -- Nodepool;
30 Scheduler -- GitHub;
31 }
32
James E. Blair60d880a2018-01-17 08:50:10 -080033Each of the Zuul processes may run on the same host, or different
34hosts. Within Zuul, the components communicate with the scheduler via
35the Gearman protocol, so each Zuul component needs to be able to
36connect to the host running the Gearman server (the scheduler has a
37built-in Gearman server which is recommended) on the Gearman port --
38TCP port 4730 by default.
James E. Blaire86abe12017-08-04 14:46:00 -070039
James E. Blair60d880a2018-01-17 08:50:10 -080040The Zuul scheduler communicates with Nodepool via the ZooKeeper
41protocol. Nodepool requires an external ZooKeeper cluster, and the
42Zuul scheduler needs to be able to connect to the hosts in that
43cluster on TCP port 2181.
44
45Both the Nodepool launchers and Zuul executors need to be able to
46communicate with the hosts which nodepool provides. If these are on
47private networks, the Executors will need to be able to route traffic
48to them.
49
50If statsd is enabled, every service needs to be able to emit data to
51statsd. Statsd can be configured to run on each host and forward
52data, or services may emit to a centralized statsd collector. Statsd
53listens on UDP port 8125 by default.
James E. Blaire86abe12017-08-04 14:46:00 -070054
55All Zuul processes read the ``/etc/zuul/zuul.conf`` file (an alternate
56location may be supplied on the command line) which uses an INI file
57syntax. Each component may have its own configuration file, though
58you may find it simpler to use the same file for all components.
James E. Blaireff5a9d2017-06-20 00:00:37 -070059
James E. Blair97940192017-08-03 14:47:47 -070060An example ``zuul.conf``:
61
62.. code-block:: ini
63
64 [gearman]
65 server=localhost
66
67 [gearman_server]
68 start=true
69 log_config=/etc/zuul/gearman-logging.yaml
70
71 [zookeeper]
72 hosts=zk1.example.com,zk2.example.com,zk3.example.com
73
Tobias Henkel940da002018-01-23 12:17:27 +010074 [web]
James E. Blair97940192017-08-03 14:47:47 -070075 status_url=https://zuul.example.com/status
76
77 [scheduler]
78 log_config=/etc/zuul/scheduler-logging.yaml
79
80A minimal Zuul system may consist of a :ref:`scheduler` and
81:ref:`executor` both running on the same host. Larger installations
82should consider running multiple executors, each on a dedicated host,
83and running mergers on dedicated hosts as well.
James E. Blaireff5a9d2017-06-20 00:00:37 -070084
85Common
86------
87
88The following applies to all Zuul components.
89
90Configuration
91~~~~~~~~~~~~~
92
James E. Blair97940192017-08-03 14:47:47 -070093The following sections of ``zuul.conf`` are used by all Zuul components:
James E. Blaireff5a9d2017-06-20 00:00:37 -070094
James E. Blaireff5a9d2017-06-20 00:00:37 -070095
James E. Blair97940192017-08-03 14:47:47 -070096.. attr:: gearman
James E. Blaireff5a9d2017-06-20 00:00:37 -070097
James E. Blair97940192017-08-03 14:47:47 -070098 Client connection information for Gearman.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -040099
James E. Blair97940192017-08-03 14:47:47 -0700100 .. attr:: server
101 :required:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700102
James E. Blair97940192017-08-03 14:47:47 -0700103 Hostname or IP address of the Gearman server.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400104
James E. Blair97940192017-08-03 14:47:47 -0700105 .. attr:: port
106 :default: 4730
James E. Blaireff5a9d2017-06-20 00:00:37 -0700107
James E. Blair97940192017-08-03 14:47:47 -0700108 Port on which the Gearman server is listening.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700109
James E. Blair97940192017-08-03 14:47:47 -0700110 .. attr:: ssl_ca
James E. Blaireff5a9d2017-06-20 00:00:37 -0700111
James E. Blair97940192017-08-03 14:47:47 -0700112 An openssl file containing a set of concatenated “certification
113 authority” certificates in PEM formet.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700114
James E. Blair97940192017-08-03 14:47:47 -0700115 .. attr:: ssl_cert
116
117 An openssl file containing the client public certificate in PEM format.
118
119 .. attr:: ssl_key
120
121 An openssl file containing the client private key in PEM format.
James E. Blairfdb111d2017-06-23 20:56:05 +0100122
James E. Blairded241e2017-10-10 13:22:40 -0700123.. attr:: statsd
124
125 Information about the optional statsd server. If the ``statsd``
126 python module is installed and this section is configured,
127 statistics will be reported to statsd. See :ref:`statsd` for more
128 information.
129
130 .. attr:: server
131
132 Hostname or IP address of the statsd server.
133
134 .. attr:: port
135 :default: 8125
136
137 The UDP port on which the statsd server is listening.
138
139 .. attr:: prefix
140
141 If present, this will be prefixed to all of the keys before
142 transmitting to the statsd server.
143
James E. Blair4f3e6222017-07-05 14:52:08 -0700144.. NOTE: this is a white lie at this point, since only the scheduler
145 uses this, however, we expect other components to use it later, so
146 it's reasonable for admins to plan for this now.
147
James E. Blair97940192017-08-03 14:47:47 -0700148.. attr:: zookeeper
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400149
James E. Blair97940192017-08-03 14:47:47 -0700150 Client connection information for ZooKeeper
James E. Blairfdb111d2017-06-23 20:56:05 +0100151
James E. Blair97940192017-08-03 14:47:47 -0700152 .. attr:: hosts
153 :required:
154
155 A list of zookeeper hosts for Zuul to use when communicating
156 with Nodepool.
157
James E. Blaire2f0a872017-09-28 10:35:12 -0700158 .. attr:: session_timeout
159 :default: 10.0
160
161 The ZooKeeper session timeout, in seconds.
162
James E. Blair97940192017-08-03 14:47:47 -0700163
164.. _scheduler:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700165
166Scheduler
167---------
168
169The scheduler is the primary component of Zuul. The scheduler is not
170a scalable component; one, and only one, scheduler must be running at
171all times for Zuul to be operational. It receives events from any
172connections to remote systems which have been configured, enqueues
173items into pipelines, distributes jobs to executors, and reports
174results.
175
James E. Blair60d880a2018-01-17 08:50:10 -0800176The scheduler includes a Gearman server which is used to communicate
177with other components of Zuul. It is possible to use an external
178Gearman server, but the built-in server is well-tested and
179recommended. If the built-in server is used, other Zuul hosts will
180need to be able to connect to the scheduler on the Gearman port, TCP
181port 4730. It is also strongly recommended to use SSL certs with
182Gearman, as secrets are transferred from the scheduler to executors
183over this link.
184
185The scheduler must be able to connect to the ZooKeeper cluster used by
186Nodepool in order to request nodes. It does not need to connect
187directly to the nodes themselves, however -- that function is handled
188by the Executors.
189
190It must also be able to connect to any services for which connections
191are configured (Gerrit, GitHub, etc).
192
James E. Blaireff5a9d2017-06-20 00:00:37 -0700193Configuration
194~~~~~~~~~~~~~
195
James E. Blair97940192017-08-03 14:47:47 -0700196The following sections of ``zuul.conf`` are used by the scheduler:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700197
James E. Blaireff5a9d2017-06-20 00:00:37 -0700198
James E. Blair97940192017-08-03 14:47:47 -0700199.. attr:: gearman_server
James E. Blaireff5a9d2017-06-20 00:00:37 -0700200
James E. Blair97940192017-08-03 14:47:47 -0700201 The builtin gearman server. Zuul can fork a gearman process from
202 itself rather than connecting to an external one.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400203
James E. Blair97940192017-08-03 14:47:47 -0700204 .. attr:: start
205 :default: false
James E. Blaireff5a9d2017-06-20 00:00:37 -0700206
James E. Blair97940192017-08-03 14:47:47 -0700207 Whether to start the internal Gearman server.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400208
James E. Blair97940192017-08-03 14:47:47 -0700209 .. attr:: listen_address
210 :default: all addresses
James E. Blaireff5a9d2017-06-20 00:00:37 -0700211
James E. Blair97940192017-08-03 14:47:47 -0700212 IP address or domain name on which to listen.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400213
Tristan Cacqueraya7586c92017-08-29 10:10:08 +0000214 .. attr:: port
215 :default: 4730
216
217 TCP port on which to listen.
218
James E. Blair97940192017-08-03 14:47:47 -0700219 .. attr:: log_config
James E. Blaireff5a9d2017-06-20 00:00:37 -0700220
James E. Blair97940192017-08-03 14:47:47 -0700221 Path to log config file for internal Gearman server.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700222
James E. Blair97940192017-08-03 14:47:47 -0700223 .. attr:: ssl_ca
James E. Blaireff5a9d2017-06-20 00:00:37 -0700224
James E. Blair97940192017-08-03 14:47:47 -0700225 An openssl file containing a set of concatenated “certification
226 authority” certificates in PEM formet.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700227
James E. Blair97940192017-08-03 14:47:47 -0700228 .. attr:: ssl_cert
James E. Blaireff5a9d2017-06-20 00:00:37 -0700229
James E. Blair97940192017-08-03 14:47:47 -0700230 An openssl file containing the server public certificate in PEM
231 format.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400232
James E. Blair97940192017-08-03 14:47:47 -0700233 .. attr:: ssl_key
James E. Blaireff5a9d2017-06-20 00:00:37 -0700234
James E. Blair97940192017-08-03 14:47:47 -0700235 An openssl file containing the server private key in PEM format.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400236
Tobias Henkel940da002018-01-23 12:17:27 +0100237.. attr:: web
238
239 .. attr:: status_url
240
241 URL that will be posted in Zuul comments made to changes when
242 starting jobs for a change.
243
244 .. TODO: is this effectively required?
245
James E. Blair97940192017-08-03 14:47:47 -0700246.. attr:: webapp
James E. Blaireff5a9d2017-06-20 00:00:37 -0700247
James E. Blair97940192017-08-03 14:47:47 -0700248 .. attr:: listen_address
249 :default: all addresses
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400250
James E. Blair97940192017-08-03 14:47:47 -0700251 IP address or domain name on which to listen.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700252
James E. Blair97940192017-08-03 14:47:47 -0700253 .. attr:: port
254 :default: 8001
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400255
James E. Blair97940192017-08-03 14:47:47 -0700256 Port on which the webapp is listening.
James E. Blair4f3e6222017-07-05 14:52:08 -0700257
James E. Blair97940192017-08-03 14:47:47 -0700258 .. attr:: status_expiry
259 :default: 1
James E. Blaireff5a9d2017-06-20 00:00:37 -0700260
James E. Blair97940192017-08-03 14:47:47 -0700261 Zuul will cache the status.json file for this many seconds.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400262
James E. Blair97940192017-08-03 14:47:47 -0700263.. attr:: scheduler
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400264
Paul Belanger40d3ce62017-11-28 11:49:55 -0500265 .. attr:: command_socket
266 :default: /var/lib/zuul/scheduler.socket
267
268 Path to command socket file for the scheduler process.
269
James E. Blair97940192017-08-03 14:47:47 -0700270 .. attr:: tenant_config
271 :required:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700272
James E. Blair97940192017-08-03 14:47:47 -0700273 Path to :ref:`tenant-config` file.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400274
James E. Blair97940192017-08-03 14:47:47 -0700275 .. attr:: log_config
276
277 Path to log config file.
278
279 .. attr:: pidfile
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700280 :default: /var/run/zuul-schedurecr/zuul-scheduler.pid
James E. Blair97940192017-08-03 14:47:47 -0700281
282 Path to PID lock file.
283
284 .. attr:: state_dir
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700285 :default: /var/lib/zuul
James E. Blair97940192017-08-03 14:47:47 -0700286
287 Path to directory in which Zuul should save its state.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700288
289Operation
290~~~~~~~~~
291
292To start the scheduler, run ``zuul-scheduler``. To stop it, kill the
293PID which was saved in the pidfile specified in the configuration.
294
295Most of Zuul's configuration is automatically updated as changes to
296the repositories which contain it are merged. However, Zuul must be
297explicitly notified of changes to the tenant config file, since it is
298not read from a git repository. To do so, send the scheduler PID
James E. Blair97940192017-08-03 14:47:47 -0700299(saved in the pidfile specified in the configuration) a `SIGHUP`
300signal.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700301
302Merger
303------
304
305Mergers are an optional Zuul service; they are not required for Zuul
306to operate, but some high volume sites may benefit from running them.
307Zuul performs quite a lot of git operations in the course of its work.
308Each change that is to be tested must be speculatively merged with the
309current state of its target branch to ensure that it can merge, and to
310ensure that the tests that Zuul perform accurately represent the
311outcome of merging the change. Because Zuul's configuration is stored
312in the git repos it interacts with, and is dynamically evaluated, Zuul
313often needs to perform a speculative merge in order to determine
314whether it needs to perform any further actions.
315
316All of these git operations add up, and while Zuul executors can also
317perform them, large numbers may impact their ability to run jobs.
318Therefore, administrators may wish to run standalone mergers in order
319to reduce the load on executors.
320
James E. Blair60d880a2018-01-17 08:50:10 -0800321Mergers need to be able to connect to the Gearman server (usually the
322scheduler host) as well as any services for which connections are
323configured (Gerrit, GitHub, etc).
324
James E. Blaireff5a9d2017-06-20 00:00:37 -0700325Configuration
326~~~~~~~~~~~~~
327
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700328The following section of ``zuul.conf`` is used by the merger:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700329
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700330.. attr:: merger
James E. Blaireff5a9d2017-06-20 00:00:37 -0700331
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500332 .. attr:: command_socket
Paul Belanger76506112017-11-27 14:10:30 -0500333 :default: /var/lib/zuul/merger.socket
334
335 Path to command socket file for the merger process.
336
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700337 .. attr:: git_dir
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400338
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700339 Directory in which Zuul should clone git repositories.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700340
Paul Belangeredadfed2017-10-05 16:04:27 -0400341 .. attr:: git_http_low_speed_limit
342 :default: 1000
343
344 If the HTTP transfer speed is less then git_http_low_speed_limit for
345 longer then git_http_low_speed_time, the transfer is aborted.
346
347 Value in bytes, setting to 0 will disable.
348
349 .. attr:: git_http_low_speed_time
350 :default: 30
351
352 If the HTTP transfer speed is less then git_http_low_speed_limit for
353 longer then git_http_low_speed_time, the transfer is aborted.
354
355 Value in seconds, setting to 0 will disable.
356
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700357 .. attr:: git_user_email
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400358
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700359 Value to pass to `git config user.email
360 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700361
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700362 .. attr:: git_user_name
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400363
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700364 Value to pass to `git config user.name
365 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700366
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700367 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400368
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700369 Path to log config file for the merger process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700370
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700371 .. attr:: pidfile
372 :default: /var/run/zuul-merger/zuul-merger.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400373
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700374 Path to PID lock file for the merger process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700375
376Operation
377~~~~~~~~~
378
379To start the merger, run ``zuul-merger``. To stop it, kill the
380PID which was saved in the pidfile specified in the configuration.
381
David Shrewsburyb040b0a2017-08-03 15:53:59 -0400382.. _executor:
383
James E. Blaireff5a9d2017-06-20 00:00:37 -0700384Executor
385--------
386
387Executors are responsible for running jobs. At the start of each job,
388an executor prepares an environment in which to run Ansible which
389contains all of the git repositories specified by the job with all
390dependent changes merged into their appropriate branches. The branch
391corresponding to the proposed change will be checked out (in all
392projects, if it exists). Any roles specified by the job will also be
393present (also with dependent changes merged, if appropriate) and added
394to the Ansible role path. The executor also prepares an Ansible
395inventory file with all of the nodes requested by the job.
396
397The executor also contains a merger. This is used by the executor to
398prepare the git repositories used by jobs, but is also available to
399perform any tasks normally performed by standalone mergers. Because
400the executor performs both roles, small Zuul installations may not
401need to run standalone mergers.
402
James E. Blair60d880a2018-01-17 08:50:10 -0800403Executors need to be able to connect to the Gearman server (usually
404the scheduler host), any services for which connections are configured
405(Gerrit, GitHub, etc), as well as directly to the hosts which Nodepool
406provides.
407
James E. Blaireff5a9d2017-06-20 00:00:37 -0700408Trusted and Untrusted Playbooks
409~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410
411The executor runs playbooks in one of two execution contexts depending
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700412on whether the project containing the playbook is a
413:term:`config-project` or an :term:`untrusted-project`. If the
414playbook is in a config project, the executor runs the playbook in the
415*trusted* execution context, otherwise, it is run in the *untrusted*
416execution context.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700417
Clint Byrum48b5a672017-08-18 14:44:00 -0700418Both execution contexts use `bubblewrap`_ [#nullwrap]_ to create a
419namespace to ensure that playbook executions are isolated and are unable
420to access files outside of a restricted environment. The administrator
421may configure additional local directories on the executor to be made
James E. Blaireff5a9d2017-06-20 00:00:37 -0700422available to the restricted environment.
423
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700424The trusted execution context has access to all Ansible features,
James E. Blaireff5a9d2017-06-20 00:00:37 -0700425including the ability to load custom Ansible modules. Needless to
426say, extra scrutiny should be given to code that runs in a trusted
427context as it could be used to compromise other jobs running on the
428executor, or the executor itself, especially if the administrator has
429granted additional access through bubblewrap, or a method of escaping
430the restricted environment created by bubblewrap is found.
431
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700432Playbooks run in the untrusted execution context are not permitted to
433load additional Ansible modules or access files outside of the
James E. Blaireff5a9d2017-06-20 00:00:37 -0700434restricted environment prepared for them by the executor. In addition
435to the bubblewrap environment applied to both execution contexts, in
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700436the untrusted context some standard Ansible modules are replaced with
437versions which prohibit some actions, including attempts to access
438files outside of the restricted execution context. These redundant
439protections are made as part of a defense-in-depth strategy.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700440
441.. _bubblewrap: https://github.com/projectatomic/bubblewrap
Clint Byrum48b5a672017-08-18 14:44:00 -0700442.. [#nullwrap] Unless one has set execution_wrapper to nullwrap in the
443 executor configuration.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700444
445Configuration
446~~~~~~~~~~~~~
447
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700448The following sections of ``zuul.conf`` are used by the executor:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700449
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700450.. attr:: executor
James E. Blaireff5a9d2017-06-20 00:00:37 -0700451
Paul Belanger20920912017-11-28 11:22:30 -0500452 .. attr:: command_socket
453 :default: /var/lib/zuul/executor.socket
454
455 Path to command socket file for the executor process.
456
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700457 .. attr:: finger_port
David Shrewsbury93eb56d2018-01-10 11:50:03 -0500458 :default: 7900
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400459
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700460 Port to use for finger log streamer.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700461
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700462 .. attr:: git_dir
463 :default: /var/lib/zuul/git
James E. Blair7e6e0a12017-07-25 11:04:42 -0700464
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700465 Directory that Zuul should clone local git repositories to. The
466 executor keeps a local copy of every git repository it works
467 with to speed operations and perform speculative merging.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400468
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700469 This should be on the same filesystem as
470 :attr:`executor.job_dir` so that when git repos are cloned into
471 the job workspaces, they can be hard-linked to the local git
472 cache.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700473
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700474 .. attr:: job_dir
475 :default: /tmp
James E. Blair7e6e0a12017-07-25 11:04:42 -0700476
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700477 Directory that Zuul should use to hold temporary job directories.
478 When each job is run, a new entry will be created under this
479 directory to hold the configuration and scratch workspace for
480 that job. It will be deleted at the end of the job (unless the
481 `--keep-jobdir` command line option is specified).
James E. Blair7e6e0a12017-07-25 11:04:42 -0700482
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700483 This should be on the same filesystem as :attr:`executor.git_dir`
484 so that when git repos are cloned into the job workspaces, they
485 can be hard-linked to the local git cache.
James E. Blair7e6e0a12017-07-25 11:04:42 -0700486
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700487 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400488
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700489 Path to log config file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700490
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700491 .. attr:: pidfile
492 :default: /var/run/zuul-executor/zuul-executor.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400493
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700494 Path to PID lock file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700495
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700496 .. attr:: private_key_file
497 :default: ~/.ssh/id_rsa
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400498
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700499 SSH private key file to be used when logging into worker nodes.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700500
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700501 .. _admin_sitewide_variables:
Jamie Lennox7655b552017-03-17 12:33:38 +1100502
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700503 .. attr:: variables
Jamie Lennox7655b552017-03-17 12:33:38 +1100504
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700505 Path to an Ansible variables file to supply site-wide variables.
506 This should be a YAML-formatted file consisting of a single
507 dictionary. The contents will be made available to all jobs as
508 Ansible variables. These variables take precedence over all
509 other forms (job variables and secrets). Care should be taken
510 when naming these variables to avoid potential collisions with
511 those used by jobs. Prefixing variable names with a
512 site-specific identifier is recommended. The default is not to
513 add any site-wide variables. See the :ref:`User's Guide
514 <user_sitewide_variables>` for more information.
Clint Byrumdc8a0902017-07-20 16:36:27 -0700515
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700516 .. attr:: disk_limit_per_job
517 :default: 250
Clint Byrumdc8a0902017-07-20 16:36:27 -0700518
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700519 This integer is the maximum number of megabytes that any one job
520 is allowed to consume on disk while it is running. If a job's
521 scratch space has more than this much space consumed, it will be
522 aborted.
Monty Taylor01380dd2017-07-28 16:01:20 -0500523
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700524 .. attr:: trusted_ro_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500525
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700526 List of paths, separated by ``:`` to read-only bind mount into
527 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500528
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700529 .. attr:: trusted_rw_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500530
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700531 List of paths, separated by ``:`` to read-write bind mount into
532 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500533
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700534 .. attr:: untrusted_ro_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500535
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700536 List of paths, separated by ``:`` to read-only bind mount into
537 untrusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500538
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700539 .. attr:: untrusted_rw_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500540
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700541 List of paths, separated by ``:`` to read-write bind mount into
542 untrusted bubblewrap contexts.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700543
Clint Byrum48b5a672017-08-18 14:44:00 -0700544 .. attr:: execution_wrapper
545 :default: bubblewrap
546
547 Name of the execution wrapper to use when executing
548 `ansible-playbook`. The default, `bubblewrap` is recommended for
549 all installations.
550
551 There is also a `nullwrap` driver for situations where one wants
552 to run Zuul without access to bubblewrap or in such a way that
553 bubblewrap may interfere with the jobs themselves. However,
554 `nullwrap` is considered unsafe, as `bubblewrap` provides
555 significant protections against malicious users and accidental
556 breakage in playbooks. As such, `nullwrap` is not recommended
557 for use in production.
James E. Blair60d880a2018-01-17 08:50:10 -0800558
Clint Byrum48b5a672017-08-18 14:44:00 -0700559 This option, and thus, `nullwrap`, may be removed in the future.
560 `bubblewrap` has become integral to securely operating Zuul. If you
561 have a valid use case for it, we encourage you to let us know.
562
Clint Byrum3cef7ed2017-09-29 20:18:54 -0700563 .. attr:: load_multiplier
564 :default: 2.5
565
566 When an executor host gets too busy, the system may suffer
567 timeouts and other ill effects. The executor will stop accepting
568 more than 1 job at a time until load has lowered below a safe
569 level. This level is determined by multiplying the number of
570 CPU's by `load_multiplier`.
571
572 So for example, if the system has 2 CPUs, and load_multiplier
573 is 2.5, the safe load for the system is 5.00. Any time the
574 system load average is over 5.00, the executor will quit
575 accepting multiple jobs at one time.
576
577 The executor will observe system load and determine whether
578 to accept more jobs every 30 seconds.
579
Tobias Henkel055cda32017-10-17 13:08:18 +0200580 .. attr:: hostname
581 :default: hostname of the server
582
583 The executor needs to know its hostname under which it is reachable by
584 zuul-web. Otherwise live console log streaming doesn't work. In most cases
585 This is automatically detected correctly. But when running in environments
586 where it cannot determine its hostname correctly this can be overridden
587 here.
588
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700589.. attr:: merger
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400590
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700591 .. attr:: git_user_email
James E. Blaireff5a9d2017-06-20 00:00:37 -0700592
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700593 Value to pass to `git config user.email
594 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400595
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700596 .. attr:: git_user_name
597
598 Value to pass to `git config user.name
599 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700600
601Operation
602~~~~~~~~~
603
604To start the executor, run ``zuul-executor``.
605
606There are several commands which can be run to control the executor's
607behavior once it is running.
608
609To stop the executor immediately, aborting all jobs (they may be
610relaunched according to their retry policy), run ``zuul-executor
611stop``.
612
613To request that the executor stop executing new jobs and exit when all
614currently running jobs have completed, run ``zuul-executor graceful``.
615
James E. Blairafe27e62017-08-03 15:11:47 -0700616To enable or disable running Ansible in verbose mode (with the
617``-vvv`` argument to ansible-playbook) run ``zuul-executor verbose``
618and ``zuul-executor unverbose``.
David Shrewsburyae734d12017-07-11 12:41:59 -0400619
620Web Server
621----------
622
623The Zuul web server currently acts as a websocket interface to live log
624streaming. Eventually, it will serve as the single process handling all
625HTTP interactions with Zuul.
626
James E. Blair60d880a2018-01-17 08:50:10 -0800627Web servers need to be able to connect to the Gearman server (usually
628the scheduler host). If the SQL reporter is used, they need to be
629able to connect to the database it reports to in order to support the
630dashboard. If a GitHub connection is configured, they need to be
631reachable by GitHub so they may receive notifications.
632
David Shrewsburyae734d12017-07-11 12:41:59 -0400633Configuration
634~~~~~~~~~~~~~
635
James E. Blairafe27e62017-08-03 15:11:47 -0700636In addition to the common configuration sections, the following
637sections of ``zuul.conf`` are used by the web server:
David Shrewsburyae734d12017-07-11 12:41:59 -0400638
James E. Blairafe27e62017-08-03 15:11:47 -0700639.. attr:: web
David Shrewsburyae734d12017-07-11 12:41:59 -0400640
James E. Blairafe27e62017-08-03 15:11:47 -0700641 .. attr:: listen_address
642 :default: 127.0.0.1
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400643
James E. Blairafe27e62017-08-03 15:11:47 -0700644 IP address or domain name on which to listen.
David Shrewsburyae734d12017-07-11 12:41:59 -0400645
James E. Blairafe27e62017-08-03 15:11:47 -0700646 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400647
James E. Blairafe27e62017-08-03 15:11:47 -0700648 Path to log config file for the web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400649
James E. Blairafe27e62017-08-03 15:11:47 -0700650 .. attr:: pidfile
651 :default: /var/run/zuul-web/zuul-web.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400652
James E. Blairafe27e62017-08-03 15:11:47 -0700653 Path to PID lock file for the web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400654
James E. Blairafe27e62017-08-03 15:11:47 -0700655 .. attr:: port
656 :default: 9000
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400657
James E. Blairafe27e62017-08-03 15:11:47 -0700658 Port to use for web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400659
James E. Blairafe27e62017-08-03 15:11:47 -0700660 .. attr:: websocket_url
661
662 Base URL on which the websocket service is exposed, if different
663 than the base URL of the web app.
Tobias Henkelb4407fc2017-07-07 13:52:56 +0200664
Tristan Cacqueray3c2d39d2017-11-29 05:36:55 +0000665 .. attr:: static_cache_expiry
666 :default: 3600
667
668 The Cache-Control max-age response header value for static files served
669 by the zuul-web. Set to 0 during development to disable Cache-Control.
670
David Shrewsburyae734d12017-07-11 12:41:59 -0400671Operation
672~~~~~~~~~
673
674To start the web server, run ``zuul-web``. To stop it, kill the
675PID which was saved in the pidfile specified in the configuration.
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500676
677Finger Gateway
678--------------
679
David Shrewsburyae3d96b2017-12-13 13:01:46 -0500680The Zuul finger gateway listens on the standard finger port (79) for
681finger requests specifying a build UUID for which it should stream log
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500682results. The gateway will determine which executor is currently running that
683build and query that executor for the log stream.
684
685This is intended to be used with the standard finger command line client.
686For example::
687
688 finger UUID@zuul.example.com
689
690The above would stream the logs for the build identified by `UUID`.
691
James E. Blair60d880a2018-01-17 08:50:10 -0800692Finger gateway servers need to be able to connect to the Gearman
693server (usually the scheduler host), as well as the console streaming
694port on the executors (usually 7900).
695
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500696Configuration
697~~~~~~~~~~~~~
698
699In addition to the common configuration sections, the following
700sections of ``zuul.conf`` are used by the finger gateway:
701
702.. attr:: fingergw
703
704 .. attr:: command_socket
705 :default: /var/lib/zuul/fingergw.socket
706
707 Path to command socket file for the executor process.
708
709 .. attr:: listen_address
710 :default: all addresses
711
712 IP address or domain name on which to listen.
713
714 .. attr:: log_config
715
716 Path to log config file for the finger gateway process.
717
718 .. attr:: pidfile
719 :default: /var/run/zuul-fingergw/zuul-fingergw.pid
720
721 Path to PID lock file for the finger gateway process.
722
723 .. attr:: port
724 :default: 79
725
726 Port to use for the finger gateway. Note that since command line
727 finger clients cannot usually specify the port, leaving this set to
728 the default value is highly recommended.
729
730 .. attr:: user
731 :default: zuul
732
733 User ID for the zuul-fingergw process. In normal operation as a
734 daemon, the finger gateway should be started as the ``root`` user, but
735 it will drop privileges to this user during startup.
736
737Operation
738~~~~~~~~~
739
740To start the finger gateway, run ``zuul-fingergw``. To stop it, kill the
741PID which was saved in the pidfile specified in the configuration.