Code Monkey home page Code Monkey logo

capistrano-paratrooper-chef's Introduction

Paratrooper-chef

A capistrano recipe to execute chef-solo in each server. All of you can use chef-solo remotely without chef-server.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-paratrooper-chef'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-paratrooper-chef

Usage

This recipe will execute chef-solo through paratrooper:chef task.

To setup paratrooper-chef for your application, add following in you config/deploy.rb.

# in "config/deploy.rb"
require 'capistrano-paratrooper-chef'

And then, put your chef-kitchen files to config/ directory. by default, paratrooper-chef uses following files and directories.

  • config/Berksfile
  • config/Cheffile
  • config/solo.rb
  • config/site-cookbooks
  • config/roles
  • config/environments
  • config/data_bags
  • config/data_bag_key

Finally, run capistrano with paratrooper:chef task. Then chef-solo runs at remote host.

$ cap paratrooper:chef

Setup chef-solo to remote hosts

Paratrooper-chef includes another task to setup chef-solo to remote hosts. To enable it, add following in your config/deploy.rb.

# in "config/deploy.rb"
require "capistrano-paratrooper-chef/omnibus_install"

This recipe will install chef-solo using omnibus-installer during deploy:setup task.

Another way, you want to install chef-solo as gem package, use following lines.

# in "config/deploy.rb"
require "capistrano-paratrooper-chef/install"

This recipe will install chef-solo using gem command during deploy:setup task. Of cource, capistrano-paratrooper-chef/install requires ruby and rubygems are available.

Define attributes for specific host

Paratrooper-chef supports switching attributes for each host. Put definition to config/nodes/#{hostname}.json.

If there are no defitions for host, paratrooper-chef uses config/solo.rb as attributes.

Chef roles Auto discovery

Chef roles auto discovery appends roles of chef to run_list of each host. To enable auto discovery, set :chef_roles_auto_discovery true (as defualt, it is disabled).

# in "config/deploy.rb"
set :chef_roles_auto_discovery, true

This feature makes name-based relations with role of capistrano and chef's one::

  • Discovering role definitions of chef from role-names of capistrano that server is assigned
  • Run chef with discovered roles at each server
  • Be able to play different roles of chef for each server

For example, 'web.example.com' plays :web role:

set :web, 'web.example.com'

And, there is role defition named 'web.json'.

# config/roles/web.json
{
  "nginx" : {
    # ...
  },
  "run_list" : [
    "recipe[nginx]",
  }
}

Then, paratrooper-chef detects automatically these relation, and append 'role[web]' to run_list of web.example.com . (do not effect to other hosts)

Options

Following options are available.

  • Settings for remote host

    • :chef_solo_path - the path of chef-solo command. use chef-solo by default (search command from $PATH).
    • :chef_working_dir - the path where chef-kitchen should installed. use $HOME/chef-solo by default.
    • :chef_cache_dir - the path for caches. use /var/chef/cache by default.
  • Settings for chef and paratrooper

    • :chef_environment - environment setting. empty by default.
    • :chef_roles_auto_discovery - Enable "Chef roles Auto discovery". use false by default.
    • :chef_verbose_logging, - Enable verbose logging mode of chef-solo. use true by default.
    • :chef_debug - Enable debug mode of chef-solo. use false by default.
  • Settings for directories

    • :chef_kitchen_path - root directory of kitchen. use config by default.
    • :chef_default_solo_json_path - default attribute file a.k.a solo.json. use solo.json by default.
    • :chef_cookbooks_path - cookbooks directory (or list of directories). use site-cookbooks by default.
    • :chef_vendor_cookbooks_path - cookbooks directory for berkshelf/librarian. use vendor/cookbooks by default.
    • :chef_nodes_path - nodes directory. use nodes by default.
    • :chef_roles_path - roles directory. use roles by default.
    • :chef_environment_path - environments directory. use environments by default.
    • :chef_databags_path - data bags directory. use data_bags by default.
    • :chef_databag_secret - path of secret-key for data bags. use data_bag_key by default.

Support recipes

Following recipes work fine with paratrooper-chef.

Support cookbook managers

Following cookbook managers work fine with paratrooper-chef.

paratrooper-chef try to fetch cookbooks using these managers.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

capistrano-paratrooper-chef's People

Contributors

tk0miya avatar shimizukawa avatar

Watchers

James Cloos avatar Koichiro Haga avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.