blob: d6b0984d241c0e4e20b343b784c7aaa12174fdcd [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
74 [webapp]
75 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
James E. Blair97940192017-08-03 14:47:47 -0700237.. attr:: webapp
James E. Blaireff5a9d2017-06-20 00:00:37 -0700238
James E. Blair97940192017-08-03 14:47:47 -0700239 .. attr:: listen_address
240 :default: all addresses
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400241
James E. Blair97940192017-08-03 14:47:47 -0700242 IP address or domain name on which to listen.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700243
James E. Blair97940192017-08-03 14:47:47 -0700244 .. attr:: port
245 :default: 8001
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400246
James E. Blair97940192017-08-03 14:47:47 -0700247 Port on which the webapp is listening.
James E. Blair4f3e6222017-07-05 14:52:08 -0700248
James E. Blair97940192017-08-03 14:47:47 -0700249 .. attr:: status_expiry
250 :default: 1
James E. Blaireff5a9d2017-06-20 00:00:37 -0700251
James E. Blair97940192017-08-03 14:47:47 -0700252 Zuul will cache the status.json file for this many seconds.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400253
James E. Blair97940192017-08-03 14:47:47 -0700254 .. attr:: status_url
James E. Blaireff5a9d2017-06-20 00:00:37 -0700255
James E. Blair97940192017-08-03 14:47:47 -0700256 URL that will be posted in Zuul comments made to changes when
257 starting jobs for a change.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400258
James E. Blair97940192017-08-03 14:47:47 -0700259 .. TODO: is this effectively required?
James E. Blaireff5a9d2017-06-20 00:00:37 -0700260
James E. Blair97940192017-08-03 14:47:47 -0700261.. attr:: scheduler
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400262
Paul Belanger40d3ce62017-11-28 11:49:55 -0500263 .. attr:: command_socket
264 :default: /var/lib/zuul/scheduler.socket
265
266 Path to command socket file for the scheduler process.
267
James E. Blair97940192017-08-03 14:47:47 -0700268 .. attr:: tenant_config
269 :required:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700270
James E. Blair97940192017-08-03 14:47:47 -0700271 Path to :ref:`tenant-config` file.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400272
James E. Blair97940192017-08-03 14:47:47 -0700273 .. attr:: log_config
274
275 Path to log config file.
276
277 .. attr:: pidfile
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700278 :default: /var/run/zuul-schedurecr/zuul-scheduler.pid
James E. Blair97940192017-08-03 14:47:47 -0700279
280 Path to PID lock file.
281
282 .. attr:: state_dir
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700283 :default: /var/lib/zuul
James E. Blair97940192017-08-03 14:47:47 -0700284
285 Path to directory in which Zuul should save its state.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700286
287Operation
288~~~~~~~~~
289
290To start the scheduler, run ``zuul-scheduler``. To stop it, kill the
291PID which was saved in the pidfile specified in the configuration.
292
293Most of Zuul's configuration is automatically updated as changes to
294the repositories which contain it are merged. However, Zuul must be
295explicitly notified of changes to the tenant config file, since it is
296not read from a git repository. To do so, send the scheduler PID
James E. Blair97940192017-08-03 14:47:47 -0700297(saved in the pidfile specified in the configuration) a `SIGHUP`
298signal.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700299
300Merger
301------
302
303Mergers are an optional Zuul service; they are not required for Zuul
304to operate, but some high volume sites may benefit from running them.
305Zuul performs quite a lot of git operations in the course of its work.
306Each change that is to be tested must be speculatively merged with the
307current state of its target branch to ensure that it can merge, and to
308ensure that the tests that Zuul perform accurately represent the
309outcome of merging the change. Because Zuul's configuration is stored
310in the git repos it interacts with, and is dynamically evaluated, Zuul
311often needs to perform a speculative merge in order to determine
312whether it needs to perform any further actions.
313
314All of these git operations add up, and while Zuul executors can also
315perform them, large numbers may impact their ability to run jobs.
316Therefore, administrators may wish to run standalone mergers in order
317to reduce the load on executors.
318
James E. Blair60d880a2018-01-17 08:50:10 -0800319Mergers need to be able to connect to the Gearman server (usually the
320scheduler host) as well as any services for which connections are
321configured (Gerrit, GitHub, etc).
322
James E. Blaireff5a9d2017-06-20 00:00:37 -0700323Configuration
324~~~~~~~~~~~~~
325
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700326The following section of ``zuul.conf`` is used by the merger:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700327
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700328.. attr:: merger
James E. Blaireff5a9d2017-06-20 00:00:37 -0700329
David Shrewsburyfe1f1942017-12-04 13:57:46 -0500330 .. attr:: command_socket
Paul Belanger76506112017-11-27 14:10:30 -0500331 :default: /var/lib/zuul/merger.socket
332
333 Path to command socket file for the merger process.
334
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700335 .. attr:: git_dir
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400336
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700337 Directory in which Zuul should clone git repositories.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700338
Paul Belangeredadfed2017-10-05 16:04:27 -0400339 .. attr:: git_http_low_speed_limit
340 :default: 1000
341
342 If the HTTP transfer speed is less then git_http_low_speed_limit for
343 longer then git_http_low_speed_time, the transfer is aborted.
344
345 Value in bytes, setting to 0 will disable.
346
347 .. attr:: git_http_low_speed_time
348 :default: 30
349
350 If the HTTP transfer speed is less then git_http_low_speed_limit for
351 longer then git_http_low_speed_time, the transfer is aborted.
352
353 Value in seconds, setting to 0 will disable.
354
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700355 .. attr:: git_user_email
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400356
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700357 Value to pass to `git config user.email
358 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700359
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700360 .. attr:: git_user_name
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400361
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700362 Value to pass to `git config user.name
363 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700364
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700365 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400366
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700367 Path to log config file for the merger process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700368
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700369 .. attr:: pidfile
370 :default: /var/run/zuul-merger/zuul-merger.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400371
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700372 Path to PID lock file for the merger process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700373
374Operation
375~~~~~~~~~
376
377To start the merger, run ``zuul-merger``. To stop it, kill the
378PID which was saved in the pidfile specified in the configuration.
379
David Shrewsburyb040b0a2017-08-03 15:53:59 -0400380.. _executor:
381
James E. Blaireff5a9d2017-06-20 00:00:37 -0700382Executor
383--------
384
385Executors are responsible for running jobs. At the start of each job,
386an executor prepares an environment in which to run Ansible which
387contains all of the git repositories specified by the job with all
388dependent changes merged into their appropriate branches. The branch
389corresponding to the proposed change will be checked out (in all
390projects, if it exists). Any roles specified by the job will also be
391present (also with dependent changes merged, if appropriate) and added
392to the Ansible role path. The executor also prepares an Ansible
393inventory file with all of the nodes requested by the job.
394
395The executor also contains a merger. This is used by the executor to
396prepare the git repositories used by jobs, but is also available to
397perform any tasks normally performed by standalone mergers. Because
398the executor performs both roles, small Zuul installations may not
399need to run standalone mergers.
400
James E. Blair60d880a2018-01-17 08:50:10 -0800401Executors need to be able to connect to the Gearman server (usually
402the scheduler host), any services for which connections are configured
403(Gerrit, GitHub, etc), as well as directly to the hosts which Nodepool
404provides.
405
James E. Blaireff5a9d2017-06-20 00:00:37 -0700406Trusted and Untrusted Playbooks
407~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
408
409The executor runs playbooks in one of two execution contexts depending
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700410on whether the project containing the playbook is a
411:term:`config-project` or an :term:`untrusted-project`. If the
412playbook is in a config project, the executor runs the playbook in the
413*trusted* execution context, otherwise, it is run in the *untrusted*
414execution context.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700415
Clint Byrum48b5a672017-08-18 14:44:00 -0700416Both execution contexts use `bubblewrap`_ [#nullwrap]_ to create a
417namespace to ensure that playbook executions are isolated and are unable
418to access files outside of a restricted environment. The administrator
419may configure additional local directories on the executor to be made
James E. Blaireff5a9d2017-06-20 00:00:37 -0700420available to the restricted environment.
421
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700422The trusted execution context has access to all Ansible features,
James E. Blaireff5a9d2017-06-20 00:00:37 -0700423including the ability to load custom Ansible modules. Needless to
424say, extra scrutiny should be given to code that runs in a trusted
425context as it could be used to compromise other jobs running on the
426executor, or the executor itself, especially if the administrator has
427granted additional access through bubblewrap, or a method of escaping
428the restricted environment created by bubblewrap is found.
429
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700430Playbooks run in the untrusted execution context are not permitted to
431load additional Ansible modules or access files outside of the
James E. Blaireff5a9d2017-06-20 00:00:37 -0700432restricted environment prepared for them by the executor. In addition
433to the bubblewrap environment applied to both execution contexts, in
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700434the untrusted context some standard Ansible modules are replaced with
435versions which prohibit some actions, including attempts to access
436files outside of the restricted execution context. These redundant
437protections are made as part of a defense-in-depth strategy.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700438
439.. _bubblewrap: https://github.com/projectatomic/bubblewrap
Clint Byrum48b5a672017-08-18 14:44:00 -0700440.. [#nullwrap] Unless one has set execution_wrapper to nullwrap in the
441 executor configuration.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700442
443Configuration
444~~~~~~~~~~~~~
445
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700446The following sections of ``zuul.conf`` are used by the executor:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700447
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700448.. attr:: executor
James E. Blaireff5a9d2017-06-20 00:00:37 -0700449
Paul Belanger20920912017-11-28 11:22:30 -0500450 .. attr:: command_socket
451 :default: /var/lib/zuul/executor.socket
452
453 Path to command socket file for the executor process.
454
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700455 .. attr:: finger_port
David Shrewsbury93eb56d2018-01-10 11:50:03 -0500456 :default: 7900
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400457
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700458 Port to use for finger log streamer.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700459
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700460 .. attr:: git_dir
461 :default: /var/lib/zuul/git
James E. Blair7e6e0a12017-07-25 11:04:42 -0700462
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700463 Directory that Zuul should clone local git repositories to. The
464 executor keeps a local copy of every git repository it works
465 with to speed operations and perform speculative merging.
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400466
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700467 This should be on the same filesystem as
468 :attr:`executor.job_dir` so that when git repos are cloned into
469 the job workspaces, they can be hard-linked to the local git
470 cache.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700471
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700472 .. attr:: job_dir
473 :default: /tmp
James E. Blair7e6e0a12017-07-25 11:04:42 -0700474
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700475 Directory that Zuul should use to hold temporary job directories.
476 When each job is run, a new entry will be created under this
477 directory to hold the configuration and scratch workspace for
478 that job. It will be deleted at the end of the job (unless the
479 `--keep-jobdir` command line option is specified).
James E. Blair7e6e0a12017-07-25 11:04:42 -0700480
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700481 This should be on the same filesystem as :attr:`executor.git_dir`
482 so that when git repos are cloned into the job workspaces, they
483 can be hard-linked to the local git cache.
James E. Blair7e6e0a12017-07-25 11:04:42 -0700484
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700485 .. attr:: log_config
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400486
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700487 Path to log config file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700488
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700489 .. attr:: pidfile
490 :default: /var/run/zuul-executor/zuul-executor.pid
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400491
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700492 Path to PID lock file for the executor process.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700493
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700494 .. attr:: private_key_file
495 :default: ~/.ssh/id_rsa
David Shrewsbury6b3b49b2017-07-11 13:00:38 -0400496
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700497 SSH private key file to be used when logging into worker nodes.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700498
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700499 .. _admin_sitewide_variables:
Jamie Lennox7655b552017-03-17 12:33:38 +1100500
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700501 .. attr:: variables
Jamie Lennox7655b552017-03-17 12:33:38 +1100502
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700503 Path to an Ansible variables file to supply site-wide variables.
504 This should be a YAML-formatted file consisting of a single
505 dictionary. The contents will be made available to all jobs as
506 Ansible variables. These variables take precedence over all
507 other forms (job variables and secrets). Care should be taken
508 when naming these variables to avoid potential collisions with
509 those used by jobs. Prefixing variable names with a
510 site-specific identifier is recommended. The default is not to
511 add any site-wide variables. See the :ref:`User's Guide
512 <user_sitewide_variables>` for more information.
Clint Byrumdc8a0902017-07-20 16:36:27 -0700513
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700514 .. attr:: disk_limit_per_job
515 :default: 250
Clint Byrumdc8a0902017-07-20 16:36:27 -0700516
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700517 This integer is the maximum number of megabytes that any one job
518 is allowed to consume on disk while it is running. If a job's
519 scratch space has more than this much space consumed, it will be
520 aborted.
Monty Taylor01380dd2017-07-28 16:01:20 -0500521
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700522 .. attr:: trusted_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 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500526
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700527 .. attr:: trusted_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 trusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500531
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700532 .. attr:: untrusted_ro_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500533
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700534 List of paths, separated by ``:`` to read-only bind mount into
535 untrusted bubblewrap contexts.
Monty Taylor01380dd2017-07-28 16:01:20 -0500536
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700537 .. attr:: untrusted_rw_paths
Monty Taylor01380dd2017-07-28 16:01:20 -0500538
James E. Blair9d0b4cc2017-08-03 15:08:47 -0700539 List of paths, separated by ``:`` to read-write bind mount into
540 untrusted bubblewrap contexts.
James E. Blaireff5a9d2017-06-20 00:00:37 -0700541
Clint Byrum48b5a672017-08-18 14:44:00 -0700542 .. attr:: execution_wrapper
543 :default: bubblewrap
544
545 Name of the execution wrapper to use when executing
546 `ansible-playbook`. The default, `bubblewrap` is recommended for
547 all installations.
548
549 There is also a `nullwrap` driver for situations where one wants
550 to run Zuul without access to bubblewrap or in such a way that
551 bubblewrap may interfere with the jobs themselves. However,
552 `nullwrap` is considered unsafe, as `bubblewrap` provides
553 significant protections against malicious users and accidental
554 breakage in playbooks. As such, `nullwrap` is not recommended
555 for use in production.
James E. Blair60d880a2018-01-17 08:50:10 -0800556
Clint Byrum48b5a672017-08-18 14:44:00 -0700557 This option, and thus, `nullwrap`, may be removed in the future.
558 `bubblewrap` has become integral to securely operating Zuul. If you
559 have a valid use case for it, we encourage you to let us know.
560
Clint Byrum3cef7ed2017-09-29 20:18:54 -0700561 .. attr:: load_multiplier
562 :default: 2.5
563
564 When an executor host gets too busy, the system may suffer
565 timeouts and other ill effects. The executor will stop accepting
566 more than 1 job at a time until load has lowered below a safe
567 level. This level is determined by multiplying the number of
568 CPU's by `load_multiplier`.
569
570 So for example, if the system has 2 CPUs, and load_multiplier
571 is 2.5, the safe load for the system is 5.00. Any time the
572 system load average is over 5.00, the executor will quit
573 accepting multiple jobs at one time.
574
575 The executor will observe system load and determine whether
576 to accept more jobs every 30 seconds.
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.