James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 1 | :title: Components |
| 2 | |
| 3 | .. _components: |
| 4 | |
| 5 | Components |
| 6 | ========== |
| 7 | |
| 8 | Zuul is a distributed system consisting of several components, each of |
| 9 | which is described below. All Zuul processes read the |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 10 | ``/etc/zuul/zuul.conf`` file (an alternate location may be supplied on |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 11 | the command line) which uses an INI file syntax. Each component may |
| 12 | have its own configuration file, though you may find it simpler to use |
| 13 | the same file for all components. |
| 14 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 15 | An example ``zuul.conf``: |
| 16 | |
| 17 | .. code-block:: ini |
| 18 | |
| 19 | [gearman] |
| 20 | server=localhost |
| 21 | |
| 22 | [gearman_server] |
| 23 | start=true |
| 24 | log_config=/etc/zuul/gearman-logging.yaml |
| 25 | |
| 26 | [zookeeper] |
| 27 | hosts=zk1.example.com,zk2.example.com,zk3.example.com |
| 28 | |
| 29 | [webapp] |
| 30 | status_url=https://zuul.example.com/status |
| 31 | |
| 32 | [scheduler] |
| 33 | log_config=/etc/zuul/scheduler-logging.yaml |
| 34 | |
| 35 | A minimal Zuul system may consist of a :ref:`scheduler` and |
| 36 | :ref:`executor` both running on the same host. Larger installations |
| 37 | should consider running multiple executors, each on a dedicated host, |
| 38 | and running mergers on dedicated hosts as well. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 39 | |
| 40 | Common |
| 41 | ------ |
| 42 | |
| 43 | The following applies to all Zuul components. |
| 44 | |
| 45 | Configuration |
| 46 | ~~~~~~~~~~~~~ |
| 47 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 48 | The following sections of ``zuul.conf`` are used by all Zuul components: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 49 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 50 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 51 | .. attr:: gearman |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 52 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 53 | Client connection information for Gearman. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 54 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 55 | .. attr:: server |
| 56 | :required: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 57 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 58 | Hostname or IP address of the Gearman server. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 59 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 60 | .. attr:: port |
| 61 | :default: 4730 |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 62 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 63 | Port on which the Gearman server is listening. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 64 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 65 | .. attr:: ssl_ca |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 66 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 67 | An openssl file containing a set of concatenated “certification |
| 68 | authority” certificates in PEM formet. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 69 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 70 | .. attr:: ssl_cert |
| 71 | |
| 72 | An openssl file containing the client public certificate in PEM format. |
| 73 | |
| 74 | .. attr:: ssl_key |
| 75 | |
| 76 | An openssl file containing the client private key in PEM format. |
James E. Blair | fdb111d | 2017-06-23 20:56:05 +0100 | [diff] [blame] | 77 | |
James E. Blair | 4f3e622 | 2017-07-05 14:52:08 -0700 | [diff] [blame] | 78 | .. NOTE: this is a white lie at this point, since only the scheduler |
| 79 | uses this, however, we expect other components to use it later, so |
| 80 | it's reasonable for admins to plan for this now. |
| 81 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 82 | .. attr:: zookeeper |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 83 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 84 | Client connection information for ZooKeeper |
James E. Blair | fdb111d | 2017-06-23 20:56:05 +0100 | [diff] [blame] | 85 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 86 | .. attr:: hosts |
| 87 | :required: |
| 88 | |
| 89 | A list of zookeeper hosts for Zuul to use when communicating |
| 90 | with Nodepool. |
| 91 | |
| 92 | |
| 93 | .. _scheduler: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 94 | |
| 95 | Scheduler |
| 96 | --------- |
| 97 | |
| 98 | The scheduler is the primary component of Zuul. The scheduler is not |
| 99 | a scalable component; one, and only one, scheduler must be running at |
| 100 | all times for Zuul to be operational. It receives events from any |
| 101 | connections to remote systems which have been configured, enqueues |
| 102 | items into pipelines, distributes jobs to executors, and reports |
| 103 | results. |
| 104 | |
| 105 | Configuration |
| 106 | ~~~~~~~~~~~~~ |
| 107 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 108 | The following sections of ``zuul.conf`` are used by the scheduler: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 109 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 110 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 111 | .. attr:: gearman_server |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 112 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 113 | The builtin gearman server. Zuul can fork a gearman process from |
| 114 | itself rather than connecting to an external one. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 115 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 116 | .. attr:: start |
| 117 | :default: false |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 118 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 119 | Whether to start the internal Gearman server. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 120 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 121 | .. attr:: listen_address |
| 122 | :default: all addresses |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 123 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 124 | IP address or domain name on which to listen. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 125 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 126 | .. attr:: log_config |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 127 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 128 | Path to log config file for internal Gearman server. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 129 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 130 | .. attr:: ssl_ca |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 131 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 132 | An openssl file containing a set of concatenated “certification |
| 133 | authority” certificates in PEM formet. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 134 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 135 | .. attr:: ssl_cert |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 136 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 137 | An openssl file containing the server public certificate in PEM |
| 138 | format. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 139 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 140 | .. attr:: ssl_key |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 141 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 142 | An openssl file containing the server private key in PEM format. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 143 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 144 | .. attr:: webapp |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 145 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 146 | .. attr:: listen_address |
| 147 | :default: all addresses |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 148 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 149 | IP address or domain name on which to listen. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 150 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 151 | .. attr:: port |
| 152 | :default: 8001 |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 153 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 154 | Port on which the webapp is listening. |
James E. Blair | 4f3e622 | 2017-07-05 14:52:08 -0700 | [diff] [blame] | 155 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 156 | .. attr:: status_expiry |
| 157 | :default: 1 |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 158 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 159 | Zuul will cache the status.json file for this many seconds. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 160 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 161 | .. attr:: status_url |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 162 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 163 | URL that will be posted in Zuul comments made to changes when |
| 164 | starting jobs for a change. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 165 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 166 | .. TODO: is this effectively required? |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 167 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 168 | .. attr:: scheduler |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 169 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 170 | .. attr:: tenant_config |
| 171 | :required: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 172 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 173 | Path to :ref:`tenant-config` file. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 174 | |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 175 | .. attr:: log_config |
| 176 | |
| 177 | Path to log config file. |
| 178 | |
| 179 | .. attr:: pidfile |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 180 | :default: /var/run/zuul-schedurecr/zuul-scheduler.pid |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 181 | |
| 182 | Path to PID lock file. |
| 183 | |
| 184 | .. attr:: state_dir |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 185 | :default: /var/lib/zuul |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 186 | |
| 187 | Path to directory in which Zuul should save its state. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 188 | |
| 189 | Operation |
| 190 | ~~~~~~~~~ |
| 191 | |
| 192 | To start the scheduler, run ``zuul-scheduler``. To stop it, kill the |
| 193 | PID which was saved in the pidfile specified in the configuration. |
| 194 | |
| 195 | Most of Zuul's configuration is automatically updated as changes to |
| 196 | the repositories which contain it are merged. However, Zuul must be |
| 197 | explicitly notified of changes to the tenant config file, since it is |
| 198 | not read from a git repository. To do so, send the scheduler PID |
James E. Blair | 9794019 | 2017-08-03 14:47:47 -0700 | [diff] [blame] | 199 | (saved in the pidfile specified in the configuration) a `SIGHUP` |
| 200 | signal. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 201 | |
| 202 | Merger |
| 203 | ------ |
| 204 | |
| 205 | Mergers are an optional Zuul service; they are not required for Zuul |
| 206 | to operate, but some high volume sites may benefit from running them. |
| 207 | Zuul performs quite a lot of git operations in the course of its work. |
| 208 | Each change that is to be tested must be speculatively merged with the |
| 209 | current state of its target branch to ensure that it can merge, and to |
| 210 | ensure that the tests that Zuul perform accurately represent the |
| 211 | outcome of merging the change. Because Zuul's configuration is stored |
| 212 | in the git repos it interacts with, and is dynamically evaluated, Zuul |
| 213 | often needs to perform a speculative merge in order to determine |
| 214 | whether it needs to perform any further actions. |
| 215 | |
| 216 | All of these git operations add up, and while Zuul executors can also |
| 217 | perform them, large numbers may impact their ability to run jobs. |
| 218 | Therefore, administrators may wish to run standalone mergers in order |
| 219 | to reduce the load on executors. |
| 220 | |
| 221 | Configuration |
| 222 | ~~~~~~~~~~~~~ |
| 223 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 224 | The following section of ``zuul.conf`` is used by the merger: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 225 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 226 | .. attr:: merger |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 227 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 228 | .. attr:: git_dir |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 229 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 230 | Directory in which Zuul should clone git repositories. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 231 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 232 | .. attr:: git_user_email |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 233 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 234 | Value to pass to `git config user.email |
| 235 | <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 236 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 237 | .. attr:: git_user_name |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 238 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 239 | Value to pass to `git config user.name |
| 240 | <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 241 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 242 | .. attr:: log_config |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 243 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 244 | Path to log config file for the merger process. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 245 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 246 | .. attr:: pidfile |
| 247 | :default: /var/run/zuul-merger/zuul-merger.pid |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 248 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 249 | Path to PID lock file for the merger process. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 250 | |
| 251 | Operation |
| 252 | ~~~~~~~~~ |
| 253 | |
| 254 | To start the merger, run ``zuul-merger``. To stop it, kill the |
| 255 | PID which was saved in the pidfile specified in the configuration. |
| 256 | |
David Shrewsbury | b040b0a | 2017-08-03 15:53:59 -0400 | [diff] [blame] | 257 | .. _executor: |
| 258 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 259 | Executor |
| 260 | -------- |
| 261 | |
| 262 | Executors are responsible for running jobs. At the start of each job, |
| 263 | an executor prepares an environment in which to run Ansible which |
| 264 | contains all of the git repositories specified by the job with all |
| 265 | dependent changes merged into their appropriate branches. The branch |
| 266 | corresponding to the proposed change will be checked out (in all |
| 267 | projects, if it exists). Any roles specified by the job will also be |
| 268 | present (also with dependent changes merged, if appropriate) and added |
| 269 | to the Ansible role path. The executor also prepares an Ansible |
| 270 | inventory file with all of the nodes requested by the job. |
| 271 | |
| 272 | The executor also contains a merger. This is used by the executor to |
| 273 | prepare the git repositories used by jobs, but is also available to |
| 274 | perform any tasks normally performed by standalone mergers. Because |
| 275 | the executor performs both roles, small Zuul installations may not |
| 276 | need to run standalone mergers. |
| 277 | |
| 278 | Trusted and Untrusted Playbooks |
| 279 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 280 | |
| 281 | The executor runs playbooks in one of two execution contexts depending |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 282 | on whether the project containing the playbook is a |
| 283 | :term:`config-project` or an :term:`untrusted-project`. If the |
| 284 | playbook is in a config project, the executor runs the playbook in the |
| 285 | *trusted* execution context, otherwise, it is run in the *untrusted* |
| 286 | execution context. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 287 | |
| 288 | Both execution contexts use `bubblewrap`_ to create a namespace to |
| 289 | ensure that playbook executions are isolated and are unable to access |
| 290 | files outside of a restricted environment. The administrator may |
| 291 | configure additional local directories on the executor to be made |
| 292 | available to the restricted environment. |
| 293 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 294 | The trusted execution context has access to all Ansible features, |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 295 | including the ability to load custom Ansible modules. Needless to |
| 296 | say, extra scrutiny should be given to code that runs in a trusted |
| 297 | context as it could be used to compromise other jobs running on the |
| 298 | executor, or the executor itself, especially if the administrator has |
| 299 | granted additional access through bubblewrap, or a method of escaping |
| 300 | the restricted environment created by bubblewrap is found. |
| 301 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 302 | Playbooks run in the untrusted execution context are not permitted to |
| 303 | load additional Ansible modules or access files outside of the |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 304 | restricted environment prepared for them by the executor. In addition |
| 305 | to the bubblewrap environment applied to both execution contexts, in |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 306 | the untrusted context some standard Ansible modules are replaced with |
| 307 | versions which prohibit some actions, including attempts to access |
| 308 | files outside of the restricted execution context. These redundant |
| 309 | protections are made as part of a defense-in-depth strategy. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 310 | |
| 311 | .. _bubblewrap: https://github.com/projectatomic/bubblewrap |
| 312 | |
| 313 | Configuration |
| 314 | ~~~~~~~~~~~~~ |
| 315 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 316 | The following sections of ``zuul.conf`` are used by the executor: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 317 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 318 | .. attr:: executor |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 319 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 320 | .. attr:: finger_port |
| 321 | :default: 79 |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 322 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 323 | Port to use for finger log streamer. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 324 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 325 | .. attr:: git_dir |
| 326 | :default: /var/lib/zuul/git |
James E. Blair | 7e6e0a1 | 2017-07-25 11:04:42 -0700 | [diff] [blame] | 327 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 328 | Directory that Zuul should clone local git repositories to. The |
| 329 | executor keeps a local copy of every git repository it works |
| 330 | with to speed operations and perform speculative merging. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 331 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 332 | This should be on the same filesystem as |
| 333 | :attr:`executor.job_dir` so that when git repos are cloned into |
| 334 | the job workspaces, they can be hard-linked to the local git |
| 335 | cache. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 336 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 337 | .. attr:: job_dir |
| 338 | :default: /tmp |
James E. Blair | 7e6e0a1 | 2017-07-25 11:04:42 -0700 | [diff] [blame] | 339 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 340 | Directory that Zuul should use to hold temporary job directories. |
| 341 | When each job is run, a new entry will be created under this |
| 342 | directory to hold the configuration and scratch workspace for |
| 343 | that job. It will be deleted at the end of the job (unless the |
| 344 | `--keep-jobdir` command line option is specified). |
James E. Blair | 7e6e0a1 | 2017-07-25 11:04:42 -0700 | [diff] [blame] | 345 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 346 | This should be on the same filesystem as :attr:`executor.git_dir` |
| 347 | so that when git repos are cloned into the job workspaces, they |
| 348 | can be hard-linked to the local git cache. |
James E. Blair | 7e6e0a1 | 2017-07-25 11:04:42 -0700 | [diff] [blame] | 349 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 350 | .. attr:: log_config |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 351 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 352 | Path to log config file for the executor process. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 353 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 354 | .. attr:: pidfile |
| 355 | :default: /var/run/zuul-executor/zuul-executor.pid |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 356 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 357 | Path to PID lock file for the executor process. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 358 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 359 | .. attr:: private_key_file |
| 360 | :default: ~/.ssh/id_rsa |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 361 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 362 | SSH private key file to be used when logging into worker nodes. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 363 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 364 | .. attr:: user |
| 365 | :default: zuul |
Jamie Lennox | 7655b55 | 2017-03-17 12:33:38 +1100 | [diff] [blame] | 366 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 367 | User ID for the zuul-executor process. In normal operation as a |
| 368 | daemon, the executor should be started as the ``root`` user, but |
| 369 | it will drop privileges to this user during startup. |
Jamie Lennox | 7655b55 | 2017-03-17 12:33:38 +1100 | [diff] [blame] | 370 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 371 | .. _admin_sitewide_variables: |
Jamie Lennox | 7655b55 | 2017-03-17 12:33:38 +1100 | [diff] [blame] | 372 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 373 | .. attr:: variables |
Jamie Lennox | 7655b55 | 2017-03-17 12:33:38 +1100 | [diff] [blame] | 374 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 375 | Path to an Ansible variables file to supply site-wide variables. |
| 376 | This should be a YAML-formatted file consisting of a single |
| 377 | dictionary. The contents will be made available to all jobs as |
| 378 | Ansible variables. These variables take precedence over all |
| 379 | other forms (job variables and secrets). Care should be taken |
| 380 | when naming these variables to avoid potential collisions with |
| 381 | those used by jobs. Prefixing variable names with a |
| 382 | site-specific identifier is recommended. The default is not to |
| 383 | add any site-wide variables. See the :ref:`User's Guide |
| 384 | <user_sitewide_variables>` for more information. |
Clint Byrum | dc8a090 | 2017-07-20 16:36:27 -0700 | [diff] [blame] | 385 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 386 | .. attr:: disk_limit_per_job |
| 387 | :default: 250 |
Clint Byrum | dc8a090 | 2017-07-20 16:36:27 -0700 | [diff] [blame] | 388 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 389 | This integer is the maximum number of megabytes that any one job |
| 390 | is allowed to consume on disk while it is running. If a job's |
| 391 | scratch space has more than this much space consumed, it will be |
| 392 | aborted. |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 393 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 394 | .. attr:: trusted_ro_paths |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 395 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 396 | List of paths, separated by ``:`` to read-only bind mount into |
| 397 | trusted bubblewrap contexts. |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 398 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 399 | .. attr:: trusted_rw_paths |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 400 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 401 | List of paths, separated by ``:`` to read-write bind mount into |
| 402 | trusted bubblewrap contexts. |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 403 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 404 | .. attr:: untrusted_ro_paths |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 405 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 406 | List of paths, separated by ``:`` to read-only bind mount into |
| 407 | untrusted bubblewrap contexts. |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 408 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 409 | .. attr:: untrusted_rw_paths |
Monty Taylor | 01380dd | 2017-07-28 16:01:20 -0500 | [diff] [blame] | 410 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 411 | List of paths, separated by ``:`` to read-write bind mount into |
| 412 | untrusted bubblewrap contexts. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 413 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 414 | .. attr:: merger |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 415 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 416 | .. attr:: git_user_email |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 417 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 418 | Value to pass to `git config user.email |
| 419 | <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_. |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 420 | |
James E. Blair | 9d0b4cc | 2017-08-03 15:08:47 -0700 | [diff] [blame] | 421 | .. attr:: git_user_name |
| 422 | |
| 423 | Value to pass to `git config user.name |
| 424 | <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>`_. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 425 | |
| 426 | Operation |
| 427 | ~~~~~~~~~ |
| 428 | |
| 429 | To start the executor, run ``zuul-executor``. |
| 430 | |
| 431 | There are several commands which can be run to control the executor's |
| 432 | behavior once it is running. |
| 433 | |
| 434 | To stop the executor immediately, aborting all jobs (they may be |
| 435 | relaunched according to their retry policy), run ``zuul-executor |
| 436 | stop``. |
| 437 | |
| 438 | To request that the executor stop executing new jobs and exit when all |
| 439 | currently running jobs have completed, run ``zuul-executor graceful``. |
| 440 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 441 | To enable or disable running Ansible in verbose mode (with the |
| 442 | ``-vvv`` argument to ansible-playbook) run ``zuul-executor verbose`` |
| 443 | and ``zuul-executor unverbose``. |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 444 | |
| 445 | Web Server |
| 446 | ---------- |
| 447 | |
| 448 | The Zuul web server currently acts as a websocket interface to live log |
| 449 | streaming. Eventually, it will serve as the single process handling all |
| 450 | HTTP interactions with Zuul. |
| 451 | |
| 452 | Configuration |
| 453 | ~~~~~~~~~~~~~ |
| 454 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 455 | In addition to the common configuration sections, the following |
| 456 | sections of ``zuul.conf`` are used by the web server: |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 457 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 458 | .. attr:: web |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 459 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 460 | .. attr:: listen_address |
| 461 | :default: 127.0.0.1 |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 462 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 463 | IP address or domain name on which to listen. |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 464 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 465 | .. attr:: log_config |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 466 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 467 | Path to log config file for the web server process. |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 468 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 469 | .. attr:: pidfile |
| 470 | :default: /var/run/zuul-web/zuul-web.pid |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 471 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 472 | Path to PID lock file for the web server process. |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 473 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 474 | .. attr:: port |
| 475 | :default: 9000 |
David Shrewsbury | 6b3b49b | 2017-07-11 13:00:38 -0400 | [diff] [blame] | 476 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 477 | Port to use for web server process. |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 478 | |
James E. Blair | afe27e6 | 2017-08-03 15:11:47 -0700 | [diff] [blame] | 479 | .. attr:: websocket_url |
| 480 | |
| 481 | Base URL on which the websocket service is exposed, if different |
| 482 | than the base URL of the web app. |
Tobias Henkel | b4407fc | 2017-07-07 13:52:56 +0200 | [diff] [blame] | 483 | |
David Shrewsbury | ae734d1 | 2017-07-11 12:41:59 -0400 | [diff] [blame] | 484 | Operation |
| 485 | ~~~~~~~~~ |
| 486 | |
| 487 | To start the web server, run ``zuul-web``. To stop it, kill the |
| 488 | PID which was saved in the pidfile specified in the configuration. |