Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

eye (14) Versions 0.7.4

Installs eye gem and configures it to manage services, includes eye_service LWRP

Policyfile
Berkshelf
Knife
cookbook 'eye', '~> 0.7.4', :supermarket
cookbook 'eye', '~> 0.7.4'
knife supermarket install eye
knife supermarket download eye
README
Dependencies
Changelog
Quality 17%

eye Cookbook

eye is a process monitoring tool, inspired by bluepill and god.
This chef cookbook installs the eye RubyGem and configures it to manage services. It also includes a LWRP.

Requirements

eye is written in Ruby, so it should work on any system. If you want to use eye's uid or gid features, Ruby > 2.0.0 is required.

Attributes

  • node['eye']['version'] - Version of eye, default is '0.6.1'
  • node['eye']['conf_dir'] - Location of eye's configuration files, default '/etc/eye'
  • node['eye']['bin'] - Location of eye binary, default "node['languages']['ruby']['bin_dir']/eye"
  • node['eye']['log_dir'] - Location of eye's logfiles, default '/var/log/eye'
  • node['eye']['run_dir'] - Path of state directory, default '/var/run/eye'
  • node['eye']['user'] - Owner of eye process, directories and configuration files, default 'root'
  • node['eye']['group'] - Group of eye process, directories and configuration files, default 'root'
  • node['eye']['http']['install'] - if set to true, eye-http gem will be installed, default 'false'
  • node['eye']['http']['version'] - Version of eye-http, default is '0.6'

Resources/Providers

This cookbook contains a LWRPs, eye_service.

eye_service 'my_service' do
    action [:enable, :reload, :restart]
end

This loads eye daemon with a needed configuration 'my_service.eye' in a subdirectory of node['eye']['conf_dir'] named by the default eye owner (e.g /etc/eye/root/my_service.rb) and starts the according process. The owner of eye daemon and the process itself is the user defined with node['eye']['user']

An (additional) eye daemon can also be started by a different owner (with it's own logfile, e.g in '/var/log/eye/deploy/eye.log')

eye_service 'my_service' do
user_srv true
user_srv_uid 'deploy'
user_srv_gid 'deploy'
user_srv_home '/home/deploy'
action [:enable, :reload, :restart]
end

In that case the configuration file should be in '/etc/eye/deploy/my_service.eye'

If eye daemon should by controlled by node['eye']['user'], but the process should be started as different user, use eye's uid or gid configuration features.

eye_service creates an init script, e.g. '/etc/init.d/my_service'. This init script can be prefixed, like

eye_service 'my_service' do
    init_script_prefix 'eye-'
    ...
end

There's also a definition eye_app which creates the necessary configuration files, log directories and calls eye_service afterwards.

Example for unicorn:

  eye_app "test_unicorn" do
    user_srv true
    user_srv_uid "deploy"
    user_srv_gid "deploy"
    user_srv_home '/home/deploy'
    enable true 
    reload false
    restart false
    template "rails_unicorn.conf.erb"
    cookbook "rails_app"
    variables :ruby => "#{node['languages']['ruby']['bin_dir']}/ruby",
              :environment => 'test',
              :working_dir => '/var/www/rails_dir'
  end

with according template:

Eye.application "test_unicorn" do
  env "RAILS_ENV" => '<%= @environment %>'
  env "PATH" => "#{File.dirname("<%= @ruby %>")}:#{ENV['PATH']}"

  working_dir "<%= @working_dir %>"

  process("unicorn") do
    pid_file "tmp/pids/unicorn.pid"
    start_command "<%= @ruby %> ./bin/unicorn -Dc ./config/unicorn.rb -E <%= @environment %>"
    stdall "log/unicorn.log"

    stop_signals [:TERM, 10.seconds]

    restart_command "kill -USR2 {PID}"

    check :cpu, :every => 30, :below => 80, :times => 3
    check :memory, :every => 30, :below => 150.megabytes, :times => [3,5]

    start_timeout 30.seconds
    restart_grace 30.seconds

    monitor_children do
      stop_command "kill -QUIT {PID}"
      check :cpu, :every => 30, :below => 80, :times => 3
      check :memory, :every => 30, :below => 150.megabytes, :times => [3,5]
    end
  end

end

Usage

e.g.
Just include eye in your node's run_list:

{
  "name":"my_node",
  "run_list": [
    "recipe[eye]"
  ]
}

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: Holger Amann holger@fehu.org

Licensed under Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

eye CHANGELOG

This file is used to list changes made in each version of the eye cookbook.

0.7.3

  • [hamann] attribute for setting log level

0.7.1

  • [hamann] lazy loading attribute doesn't work as expected, replacing it by new user_srv_home option

0.7.0

  • [hamann] additional parameters for eye_app definition to control service on configuration changes (default: enable). Changes previous default behaviour of enabling, reloading and restarting

0.6.2

  • [hamann] lazy load attribute for user home to prevent error if user doesn't exist at compile time
  • [hamann] update eye(-http) gem to 0.6.2

0.6.0

  • [hamann] recipe to install eye-http
  • [hamann] eye_app: loading all configuration files ending with _config.rb

0.5.0

  • [hamann] - Update eye gem to 0.6.1
  • [ryansch] - Cache result of method calls for block scope

0.4.0

  • Respect the service group when starting services
  • Use exit code of eye info to check if process is running
  • Update eye gem to 0.5.2

0.3.1

  • [hamann] - Update eye gem to 0.5.1

0.0.1

  • [hamann] - Initial release of eye

Collaborator Number Metric
            

0.7.4 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.7.4 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.7.4 failed this metric

FC043: Prefer new notification syntax: eye/definitions/eye_app.rb:1
FC043: Prefer new notification syntax: eye/definitions/eye_app.rb:44
FC064: Ensure issues_url is set in metadata: eye/metadata.rb:1
FC065: Ensure source_url is set in metadata: eye/metadata.rb:1
FC066: Ensure chef_version is set in metadata: eye/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: eye/metadata.rb:1
FC069: Ensure standardized license defined in metadata: eye/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:52
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:59
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:66
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:72
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:84
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:91
FC085: Resource using new_resource.updated_by_last_action to converge resource: eye/providers/service.rb:98
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.7.4 passed this metric

Testing File Metric
            

0.7.4 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.7.4 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number