Permalink
Browse files

Adapt cookbooks for the Bluebox environment

  • Loading branch information...
1 parent 60b3bef commit eb3812d14636d4d628f5a6da5677d62e95bef203 @roidrage roidrage committed Feb 4, 2013
@@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs Java runtime."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "1.1"
+version "1.2"
depends "apt"
@@ -21,6 +21,10 @@
["centos","redhat","fedora"] => {
"default" => ["java-1.6.0-openjdk","java-1.6.0-openjdk-devel"]
},
+ ["ubuntu"] => {
+ "12.04" => ["openjdk-7-jdk", "default-jdk"],
+ "default" => ["openjdk-6-jdk","default-jdk"]
+ },
"default" => ["openjdk-6-jdk","default-jdk"]
)
@@ -30,6 +34,8 @@
"java-6-openjdk"
when ["ubuntu", "11.10"] then
"java-1.6.0-openjdk"
+ when ["ubuntu", "12.04"] then
+ "java-1.7.0-openjdk"
else
"java-1.6.0-openjdk"
end
@@ -30,23 +30,25 @@
notifies :run, resources(:execute => "monit-reload")
end
-template "/etc/monit/conf.d/alerts.monitrc" do
- source "alerts.erb"
- owner "root"
- group "root"
- mode "0600"
- variables :alerts => node[:monit][:alerts]
- notifies :run, resources(:execute => "monit-reload")
-end
-
-node[:monit][:checks][:enabled].each do |check|
- data = node[:monit][:checks][check]
- template "/etc/monit/conf.d/#{check}.monitrc" do
- source "#{check}.erb"
- mode "0644"
+if node[:monit][:checks][:enabled].any?
+ template "/etc/monit/conf.d/alerts.monitrc" do
+ source "alerts.erb"
owner "root"
group "root"
- variables :data => data
+ mode "0600"
+ variables :alerts => node[:monit][:alerts]
notifies :run, resources(:execute => "monit-reload")
end
+
+ node[:monit][:checks][:enabled].each do |check|
+ data = node[:monit][:checks][check]
+ template "/etc/monit/conf.d/#{check}.monitrc" do
+ source "#{check}.erb"
+ mode "0644"
+ owner "root"
+ group "root"
+ variables :data => data
+ notifies :run, resources(:execute => "monit-reload")
+ end
+ end
end
@@ -1,4 +1,4 @@
-default[:travis][:worker][:home] = '/mnt/ssd/travis/worker'
+default[:travis][:worker][:home] = '/home/deploy'
default[:travis][:worker][:repository] = 'git://github.com/travis-ci/travis-worker.git'
default[:travis][:worker][:ref] = 'master'
default[:travis][:worker][:amqp] = {
@@ -8,5 +8,7 @@
:password => 'travis',
:virtual_host => 'travis'
}
-default[:travis][:worker][:vms] = 6
+default[:travis][:worker][:vms] = 20
default[:travis][:worker][:env] = 'ruby'
+default[:travis][:worker][:hostname] = "#{node[:travis][:worker][:env]}.worker.travis-ci.com"
+default[:travis][:worker][:log_level] = 'info'
@@ -0,0 +1,77 @@
+require_recipe 'runit'
+require_recipe 'jruby'
+
+users = if Chef::Config[:solo]
+ node[:users]
+ else
+ search(:users)
+ end
+
+execute "monit-reload" do
+ action :nothing
+ command "monit reload"
+end
+
+service "travis-worker" do
+ action :nothing
+end
+
+directory node[:travis][:worker][:home] do
+ action :create
+ recursive true
+ owner "travis"
+ group "travis"
+ mode "0755"
+end
+
+git node[:travis][:worker][:home] do
+ repository node[:travis][:worker][:repository]
+ reference node[:travis][:worker][:ref]
+ action :sync
+ user "travis"
+ group "travis"
+ notifies :restart, resources(:service => 'travis-worker')
+end
+
+directory "#{node[:travis][:worker][:home]}/log" do
+ action :create
+ owner "travis"
+ group "travis"
+ mode "0755"
+end
+
+bash "bundle gems" do
+ code "#{File.dirname(node[:jruby][:bin])}/bundle install --deployment --binstubs"
+ user "travis"
+ group "travis"
+ cwd node[:travis][:worker][:home]
+end
+
+template "#{node[:travis][:worker][:home]}/config/worker.yml" do
+ source "worker-bluebox.yml.erb"
+ owner "travis"
+ group "travis"
+ mode "0600"
+ variables :amqp => node[:travis][:worker][:amqp],
+ :worker => node[:travis][:worker],
+ :bluebox => node[:bluebox],
+ :librato => node[:collectd_librato]
+
+ notifies :restart, resources(:service => 'travis-worker')
+end
+
+runit_service "travis-worker" do
+ options :jruby => node[:jruby][:bin],
+ :worker_home => node[:travis][:worker][:home],
+ :user => "travis",
+ :group => "travis"
+end
+
+template "/etc/monit/conf.d/travis-worker.monitrc" do
+ source "travis-worker.monitrc.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ variables :home => node[:travis][:worker][:home]
+ notifies :run, resources(:execute => 'monit-reload')
+end
@@ -0,0 +1,23 @@
+env: <%= @worker[:env] %>
+linux:
+ host: <%= @worker[:hostname] %>
+ log_level: <%= @worker[:log_level] %>
+ amqp:
+ host: <%= @amqp[:host] %>
+ virtual_host: <%= @amqp[:virtual_host] %>
+ port: <%= @amqp[:port] %>
+ username: <%= @amqp[:username] %>
+ password: <%= @amqp[:password] %>
+ vms:
+ provider: <%= @worker[:provider] %>
+ count: <%= @worker[:vms] %>
+ blue_box:
+ customer_id: <%= @bluebox[:customer_id] %>
+ api_key: <%= @bluebox[:api_key] %>
+ flavor_id: <%= @bluebox[:flavor_id] %>
+ location_id: <%= @bluebox[:location_id] %>
+ librato:
+ email: <%= @librato[:email] %>
+ token: <%= @librato[:token] %>
+ language_mappings:
+ haskell: jvm

0 comments on commit eb3812d

Please sign in to comment.