Commit 3a47d364c85d04b6e6bf7e5917b879c154dafa5b
0 parents
Exists in
master
Remove caches for fast download
Showing 40 changed files with 2126 additions and 0 deletions Inline Diff
- .gitignore
- .ruby-version
- Gemfile
- Gemfile.lock
- LICENSE
- Puppetfile
- Puppetfile.lock
- README.md
- config/basic.rb
- config/boxen.rb
- config/hiera.yaml
- docs/faq.md
- docs/modules.md
- docs/personal-configuration.md
- docs/puppet.md
- docs/rails.md
- hiera/common.yaml.example
- hiera/users/hanjianwei.yaml
- lib/.gitkeep
- manifests/site.pp
- modules/people/README.md
- modules/people/manifests/.gitkeep
- modules/people/manifests/hanjianwei.pp
- modules/people/manifests/hanjianwei/applications.pp
- modules/people/manifests/hanjianwei/config.pp
- modules/people/manifests/hanjianwei/mirrors.pp
- modules/people/manifests/hanjianwei/osx.pp
- modules/people/manifests/hanjianwei/repositories.pp
- modules/projects/README.md
- modules/projects/manifests/.gitkeep
- modules/projects/manifests/all.pp
- modules/projects/templates/shared/nginx.conf.erb
- script/bootstrap
- script/boxen
- script/boxen-bootstrap
- script/boxen-git-credential
- script/boxen-my-config
- script/nuke
- script/sync
- shared/README.md
.gitignore
| File was created | 1 | /.bundle | ||
| 2 | /.librarian | |||
| 3 | /.projects | |||
| 4 | /.snapshot | |||
| 5 | /.tmp | |||
| 6 | /bin | |||
| 7 | /config/local.rb | |||
| 8 | /log | |||
| 9 | /tmp | |||
| 10 | /shared/* | |||
| 11 | !/shared/README.md | |||
| 12 | /vendor/ |
.ruby-version
| File was created | 1 | system |
Gemfile
| File was created | 1 | source "http://mirrors.aliyun.com/rubygems/" | ||
| 2 | ||||
| 3 | gem "boxen", "~> 2.6" | |||
| 4 | gem "hiera", "~> 1.3.3" | |||
| 5 | gem "librarian-puppet", "~> 1.0.2" | |||
| 6 | gem "puppet", "3.6.1" | |||
| 7 | gem "puppet-lint", "0.3.2" | |||
| 8 | gem "puppetlabs_spec_helper", "0.4.1" | |||
| 9 | gem "open4", "~> 1.3.4" | |||
| 10 | gem "rake", "10.3.2" | |||
| 11 | gem "rspec-puppet", "1.0.1" | |||
| 12 | gem "deep_merge", "~> 1.0" | |||
| 13 | ||||
| 14 | group :development do | |||
| 15 | gem "aws-sdk", "~> 1.42" | |||
| 16 | gem "net-ssh" |
Gemfile.lock
| File was created | 1 | GEM | ||
| 2 | remote: https://rubygems.org/ | |||
| 3 | specs: | |||
| 4 | CFPropertyList (2.2.8) | |||
| 5 | addressable (2.3.6) | |||
| 6 | ansi (1.4.3) | |||
| 7 | aws-sdk (1.42.0) | |||
| 8 | json (~> 1.4) | |||
| 9 | nokogiri (>= 1.4.4) | |||
| 10 | boxen (2.6.0) | |||
| 11 | ansi (~> 1.4) | |||
| 12 | hiera (~> 1.0) | |||
| 13 | highline (~> 1.6) | |||
| 14 | json_pure (>= 1.7.7, < 2.0) | |||
| 15 | librarian-puppet (~> 1.0.0) | |||
| 16 | octokit (~> 2.7, >= 2.7.1) | |||
| 17 | puppet (~> 3.0) | |||
| 18 | builder (3.2.2) | |||
| 19 | deep_merge (1.0.1) | |||
| 20 | diff-lcs (1.2.5) | |||
| 21 | facter (2.0.1) | |||
| 22 | CFPropertyList (~> 2.2.6) | |||
| 23 | faraday (0.9.0) | |||
| 24 | multipart-post (>= 1.2, < 3) | |||
| 25 | hiera (1.3.3) | |||
| 26 | json_pure | |||
| 27 | highline (1.6.21) | |||
| 28 | json (1.8.1) | |||
| 29 | json_pure (1.8.1) | |||
| 30 | librarian (0.1.2) | |||
| 31 | highline | |||
| 32 | thor (~> 0.15) | |||
| 33 | librarian-puppet (1.0.2) | |||
| 34 | json | |||
| 35 | librarian (>= 0.1.2) | |||
| 36 | metaclass (0.0.4) | |||
| 37 | mini_portile (0.6.0) | |||
| 38 | mocha (1.1.0) | |||
| 39 | metaclass (~> 0.0.1) | |||
| 40 | multipart-post (2.0.0) | |||
| 41 | net-ssh (2.9.1) | |||
| 42 | nokogiri (1.6.2.1) | |||
| 43 | mini_portile (= 0.6.0) | |||
| 44 | octokit (2.7.2) | |||
| 45 | sawyer (~> 0.5.2) | |||
| 46 | open4 (1.3.4) | |||
| 47 | puppet (3.6.1) | |||
| 48 | facter (> 1.6, < 3) | |||
| 49 | hiera (~> 1.0) | |||
| 50 | json_pure | |||
| 51 | rgen (~> 0.6.5) | |||
| 52 | puppet-lint (0.3.2) | |||
| 53 | puppetlabs_spec_helper (0.4.1) | |||
| 54 | mocha (>= 0.10.5) | |||
| 55 | rake | |||
| 56 | rspec (>= 2.9.0) | |||
| 57 | rspec-puppet (>= 0.1.1) | |||
| 58 | rake (10.3.2) | |||
| 59 | rbvmomi (1.8.1) | |||
| 60 | builder | |||
| 61 | nokogiri (>= 1.4.1) | |||
| 62 | trollop | |||
| 63 | rgen (0.6.6) | |||
| 64 | rspec (3.0.0) | |||
| 65 | rspec-core (~> 3.0.0) | |||
| 66 | rspec-expectations (~> 3.0.0) | |||
| 67 | rspec-mocks (~> 3.0.0) | |||
| 68 | rspec-core (3.0.0) | |||
| 69 | rspec-support (~> 3.0.0) | |||
| 70 | rspec-expectations (3.0.0) | |||
| 71 | diff-lcs (>= 1.2.0, < 2.0) | |||
| 72 | rspec-support (~> 3.0.0) | |||
| 73 | rspec-mocks (3.0.0) | |||
| 74 | rspec-support (~> 3.0.0) | |||
| 75 | rspec-puppet (1.0.1) | |||
| 76 | rspec | |||
| 77 | rspec-support (3.0.0) | |||
| 78 | sawyer (0.5.4) | |||
| 79 | addressable (~> 2.3.5) | |||
| 80 | faraday (~> 0.8, < 0.10) | |||
| 81 | thor (0.19.1) | |||
| 82 | trollop (2.0) | |||
| 83 | ||||
| 84 | PLATFORMS | |||
| 85 | ruby | |||
| 86 | ||||
| 87 | DEPENDENCIES | |||
| 88 | aws-sdk (~> 1.42) | |||
| 89 | boxen (~> 2.6) | |||
| 90 | deep_merge (~> 1.0) | |||
| 91 | hiera (~> 1.3.3) | |||
| 92 | librarian-puppet (~> 1.0.2) | |||
| 93 | net-ssh | |||
| 94 | open4 (~> 1.3.4) | |||
| 95 | puppet (= 3.6.1) | |||
| 96 | puppet-lint (= 0.3.2) | |||
| 97 | puppetlabs_spec_helper (= 0.4.1) | |||
| 98 | rake (= 10.3.2) |
LICENSE
| File was created | 1 | Copyright (c) 2012 GitHub, Inc. | ||
| 2 | ||||
| 3 | Permission is hereby granted, free of charge, to any person obtaining | |||
| 4 | a copy of this software and associated documentation files (the | |||
| 5 | "Software"), to deal in the Software without restriction, including | |||
| 6 | without limitation the rights to use, copy, modify, merge, publish, | |||
| 7 | distribute, sublicense, and/or sell copies of the Software, and to | |||
| 8 | permit persons to whom the Software is furnished to do so, subject to | |||
| 9 | the following conditions: | |||
| 10 | ||||
| 11 | The above copyright notice and this permission notice shall be | |||
| 12 | included in all copies or substantial portions of the Software. | |||
| 13 | ||||
| 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
| 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
| 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |||
| 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
Puppetfile
| File was created | 1 | # This file manages Puppet module dependencies. | ||
| 2 | # | |||
| 3 | # It works a lot like Bundler. We provide some core modules by | |||
| 4 | # default. This ensures at least the ability to construct a basic | |||
| 5 | # environment. | |||
| 6 | ||||
| 7 | # Shortcut for a module from GitHub's boxen organization | |||
| 8 | def github(name, *args) | |||
| 9 | options ||= if args.last.is_a? Hash | |||
| 10 | args.last | |||
| 11 | else | |||
| 12 | {} | |||
| 13 | end | |||
| 14 | ||||
| 15 | if path = options.delete(:path) | |||
| 16 | mod name, :path => path | |||
| 17 | else | |||
| 18 | version = args.first | |||
| 19 | options[:repo] ||= "boxen/puppet-#{name}" | |||
| 20 | mod name, version, :github_tarball => options[:repo] | |||
| 21 | end | |||
| 22 | end | |||
| 23 | ||||
| 24 | # Shortcut for a module under development | |||
| 25 | def dev(name, *args) | |||
| 26 | mod name, :path => "#{ENV['HOME']}/src/boxen/puppet-#{name}" | |||
| 27 | end | |||
| 28 | ||||
| 29 | # Includes many of our custom types and providers, as well as global | |||
| 30 | # config. Required. | |||
| 31 | ||||
| 32 | github "boxen", "3.6.1" | |||
| 33 | ||||
| 34 | # Support for default hiera data in modules | |||
| 35 | ||||
| 36 | github "module-data", "0.0.3", :repo => "ripienaar/puppet-module-data" | |||
| 37 | ||||
| 38 | # Core modules for a basic development environment. You can replace | |||
| 39 | # some/most of these if you want, but it's not recommended. | |||
| 40 | ||||
| 41 | github "dnsmasq", "1.0.1" | |||
| 42 | github "gcc", "2.0.101" | |||
| 43 | github "git", "2.4.0" | |||
| 44 | github "homebrew", "1.9.4.rc", :repo => "hanjianwei/puppet-homebrew" | |||
| 45 | github "hub", "1.3.0" | |||
| 46 | github "inifile", "1.0.3", :repo => "puppetlabs/puppetlabs-inifile" | |||
| 47 | github "nginx", "1.4.3" | |||
| 48 | github "nodejs", "3.7.0" | |||
| 49 | github "openssl", "1.0.0" | |||
| 50 | github "pkgconfig", "1.0.0" | |||
| 51 | github "repository", "2.3.0" |
Puppetfile.lock
| File was created | 1 | GITHUBTARBALL | ||
| 2 | remote: boxen/puppet-boxen | |||
| 3 | specs: | |||
| 4 | boxen (3.6.1) | |||
| 5 | ||||
| 6 | GITHUBTARBALL | |||
| 7 | remote: boxen/puppet-dnsmasq | |||
| 8 | specs: | |||
| 9 | dnsmasq (1.0.1) | |||
| 10 | ||||
| 11 | GITHUBTARBALL | |||
| 12 | remote: boxen/puppet-gcc | |||
| 13 | specs: | |||
| 14 | gcc (2.0.101) | |||
| 15 | ||||
| 16 | GITHUBTARBALL | |||
| 17 | remote: boxen/puppet-git | |||
| 18 | specs: | |||
| 19 | git (2.4.0) | |||
| 20 | ||||
| 21 | GITHUBTARBALL | |||
| 22 | remote: boxen/puppet-hub | |||
| 23 | specs: | |||
| 24 | hub (1.3.0) | |||
| 25 | ||||
| 26 | GITHUBTARBALL | |||
| 27 | remote: boxen/puppet-nginx | |||
| 28 | specs: | |||
| 29 | nginx (1.4.3) | |||
| 30 | ||||
| 31 | GITHUBTARBALL | |||
| 32 | remote: boxen/puppet-nodejs | |||
| 33 | specs: | |||
| 34 | nodejs (3.7.0) | |||
| 35 | ||||
| 36 | GITHUBTARBALL | |||
| 37 | remote: boxen/puppet-openssl | |||
| 38 | specs: | |||
| 39 | openssl (1.0.0) | |||
| 40 | ||||
| 41 | GITHUBTARBALL | |||
| 42 | remote: boxen/puppet-osx | |||
| 43 | specs: | |||
| 44 | osx (2.7.0) | |||
| 45 | ||||
| 46 | GITHUBTARBALL | |||
| 47 | remote: boxen/puppet-pkgconfig | |||
| 48 | specs: | |||
| 49 | pkgconfig (1.0.0) | |||
| 50 | ||||
| 51 | GITHUBTARBALL | |||
| 52 | remote: boxen/puppet-repository | |||
| 53 | specs: | |||
| 54 | repository (2.3.0) | |||
| 55 | ||||
| 56 | GITHUBTARBALL | |||
| 57 | remote: boxen/puppet-ruby | |||
| 58 | specs: | |||
| 59 | ruby (8.0.4) | |||
| 60 | ||||
| 61 | GITHUBTARBALL | |||
| 62 | remote: boxen/puppet-sudo | |||
| 63 | specs: | |||
| 64 | sudo (1.0.0) | |||
| 65 | ||||
| 66 | GITHUBTARBALL | |||
| 67 | remote: boxen/puppet-xquartz | |||
| 68 | specs: | |||
| 69 | xquartz (1.1.1) | |||
| 70 | ||||
| 71 | GITHUBTARBALL | |||
| 72 | remote: glarizza/puppet-property_list_key | |||
| 73 | specs: | |||
| 74 | property_list_key (0.2.1) | |||
| 75 | ||||
| 76 | GITHUBTARBALL | |||
| 77 | remote: hanjianwei/puppet-brewcask | |||
| 78 | specs: | |||
| 79 | brewcask (0.0.4.rc2) | |||
| 80 | ||||
| 81 | GITHUBTARBALL | |||
| 82 | remote: hanjianwei/puppet-homebrew | |||
| 83 | specs: | |||
| 84 | homebrew (1.9.4.rc) | |||
| 85 | ||||
| 86 | GITHUBTARBALL | |||
| 87 | remote: puppetlabs/puppetlabs-inifile | |||
| 88 | specs: | |||
| 89 | inifile (1.0.3) | |||
| 90 | ||||
| 91 | GITHUBTARBALL | |||
| 92 | remote: puppetlabs/puppetlabs-stdlib | |||
| 93 | specs: | |||
| 94 | stdlib (4.2.1) | |||
| 95 | ||||
| 96 | GITHUBTARBALL | |||
| 97 | remote: ripienaar/puppet-module-data | |||
| 98 | specs: | |||
| 99 | module-data (0.0.3) | |||
| 100 | ||||
| 101 | DEPENDENCIES |
README.md
| File was created | 1 | # Our Boxen | ||
| 2 | ||||
| 3 | This is a template Boxen project designed for your organization to fork and | |||
| 4 | modify appropriately. | |||
| 5 | The Boxen rubygem and the Boxen puppet modules are only a framework for getting | |||
| 6 | things done. | |||
| 7 | This repository template is just a basic example of _how_ to do things with them. | |||
| 8 | ||||
| 9 | ## Getting Started | |||
| 10 | ||||
| 11 | To give you a brief overview, we're going to: | |||
| 12 | ||||
| 13 | * Install dependencies (basically Xcode) | |||
| 14 | * Bootstrap a boxen for your self/team/org/company | |||
| 15 | * Then convert your local copy of that boxen to the post-bootstrapped version | |||
| 16 | ||||
| 17 | There are a few potential conflicts to keep in mind. | |||
| 18 | Boxen does its best not to get in the way of a dirty system, | |||
| 19 | but you should check into the following before attempting to install your | |||
| 20 | boxen on any machine (we do some checks before every Boxen run to try | |||
| 21 | and detect most of these and tell you anyway): | |||
| 22 | ||||
| 23 | * Boxen __requires__ at least the Xcode Command Line Tools installed. | |||
| 24 | * Boxen __will not__ work with an existing rvm install. | |||
| 25 | * Boxen __may not__ play nice with a GitHub username that includes dash(-) | |||
| 26 | * Boxen __may not__ play nice with an existing rbenv install. | |||
| 27 | * Boxen __may not__ play nice with an existing chruby install. | |||
| 28 | * Boxen __may not__ play nice with an existing homebrew install. | |||
| 29 | * Boxen __may not__ play nice with an existing nvm install. | |||
| 30 | * Boxen __recommends__ installing the full Xcode. | |||
| 31 | ||||
| 32 | ### Dependencies | |||
| 33 | ||||
| 34 | **Install the Xcode Command Lines Tools and/or full Xcode.** | |||
| 35 | This will grant you the most predictable behavior in building apps like | |||
| 36 | MacVim. | |||
| 37 | ||||
| 38 | How do you do it? | |||
| 39 | ||||
| 40 | #### OS X 10.9 (Mavericks) | |||
| 41 | ||||
| 42 | If you are using [`b26abd0` of boxen-web](https://github.com/boxen/boxen-web/commit/b26abd0d681129eba0b5f46ed43110d873d8fdc2) | |||
| 43 | or newer, it will be automatically installed as part of Boxen. | |||
| 44 | Otherwise, follow instructions below. | |||
| 45 | ||||
| 46 | #### OS X < 10.9 | |||
| 47 | ||||
| 48 | 1. Install Xcode from the Mac App Store. | |||
| 49 | 1. Open Xcode. | |||
| 50 | 1. Open the Preferences window (`Cmd-,`). | |||
| 51 | 1. Go to the Downloads tab. | |||
| 52 | 1. Install the Command Line Tools. | |||
| 53 | ||||
| 54 | ### Bootstrapping | |||
| 55 | ||||
| 56 | Create a **new** git repository somewhere on the internet. | |||
| 57 | It can be private or public -- it really doesn't matter. | |||
| 58 | If you're making a repository on GitHub, you _may not_ want to fork this repo | |||
| 59 | to get started. | |||
| 60 | The reason for that is that you can't really make private forks of public | |||
| 61 | repositories easily. | |||
| 62 | ||||
| 63 | Once you've done that, you can run the following to bootstrap | |||
| 64 | your boxen: | |||
| 65 | ||||
| 66 | ``` | |||
| 67 | sudo mkdir -p /opt/boxen | |||
| 68 | sudo chown ${USER}:staff /opt/boxen | |||
| 69 | git clone https://github.com/boxen/our-boxen /opt/boxen/repo | |||
| 70 | cd /opt/boxen/repo | |||
| 71 | git remote rm origin | |||
| 72 | git remote add origin <the location of my new git repository> | |||
| 73 | git push -u origin master | |||
| 74 | ``` | |||
| 75 | ||||
| 76 | Now that your boxen is bootstrapped, you can run the following to | |||
| 77 | install the default configuration from this repo: | |||
| 78 | ||||
| 79 | ``` | |||
| 80 | cd /opt/boxen/repo | |||
| 81 | ./script/boxen | |||
| 82 | ``` | |||
| 83 | ||||
| 84 | ### Distributing | |||
| 85 | ||||
| 86 | That's enough to get your boxen into a usable state on other machines, | |||
| 87 | usually. | |||
| 88 | From there, we recommend setting up | |||
| 89 | [boxen-web](https://github.com/boxen/boxen-web) | |||
| 90 | as an easy way to automate letting other folks install your boxen. | |||
| 91 | ||||
| 92 | If you _don't_ want to use boxen-web, folks can get using your boxen like so: | |||
| 93 | ||||
| 94 | ``` | |||
| 95 | sudo mkdir -p /opt/boxen | |||
| 96 | sudo chown ${USER}:staff /opt/boxen | |||
| 97 | git clone <location of my new git repository> /opt/boxen/repo | |||
| 98 | cd /opt/boxen/repo | |||
| 99 | ./script/boxen | |||
| 100 | ``` | |||
| 101 | ||||
| 102 | Keep in mind this requires you to encrypt your hard drive by default. | |||
| 103 | If you do not want to do encrypt your hard drive, you can use the `--no-fde`. | |||
| 104 | ||||
| 105 | ``` | |||
| 106 | ./script/boxen --no-fde | |||
| 107 | ``` | |||
| 108 | ||||
| 109 | It should run successfully, and should tell you to source a shell script | |||
| 110 | in your environment. | |||
| 111 | For users without a bash or zsh config or a `~/.profile` file, | |||
| 112 | Boxen will create a shim for you that will work correctly. | |||
| 113 | If you do have a `~/.bashrc` or `~/.zshrc`, your shell will not use | |||
| 114 | `~/.profile` so you'll need to add a line like so at _the end of your config_: | |||
| 115 | ||||
| 116 | ``` sh | |||
| 117 | [ -f /opt/boxen/env.sh ] && source /opt/boxen/env.sh | |||
| 118 | ``` | |||
| 119 | ||||
| 120 | Once your shell is ready, open a new tab/window in your Terminal | |||
| 121 | and you should be able to successfully run `boxen --env`. | |||
| 122 | If that runs cleanly, you're in good shape. | |||
| 123 | ||||
| 124 | ## What You Get | |||
| 125 | ||||
| 126 | This template project provides the following by default: | |||
| 127 | ||||
| 128 | * Homebrew | |||
| 129 | * Git | |||
| 130 | * Hub | |||
| 131 | * dnsmasq w/ .dev resolver for localhost | |||
| 132 | * rbenv | |||
| 133 | * Full Disk Encryption requirement | |||
| 134 | * Node.js 0.6 | |||
| 135 | * Node.js 0.8 | |||
| 136 | * Node.js 0.10 | |||
| 137 | * Ruby 1.9.3 | |||
| 138 | * Ruby 2.0.0 | |||
| 139 | * Ruby 2.1.0 | |||
| 140 | * Ruby 2.1.1 | |||
| 141 | * ack | |||
| 142 | * Findutils | |||
| 143 | * GNU tar | |||
| 144 | ||||
| 145 | ## Customizing | |||
| 146 | ||||
| 147 | You can always check out the number of existing modules we already | |||
| 148 | provide as optional installs under the | |||
| 149 | [boxen organization](https://github.com/boxen). These modules are all | |||
| 150 | tested to be compatible with Boxen. Use the `Puppetfile` to pull them | |||
| 151 | in dependencies automatically whenever `boxen` is run. | |||
| 152 | ||||
| 153 | ### Including boxen modules from github (boxen/puppet-<name>) | |||
| 154 | ||||
| 155 | You must add the github information for your added Puppet module into your Puppetfile at the root of your | |||
| 156 | boxen repo (ex. /path/to/your-boxen/Puppetfile): | |||
| 157 | ||||
| 158 | # Core modules for a basic development environment. You can replace | |||
| 159 | # some/most of these if you want, but it's not recommended. | |||
| 160 | ||||
| 161 | github "repository", "2.0.2" | |||
| 162 | github "dnsmasq", "1.0.0" | |||
| 163 | github "gcc", "1.0.0" | |||
| 164 | github "git", "1.2.2" | |||
| 165 | github "homebrew", "1.1.2" | |||
| 166 | github "hub", "1.0.0" | |||
| 167 | github "inifile", "0.9.0", :repo => "cprice404/puppetlabs-inifile" | |||
| 168 | github "nginx", "1.4.0" | |||
| 169 | github "nodejs", "2.2.0" | |||
| 170 | github "ruby", "4.1.0" | |||
| 171 | github "stdlib", "4.0.2", :repo => "puppetlabs/puppetlabs-stdlib" | |||
| 172 | github "sudo", "1.0.0" | |||
| 173 | ||||
| 174 | # Optional/custom modules. There are tons available at | |||
| 175 | # https://github.com/boxen. | |||
| 176 | ||||
| 177 | github "java", "1.1.0" | |||
| 178 | ||||
| 179 | In the above snippet of a customized Puppetfile, the bottom line | |||
| 180 | includes the Java module from Github using the tag "1.1.0" from the github repository | |||
| 181 | "boxen/puppet-java". The function "github" is defined at the top of the Puppetfile | |||
| 182 | and takes the name of the module, the version, and optional repo location: | |||
| 183 | ||||
| 184 | def github(name, version, options = nil) | |||
| 185 | options ||= {} | |||
| 186 | options[:repo] ||= "boxen/puppet-#{name}" | |||
| 187 | mod name, version, :github_tarball => options[:repo] | |||
| 188 | end | |||
| 189 | ||||
| 190 | Now Puppet knows where to download the module from when you include it in your site.pp or mypersonal.pp file: | |||
| 191 | ||||
| 192 | # include the java module referenced in my Puppetfile with the line | |||
| 193 | # github "java", "1.1.0" | |||
| 194 | include java | |||
| 195 | ||||
| 196 | ### Hiera | |||
| 197 | ||||
| 198 | Hiera is preferred mechanism to make changes to module defaults (e.g. default | |||
| 199 | global ruby version, service ports, etc). This repository supplies a | |||
| 200 | starting point for your Hiera configuration at `config/hiera.yml`, and an | |||
| 201 | example data file at `hiera/common.yaml`. See those files for more details. | |||
| 202 | ||||
| 203 | The default `config/hiera.yml` is configured with a hierarchy that allows | |||
| 204 | individuals to have their own hiera data file in | |||
| 205 | `hiera/users/{github_login}.yaml` which augments and overrides | |||
| 206 | site-wide values in `hiera/common.yaml`. This default is, as with most of the | |||
| 207 | configuration in the example repo, a great starting point for many | |||
| 208 | organisations, but is totally up to you. You might want to, for | |||
| 209 | example, have a set of values that can't be overridden by adding a file to | |||
| 210 | the top of the hierarchy, or to have values set on specific OS | |||
| 211 | versions: | |||
| 212 | ||||
| 213 | ```yaml | |||
| 214 | # ... | |||
| 215 | :hierarchy: | |||
| 216 | - "global-overrides.yaml" | |||
| 217 | - "users/%{::github_login}" | |||
| 218 | - "osx-%{::macosx_productversion_major}" | |||
| 219 | - common | |||
| 220 | ``` | |||
| 221 | ||||
| 222 | ### Node definitions | |||
| 223 | ||||
| 224 | Puppet has the concept of a | |||
| 225 | ['node'](http://docs.puppetlabs.com/references/glossary.html#agent), | |||
| 226 | which is essentially the machine on which Puppet is running. Puppet looks for | |||
| 227 | [node definitions](http://docs.puppetlabs.com/learning/agent_master_basic.html#node-definitions) | |||
| 228 | in the `manifests/site.pp` file in the Boxen repo. You'll see a default node | |||
| 229 | declaration that looks like the following: | |||
| 230 | ||||
| 231 | ``` puppet | |||
| 232 | node default { | |||
| 233 | # core modules, needed for most things | |||
| 234 | include dnsmasq | |||
| 235 | ||||
| 236 | # more... | |||
| 237 | } | |||
| 238 | ``` | |||
| 239 | ||||
| 240 | ### How Boxen interacts with Puppet | |||
| 241 | ||||
| 242 | Boxen runs everything declared in `manifests/site.pp` by default. | |||
| 243 | But just like any other source code, throwing all your work into one massive | |||
| 244 | file is going to be difficult to work with. Instead, we recommend you | |||
| 245 | use modules in the `Puppetfile` when you can and make new modules |
config/basic.rb
| File was created | 1 | # Set up the execution environment. Load this file before trying to do | ||
| 2 | # anything else. This file assumes that the repo's been bootstrapped. | |||
| 3 | ||||
| 4 | require "pathname" | |||
| 5 | ||||
| 6 | # Make sure we're in the repo's root directory. | |||
| 7 | ||||
| 8 | Dir.chdir Pathname.new(__FILE__).realpath + "../.." | |||
| 9 | ||||
| 10 | # Load custom config. | |||
| 11 | ||||
| 12 | load File.expand_path "../boxen.rb", __FILE__ | |||
| 13 | ||||
| 14 | # Load local config if it exists. This file is ignored by Git, and can | |||
| 15 | # be used for personal config. | |||
| 16 | ||||
| 17 | local = File.expand_path "../local.rb", __FILE__ |
config/boxen.rb
| File was created | 1 | # This file will be loaded by config/basic early in a Boxen run. Use | ||
| 2 | # it to provide any custom code or behavior your Boxen setup requires. | |||
| 3 | ||||
| 4 | # Change the prefix boxen is installed to. | |||
| 5 | # ENV['BOXEN_HOME'] = '/opt/boxen' | |||
| 6 | ||||
| 7 | # Change the repo boxen will use. | |||
| 8 | # ENV['BOXEN_REPO_NAME'] = 'boxen/our-boxen' | |||
| 9 | ||||
| 10 | # Boxen binary packaging | |||
| 11 | # ENV["BOXEN_S3_ACCESS_KEY"] = '' | |||
| 12 | # ENV["BOXEN_S3_SECRET_KEY"] = '' | |||
| 13 | # ENV["BOXEN_S3_BUCKET"] = '' | |||
| 14 | ||||
| 15 | # Auto-report issues on failed runs | |||
| 16 | # ENV["BOXEN_ISSUES_ENABLED"] = 'yes' | |||
| 17 | ||||
| 18 | # Submit audit data to an arbitrary HTTP endpoint | |||
| 19 | # ENV["BOXEN_WEB_HOOK_URL"] = 'https://some-uri.com/boxen' |
config/hiera.yaml
| File was created | 1 | --- | ||
| 2 | # This file configures the hiera "database" for Boxen. As with most files in | |||
| 3 | # this repo, it's just an example, and you should feel free to make any | |||
| 4 | # changes suited to your organisation. | |||
| 5 | ||||
| 6 | # The defaults here should give you a solid start; put global defaults in | |||
| 7 | # a file named hiera/common.yaml, and individuals can supplement and/or override | |||
| 8 | # them in hiera/{github_login}.yaml | |||
| 9 | ||||
| 10 | :backends: | |||
| 11 | - yaml | |||
| 12 | :yaml: | |||
| 13 | :datadir: "%{::boxen_home}/repo/hiera" | |||
| 14 | :hierarchy: | |||
| 15 | - "users/%{github_login}" | |||
| 16 | - common | |||
| 17 | ||||
| 18 | # Many modules make their own hiera data available through the use of | |||
| 19 | # puppet-module-data. Some depend on the 'deeper' merge_behavior setting, so | |||
| 20 | # remove it at your own risk! | |||
| 21 | # ... |
docs/faq.md
| File was created | 1 | # FAQ | ||
| 2 | ||||
| 3 | Below you can find common questions and answers. | |||
| 4 | ||||
| 5 | ### Q: How do you uninstall an application and get it to reinstall in the application folder with boxen? | |||
| 6 | ||||
| 7 | When removing applications make sure to remove the corresponding `/var/db/.puppet_appdmg_installed_application` so that boxen will reinstall it. | |||
| 8 | ||||
| 9 | ### Q: How do you remove Boxen? | |||
| 10 | ||||
| 11 | Run `script/nuke` from inside the `/opt/boxen/repo` directory. | |||
| 12 | ||||
| 13 | ### Q: How do you upgrade your boxen from the public our-boxen? | |||
| 14 | Anwser distilled from http://grahamgilbert.com/blog/2014/04/04/updating-boxen/ | |||
| 15 | As Boxen is made by GitHub, updating it is much like updating any other project on there that you’ve made a fork of. First we’re going to add it as a remote repository: | |||
| 16 | ||||
| 17 | ```bash | |||
| 18 | cd ~/src/our-boxen | |||
| 19 | git remote add upstream https://github.com/boxen/our-boxen.git | |||
| 20 | ``` | |||
| 21 | Then we’re going to fetch the stuff from the upstream repository: | |||
| 22 | ||||
| 23 | ```bash | |||
| 24 | git fetch upstream | |||
| 25 | ``` | |||
| 26 | ||||
| 27 | Now we’re going to merge the updated repository with our own: | |||
| 28 | ||||
| 29 | ```bash | |||
| 30 | git checkout master | |||
| 31 | git merge upstream/master | |||
| 32 | ``` | |||
| 33 | ||||
| 34 | Now deal with conflicts in (Puppetfile, manifests/site.pp), ignore any diffs in Puppetfile.lock and Gemfile.lock. | |||
| 35 | ||||
| 36 | ||||
| 37 | ```bash | |||
| 38 | git mergetool | |||
| 39 | ``` | |||
| 40 | ||||
| 41 | The next step is to update your Puppet modules and RubyGems. First delete Puppetfile.lock and Gemfile.lock. Now go back to your trusty Terminal and: | |||
| 42 | ||||
| 43 | ```bash | |||
| 44 | rm Puppetfile.lock Gemfile.lock | |||
| 45 | bundle install --no-deployment --without development |
docs/modules.md
| File was created | 1 | # Writing Puppet modules for Boxen | ||
| 2 | ||||
| 3 | Writing Puppet modules for Boxen is easy. | |||
| 4 | ||||
| 5 | ## Tooling | |||
| 6 | ||||
| 7 | * Always use Bundler | |||
| 8 | * Always use librarian-puppet | |||
| 9 | * Always use puppet-lint | |||
| 10 | * Always use rspec-puppet | |||
| 11 | ||||
| 12 | ## Directory structure | |||
| 13 | ||||
| 14 | We follow Puppet's recommended structure very closely. | |||
| 15 | Here's the directory structure from the boxen Puppet module: | |||
| 16 | ||||
| 17 | ``` | |||
| 18 | ├── Gemfile | |||
| 19 | ├── Gemfile.lock | |||
| 20 | ├── README.md | |||
| 21 | ├── files | |||
| 22 | │ ├── README.md | |||
| 23 | │ └── gemrc | |||
| 24 | ├── lib | |||
| 25 | │ ├── facter | |||
| 26 | │ │ ├── boxen.rb | |||
| 27 | │ │ └── root_encrypted.rb | |||
| 28 | │ └── puppet | |||
| 29 | │ ├── parser | |||
| 30 | │ │ └── functions | |||
| 31 | │ │ ├── file_exists.rb | |||
| 32 | │ │ ├── include_all_projects.rb | |||
| 33 | │ │ └── include_projects_from_boxen_cli.rb | |||
| 34 | │ ├── provider | |||
| 35 | │ │ ├── package | |||
| 36 | │ │ │ ├── compressed_app.rb | |||
| 37 | │ │ │ ├── hax.rb | |||
| 38 | │ │ │ └── homebrew.rb | |||
| 39 | │ │ ├── repository | |||
| 40 | │ │ │ └── git.rb | |||
| 41 | │ │ └── service | |||
| 42 | │ │ └── ghlaunchd.rb | |||
| 43 | │ └── type | |||
| 44 | │ └── repository.rb | |||
| 45 | ├── manifests | |||
| 46 | │ ├── bin.pp | |||
| 47 | │ ├── config.pp | |||
| 48 | │ ├── development | |||
| 49 | │ │ └── project.pp | |||
| 50 | │ ├── development.pp | |||
| 51 | │ ├── environment.pp | |||
| 52 | │ ├── gemrc.pp | |||
| 53 | │ ├── janitor.pp | |||
| 54 | │ ├── osx_defaults.pp | |||
| 55 | │ ├── personal.pp | |||
| 56 | │ ├── profile.pp | |||
| 57 | │ ├── project.pp | |||
| 58 | │ ├── repo.pp | |||
| 59 | │ ├── security.pp | |||
| 60 | │ ├── sudoers.pp | |||
| 61 | │ └── zipped_widget.pp | |||
| 62 | ├── script | |||
| 63 | │ ├── bootstrap | |||
| 64 | │ ├── cibuild | |||
| 65 | │ ├── lint | |||
| 66 | │ ├── specs | |||
| 67 | │ └── syntax | |||
| 68 | ├── spec | |||
| 69 | │ ├── classes | |||
| 70 | │ │ ├── bin_spec.rb | |||
| 71 | │ │ └── environment_spec.rb | |||
| 72 | │ ├── fixtures | |||
| 73 | │ │ ├── Puppetfile | |||
| 74 | │ │ ├── Puppetfile.lock | |||
| 75 | │ │ ├── manifests | |||
| 76 | │ │ │ └── site.pp | |||
| 77 | │ │ └── modules | |||
| 78 | │ │ ├── boxen | |||
| 79 | │ │ │ ├── files -> ../../../../files | |||
| 80 | │ │ │ ├── lib -> ../../../../lib | |||
| 81 | │ │ │ ├── manifests -> ../../../../manifests | |||
| 82 | │ │ │ └── templates -> ../../../../templates | |||
| 83 | │ │ └── projects | |||
| 84 | │ │ └── manifests | |||
| 85 | │ │ └── test.pp | |||
| 86 | │ ├── spec_helper.rb | |||
| 87 | │ └── unit | |||
| 88 | │ └── puppet | |||
| 89 | │ └── type | |||
| 90 | │ └── repository_spec.rb | |||
| 91 | └── templates | |||
| 92 | ├── config.sh.erb | |||
| 93 | ├── env.sh.erb | |||
| 94 | └── gh_creds.sh.erb | |||
| 95 | ``` | |||
| 96 | ||||
| 97 | Of note, we do not use things like `rake` to drive specs. | |||
| 98 | Instead, we bias towards simple, portable shell scripts that can be consumed | |||
| 99 | by other shell scripts. | |||
| 100 |
docs/personal-configuration.md
| File was created | 1 | # Personal Configuration | ||
| 2 | ||||
| 3 | One of the design choices of Boxen very early on was that we didn't want to | |||
| 4 | dictate down to users "you can do this, but you can't do that". | |||
| 5 | We do so as little as possible in the core, and we don't do it at all for | |||
| 6 | per-user configurations. | |||
| 7 | ||||
| 8 | How? The personal manifest. | |||
| 9 | ||||
| 10 | ## What even is a personal manifest? | |||
| 11 | ||||
| 12 | Personal manifests live in `modules/people/manifests/<name>.pp`, | |||
| 13 | where `<name>` is your GitHub username. | |||
| 14 | ||||
| 15 | The simplest personal manifest looks like this: | |||
| 16 | ||||
| 17 | ``` puppet | |||
| 18 | class people::wfarr { | |||
| 19 | notify { 'hello world': } | |||
| 20 | } | |||
| 21 | ``` | |||
| 22 | ||||
| 23 | Ah, the good old "Hello World". | |||
| 24 | It's boring, but you can see there's really not much boilerplate involved. | |||
| 25 | Let's try something *real* this time: | |||
| 26 | ||||
| 27 | ``` puppet | |||
| 28 | class people::wfarr { | |||
| 29 | include boxen::development | |||
| 30 | } | |||
| 31 | ``` | |||
| 32 | ||||
| 33 | So what does this do? | |||
| 34 | It clones every repo in the Boxen org to `~/src/boxen/<repo>`. | |||
| 35 | How? | |||
| 36 | Well, we can refer to [the source code](https://github.com/boxen/puppet-boxen/blob/master/manifests/development.pp)! | |||
| 37 | If you're new to Puppet, or are unsure of what that class is doing, check out | |||
| 38 | the [intro to puppet](./puppet.md) we've put together. | |||
| 39 | ||||
| 40 | ## Running different code on multiple machines | |||
| 41 | ||||
| 42 | Puppet has conditionals and switching. | |||
| 43 | Typically, the most reliable way to ensure some code runs on one machine but not | |||
| 44 | others is to use the `case` statement on the `hostname` fact. | |||
| 45 | Example: | |||
| 46 | ||||
| 47 | ``` puppet | |||
| 48 | case $::hostname { | |||
| 49 | 'scruffy': { | |||
| 50 | notify { "I'm Scruffy. The Janitor.": } |
docs/puppet.md
| File was created | 1 | # What is a puppet? | ||
| 2 | ||||
| 3 | Puppet is configuration management tool, written in Ruby, that compiles | |||
| 4 | and runs code written in the Puppet language. | |||
| 5 | ||||
| 6 | But what does that actually mean in words a human can understand? | |||
| 7 | Puppet is a tool that runs some code and that code can do all sorts of | |||
| 8 | really powerful things to configure computers for you. | |||
| 9 | ||||
| 10 | Why do I want code mucking about with my laptop though? | |||
| 11 | For the exact same reasons you want code configuring your server. | |||
| 12 | In particular, homogeneity, reproducibility, reusability, and automation. | |||
| 13 | When you use code to express how a machine should be configured, | |||
| 14 | you know that all of your machines are configured the same way, | |||
| 15 | that you can repeat that configuration any number of times, | |||
| 16 | and that you don't have to do it manually each time. | |||
| 17 | ||||
| 18 | ## How does Puppet work? | |||
| 19 | ||||
| 20 | A Puppet run has two main steps: compilation and application. | |||
| 21 | ||||
| 22 | The compilations step starts with reading in what's called the site manifest. | |||
| 23 | The site manifest is a single file that contains Puppet code that is responsible | |||
| 24 | for telling the compiler what other Puppet code it should compile. | |||
| 25 | ||||
| 26 | Here are the first few lines of the default site manifest for Boxen: | |||
| 27 | ||||
| 28 | ``` | |||
| 29 | include boxen::environment | |||
| 30 | include homebrew | |||
| 31 | include gcc | |||
| 32 | ``` | |||
| 33 | ||||
| 34 | This tells the Puppet compiler that it must include the classes | |||
| 35 | `boxen::environment`, `homebrew`, and `gcc`. | |||
| 36 | Puppet will look for those classes on the modulepath. | |||
| 37 | Typically, these files would be located at | |||
| 38 | `$modulepath/boxen/manifests/environment.pp` and | |||
| 39 | `$modulepath/homebrew/manifests/init.pp`. | |||
| 40 | ||||
| 41 | These might include other classes as well, or define **resources**. | |||
| 42 | Resources are the building blocks of Puppet. | |||
| 43 | A resource is an abstract description about a **thing** and the **state** | |||
| 44 | that thing should be in. | |||
| 45 |