Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bootstrap script installs ruby 1.9.2 from source, avoiding the buggy …

…1.9.2 that the ubuntu package imposes.
  • Loading branch information...
commit cbd55de1181c1dedbcd3a34d7bd80fb578906eb1 1 parent a1ae777
Philip (flip) Kromer authored
View
4 lib/cluster_chef/facet.rb
@@ -24,12 +24,10 @@ def facet_role name=nil, &block
@facet_role_name = name if name
if block_given?
@facet_role = Chef::Role.new
-
# Do some magic to make it so that the role definition knows @cluster and @facet
cluster = cluster
facet = self
@facet_role.instance_eval{ @facet = facet; @cluster = cluster }
-
@facet_role.instance_eval( &block )
@facet_role.name @facet_role_name
@facet_role.description "ClusterChef generated facet role for #{cluster_name}-#{facet_name}" unless @facet_role.description
@@ -96,7 +94,6 @@ def security_groups
#
def resolve!
cloud.security_group "#{cluster_name}-#{facet_name}"
-
resolve_servers!
self
end
@@ -104,6 +101,5 @@ def resolve!
def resolve_servers!
servers.each(&:resolve!)
end
-
end
end
View
16 lib/cluster_chef/knife/bootstrap/ubuntu10.04-basic.erb
@@ -4,19 +4,25 @@ bash -c '
set -v
+<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
+eval `cat /etc/lsb-release `
+export DEBIAN_FRONTEND=noninteractive
+
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras
cd /tmp
- wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
- tar zxf rubygems-1.3.7.tgz
- cd rubygems-1.3.7
+ wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
+ tar zxf rubygems-1.6.2.tgz
+ cd rubygems-1.6.2
ruby setup.rb --no-format-executable
fi
+gem update --no-rdoc --no-ri
gem install ohai --no-rdoc --no-ri --verbose
gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
+echo -e "`date` \n\n**** \n**** Knifing in the chef client config files:\n****\n"
mkdir -p /etc/chef
(
@@ -27,6 +33,8 @@ EOP
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
+echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
+
(
cat <<'EOP'
<%= config_content %>
@@ -41,7 +49,7 @@ EOP
echo -e "`date` \n\n**** \n**** Adding chef client runit scripts:\n****\n"
service chef-client stop 2>/dev/null ; sleep 1 ; killall chef-client 2>/dev/null
-mkdir -p /var/log/chef /var/chef /etc/sv/chef-client/log/main
+mkdir -p /var/log/chef /var/chef /etc/sv/chef-client/log/main /etc/sv/chef-client/supervise
cat > /etc/sv/chef-client/log/run <<EOF
#!/bin/bash
exec svlogd -tt ./main
View
48 lib/cluster_chef/knife/bootstrap/ubuntu10.04-cluster_chef.erb
@@ -8,38 +8,52 @@ bash -c '
set -v
-RUBY_VERSION=1.9.1 # this actually installs 1.9.2, it just says 1.9.1
+RUBY_VERSION=1.9.2-p290
+
+<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
eval `cat /etc/lsb-release `
export DEBIAN_FRONTEND=noninteractive
if [ ! -f /usr/bin/chef-client ]; then
-
echo -e "`date` \n\n**** \n**** apt update:\n****\n"
apt-get update
apt-get -y upgrade
echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
-apt-get install -y build-essential wget runit runit-services
+apt-get install -y build-essential wget runit runit-services zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev
echo -e "`date` \n\n**** \n**** Installing ruby version ${RUBY_VERSION}:\n****\n"
-apt-get install -y ruby${RUBY_VERSION} ruby${RUBY_VERSION}-dev libruby${RUBY_VERSION} libruby${RUBY_VERSION}-dbg ri${RUBY_VERSION} rubygems${RUBY_VERSION}
-sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby${RUBY_VERSION} 100 --slave /usr/bin/ri ri /usr/bin/ri${RUBY_VERSION} --slave /usr/bin/irb irb /usr/bin/irb${RUBY_VERSION} --slave /usr/bin/erb erb /usr/bin/erb${RUBY_VERSION} --slave /usr/bin/gem gem /usr/bin/gem${RUBY_VERSION} --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz /usr/share/man/man1/ruby${RUBY_VERSION}.1.gz
+
+# apt-get install -y ruby${RUBY_VERSION} ruby${RUBY_VERSION}-dev libruby${RUBY_VERSION} libruby${RUBY_VERSION}-dbg ri${RUBY_VERSION} rubygems${RUBY_VERSION}
+
+cd /tmp
+wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-${RUBY_VERSION}.tar.gz
+tar xzf ruby-${RUBY_VERSION}.tar.gz
+cd ruby-${RUBY_VERSION}
+./configure --with-ruby-version=${RUBY_VERSION} --prefix=/usr --program-suffix=${RUBY_VERSION}
+make -j2
+make install
+
+sudo update-alternatives --remove-all gem && true
+update-alternatives \
+ --install /usr/bin/ruby ruby /usr/bin/ruby${RUBY_VERSION} 400 \
+ --slave /usr/bin/ri ri /usr/bin/ri${RUBY_VERSION} \
+ --slave /usr/bin/irb irb /usr/bin/irb${RUBY_VERSION} \
+ --slave /usr/bin/erb erb /usr/bin/erb${RUBY_VERSION} \
+ --slave /usr/bin/gem gem /usr/bin/gem${RUBY_VERSION} \
+ --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
+ /usr/share/man/man1/ruby${RUBY_VERSION}.1
if ruby -e "exit(%x{gem --version} < \"1.6.2\" ? 0 : -1 )" ; then
- echo -e "`date` \n\n**** \n**** Unchaining rubygems from the tyrrany of ubuntu:\n****\n"
- # export REALLY_GEM_UPDATE_SYSTEM=true
- # gem install --no-rdoc --no-ri rubygems-update; /var/lib/gems/${RUBY_VERSION}/bin/update_rubygems ; gem update --system ; gem --version
- cd /tmp
- wget http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
- tar zxf rubygems-1.6.2.tgz
- cd rubygems-1.6.2
- ruby setup.rb --no-format-executable
+ echo -e "`date` \n\n**** \n**** Updating rubygems:\n****\n"
+ gem install --no-rdoc --no-ri rubygems-update --version=1.6.2
+ update_rubygems --version=1.6.2
fi
echo -e "`date` \n\n**** \n**** Installing chef:\n****\n"
-gem install ohai --no-rdoc --no-ri --verbose
-gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
-gem install --no-rdoc --no-ri extlib json ruby-shadow right_aws
+gem install ohai --no-rdoc --no-ri
+gem install chef --no-rdoc --no-ri <%= bootstrap_version_string %>
+gem install --no-rdoc --no-ri extlib json ruby-shadow right_aws
fi # if no chef-client
@@ -70,7 +84,7 @@ EOP
echo -e "`date` \n\n**** \n**** Adding chef client runit scripts:\n****\n"
service chef-client stop 2>/dev/null ; sleep 1 ; killall chef-client 2>/dev/null
-mkdir -p /var/log/chef /var/chef /etc/sv/chef-client/log/main
+mkdir -p /var/log/chef /var/chef /etc/sv/chef-client/log/main /etc/sv/chef-client/supervise
cat > /etc/sv/chef-client/log/run <<EOF
#!/bin/bash
exec svlogd -tt ./main
View
3  lib/cluster_chef/knife/cluster_launch.rb
@@ -89,6 +89,9 @@ def run
puts "Launching machines:"
target.create_servers
+ # This will create/update any roles
+ target.sync_roles
+
puts
display(target)
View
5 lib/cluster_chef/server.rb
@@ -32,7 +32,7 @@ def fullname name=nil
# <b>DEPRECATED:</b> Please use <tt>fullname</tt> instead.
def chef_node_name name
- #warn "[DEPRECATION] `chef_node_name` is deprecated. Please use `fullname` instead."
+ # warn "[DEPRECATION] `chef_node_name` is deprecated. Please use `fullname` instead."
fullname name
end
@@ -204,9 +204,11 @@ def sync_to_chef
chef_node.normal[key] = value
end
chef_node.save
+ true
rescue Net::HTTPServerException => e
raise unless e.response.code == '404'
warn "chef node does not exist yet. Skipping sync"
+ false
end
def safely *args, &block
@@ -320,4 +322,3 @@ def attach_volumes
end
end
end
-
Please sign in to comment.
Something went wrong with that request. Please try again.