blob: ba147527501cbd3b834529ba36ede0d2c53bde50 [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. Blair73f9f1f2018-02-08 13:07:13 -0800445 .. attr:: state_dir
446 :default: /var/lib/zuul
447
448 Path to directory in which Zuul should save its state.
449
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700450 .. attr:: git_dir
451 :default: /var/lib/zuul/git
James E. Blair7e6e0a12017-07-25 11:04:42 -0700452
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700453 Directory that Zuul should clone local git repositories to. The
454 executor keeps a local copy of every git repository it works
455 with to speed operations and perform speculative merging.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400456
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700457 This should be on the same filesystem as
458 :attr:`executor.job_dir` so that when git repos are cloned into
459 the job workspaces, they can be hard-linked to the local git
460 cache.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700461
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700462 .. attr:: job_dir
463 :default: /tmp
James E. Blair7e6e0a12017-07-25 11:04:42 -0700464
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700465 Directory that Zuul should use to hold temporary job directories.
466 When each job is run, a new entry will be created under this
467 directory to hold the configuration and scratch workspace for
468 that job. It will be deleted at the end of the job (unless the
469 `--keep-jobdir` command line option is specified).
James E. Blair7e6e0a12017-07-25 11:04:42 -0700470
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700471 This should be on the same filesystem as :attr:`executor.git_dir`
472 so that when git repos are cloned into the job workspaces, they
473 can be hard-linked to the local git cache.
James E. Blair7e6e0a12017-07-25 11:04:42 -0700474
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700475 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400476
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700477 Path to log config file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700478
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700479 .. attr:: pidfile
480 :default: /var/run/zuul-executor/zuul-executor.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400481
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700482 Path to PID lock file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700483
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700484 .. attr:: private_key_file
485 :default: ~/.ssh/id_rsa
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400486
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700487 SSH private key file to be used when logging into worker nodes.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700488
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700489 .. _admin_sitewide_variables:
Jamie Lennox7655b552017-03-17 12:33:38 +1100490
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700491 .. attr:: variables
Jamie Lennox7655b552017-03-17 12:33:38 +1100492
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700493 Path to an Ansible variables file to supply site-wide variables.
494 This should be a YAML-formatted file consisting of a single
495 dictionary. The contents will be made available to all jobs as
496 Ansible variables. These variables take precedence over all
497 other forms (job variables and secrets). Care should be taken
498 when naming these variables to avoid potential collisions with
499 those used by jobs. Prefixing variable names with a
500 site-specific identifier is recommended. The default is not to
501 add any site-wide variables. See the :ref:`User's Guide
502 <user_sitewide_variables>` for more information.
Clint Byrumdc8a0902017-07-20 16:36:27 -0700503
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700504 .. attr:: disk_limit_per_job
505 :default: 250
Clint Byrumdc8a0902017-07-20 16:36:27 -0700506
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700507 This integer is the maximum number of megabytes that any one job
508 is allowed to consume on disk while it is running. If a job's
509 scratch space has more than this much space consumed, it will be
510 aborted.
Monty Taylor01380dd2017-07-28 16:01:20 -0500511
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700512 .. attr:: trusted_ro_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-only 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:: trusted_rw_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-write bind mount into
520 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500521
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700522 .. attr:: untrusted_ro_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-only bind mount into
525 untrusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500526
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700527 .. attr:: untrusted_rw_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500528
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700529 List of paths, separated by ``:`` to read-write bind mount into
530 untrusted bubblewrap contexts.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700531
Clint Byrum48b5a672017-08-18 14:44:00 -0700532 .. attr:: execution_wrapper
533 :default: bubblewrap
534
535 Name of the execution wrapper to use when executing
536 `ansible-playbook`. The default, `bubblewrap` is recommended for
537 all installations.
538
539 There is also a `nullwrap` driver for situations where one wants
540 to run Zuul without access to bubblewrap or in such a way that
541 bubblewrap may interfere with the jobs themselves. However,
542 `nullwrap` is considered unsafe, as `bubblewrap` provides
543 significant protections against malicious users and accidental
544 breakage in playbooks. As such, `nullwrap` is not recommended
545 for use in production.
James E. Blair60d880a2018-01-17 08:50:10 -0800546
Clint Byrum48b5a672017-08-18 14:44:00 -0700547 This option, and thus, `nullwrap`, may be removed in the future.
548 `bubblewrap` has become integral to securely operating Zuul. If you
549 have a valid use case for it, we encourage you to let us know.
550
Clint Byrum3cef7ed2017-09-29 20:18:54 -0700551 .. attr:: load_multiplier
552 :default: 2.5
553
554 When an executor host gets too busy, the system may suffer
555 timeouts and other ill effects. The executor will stop accepting
556 more than 1 job at a time until load has lowered below a safe
557 level. This level is determined by multiplying the number of
558 CPU's by `load_multiplier`.
559
560 So for example, if the system has 2 CPUs, and load_multiplier
561 is 2.5, the safe load for the system is 5.00. Any time the
562 system load average is over 5.00, the executor will quit
563 accepting multiple jobs at one time.
564
565 The executor will observe system load and determine whether
566 to accept more jobs every 30 seconds.
567
Paul Belanger1754b2c2018-01-08 16:24:57 -0500568 .. attr:: min_avail_mem
569 :default: 5.0
570
571 This is the minimum percentage of system RAM available. The
572 executor will stop accepting more than 1 job at a time until
573 more memory is available. The available memory percentage is
574 calculated from the total available memory divided by the
575 total real memory multiplied by 100. Buffers and cache are
576 considered available in the calculation.
577
Tobias Henkel055cda32017-10-17 13:08:18 +0200578 .. attr:: hostname
579 :default: hostname of the server
580
581 The executor needs to know its hostname under which it is reachable by
582 zuul-web. Otherwise live console log streaming doesn't work. In most cases
583 This is automatically detected correctly. But when running in environments
584 where it cannot determine its hostname correctly this can be overridden
585 here.
586
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700587.. attr:: merger
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400588
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700589 .. attr:: git_user_email
James E. Blaireff5a9d2017-06-20 00:00:37 -0700590
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700591 Value to pass to `git config user.email
592 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400593
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700594 .. attr:: git_user_name
595
596 Value to pass to `git config user.name
597 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700598
599Operation
600~~~~~~~~~
601
602To start the executor, run ``zuul-executor``.
603
604There are several commands which can be run to control the executor's
605behavior once it is running.
606
607To stop the executor immediately, aborting all jobs (they may be
608relaunched according to their retry policy), run ``zuul-executor
609stop``.
610
611To request that the executor stop executing new jobs and exit when all
612currently running jobs have completed, run ``zuul-executor graceful``.
613
James E. Blairafe27e62017-08-03 15:11:47 -0700614To enable or disable running Ansible in verbose mode (with the
615``-vvv`` argument to ansible-playbook) run ``zuul-executor verbose``
616and ``zuul-executor unverbose``.
David Shrewsburyae734d12017-07-11 12:41:59 -0400617
618Web Server
619----------
620
621The Zuul web server currently acts as a websocket interface to live log
622streaming. Eventually, it will serve as the single process handling all
623HTTP interactions with Zuul.
624
James E. Blair60d880a2018-01-17 08:50:10 -0800625Web servers need to be able to connect to the Gearman server (usually
626the scheduler host). If the SQL reporter is used, they need to be
627able to connect to the database it reports to in order to support the
628dashboard. If a GitHub connection is configured, they need to be
629reachable by GitHub so they may receive notifications.
630
David Shrewsburyae734d12017-07-11 12:41:59 -0400631Configuration
632~~~~~~~~~~~~~
633
James E. Blairafe27e62017-08-03 15:11:47 -0700634In addition to the common configuration sections, the following
635sections of ``zuul.conf`` are used by the web server:
David Shrewsburyae734d12017-07-11 12:41:59 -0400636
James E. Blairafe27e62017-08-03 15:11:47 -0700637.. attr:: web
David Shrewsburyae734d12017-07-11 12:41:59 -0400638
James E. Blairafe27e62017-08-03 15:11:47 -0700639 .. attr:: listen_address
640 :default: 127.0.0.1
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400641
James E. Blairafe27e62017-08-03 15:11:47 -0700642 IP address or domain name on which to listen.
David Shrewsburyae734d12017-07-11 12:41:59 -0400643
James E. Blairafe27e62017-08-03 15:11:47 -0700644 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400645
James E. Blairafe27e62017-08-03 15:11:47 -0700646 Path to log config file for the web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400647
James E. Blairafe27e62017-08-03 15:11:47 -0700648 .. attr:: pidfile
649 :default: /var/run/zuul-web/zuul-web.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400650
James E. Blairafe27e62017-08-03 15:11:47 -0700651 Path to PID lock file for the web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400652
James E. Blairafe27e62017-08-03 15:11:47 -0700653 .. attr:: port
654 :default: 9000
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400655
James E. Blairafe27e62017-08-03 15:11:47 -0700656 Port to use for web server process.
David Shrewsburyae734d12017-07-11 12:41:59 -0400657
James E. Blairafe27e62017-08-03 15:11:47 -0700658 .. attr:: websocket_url
659
660 Base URL on which the websocket service is exposed, if different
661 than the base URL of the web app.
Tobias Henkelb4407fc2017-07-07 13:52:56 +0200662
Tristan Cacqueray3c2d39d2017-11-29 05:36:55 +0000663 .. attr:: static_cache_expiry
664 :default: 3600
665
666 The Cache-Control max-age response header value for static files served
667 by the zuul-web. Set to 0 during development to disable Cache-Control.
668
David Shrewsburyae734d12017-07-11 12:41:59 -0400669Operation
670~~~~~~~~~
671
672To start the web server, run ``zuul-web``. To stop it, kill the
673PID which was saved in the pidfile specified in the configuration.
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500674
675Finger Gateway
676--------------
677
David Shrewsburyae3d96b2017-12-13 13:01:46 -0500678The Zuul finger gateway listens on the standard finger port (79) for
679finger requests specifying a build UUID for which it should stream log
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500680results. The gateway will determine which executor is currently running that
681build and query that executor for the log stream.
682
683This is intended to be used with the standard finger command line client.
684For example::
685
686 finger UUID@zuul.example.com
687
688The above would stream the logs for the build identified by `UUID`.
689
James E. Blair60d880a2018-01-17 08:50:10 -0800690Finger gateway servers need to be able to connect to the Gearman
691server (usually the scheduler host), as well as the console streaming
692port on the executors (usually 7900).
693
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500694Configuration
695~~~~~~~~~~~~~
696
697In addition to the common configuration sections, the following
698sections of ``zuul.conf`` are used by the finger gateway:
699
700.. attr:: fingergw
701
702 .. attr:: command_socket
703 :default: /var/lib/zuul/fingergw.socket
704
705 Path to command socket file for the executor process.
706
707 .. attr:: listen_address
708 :default: all addresses
709
710 IP address or domain name on which to listen.
711
712 .. attr:: log_config
713
714 Path to log config file for the finger gateway process.
715
716 .. attr:: pidfile
717 :default: /var/run/zuul-fingergw/zuul-fingergw.pid
718
719 Path to PID lock file for the finger gateway process.
720
721 .. attr:: port
722 :default: 79
723
724 Port to use for the finger gateway. Note that since command line
725 finger clients cannot usually specify the port, leaving this set to
726 the default value is highly recommended.
727
728 .. attr:: user
729 :default: zuul
730
731 User ID for the zuul-fingergw process. In normal operation as a
732 daemon, the finger gateway should be started as the ``root`` user, but
733 it will drop privileges to this user during startup.
734
735Operation
736~~~~~~~~~
737
738To start the finger gateway, run ``zuul-fingergw``. To stop it, kill the
739PID which was saved in the pidfile specified in the configuration.