| LEFT | RIGHT |
| 1 Adblock Plus infrastructure | 1 Adblock Plus infrastructure |
| 2 =========================== | 2 =========================== |
| 3 | 3 |
| 4 The Adblock Plus infrastructure uses [Puppet](http://puppetlabs.com/) | 4 The Adblock Plus infrastructure uses [Puppet](http://puppetlabs.com/) |
| 5 to set up servers, and to have a realistic development environment. | 5 to set up servers, and to have a realistic development environment. |
| 6 | 6 |
| 7 Our Puppet manifests are only tested with Ubuntu 12.04 right now. | 7 Our Puppet manifests are only tested with Ubuntu 12.04 right now. |
| 8 | 8 |
| 9 Host specific setup | 9 Environment specific setup |
| 10 ------------------- | 10 -------------------------- |
| 11 | 11 |
| 12 Some infrastructure parts are specific to the environment (such as e.g. | 12 Some infrastructure parts are specific to the environment (such as e.g. |
| 13 *development*, *test* and *production*) whilst passwords, for example, | 13 *development*, *test* and *production*) whilst passwords, for example, |
| 14 are confidential. In order to allow for such specific configuration, the | 14 are confidential. In order to allow for such specific configuration, the |
| 15 repository requires a set of manual operations during the initial setup: | 15 repository requires a set of manual operations during the initial setup: |
| 16 | 16 |
| 17 ### `modules/private` | 17 ### `modules/private` |
| 18 | 18 |
| 19 The `private` module is destined to store confidential information such as | 19 The `private` module is destined to store confidential information such as |
| 20 [RSA](http://en.wikipedia.org/wiki/RSA_%28cryptosystem%29) keys, `htpasswd` | 20 [RSA](http://en.wikipedia.org/wiki/RSA_%28cryptosystem%29) keys, `htpasswd` |
| 21 files and so on. The repository provides a `private-stub` module containing | 21 files and so on. The repository provides a `private-stub` module containing |
| 22 defaults suitable for development and testing purpose. One can create a | 22 defaults suitable for development and testing purposes. One can create a |
| 23 symbolic link to start using the resource: | 23 symbolic link to start using the resource: |
| 24 | 24 |
| 25 # UNIX-oid | 25 #### UNIX-like |
| 26 user@host:~/infrastructure$ ln -s private-stub modules/private | 26 |
| 27 | 27 ln -s private-stub modules/private |
| 28 # Windows | 28 |
| 29 C:\infrastructure\> MKLINK /D modules\private private-stub | 29 #### Windows |
| 30 |
| 31 MKLINK /D modules\private private-stub |
| 30 | 32 |
| 31 When creating a custom version, one may inspect the `modules/private-stub` | 33 When creating a custom version, one may inspect the `modules/private-stub` |
| 32 directory to determine which resources have to be provided. | 34 directory to determine which resources have to be provided. |
| 33 | 35 |
| 34 ### `hiera/private` | 36 ### `hiera/private` |
| 35 | 37 |
| 36 Analogous to `modules/private`, [Hiera](https://docs.puppetlabs.com/hiera/1/) | 38 Analogous to `modules/private`, [Hiera](https://docs.puppetlabs.com/hiera/1/) |
| 37 configuration files specific to the current environment are expected to be | 39 configuration files specific to the current environment are expected to be |
| 38 found in `hiera/private`. Default resources for development (and testing) | 40 found in `hiera/private`. Default resources for development (and testing) |
| 39 purpose are provided within `modules/private-stub/hiera`: | 41 purposes are provided within `modules/private-stub/hiera`: |
| 40 | 42 |
| 41 # UNIX-oid | 43 #### UNIX-like |
| 42 user@host:~/infrastructure$ ln -s ../modules/private-stub/hiera hiera/privat
e | 44 |
| 43 | 45 ln -s ../modules/private-stub/hiera hiera/private |
| 44 # Windows | 46 |
| 45 C:\infrastructure\> MKLINK /D ..\modules\private-stub\hiera hiera\private | 47 #### Windows |
| 48 |
| 49 MKLINK /D ..\modules\private-stub\hiera hiera\private |
| 46 | 50 |
| 47 Note that custom versions are recommended to be tracked together with the | 51 Note that custom versions are recommended to be tracked together with the |
| 48 custom `private` module, if any. | 52 custom `private` module, if any. |
| 49 | 53 |
| 50 Development environment | 54 Development environment |
| 51 ----------------------- | 55 ----------------------- |
| 52 | 56 |
| 53 As with our other projects, all changes to our infrastructure should | 57 As with our other projects, all changes to our infrastructure should |
| 54 be made in a local development environment, and reviewed before | 58 be made in a local development environment, and reviewed before |
| 55 deployment. Thanks to Puppet, we can easily set up local VMs that | 59 deployment. Thanks to Puppet, we can easily set up local VMs that |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 To set up a new host, extend the custom `hiera/private/host.yaml` by another | 103 To set up a new host, extend the custom `hiera/private/host.yaml` by another |
| 100 `servers:` item, e.g.: | 104 `servers:` item, e.g.: |
| 101 | 105 |
| 102 # ... | 106 # ... |
| 103 custom1: | 107 custom1: |
| 104 ip: [10.8.0.254] | 108 ip: [10.8.0.254] |
| 105 dns: foobar.example.com | 109 dns: foobar.example.com |
| 106 ssh_public_key: AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAA... | 110 ssh_public_key: AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAA... |
| 107 role: codereviewserver | 111 role: codereviewserver |
| 108 | 112 |
| 109 See `modules/base/manifests/init.pp`, especially the `explicit_host_record()` | 113 See `modules/base/manifests/init.pp`, especially the definition of the named |
| 110 named type within class `base`, for more information on the possible option | 114 type `explicit_host_record()` within class `base`, for more information on the |
| 111 keys and values. | 115 possible option keys and values. |
| 116 |
| 117 In development, this is all that needs to be done before the new box can be |
| 118 started using `vagrant up ...`. Production servers, however, need a working |
| 119 Puppet configuration first (see below). |
| 112 | 120 |
| 113 Configuring Puppet | 121 Configuring Puppet |
| 114 ------------------ | 122 ------------------ |
| 115 | 123 |
| 116 Below please find brief instructions for setting up Puppet on both master | |
| 117 and agents: | |
| 118 | |
| 119 ### Prerequisites | 124 ### Prerequisites |
| 120 | 125 |
| 121 1. Install Ubuntu Server 12.04 LTS | 126 1. Install Ubuntu Server 12.04 LTS |
| 122 2. Perform an update and install Puppet | 127 2. Run `hiera/install_precise.py` as user `root` to install Puppet and Hiera |
| 123 | |
| 124 » apt-get -y update && apt-get -y upgrade && apt-get -y install puppet | |
| 125 | |
| 126 3. Enable pluginsync (Add the following to the _main_ section in | 128 3. Enable pluginsync (Add the following to the _main_ section in |
| 127 _/etc/puppet/puppet.conf_) | 129 _/etc/puppet/puppet.conf_) |
| 128 | 130 |
| 129 pluginsync=true | 131 pluginsync=true |
| 130 | 132 |
| 131 4. Configure the master address (Add the following to the bottom of | 133 4. Configure the master address (Add the following to the bottom of |
| 132 _/etc/puppet/puppet.conf_) | 134 _/etc/puppet/puppet.conf_) |
| 133 | 135 |
| 134 [agent] | 136 [agent] |
| 135 server = puppetmaster.adblockplus.org | 137 server = puppetmaster.adblockplus.org |
| 136 | 138 |
| 137 Now you can either set it up as a pure agent or as a master. The | 139 Now you can either set it up as a pure agent or as a master. The |
| 138 master provides the configuration, agents fetch it from the master and | 140 master provides the configuration, agents fetch it from the master and |
| 139 apply it locally. The master is also an agent, fetching configuration | 141 apply it locally. The master is also an agent, fetching configuration |
| 140 from itself. | 142 from itself. |
| 141 | 143 |
| 142 #### Puppet agent | 144 ### Puppet agent |
| 143 | 145 |
| 144 1. Attempt an initial provisioning, this will fail | 146 1. Attempt an initial provisioning, this will fail |
| 145 | 147 |
| 146 puppet agent --test | 148 puppet agent --test |
| 147 | 149 |
| 148 2. On the master: List the certificates to get the name of the new | 150 2. On the master: List the certificates to get the name of the new |
| 149 agent's certificate | 151 agent's certificate |
| 150 | 152 |
| 151 puppet cert list | 153 puppet cert list |
| 152 | 154 |
| 153 3. Still on the master: Sign the certificate, e.g. for serverx: | 155 3. Still on the master: Sign the certificate, e.g. for serverx: |
| 154 | 156 |
| 155 puppet cert sign serverx | 157 puppet cert sign serverx |
| 156 | 158 |
| 157 4. Back on the agent: Attempt another provisioning, it should work now | 159 4. Back on the agent: Attempt another provisioning, it should work now |
| 158 | 160 |
| 159 puppet agent --test | 161 puppet agent --test |
| 160 | 162 |
| 161 #### Puppet master | 163 ### Puppet master |
| 162 | 164 |
| 163 1. Configure the certificate name (Add the following to the _master_ | 165 1. Configure the certificate name (Add the following to the _master_ |
| 164 section in _/etc/puppet/puppet.conf_) | 166 section in _/etc/puppet/puppet.conf_) |
| 165 | 167 |
| 166 certname = puppetmaster.adblockplus.org | 168 certname = puppetmaster.adblockplus.org |
| 167 | 169 |
| 168 2. Install the required packages | 170 2. Install the required packages |
| 169 | 171 |
| 170 apt-get install puppetmaster mercurial | 172 apt-get install puppetmaster mercurial |
| 171 | 173 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 Monitoring is fully functional in any environment, including development. | 205 Monitoring is fully functional in any environment, including development. |
| 204 Here, after bootstrapping the `server4` box, one can access the Nagios GUI | 206 Here, after bootstrapping the `server4` box, one can access the Nagios GUI |
| 205 from the host machine via <https://nagiosadmin:nagiosadmin@10.8.0.99/>. | 207 from the host machine via <https://nagiosadmin:nagiosadmin@10.8.0.99/>. |
| 206 | 208 |
| 207 The monitoring service of our production environment, however, is accessible | 209 The monitoring service of our production environment, however, is accessible |
| 208 via <https://monitoring.adblockplus.org/>. | 210 via <https://monitoring.adblockplus.org/>. |
| 209 Add yourself to _files/nagios-htpasswd_ in the _private_ module used on the | 211 Add yourself to _files/nagios-htpasswd_ in the _private_ module used on the |
| 210 server, or have someone add you if you don't have access. | 212 server, or have someone add you if you don't have access. |
| 211 | 213 |
| 212 | 214 |
| LEFT | RIGHT |