Skip to content

Commit

Permalink
add missing supervisord cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
Ami Rahav committed Dec 14, 2014
1 parent e105703 commit 07693d6
Show file tree
Hide file tree
Showing 14 changed files with 278 additions and 223 deletions.
1 change: 1 addition & 0 deletions cookbooks/supervisord/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.bundle
14 changes: 14 additions & 0 deletions cookbooks/supervisord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Changes
=======

1.0.1
-----
- Add missing `stopwaitsecs` setting.

1.0.0
-----

- foodcritic / chefspec tests
- simplify providers (don't use "linked service")
- docs
- support all supervisord.conf options
6 changes: 6 additions & 0 deletions cookbooks/supervisord/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org/'

gem 'chef', '~> 11.8'
gem 'chefspec', '~> 3.0'
gem 'foodcritic', '~> 3.0'
gem 'strainer'
223 changes: 0 additions & 223 deletions cookbooks/supervisord/Gemfile.lock

This file was deleted.

35 changes: 35 additions & 0 deletions cookbooks/supervisord/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Supervisord cookbook
====================

This cookbook installs
[Supervisord](http://supervisord.org/configuration.html) and provides
a resource to supervise programs.

Usage
-----

Include `recipe[supervisord]` in your run list, and
`supervisord_program` resource to configure individual programs. See
`See recipes/example.rb` for sample usage

Resources
---------

## `supervisord_program`

### Actions

- `:supervise` (default): add program to supervisord config
- `:start`, `:stop`, `:restart`: manage service

### Attribute parameters

- `:name` (name attribute)
- `:command` (required)
- all settings of a `[program:X]` section of supervisord config

Authors
-------

* Maciej Pasternacki
* Dan Crosta
3 changes: 3 additions & 0 deletions cookbooks/supervisord/Strainerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
knife test: bundle exec knife cookbook test $COOKBOOK
foodcritic: bundle exec foodcritic -f any $SANDBOX/$COOKBOOK
chefspec: bundle exec rspec $SANDBOX/$COOKBOOK
31 changes: 31 additions & 0 deletions cookbooks/supervisord/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "supervisord",
"description": "Installs/Configures supervisord",
"long_description": "Supervisord cookbook\n====================\n\nThis cookbook installs\n[Supervisord](http://supervisord.org/configuration.html) and provides\na resource to supervise programs.\n\nUsage\n-----\n\nInclude `recipe[supervisord]` in your run list, and\n`supervisord_program` resource to configure individual programs. See\n`See recipes/example.rb` for sample usage\n\nResources\n---------\n\n## `supervisord_program` \n\n### Actions\n\n- `:supervise` (default): add program to supervisord config\n- `:start`, `:stop`, `:restart`: manage service\n\n### Attribute parameters\n\n- `:name` (name attribute)\n- `:command` (required)\n- all settings of a `[program:X]` section of supervisord config\n\nAuthors\n-------\n\n* Maciej Pasternacki\n* Dan Crosta\n",
"maintainer": "Maciej Pasternacki",
"maintainer_email": "maciej@pasternacki.net",
"license": "WTFPL",
"platforms": {
"ubuntu": ">= 0.0.0",
"debian": ">= 6.0"
},
"dependencies": {
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
},
"version": "1.0.1"
}
10 changes: 10 additions & 0 deletions cookbooks/supervisord/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name "supervisord"
maintainer "Maciej Pasternacki"
maintainer_email "maciej@pasternacki.net"
license "WTFPL"
description "Installs/Configures supervisord"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.1"

supports "ubuntu"
supports "debian", ">= 6.0"
29 changes: 29 additions & 0 deletions cookbooks/supervisord/providers/program.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'chef/mixin/shell_out'

include Chef::Mixin::ShellOut

def initialize(*args)
super
@run_context.include_recipe "supervisord"
end


action :supervise do
template "/etc/supervisor/conf.d/#{new_resource.name}.conf" do
source "supervised-program.conf.erb"
cookbook "supervisord"
owner "root"
group "root"
mode "0600"
variables :program => new_resource
notifies :reload, resources("service[supervisor]")
end
new_resource.updated_by_last_action(true)
end

[:start, :stop, :restart].each do |act|
action act do
shell_out! "supervisorctl #{act} #{new_resource.name}"
new_resource.updated_by_last_action(true)
end
end
6 changes: 6 additions & 0 deletions cookbooks/supervisord/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package "supervisor" # FIXME: work with custom debian package

service "supervisor" do
reload_command "supervisorctl reload"
action [ :enable, :start ]
end
Loading

0 comments on commit 07693d6

Please sign in to comment.