canmove, Confirmed users
1,394
edits
No edit summary |
|||
| Line 4: | Line 4: | ||
== Definitions == | == Definitions == | ||
* Type - Puppet documentation talks a lot about this. Each different "type" deals with a different aspect of the system. For example, the "user" type can do most things related to user management (passwords, UID/GID, homedirs, shells, etc). The 'package' type deals with package management (eg, apt, rpm, fink, etc). And so on. | * Type - Puppet documentation talks a lot about this. Each different "type" deals with a different aspect of the system. For example, the "user" type can do most things related to user management (passwords, UID/GID, homedirs, shells, etc). The 'package' type deals with package management (eg, apt, rpm, fink, etc). And so on. | ||
| Line 17: | Line 18: | ||
=== The Slave-Master Link === | === The Slave-Master Link === | ||
You can find to which puppet master a slave connects to by checking this | You can find to which puppet master a slave connects to by checking this file's contents: | ||
# for linux testers (fedora) | # for linux testers (fedora) | ||
~cltbld/.config/autostart/gnome-terminal.desktop | ~cltbld/.config/autostart/gnome-terminal.desktop | ||
| Line 35: | Line 36: | ||
* Basic includes | * Basic includes | ||
* Packages that make changes | * Packages that make changes | ||
* Modules | |||
We are pushing toward organizing everything into modules, although this is not a particularly rapid process at the moment. Talk to Dustin. | |||
=== Site Files & Basic Includes === | === Site Files & Basic Includes === | ||
| Line 63: | Line 66: | ||
* The classes [http://hg.mozilla.org/build/puppet-manifests/file/tip/classes/buildslave.pp buildslave.pp] and [http://hg.mozilla.org/build/puppet-manifests/file/tip/classes/staging-buildslave.pp staging-buildslave.pp] include most of the packages (devtools, nagios, mercurial, buildbot, extras, etc) we want. | * The classes [http://hg.mozilla.org/build/puppet-manifests/file/tip/classes/buildslave.pp buildslave.pp] and [http://hg.mozilla.org/build/puppet-manifests/file/tip/classes/staging-buildslave.pp staging-buildslave.pp] include most of the packages (devtools, nagios, mercurial, buildbot, extras, etc) we want. | ||
* The packages can have different sections or "Types" that can be "exec", "user", "package", "file", "service" | * The packages can have different sections or "Types" that can be "exec", "user", "package", "file", "service" | ||
=== Modules === | |||
Going forward, puppet functionality should be encapsulated into modules. Modules include the relevant manifests, as well as files, templates, and (with some minor changes to our puppet client configs) even custom facts or types! | |||
Modules should be generic in their purpose, and well-encapsulated. They should not be specific to one operating system or distro by design, although it's OK to omit implementations we do not need (for example, it's OK for a module providing resources only used by build slaves to error out if it's used on a Fedora system - if and when we start building on Fedora, we'll need to extend the implementation). | |||
A module should be self-contained and have a well-documented and commented interface. If it depends on any other modules, that should also be highlighted in the comments. | |||
== Puppet Files == | == Puppet Files == | ||
| Line 74: | Line 84: | ||
* $slaveType is the "type" of node of the slave is: 'build', 'test', 'stage', 'master', etc. | * $slaveType is the "type" of node of the slave is: 'build', 'test', 'stage', 'master', etc. | ||
Below '$type', are all of the files served by Puppet. They are organized according to where they'll end up on the slave. For example, if / | Below '$type', are all of the files served by Puppet. They are organized according to where they'll end up on the slave. For example, if ''/usr/lib/libsomethinghuge.so'' is to be synced to the slave, it should live in ''usr/lib/libsomethinghuge.so''. Note that as much as possible, text files should not be kept in puppet-files -- use a module and its ''files/'' subdirectory instead. | ||
There are two special directories for each level/os/hardwaremodel/type combination, too: | There are two special directories for each level/os/hardwaremodel/type combination, too: | ||
* local -- This directory contains files which should NOT be synced between staging <-> production or between different locations. Files such as the Puppet configs which have different contents depending on location and support level live here. | * local -- This directory contains files which should NOT be synced between staging <-> production or between different locations. Files such as the Puppet configs which have different contents depending on location and support level live here. Try not to use this. | ||
* DMGs (Mac) / RPMs (Fedora/CentOS) -- These directories contain platform specific packages which Puppet installs. | * DMGs (Mac) / RPMs (Fedora/CentOS) -- These directories contain platform specific packages which Puppet installs. | ||
== Common Use Cases == | == Common Use Cases == | ||
* [[ReleaseEngineering/How To/Reset the cltbld Password with Puppet]] | |||
* [[https://wiki.mozilla.org/ReleaseEngineering/How_To/Install_a_Package_with_Puppet]] | |||
== Testing == | == Testing == | ||
Before you test on the Puppet server it's good to run the 'test-manifests.sh' scripts locally. This script will test the syntax of the manifest files and catch very basic issues. It will not catch any issues with run-time code such as Exec's. This should really be a Makefile - {{bug|635067}} | |||
Staging of updates is done with ''staging-puppet.build.mozilla.org'' and staging slaves. You should book staging-puppet as well as an slaves you intend to test on before making any changes to the manifests on the Puppet server. All Puppet server work is done as the root user. | |||
=== Setting up the server === | === Setting up the server === | ||
If you've never used the Puppet server before you'll want to start a clone of the manifests for yourself. You can clone the main manifests repo or your own user repo to a directory under /etc/puppet. Once you have your clone, two edits are necessary: | If you've never used the Puppet server before you'll want to start a clone of the manifests for yourself. You can clone the main manifests repo or your own user repo to a directory under ''/etc/puppet''. Once you have your clone, two edits are necessary: | ||
* Copy the password hash into your clone's build/cltbld.pp. This can be done with the following command, run from the root of your clone: | * Copy the password hash into your clone's build/cltbld.pp. This can be done with the following command, run from the root of your clone: | ||
hg -R /etc/puppet/manifests.real diff /etc/puppet/manifests.real/build/cltbld.pp | patch -p1 | hg -R /etc/puppet/manifests.real diff /etc/puppet/manifests.real/build/cltbld.pp | patch -p1 | ||
or more easily | or more easily | ||
patch -p1 < /etc/puppet/password | patch -p1 < /etc/puppet/password | ||
* | * Copy ''staging.pp'' to ''site.pp'' and comment out all of the "node" entries except for those which you have booked. | ||
It's easiest to use the ''mq'' extension to make these changes in a patch on your queue. Then, when you want to change revisions, just pop the patch, use 'hg pull -u', and re-push your patch. | |||
If you have a patch to apply to the repository now is the time to do it. | |||
Finally, if your changes involve edits to any files served by Puppet, apply those changes in the appropriate places under /N/staging. It's usually easiest to keep a text file tracking these changes - then you can post the contents of that file to the bug for review, so that it's clear to reviewers what changes are being made here. Because puppet-files are unversioned, try to minimize the amount of change you must make here. | |||
Once all of that is done you can swap your manifests in with ''/etc/puppet/set-manifests.sh YOURNAME''. Omit the name to reset them to the default ("real") manifests. If you've added new files or changed staging-fileserver.conf you'll need to restart the Puppetmaster process with:</p> | |||
service puppetmaster restart | service puppetmaster restart | ||
although note that the daemon will pick up the changes after some short delay if you do not restart. | |||
Now, you're ready to test. | Now, you're ready to test. | ||
| Line 179: | Line 139: | ||
Once you're finished testing the manifests symlink needs to be re-adjusted with: | Once you're finished testing the manifests symlink needs to be re-adjusted with: | ||
cd /etc/puppet | cd /etc/puppet | ||
./set-manifests.sh | |||
== Moving file updates to production == | == Moving file updates to production == | ||
| Line 211: | Line 170: | ||
Be sure to do this on all Puppet masters. | Be sure to do this on all Puppet masters. | ||