Skip to content

Commit b655213

Browse files
author
Jen-Mei Wu
committed
Installs most everything ... should probably do something about wget
which does crazy things to output (maybe change progress type to dot).
1 parent 6baaf92 commit b655213

15 files changed

+304
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Capfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
2+
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
3+
load 'config/deploy'

README.markdown

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Ruby Outreach to Women in San Francisco June 12-13, 2009
2+
# Automated installation of development environment on Ubuntu 9.04
3+
4+
This Sprinkle project will help install some packages needed for software
5+
development, including:
6+
7+
This includes:
8+
9+
* SQLite
10+
* Apache 2
11+
* Passenger
12+
* Git
13+
* Ruby 1.8
14+
* Ruby Gems
15+
* Heroku
16+
* Java and NetBeans (they're in the same package right now; should be separated later)
17+
18+
To use, first install a default install of Ubuntu 9.04 desktop (I've only used
19+
32-bit, using 'ubuntu' for both username and password). You might also need to:
20+
21+
> sudo apt-get install debian-archive-keyring
22+
> sudo apt-get update
23+
> sudo apt-get install openssh-server
24+
25+
The first two commands deal with a possible problem that may occur where
26+
apt-get install will display the message ["WARNING: The following packages
27+
cannot be authenticated"][1]. This doesn't always happen (The only time I've
28+
experienced it was with the VMware VM I created to test this script; the
29+
VirtualBox VM I created for testing didn't have this problem).
30+
31+
We need SSH server installed since Sprinkle uses SSH to connect to the machine
32+
to do the install.
33+
34+
Find out the IP address of the VM then from the sprinkle directory, type:
35+
36+
> sprinkle -c -v -s config/ruby_outreach.rb
37+
38+
This should be all that's needed to install the list above.
39+
40+
[1]: http://changelog.complete.org/archives/496-how-to-solve-the-following-packages-cannot-be-authenticated

config/deploy.rb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def prompt_with_default(var, default)
2+
set(var) do
3+
Capistrano::CLI.ui.ask "#{var} [#{default}] : "
4+
end
5+
set var, default if eval("#{var.to_s}.empty?")
6+
end
7+
8+
puts "Please select server to deploy to"
9+
prompt_with_default(:server_name, "")
10+
role(:app, server_name)
11+
12+
prompt_with_default(:user, "ubuntu")

config/ruby_outreach.rb

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
%w(base_server database misc ruby rubygems scm server).each do |r|
2+
require File.join(File.dirname(__FILE__), 'stack', r)
3+
end
4+
5+
# What we're installing to your server
6+
# Take what you want, leave what you don't
7+
# Build up your own and strip down your server until you get it right.
8+
policy :ruby_outreach, :roles => :app do
9+
# requires :keyring
10+
requires :webserver # Apache
11+
requires :appserver # Passenger
12+
requires :ruby # Ruby Enterprise edition
13+
requires :mysql
14+
requires :mysql_driver
15+
requires :sqlite3
16+
requires :sqlite3_driver
17+
requires :scm # Git
18+
19+
# The next three packages are in misc.rb
20+
requires :heroku
21+
requires :misc # screen, vim, etc.
22+
requires :java_and_netbeans
23+
end
24+
25+
deployment do
26+
# mechanism for deployment
27+
delivery :capistrano do
28+
begin
29+
recipes 'Capfile'
30+
rescue LoadError
31+
recipes 'deploy'
32+
end
33+
end
34+
35+
# source based package installer defaults
36+
source do
37+
prefix '/usr/local'
38+
archives '/usr/local/sources'
39+
builds '/usr/local/build'
40+
end
41+
end

config/stack/base_server.rb

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package :base_server do
2+
description 'Stuff to install initially'
3+
apt 'htop sysstat logwatch lsof'
4+
requires :build_essential, :wget
5+
end
6+
7+
package :build_essential do
8+
description 'Build tools'
9+
apt(['build-essential']) do
10+
pre :install, 'apt-get update'
11+
end
12+
end
13+
14+
package :wget do
15+
description 'wget'
16+
apt(['wget'])
17+
requires :build_essential
18+
end

config/stack/database.rb

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package :mysql, :provides => :database do
2+
description 'MySQL Database'
3+
apt %w( mysql-server mysql-client )
4+
end
5+
6+
package :mysql_driver do
7+
description 'Ruby MySQL database driver'
8+
gem 'mysql'
9+
end
10+
11+
package :sqlite3, :provides => :database do
12+
description 'SQLite3 database'
13+
apt 'sqlite3'
14+
end
15+
16+
package :sqlite3_driver do
17+
description 'Ruby SQLite3 library.'
18+
apt 'libsqlite3-dev libsqlite3-ruby1.8'
19+
20+
requires :rubygems
21+
end

config/stack/misc.rb

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Problematic since it fails on the problem it's trying to solve.
2+
#package :keyring do
3+
# description 'See http://changelog.complete.org/archives/496-how-to-solve-the-following-packages-cannot-be-authenticated'
4+
# apt 'apt-get install debian-archive-keyring' do
5+
# post :install, ['apt-get update']
6+
# end
7+
#end
8+
9+
package :misc do
10+
description 'Misc. items to make life easier'
11+
apt 'libtidy-dev screen man smbfs samba cron rsync vim logrotate libxml2 libxml2-dev libxslt1.1 libxslt1-dev curl libcurl4-openssl-dev'
12+
requires :build_essential # build_essential because it does an apt-get upgrade
13+
end
14+
15+
# Install Sun's Java because NetBeans has some problems with open jdk.
16+
# See: http://panthersoftware.com/articles/view/6/ruby-on-rails-development-on-ubuntu-9-04-jaunty-using-ruby-1-8-6
17+
# Right now this is all combined; later will look up the right installer
18+
# to use for doing a custom install (not immediately clear; source installer
19+
# is close, but automatically unpacks, which we don't need and which causes an
20+
# error)
21+
package :java_and_netbeans do
22+
description "Java w/ some funky stuff to accept license"
23+
nb_inst = [
24+
'sh -c mkdir -p ~/downloads',
25+
'cd ~/downloads',
26+
'wget http://ftp.ussg.iu.edu/netbeans/6.5.1/bundles/netbeans-6.5.1-ml-ruby-linux.sh ~/downloads/',
27+
'sh netbeans-6.5.1-ml-ruby-linux.sh --silent'
28+
].join(';')
29+
apt 'sun-java6-jre tzdata-java' do
30+
pre :install, [
31+
"/bin/echo -e 'sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true\\nsun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true' >/tmp/java-license.txt",
32+
"debconf-set-selections /tmp/java-license.txt"
33+
]
34+
post :install, [nb_inst]
35+
end
36+
end
37+
38+
package(:heroku) do
39+
description "Installs Heroku"
40+
gem('heroku')
41+
verify do
42+
has_gem('heroku')
43+
end
44+
requires(:rubygems)
45+
end

config/stack/ruby.rb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package :ruby do
2+
description 'Ruby Virtual Machine'
3+
version '1.8.6'
4+
apt %q(ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby) do
5+
post :install, [%q(ln -s /usr/bin/ruby1.8 /usr/bin/ruby),
6+
%q(ln -s /usr/bin/ri1.8 /usr/bin/ri),
7+
%q(ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc),
8+
%q(ln -s /usr/bin/irb1.8 /usr/bin/irb)]
9+
end
10+
11+
verify 'binaries' do
12+
has_file '/usr/bin/ruby1.8'
13+
has_file '/usr/bin/ri1.8'
14+
has_file '/usr/bin/rdoc1.8'
15+
has_file '/usr/bin/irb1.8'
16+
end
17+
end

config/stack/rubygems.rb

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package :rubygems do
2+
description 'Ruby Gems Package Management System'
3+
version '1.3.4'
4+
source "http://de.mirror.rubyforge.org/rubygems/rubygems-1.3.4.tgz" do
5+
# source "http://rubyforge.org/frs/download.php/38646/rubygems-#{version}.tgz" do
6+
custom_install 'ruby setup.rb'
7+
post :install, 'ln -s /usr/bin/gem1.8 /usr/bin/gem'
8+
post :install, 'gem sources -a http://gems.github.com'
9+
post :install, 'gem update'
10+
post :install, 'gem update --system'
11+
end
12+
13+
verify 'binary' do
14+
has_file '/usr/bin/gem1.8'
15+
has_symlink '/usr/bin/gem', '/usr/bin/gem1.8'
16+
end
17+
18+
requires :ruby, :wget
19+
end

config/stack/scm.rb

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package :git, :provides => :scm do
2+
apt 'git-core'
3+
end
4+
5+
# package :git, :provides => :scm do
6+
# description 'Git Distributed Version Control'
7+
# version '1.6.1'
8+
# source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
9+
# requires :git_dependencies
10+
#
11+
# verify do
12+
# has_file '/usr/local/bin/git'
13+
# end
14+
# end
15+
#
16+
# package :git_dependencies do
17+
# description 'Git Build Dependencies'
18+
# apt 'git-core', :dependencies_only => true
19+
# end

config/stack/server.rb

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package :apache, :provides => :webserver do
2+
description 'Apache2 web server.'
3+
apt 'apache2 apache2.2-common apache2-mpm-worker apache2-utils libexpat1 ssl-cert' do
4+
post :install, 'a2enmod rewrite'
5+
end
6+
7+
verify do
8+
has_process 'apache2'
9+
end
10+
11+
requires :base_server
12+
end
13+
14+
package :apache2_prefork_dev do
15+
description 'A dependency required by some packages.'
16+
apt 'apache2-prefork-dev'
17+
end
18+
19+
package :passenger, :provides => :appserver do
20+
description 'Phusion Passenger (mod_rails)'
21+
gem 'passenger' do
22+
version('2.2.2')
23+
post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module'
24+
25+
# Create the passenger conf file
26+
post :install, 'mkdir -p /etc/apache2/extras'
27+
post :install, 'touch /etc/apache2/extras/passenger.conf'
28+
post :install, 'echo "Include /etc/apache2/extras/passenger.conf"|sudo tee -a /etc/apache2/apache2.conf'
29+
30+
[%q(LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so),
31+
%q(PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2),
32+
%q(PassengerRuby /usr/bin/ruby1.8),
33+
%q(PassengerMaxPoolSize 6),
34+
%q(PassengerPoolIdleTime 3600),
35+
%q(RailsEnv production)].each do |line|
36+
post :install, "echo '#{line}' |sudo tee -a /etc/apache2/extras/passenger.conf"
37+
end
38+
39+
# Restart apache to note changes
40+
post :install, '/etc/init.d/apache2 restart'
41+
end
42+
43+
verify do
44+
has_file '/etc/apache2/extras/passenger.conf'
45+
has_file '/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so'
46+
has_directory '/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2'
47+
end
48+
49+
requires :apache, :apache2_prefork_dev, :rubygems
50+
end

nbproject/private/private.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
3+
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
4+
</project-private>

nbproject/project.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
main.file=
2+
platform.active=Ruby
3+
source.encoding=UTF-8

nbproject/project.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://www.netbeans.org/ns/project/1">
3+
<type>org.netbeans.modules.ruby.rubyproject</type>
4+
<configuration>
5+
<data xmlns="http://www.netbeans.org/ns/ruby-project/1">
6+
<name>Green Fields Ruby</name>
7+
<source-roots/>
8+
<test-roots/>
9+
</data>
10+
</configuration>
11+
</project>

0 commit comments

Comments
 (0)