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