blob: 88b898f5a81c2b1b48b1b45325318ddd138cabef [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:: scheduler
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400247
Paul Belanger40d3ce62017-11-28 11:49:55 -0500248 .. attr:: command_socket
249 :default: /var/lib/zuul/scheduler.socket
250
251 Path to command socket file for the scheduler process.
252
James E. Blair97940192017-08-03 14:47:47 -0700253 .. attr:: tenant_config
254 :required:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700255
James E. Blair97940192017-08-03 14:47:47 -0700256 Path to :ref:`tenant-config` file.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400257
James E. Blair97940192017-08-03 14:47:47 -0700258 .. attr:: log_config
259
260 Path to log config file.
261
262 .. attr:: pidfile
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700263 :default: /var/run/zuul-schedurecr/zuul-scheduler.pid
James E. Blair97940192017-08-03 14:47:47 -0700264
265 Path to PID lock file.
266
267 .. attr:: state_dir
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700268 :default: /var/lib/zuul
James E. Blair97940192017-08-03 14:47:47 -0700269
270 Path to directory in which Zuul should save its state.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700271
272Operation
273~~~~~~~~~
274
275To start the scheduler, run ``zuul-scheduler``. To stop it, kill the
276PID which was saved in the pidfile specified in the configuration.
277
278Most of Zuul's configuration is automatically updated as changes to
279the repositories which contain it are merged. However, Zuul must be
280explicitly notified of changes to the tenant config file, since it is
281not read from a git repository. To do so, send the scheduler PID
James E. Blair97940192017-08-03 14:47:47 -0700282(saved in the pidfile specified in the configuration) a `SIGHUP`
283signal.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700284
285Merger
286------
287
288Mergers are an optional Zuul service; they are not required for Zuul
289to operate, but some high volume sites may benefit from running them.
290Zuul performs quite a lot of git operations in the course of its work.
291Each change that is to be tested must be speculatively merged with the
292current state of its target branch to ensure that it can merge, and to
293ensure that the tests that Zuul perform accurately represent the
294outcome of merging the change. Because Zuul's configuration is stored
295in the git repos it interacts with, and is dynamically evaluated, Zuul
296often needs to perform a speculative merge in order to determine
297whether it needs to perform any further actions.
298
299All of these git operations add up, and while Zuul executors can also
300perform them, large numbers may impact their ability to run jobs.
301Therefore, administrators may wish to run standalone mergers in order
302to reduce the load on executors.
303
James E. Blair60d880a2018-01-17 08:50:10 -0800304Mergers need to be able to connect to the Gearman server (usually the
305scheduler host) as well as any services for which connections are
306configured (Gerrit, GitHub, etc).
307
James E. Blaireff5a9d2017-06-20 00:00:37 -0700308Configuration
309~~~~~~~~~~~~~
310
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700311The following section of ``zuul.conf`` is used by the merger:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700312
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700313.. attr:: merger
James E. Blaireff5a9d2017-06-20 00:00:37 -0700314
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500315 .. attr:: command_socket
Paul Belanger76506112017-11-27 14:10:30 -0500316 :default: /var/lib/zuul/merger.socket
317
318 Path to command socket file for the merger process.
319
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700320 .. attr:: git_dir
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400321
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700322 Directory in which Zuul should clone git repositories.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700323
Paul Belangeredadfed2017-10-05 16:04:27 -0400324 .. attr:: git_http_low_speed_limit
325 :default: 1000
326
327 If the HTTP transfer speed is less then git_http_low_speed_limit for
328 longer then git_http_low_speed_time, the transfer is aborted.
329
330 Value in bytes, setting to 0 will disable.
331
332 .. attr:: git_http_low_speed_time
333 :default: 30
334
335 If the HTTP transfer speed is less then git_http_low_speed_limit for
336 longer then git_http_low_speed_time, the transfer is aborted.
337
338 Value in seconds, setting to 0 will disable.
339
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700340 .. attr:: git_user_email
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400341
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700342 Value to pass to `git config user.email
343 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700344
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700345 .. attr:: git_user_name
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400346
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700347 Value to pass to `git config user.name
348 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700349
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700350 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400351
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700352 Path to log config file for the merger process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700353
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700354 .. attr:: pidfile
355 :default: /var/run/zuul-merger/zuul-merger.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400356
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700357 Path to PID lock file for the merger process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700358
359Operation
360~~~~~~~~~
361
362To start the merger, run ``zuul-merger``. To stop it, kill the
363PID which was saved in the pidfile specified in the configuration.
364
David Shrewsburyb040b0a2017-08-03 15:53:59 -0400365.. _executor:
366
James E. Blaireff5a9d2017-06-20 00:00:37 -0700367Executor
368--------
369
370Executors are responsible for running jobs. At the start of each job,
371an executor prepares an environment in which to run Ansible which
372contains all of the git repositories specified by the job with all
373dependent changes merged into their appropriate branches. The branch
374corresponding to the proposed change will be checked out (in all
375projects, if it exists). Any roles specified by the job will also be
376present (also with dependent changes merged, if appropriate) and added
377to the Ansible role path. The executor also prepares an Ansible
378inventory file with all of the nodes requested by the job.
379
380The executor also contains a merger. This is used by the executor to
381prepare the git repositories used by jobs, but is also available to
382perform any tasks normally performed by standalone mergers. Because
383the executor performs both roles, small Zuul installations may not
384need to run standalone mergers.
385
James E. Blair60d880a2018-01-17 08:50:10 -0800386Executors need to be able to connect to the Gearman server (usually
387the scheduler host), any services for which connections are configured
388(Gerrit, GitHub, etc), as well as directly to the hosts which Nodepool
389provides.
390
James E. Blaireff5a9d2017-06-20 00:00:37 -0700391Trusted and Untrusted Playbooks
392~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
393
394The executor runs playbooks in one of two execution contexts depending
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700395on whether the project containing the playbook is a
396:term:`config-project` or an :term:`untrusted-project`. If the
397playbook is in a config project, the executor runs the playbook in the
398*trusted* execution context, otherwise, it is run in the *untrusted*
399execution context.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700400
Clint Byrum48b5a672017-08-18 14:44:00 -0700401Both execution contexts use `bubblewrap`_ [#nullwrap]_ to create a
402namespace to ensure that playbook executions are isolated and are unable
403to access files outside of a restricted environment. The administrator
404may configure additional local directories on the executor to be made
James E. Blaireff5a9d2017-06-20 00:00:37 -0700405available to the restricted environment.
406
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700407The trusted execution context has access to all Ansible features,
James E. Blaireff5a9d2017-06-20 00:00:37 -0700408including the ability to load custom Ansible modules. Needless to
409say, extra scrutiny should be given to code that runs in a trusted
410context as it could be used to compromise other jobs running on the
411executor, or the executor itself, especially if the administrator has
412granted additional access through bubblewrap, or a method of escaping
413the restricted environment created by bubblewrap is found.
414
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700415Playbooks run in the untrusted execution context are not permitted to
416load additional Ansible modules or access files outside of the
James E. Blaireff5a9d2017-06-20 00:00:37 -0700417restricted environment prepared for them by the executor. In addition
418to the bubblewrap environment applied to both execution contexts, in
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700419the untrusted context some standard Ansible modules are replaced with
420versions which prohibit some actions, including attempts to access
421files outside of the restricted execution context. These redundant
422protections are made as part of a defense-in-depth strategy.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700423
424.. _bubblewrap: https://github.com/projectatomic/bubblewrap
Clint Byrum48b5a672017-08-18 14:44:00 -0700425.. [#nullwrap] Unless one has set execution_wrapper to nullwrap in the
426 executor configuration.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700427
428Configuration
429~~~~~~~~~~~~~
430
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700431The following sections of ``zuul.conf`` are used by the executor:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700432
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700433.. attr:: executor
James E. Blaireff5a9d2017-06-20 00:00:37 -0700434
Paul Belanger20920912017-11-28 11:22:30 -0500435 .. attr:: command_socket
436 :default: /var/lib/zuul/executor.socket
437
438 Path to command socket file for the executor process.
439
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700440 .. attr:: finger_port
David Shrewsbury93eb56d2018-01-10 11:50:03 -0500441 :default: 7900
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400442
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700443 Port to use for finger log streamer.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700444
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700445 .. attr:: git_dir
446 :default: /var/lib/zuul/git
James E. Blair7e6e0a12017-07-25 11:04:42 -0700447
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700448 Directory that Zuul should clone local git repositories to. The
449 executor keeps a local copy of every git repository it works
450 with to speed operations and perform speculative merging.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400451
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700452 This should be on the same filesystem as
453 :attr:`executor.job_dir` so that when git repos are cloned into
454 the job workspaces, they can be hard-linked to the local git
455 cache.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700456
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700457 .. attr:: job_dir
458 :default: /tmp
James E. Blair7e6e0a12017-07-25 11:04:42 -0700459
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700460 Directory that Zuul should use to hold temporary job directories.
461 When each job is run, a new entry will be created under this
462 directory to hold the configuration and scratch workspace for
463 that job. It will be deleted at the end of the job (unless the
464 `--keep-jobdir` command line option is specified).
James E. Blair7e6e0a12017-07-25 11:04:42 -0700465
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700466 This should be on the same filesystem as :attr:`executor.git_dir`
467 so that when git repos are cloned into the job workspaces, they
468 can be hard-linked to the local git cache.
James E. Blair7e6e0a12017-07-25 11:04:42 -0700469
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700470 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400471
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700472 Path to log config file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700473
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700474 .. attr:: pidfile
475 :default: /var/run/zuul-executor/zuul-executor.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400476
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700477 Path to PID lock file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700478
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700479 .. attr:: private_key_file
480 :default: ~/.ssh/id_rsa
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400481
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700482 SSH private key file to be used when logging into worker nodes.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700483
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700484 .. _admin_sitewide_variables:
Jamie Lennox7655b552017-03-17 12:33:38 +1100485
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700486 .. attr:: variables
Jamie Lennox7655b552017-03-17 12:33:38 +1100487
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700488 Path to an Ansible variables file to supply site-wide variables.
489 This should be a YAML-formatted file consisting of a single
490 dictionary. The contents will be made available to all jobs as
491 Ansible variables. These variables take precedence over all
492 other forms (job variables and secrets). Care should be taken
493 when naming these variables to avoid potential collisions with
494 those used by jobs. Prefixing variable names with a
495 site-specific identifier is recommended. The default is not to
496 add any site-wide variables. See the :ref:`User's Guide
497 <user_sitewide_variables>` for more information.
Clint Byrumdc8a0902017-07-20 16:36:27 -0700498
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700499 .. attr:: disk_limit_per_job
500 :default: 250
Clint Byrumdc8a0902017-07-20 16:36:27 -0700501
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700502 This integer is the maximum number of megabytes that any one job
503 is allowed to consume on disk while it is running. If a job's
504 scratch space has more than this much space consumed, it will be
505 aborted.
Monty Taylor01380dd2017-07-28 16:01:20 -0500506
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700507 .. attr:: trusted_ro_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500508
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700509 List of paths, separated by ``:`` to read-only bind mount into
510 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500511
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700512 .. attr:: trusted_rw_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500513
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700514 List of paths, separated by ``:`` to read-write bind mount into
515 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500516
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700517 .. attr:: untrusted_ro_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500518
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700519 List of paths, separated by ``:`` to read-only bind mount into
520 untrusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500521
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700522 .. attr:: untrusted_rw_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500523
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700524 List of paths, separated by ``:`` to read-write bind mount into
525 untrusted bubblewrap contexts.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700526
Clint Byrum48b5a672017-08-18 14:44:00 -0700527 .. attr:: execution_wrapper
528 :default: bubblewrap
529
530 Name of the execution wrapper to use when executing
531 `ansible-playbook`. The default, `bubblewrap` is recommended for
532 all installations.
533
534 There is also a `nullwrap` driver for situations where one wants
535 to run Zuul without access to bubblewrap or in such a way that
536 bubblewrap may interfere with the jobs themselves. However,
537 `nullwrap` is considered unsafe, as `bubblewrap` provides
538 significant protections against malicious users and accidental
539 breakage in playbooks. As such, `nullwrap` is not recommended
540 for use in production.
James E. Blair60d880a2018-01-17 08:50:10 -0800541
Clint Byrum48b5a672017-08-18 14:44:00 -0700542 This option, and thus, `nullwrap`, may be removed in the future.
543 `bubblewrap` has become integral to securely operating Zuul. If you
544 have a valid use case for it, we encourage you to let us know.
545
Clint Byrum3cef7ed2017-09-29 20:18:54 -0700546 .. attr:: load_multiplier
547 :default: 2.5
548
549 When an executor host gets too busy, the system may suffer
550 timeouts and other ill effects. The executor will stop accepting
551 more than 1 job at a time until load has lowered below a safe
552 level. This level is determined by multiplying the number of
553 CPU's by `load_multiplier`.
554
555 So for example, if the system has 2 CPUs, and load_multiplier
556 is 2.5, the safe load for the system is 5.00. Any time the
557 system load average is over 5.00, the executor will quit
558 accepting multiple jobs at one time.
559
560 The executor will observe system load and determine whether
561 to accept more jobs every 30 seconds.
562
Paul Belanger1754b2c2018-01-08 16:24:57 -0500563 .. attr:: min_avail_mem
564 :default: 5.0
565
566 This is the minimum percentage of system RAM available. The
567 executor will stop accepting more than 1 job at a time until
568 more memory is available. The available memory percentage is
569 calculated from the total available memory divided by the
570 total real memory multiplied by 100. Buffers and cache are
571 considered available in the calculation.
572
Tobias Henkel055cda32017-10-17 13:08:18 +0200573 .. attr:: hostname
574 :default: hostname of the server
575
576 The executor needs to know its hostname under which it is reachable by
577 zuul-web. Otherwise live console log streaming doesn't work. In most cases
578 This is automatically detected correctly. But when running in environments
579 where it cannot determine its hostname correctly this can be overridden
580 here.
581
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700582.. attr:: merger
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400583
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700584 .. attr:: git_user_email
James E. Blaireff5a9d2017-06-20 00:00:37 -0700585
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700586 Value to pass to `git config user.email
587 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400588
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700589 .. attr:: git_user_name
590
591 Value to pass to `git config user.name
592 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700593
594Operation
595~~~~~~~~~
596
597To start the executor, run ``zuul-executor``.
598
599There are several commands which can be run to control the executor's
600behavior once it is running.
601
602To stop the executor immediately, aborting all jobs (they may be
603relaunched according to their retry policy), run ``zuul-executor
604stop``.
605
606To request that the executor stop executing new jobs and exit when all
607currently running jobs have completed, run ``zuul-executor graceful``.
608
James E. Blairafe27e62017-08-03 15:11:47 -0700609To enable or disable running Ansible in verbose mode (with the
610``-vvv`` argument to ansible-playbook) run ``zuul-executor verbose``
611and ``zuul-executor unverbose``.
David Shrewsburyae734d12017-07-11 12:41:59 -0400612
613Web Server
614----------
615
616The Zuul web server currently acts as a websocket interface to live log
617streaming. Eventually, it will serve as the single process handling all
618HTTP interactions with Zuul.
619
James E. Blair60d880a2018-01-17 08:50:10 -0800620Web servers need to be able to connect to the Gearman server (usually
621the scheduler host). If the SQL reporter is used, they need to be
622able to connect to the database it reports to in order to support the
623dashboard. If a GitHub connection is configured, they need to be
624reachable by GitHub so they may receive notifications.
625
David Shrewsburyae734d12017-07-11 12:41:59 -0400626Configuration
627~~~~~~~~~~~~~
628
James E. Blairafe27e62017-08-03 15:11:47 -0700629In addition to the common configuration sections, the following
630sections of ``zuul.conf`` are used by the web server:
David Shrewsburyae734d12017-07-11 12:41:59 -0400631
James E. Blairafe27e62017-08-03 15:11:47 -0700632.. attr:: web
David Shrewsburyae734d12017-07-11 12:41:59 -0400633
James E. Blairafe27e62017-08-03 15:11:47 -0700634 .. attr:: listen_address
635 :default: 127.0.0.1
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400636
James E. Blairafe27e62017-08-03 15:11:47 -0700637 IP address or domain name on which to listen.
David Shrewsburyae734d12017-07-11 12:41:59 -0400638
James E. Blairafe27e62017-08-03 15:11:47 -0700639 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400640
James E. Blairafe27e62017-08-03 15:11:47 -0700641 Path to log config file for the web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400642
James E. Blairafe27e62017-08-03 15:11:47 -0700643 .. attr:: pidfile
644 :default: /var/run/zuul-web/zuul-web.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400645
James E. Blairafe27e62017-08-03 15:11:47 -0700646 Path to PID lock file for the web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400647
James E. Blairafe27e62017-08-03 15:11:47 -0700648 .. attr:: port
649 :default: 9000
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400650
James E. Blairafe27e62017-08-03 15:11:47 -0700651 Port to use for web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400652
James E. Blairafe27e62017-08-03 15:11:47 -0700653 .. attr:: websocket_url
654
655 Base URL on which the websocket service is exposed, if different
656 than the base URL of the web app.
Tobias Henkelb4407fc2017-07-07 13:52:56 +0200657
Tristan Cacqueray3c2d39d2017-11-29 05:36:55 +0000658 .. attr:: static_cache_expiry
659 :default: 3600
660
661 The Cache-Control max-age response header value for static files served
662 by the zuul-web. Set to 0 during development to disable Cache-Control.
663
David Shrewsburyae734d12017-07-11 12:41:59 -0400664Operation
665~~~~~~~~~
666
667To start the web server, run ``zuul-web``. To stop it, kill the
668PID which was saved in the pidfile specified in the configuration.
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500669
670Finger Gateway
671--------------
672
David Shrewsburyae3d96b2017-12-13 13:01:46 -0500673The Zuul finger gateway listens on the standard finger port (79) for
674finger requests specifying a build UUID for which it should stream log
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500675results. The gateway will determine which executor is currently running that
676build and query that executor for the log stream.
677
678This is intended to be used with the standard finger command line client.
679For example::
680
681 finger UUID@zuul.example.com
682
683The above would stream the logs for the build identified by `UUID`.
684
James E. Blair60d880a2018-01-17 08:50:10 -0800685Finger gateway servers need to be able to connect to the Gearman
686server (usually the scheduler host), as well as the console streaming
687port on the executors (usually 7900).
688
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500689Configuration
690~~~~~~~~~~~~~
691
692In addition to the common configuration sections, the following
693sections of ``zuul.conf`` are used by the finger gateway:
694
695.. attr:: fingergw
696
697 .. attr:: command_socket
698 :default: /var/lib/zuul/fingergw.socket
699
700 Path to command socket file for the executor process.
701
702 .. attr:: listen_address
703 :default: all addresses
704
705 IP address or domain name on which to listen.
706
707 .. attr:: log_config
708
709 Path to log config file for the finger gateway process.
710
711 .. attr:: pidfile
712 :default: /var/run/zuul-fingergw/zuul-fingergw.pid
713
714 Path to PID lock file for the finger gateway process.
715
716 .. attr:: port
717 :default: 79
718
719 Port to use for the finger gateway. Note that since command line
720 finger clients cannot usually specify the port, leaving this set to
721 the default value is highly recommended.
722
723 .. attr:: user
724 :default: zuul
725
726 User ID for the zuul-fingergw process. In normal operation as a
727 daemon, the finger gateway should be started as the ``root`` user, but
728 it will drop privileges to this user during startup.
729
730Operation
731~~~~~~~~~
732
733To start the finger gateway, run ``zuul-fingergw``. To stop it, kill the
734PID which was saved in the pidfile specified in the configuration.