blob: 4e2e889f042a16638ab727045c817475634775f8 [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
9which is described below. All Zuul processes read the
10**/etc/zuul/zuul.conf** file (an alternate location may be supplied on
11the command line) which uses an INI file syntax. Each component may
12have its own configuration file, though you may find it simpler to use
13the same file for all components.
14
15A minimal Zuul system may consist of a *scheduler* and *executor* both
16running on the same host. Larger installations should consider
17running multiple executors, each on a dedicated host, and running
18mergers on dedicated hosts as well.
19
20Common
21------
22
23The following applies to all Zuul components.
24
25Configuration
26~~~~~~~~~~~~~
27
28The following sections of **zuul.conf** are used by all Zuul components:
29
30gearman
31"""""""
32
33Client connection information for gearman.
34
35**server**
36 Hostname or IP address of the Gearman server.
37 ``server=gearman.example.com`` (required)
38
39**port**
40 Port on which the Gearman server is listening.
41 ``port=4730`` (optional)
42
43**ssl_ca**
44 Optional: An openssl file containing a set of concatenated
45 “certification authority” certificates in PEM formet.
46
47**ssl_cert**
48 Optional: An openssl file containing the client public certificate in
49 PEM format.
50
51**ssl_key**
52 Optional: An openssl file containing the client private key in PEM format.
53
James E. Blairedc40162017-06-23 20:43:38 +010054zuul
55""""
56
57**status_url**
58 URL that will be posted in Zuul comments made to changes when
59 starting jobs for a change. Used by zuul-scheduler only.
60 ``status_url=https://zuul.example.com/status``
61
62**zookeeper_hosts**
63 A list of zookeeper hosts for Zuul to use when communicating with
64 Nodepool. ``zookeeper_hosts=zk1.example.com,zk2.example.com,zk3.example.com``
65
James E. Blaireff5a9d2017-06-20 00:00:37 -070066
67Scheduler
68---------
69
70The scheduler is the primary component of Zuul. The scheduler is not
71a scalable component; one, and only one, scheduler must be running at
72all times for Zuul to be operational. It receives events from any
73connections to remote systems which have been configured, enqueues
74items into pipelines, distributes jobs to executors, and reports
75results.
76
77Configuration
78~~~~~~~~~~~~~
79
80The following sections of **zuul.conf** are used by the scheduler:
81
82gearman_server
83""""""""""""""
84
85The builtin gearman server. Zuul can fork a gearman process from itself rather
86than connecting to an external one.
87
88**start**
89 Whether to start the internal Gearman server (default: False).
90 ``start=true``
91
92**listen_address**
93 IP address or domain name on which to listen (default: all addresses).
94 ``listen_address=127.0.0.1``
95
96**log_config**
97 Path to log config file for internal Gearman server.
98 ``log_config=/etc/zuul/gearman-logging.yaml``
99
100**ssl_ca**
101 Optional: An openssl file containing a set of concatenated “certification authority” certificates
102 in PEM formet.
103
104**ssl_cert**
105 Optional: An openssl file containing the server public certificate in PEM format.
106
107**ssl_key**
108 Optional: An openssl file containing the server private key in PEM format.
109
110webapp
111""""""
112
113**listen_address**
114 IP address or domain name on which to listen (default: 0.0.0.0).
115 ``listen_address=127.0.0.1``
116
117**port**
118 Port on which the webapp is listening (default: 8001).
119 ``port=8008``
120
James E. Blaireff5a9d2017-06-20 00:00:37 -0700121**status_expiry**
122 Zuul will cache the status.json file for this many seconds. This is an
123 optional value and ``1`` is used by default.
124 ``status_expiry=1``
125
126scheduler
127"""""""""
128.. TODO: rename this to 'scheduler' (currently 'zuul') and update to match these docs
129
130**tenant_config**
131 Path to tenant config file.
132 ``layout_config=/etc/zuul/tenant.yaml``
133
134**log_config**
135 Path to log config file.
136 ``log_config=/etc/zuul/scheduler-logging.yaml``
137
138**pidfile**
139 Path to PID lock file.
140 ``pidfile=/var/run/zuul/scheduler.pid``
141
142**state_dir**
143 Path to directory that Zuul should save state to.
144 ``state_dir=/var/lib/zuul``
145
146Operation
147~~~~~~~~~
148
149To start the scheduler, run ``zuul-scheduler``. To stop it, kill the
150PID which was saved in the pidfile specified in the configuration.
151
152Most of Zuul's configuration is automatically updated as changes to
153the repositories which contain it are merged. However, Zuul must be
154explicitly notified of changes to the tenant config file, since it is
155not read from a git repository. To do so, send the scheduler PID
156(saved in the pidfile specified in the configuration) a SIGHUP signal.
157
158Merger
159------
160
161Mergers are an optional Zuul service; they are not required for Zuul
162to operate, but some high volume sites may benefit from running them.
163Zuul performs quite a lot of git operations in the course of its work.
164Each change that is to be tested must be speculatively merged with the
165current state of its target branch to ensure that it can merge, and to
166ensure that the tests that Zuul perform accurately represent the
167outcome of merging the change. Because Zuul's configuration is stored
168in the git repos it interacts with, and is dynamically evaluated, Zuul
169often needs to perform a speculative merge in order to determine
170whether it needs to perform any further actions.
171
172All of these git operations add up, and while Zuul executors can also
173perform them, large numbers may impact their ability to run jobs.
174Therefore, administrators may wish to run standalone mergers in order
175to reduce the load on executors.
176
177Configuration
178~~~~~~~~~~~~~
179
180The following section of **zuul.conf** is used by the merger:
181
182merger
183""""""
184
185**git_dir**
186 Directory that Zuul should clone local git repositories to.
187 ``git_dir=/var/lib/zuul/git``
188
189**git_user_email**
190 Optional: Value to pass to `git config user.email`.
191 ``git_user_email=zuul@example.com``
192
193**git_user_name**
194 Optional: Value to pass to `git config user.name`.
195 ``git_user_name=zuul``
196
197**log_config**
198 Path to log config file for the merger process.
199 ``log_config=/etc/zuul/logging.yaml``
200
201**pidfile**
202 Path to PID lock file for the merger process.
203 ``pidfile=/var/run/zuul-merger/merger.pid``
204
205Operation
206~~~~~~~~~
207
208To start the merger, run ``zuul-merger``. To stop it, kill the
209PID which was saved in the pidfile specified in the configuration.
210
211Executor
212--------
213
214Executors are responsible for running jobs. At the start of each job,
215an executor prepares an environment in which to run Ansible which
216contains all of the git repositories specified by the job with all
217dependent changes merged into their appropriate branches. The branch
218corresponding to the proposed change will be checked out (in all
219projects, if it exists). Any roles specified by the job will also be
220present (also with dependent changes merged, if appropriate) and added
221to the Ansible role path. The executor also prepares an Ansible
222inventory file with all of the nodes requested by the job.
223
224The executor also contains a merger. This is used by the executor to
225prepare the git repositories used by jobs, but is also available to
226perform any tasks normally performed by standalone mergers. Because
227the executor performs both roles, small Zuul installations may not
228need to run standalone mergers.
229
230Trusted and Untrusted Playbooks
231~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232
233The executor runs playbooks in one of two execution contexts depending
234on whether the project containing the playbook is a *config project*
235or an *untrusted project*. If the playbook is in a *config project*,
236the executor runs the playbook in the *trusted* execution context,
237otherwise, it is run in the *untrusted* execution context.
238
239Both execution contexts use `bubblewrap`_ to create a namespace to
240ensure that playbook executions are isolated and are unable to access
241files outside of a restricted environment. The administrator may
242configure additional local directories on the executor to be made
243available to the restricted environment.
244
245The *trusted* execution context has access to all Ansible features,
246including the ability to load custom Ansible modules. Needless to
247say, extra scrutiny should be given to code that runs in a trusted
248context as it could be used to compromise other jobs running on the
249executor, or the executor itself, especially if the administrator has
250granted additional access through bubblewrap, or a method of escaping
251the restricted environment created by bubblewrap is found.
252
253Playbooks run in the *untrusted* execution context are not permitted
254to load additional Ansible modules or access files outside of the
255restricted environment prepared for them by the executor. In addition
256to the bubblewrap environment applied to both execution contexts, in
257the *untrusted* context some standard Ansible modules are replaced
258with versions which prohibit some actions, including attempts to
259access files outside of the restricted execution context. These
260redundant protections are made as part of a defense-in-depth strategy.
261
262.. _bubblewrap: https://github.com/projectatomic/bubblewrap
263
264Configuration
265~~~~~~~~~~~~~
266
267The following sections of **zuul.conf** are used by the executor:
268
269executor
270""""""""
271
272**finger_port**
273 Port to use for finger log streamer.
274 ``finger_port=79``
275
276**git_dir**
277 Directory that Zuul should clone local git repositories to.
278 ``git_dir=/var/lib/zuul/git``
279
280**log_config**
281 Path to log config file for the executor process.
282 ``log_config=/etc/zuul/logging.yaml``
283
284**private_key_file**
285 SSH private key file to be used when logging into worker nodes.
286 ``private_key_file=~/.ssh/id_rsa``
287
288**user**
289 User ID for the zuul-executor process. In normal operation as a daemon,
290 the executor should be started as the ``root`` user, but it will drop
291 privileges to this user during startup.
292 ``user=zuul``
293
294merger
295""""""
296
297**git_user_email**
298 Optional: Value to pass to `git config user.email`.
299 ``git_user_email=zuul@example.com``
300
301**git_user_name**
302 Optional: Value to pass to `git config user.name`.
303 ``git_user_name=zuul``
304
305Operation
306~~~~~~~~~
307
308To start the executor, run ``zuul-executor``.
309
310There are several commands which can be run to control the executor's
311behavior once it is running.
312
313To stop the executor immediately, aborting all jobs (they may be
314relaunched according to their retry policy), run ``zuul-executor
315stop``.
316
317To request that the executor stop executing new jobs and exit when all
318currently running jobs have completed, run ``zuul-executor graceful``.
319
320To enable or disable running Ansible in verbose mode (with the '-vvv'
321argument to ansible-playbook) run ``zuul-executor verbose`` and
322``zuul-executor unverbose``.