Skip to content

Instantly share code, notes, and snippets.

@jsierles
Created February 9, 2009 13:55
Show Gist options
  • Save jsierles/60794 to your computer and use it in GitHub Desktop.
Save jsierles/60794 to your computer and use it in GitHub Desktop.
diff --git a/chef/recipes/server.rb b/chef/recipes/server.rb
index b07f20c..c715439 100644
--- a/chef/recipes/server.rb
+++ b/chef/recipes/server.rb
@@ -17,6 +17,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+include_recipe "runit"
+
+directory "/etc/chef" do
+ owner "root"
+ mode 0755
+end
+
+template "/etc/chef/server.rb" do
+ owner "root"
+ mode 0644
+ source "server.rb.erb"
+ action :create
+end
+
+template "/etc/chef/client.rb" do
+ owner "root"
+ mode 0644
+ source "client.rb.erb"
+ action :create
+end
+
+gem_package "stompserver" do
+ action :install
+end
runit_service "stompserver"
package "couchdb"
@@ -29,7 +53,7 @@ end
service "couchdb" do
supports :restart => true, :status => true
- action :enable
+ action [ :enable, :start ]
end
runit_service "chef-indexer"
diff --git a/chef/templates/default/sv-chef-indexer-run.erb b/chef/templates/default/sv-chef-indexer-run.erb
old mode 100644
new mode 100755
diff --git a/chef/templates/default/sv-chef-server-log-run.erb b/chef/templates/default/sv-chef-server-log-run.erb
old mode 100644
new mode 100755
diff --git a/chef/templates/default/sv-chef-server-run.erb b/chef/templates/default/sv-chef-server-run.erb
old mode 100644
new mode 100755
diff --git a/chef/templates/default/sv-stompserver-log-run.erb b/chef/templates/default/sv-stompserver-log-run.erb
old mode 100644
new mode 100755
diff --git a/chef/templates/default/sv-stompserver-run.erb b/chef/templates/default/sv-stompserver-run.erb
old mode 100644
new mode 100755
diff --git a/runit/attributes/sv_bin.rb b/runit/attributes/sv_bin.rb
index 27041ee..3f70fb2 100644
--- a/runit/attributes/sv_bin.rb
+++ b/runit/attributes/sv_bin.rb
@@ -20,8 +20,5 @@
runit_sv_bin `which sv`.chomp!
-case platform
-when "ubuntu","debian"
- runit_service_dir "/etc/service"
- runit_sv_dir "/etc/sv"
-end
+runit_service_dir "/etc/service"
+runit_sv_dir "/etc/sv"
diff --git a/runit/definitions/runit_service.rb b/runit/definitions/runit_service.rb
old mode 100644
new mode 100755
index fbd55eb..dda5c98
--- a/runit/definitions/runit_service.rb
+++ b/runit/definitions/runit_service.rb
@@ -49,19 +49,17 @@ define :runit_service, :directory => nil, :only_if => false do
source "sv-#{params[:name]}-log-run.erb"
end
- link "sv-#{params[:name]}" do
- source_file node[:runit_sv_bin]
- target_file "/etc/init.d/#{params[:name]}"
+ link "/etc/init.d/#{params[:name]}" do
+ to node[:runit_sv_bin]
end
- link "service-#{params[:name]}" do
- target_file "#{node[:runit_service_dir]}/#{params[:name]}"
- source_file "#{sv_dir_name}"
+ link "#{node[:runit_service_dir]}/#{params[:name]}" do
+ to "#{sv_dir_name}"
end
service params[:name] do
supports :restart => true, :status => true
- action :enable
+ action :nothing
end
#execute "#{params[:name]}-down" do
diff --git a/runit/files/Ubuntu-7.04/runsvdir b/runit/files/Ubuntu-7.04/runsvdir
old mode 100644
new mode 100755
diff --git a/runit/recipes/default.rb b/runit/recipes/default.rb
old mode 100644
new mode 100755
index a3523b1..6b51ead
--- a/runit/recipes/default.rb
+++ b/runit/recipes/default.rb
@@ -34,6 +34,7 @@ when "debian","ubuntu"
source "runsvdir"
mode 0644
notifies :run, resources(:execute => "start-runsvdir")
+ only_if do File.directory?("/etc/event.d") end
end
file "/etc/inittab" do
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment