Thanh Ha | 33ccffe | 2016-01-24 21:32:25 -0500 | [diff] [blame] | 1 | Quick Start Guide |
| 2 | ================= |
| 3 | |
| 4 | System Requirements |
| 5 | ------------------- |
| 6 | |
| 7 | For most deployments zuul only needs 1-2GB. OpenStack uses a 30GB setup. |
| 8 | |
| 9 | Install Zuul |
| 10 | ------------ |
| 11 | |
| 12 | You can get zuul from pypi via:: |
| 13 | |
| 14 | pip install zuul |
| 15 | |
| 16 | Zuul Components |
| 17 | --------------- |
| 18 | |
| 19 | Zuul provides the following components: |
| 20 | |
| 21 | - **zuul-server**: scheduler daemon which communicates with Gerrit and |
Paul Belanger | 174a827 | 2017-03-14 13:20:10 -0400 | [diff] [blame] | 22 | Gearman. Handles receiving events, executing jobs, collecting results |
Thanh Ha | 33ccffe | 2016-01-24 21:32:25 -0500 | [diff] [blame] | 23 | and postingreports. |
| 24 | - **zuul-merger**: speculative-merger which communicates with Gearman. |
| 25 | Prepares Git repositories for jobs to test against. This additionally |
| 26 | requires a web server hosting the Git repositories which can be cloned |
| 27 | by the jobs. |
| 28 | - **zuul-cloner**: client side script used to setup job workspace. It is |
| 29 | used to clone the repositories prepared by the zuul-merger described |
| 30 | previously. |
| 31 | - **gearmand**: optional builtin gearman daemon provided by zuul-server |
| 32 | |
| 33 | External components: |
| 34 | |
| 35 | - Jenkins Gearman plugin: Used by Jenkins to connect to Gearman |
| 36 | |
| 37 | Zuul Communication |
| 38 | ------------------ |
| 39 | |
| 40 | All the Zuul components communicate with each other using Gearman. As well as |
| 41 | the following communication channels: |
| 42 | |
| 43 | zuul-server: |
| 44 | |
| 45 | - Gerrit |
| 46 | - Gearman Daemon |
| 47 | |
| 48 | zuul-merger: |
| 49 | |
| 50 | - Gerrit |
| 51 | - Gearman Daemon |
| 52 | |
| 53 | zuul-cloner: |
| 54 | |
| 55 | - http hosted zuul-merger git repos |
| 56 | |
| 57 | Jenkins: |
| 58 | |
| 59 | - Gearman Daemon via Jenkins Gearman Plugin |
| 60 | |
| 61 | Zuul Setup |
| 62 | ---------- |
| 63 | |
| 64 | At minimum we need to provide **zuul.conf** and **layout.yaml** and placed |
| 65 | in /etc/zuul/ directory. You will also need a zuul user and ssh key for the |
| 66 | zuul user in Gerrit. The following example uses the builtin gearmand service |
| 67 | in zuul. |
| 68 | |
| 69 | **zuul.conf**:: |
| 70 | |
| 71 | [zuul] |
| 72 | layout_config=/etc/zuul/layout.yaml |
| 73 | |
| 74 | [merger] |
| 75 | git_dir=/git |
| 76 | zuul_url=http://zuul.example.com/p |
| 77 | |
| 78 | [gearman_server] |
| 79 | start=true |
| 80 | |
| 81 | [gearman] |
| 82 | server=127.0.0.1 |
| 83 | |
| 84 | [connection gerrit] |
| 85 | driver=gerrit |
| 86 | server=git.example.com |
| 87 | port=29418 |
| 88 | baseurl=https://git.example.com/gerrit/ |
| 89 | user=zuul |
| 90 | sshkey=/home/zuul/.ssh/id_rsa |
| 91 | |
| 92 | See :doc:`zuul` for more details. |
| 93 | |
| 94 | The following sets up a basic timer triggered job using zuul. |
| 95 | |
| 96 | **layout.yaml**:: |
| 97 | |
| 98 | pipelines: |
| 99 | - name: periodic |
| 100 | source: gerrit |
| 101 | manager: IndependentPipelineManager |
| 102 | trigger: |
| 103 | timer: |
| 104 | - time: '0 * * * *' |
| 105 | |
| 106 | projects: |
| 107 | - name: aproject |
| 108 | periodic: |
| 109 | - aproject-periodic-build |
| 110 | |
| 111 | Starting Zuul |
| 112 | ------------- |
| 113 | |
| 114 | You can run zuul-server with the **-d** option to make it not daemonize. It's |
| 115 | a good idea at first to confirm there's no issues with your configuration. |
| 116 | |
| 117 | Simply run:: |
| 118 | |
| 119 | zuul-server |
| 120 | |
| 121 | Once run you should have 2 zuul-server processes:: |
| 122 | |
| 123 | zuul 12102 1 0 Jan21 ? 00:15:45 /home/zuul/zuulvenv/bin/python /home/zuul/zuulvenv/bin/zuul-server -d |
| 124 | zuul 12107 12102 0 Jan21 ? 00:00:01 /home/zuul/zuulvenv/bin/python /home/zuul/zuulvenv/bin/zuul-server -d |
| 125 | |
| 126 | Note: In this example zuul was installed in a virtualenv. |
| 127 | |
| 128 | The 2nd zuul-server process is gearmand running if you are using the builtin |
| 129 | gearmand server, otherwise there will only be 1 process. |
| 130 | |
| 131 | Zuul won't actually process your Job queue however unless you also have a |
| 132 | zuul-merger process running. |
| 133 | |
| 134 | Simply run:: |
| 135 | |
| 136 | zuul-merger |
| 137 | |
| 138 | Zuul should now be able to process your periodic job as configured above once |
| 139 | the Jenkins side of things is configured. |
| 140 | |
| 141 | Jenkins Setup |
| 142 | ------------- |
| 143 | |
| 144 | Install the Jenkins Gearman Plugin via Jenkins Plugin management interface. |
| 145 | Then naviage to **Manage > Configuration > Gearman** and setup the Jenkins |
| 146 | server hostname/ip and port to connect to gearman. |
| 147 | |
| 148 | At this point gearman should be running your Jenkins jobs. |
| 149 | |
| 150 | Troubleshooting |
| 151 | --------------- |
| 152 | |
| 153 | Checking Gearman function registration (jobs). You can use telnet to connect |
| 154 | to gearman to check that Jenkins is registering your configured jobs in |
| 155 | gearman:: |
| 156 | |
| 157 | telnet <gearman_ip> 4730 |
| 158 | |
| 159 | Useful commands are **workers** and **status** which you can run by just |
| 160 | typing those commands once connected to gearman. Every job in your Jenkins |
| 161 | master must appear when you run **workers** for Zuul to be able to run jobs |
| 162 | against your Jenkins instance. |