jsierles-sprinkle 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CREDITS +19 -0
- data/History.txt +4 -0
- data/MIT-LICENSE +20 -0
- data/Manifest.txt +87 -0
- data/README.txt +238 -0
- data/Rakefile +4 -0
- data/bin/sprinkle +86 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +17 -0
- data/examples/packages/build_essential.rb +9 -0
- data/examples/packages/databases/mysql.rb +13 -0
- data/examples/packages/databases/sqlite3.rb +16 -0
- data/examples/packages/phusion.rb +55 -0
- data/examples/packages/ruby/rails.rb +9 -0
- data/examples/packages/ruby/ruby.rb +17 -0
- data/examples/packages/ruby/rubygems.rb +17 -0
- data/examples/packages/scm/git.rb +11 -0
- data/examples/packages/scm/subversion.rb +4 -0
- data/examples/packages/servers/apache.rb +15 -0
- data/examples/rails/README +15 -0
- data/examples/rails/deploy.rb +2 -0
- data/examples/rails/packages/database.rb +9 -0
- data/examples/rails/packages/essential.rb +9 -0
- data/examples/rails/packages/rails.rb +28 -0
- data/examples/rails/packages/scm.rb +11 -0
- data/examples/rails/packages/search.rb +11 -0
- data/examples/rails/packages/server.rb +28 -0
- data/examples/rails/rails.rb +73 -0
- data/examples/sprinkle/sprinkle.rb +38 -0
- data/lib/sprinkle.rb +32 -0
- data/lib/sprinkle/actors/actors.rb +17 -0
- data/lib/sprinkle/actors/capistrano.rb +117 -0
- data/lib/sprinkle/actors/local.rb +26 -0
- data/lib/sprinkle/actors/ssh.rb +81 -0
- data/lib/sprinkle/actors/vlad.rb +65 -0
- data/lib/sprinkle/configurable.rb +31 -0
- data/lib/sprinkle/deployment.rb +73 -0
- data/lib/sprinkle/extensions/arbitrary_options.rb +10 -0
- data/lib/sprinkle/extensions/array.rb +5 -0
- data/lib/sprinkle/extensions/blank_slate.rb +5 -0
- data/lib/sprinkle/extensions/dsl_accessor.rb +15 -0
- data/lib/sprinkle/extensions/string.rb +10 -0
- data/lib/sprinkle/extensions/symbol.rb +7 -0
- data/lib/sprinkle/installers/apt.rb +52 -0
- data/lib/sprinkle/installers/deb.rb +38 -0
- data/lib/sprinkle/installers/gem.rb +62 -0
- data/lib/sprinkle/installers/installer.rb +120 -0
- data/lib/sprinkle/installers/rake.rb +37 -0
- data/lib/sprinkle/installers/rpm.rb +37 -0
- data/lib/sprinkle/installers/source.rb +179 -0
- data/lib/sprinkle/installers/yum.rb +37 -0
- data/lib/sprinkle/package.rb +233 -0
- data/lib/sprinkle/policy.rb +125 -0
- data/lib/sprinkle/script.rb +23 -0
- data/lib/sprinkle/verifiers/directory.rb +16 -0
- data/lib/sprinkle/verifiers/executable.rb +36 -0
- data/lib/sprinkle/verifiers/file.rb +20 -0
- data/lib/sprinkle/verifiers/process.rb +21 -0
- data/lib/sprinkle/verifiers/ruby.rb +25 -0
- data/lib/sprinkle/verifiers/symlink.rb +30 -0
- data/lib/sprinkle/verify.rb +114 -0
- data/lib/sprinkle/version.rb +9 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/sprinkle/actors/capistrano_spec.rb +170 -0
- data/spec/sprinkle/actors/local_spec.rb +29 -0
- data/spec/sprinkle/configurable_spec.rb +46 -0
- data/spec/sprinkle/deployment_spec.rb +80 -0
- data/spec/sprinkle/extensions/array_spec.rb +19 -0
- data/spec/sprinkle/extensions/string_spec.rb +21 -0
- data/spec/sprinkle/installers/apt_spec.rb +70 -0
- data/spec/sprinkle/installers/gem_spec.rb +75 -0
- data/spec/sprinkle/installers/installer_spec.rb +151 -0
- data/spec/sprinkle/installers/rake_spec.rb +29 -0
- data/spec/sprinkle/installers/rpm_spec.rb +50 -0
- data/spec/sprinkle/installers/source_spec.rb +331 -0
- data/spec/sprinkle/installers/yum_spec.rb +49 -0
- data/spec/sprinkle/package_spec.rb +422 -0
- data/spec/sprinkle/policy_spec.rb +126 -0
- data/spec/sprinkle/script_spec.rb +51 -0
- data/spec/sprinkle/sprinkle_spec.rb +25 -0
- data/spec/sprinkle/verify_spec.rb +160 -0
- data/sprinkle.gemspec +70 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- metadata +180 -0
data/config/hoe.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'sprinkle/version'
|
2
|
+
|
3
|
+
AUTHOR = 'Marcus Crafter' # can also be an array of Authors
|
4
|
+
EMAIL = "crafterm@redartisan.com"
|
5
|
+
DESCRIPTION = "Ruby DSL based software provisioning tool"
|
6
|
+
GEM_NAME = 'sprinkle' # what ppl will type to install your gem
|
7
|
+
RUBYFORGE_PROJECT = 'sprinkle' # The unix name for your project
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
|
11
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
12
|
+
@config = nil
|
13
|
+
RUBYFORGE_USERNAME = "unknown"
|
14
|
+
def rubyforge_username
|
15
|
+
unless @config
|
16
|
+
begin
|
17
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
18
|
+
rescue
|
19
|
+
puts <<-EOS
|
20
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
21
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
22
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
23
|
+
EOS
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
REV = nil
|
32
|
+
# UNCOMMENT IF REQUIRED:
|
33
|
+
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
34
|
+
VERS = Sprinkle::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
+
RDOC_OPTS = ['--quiet', '--title', 'sprinkle documentation',
|
36
|
+
"--opname", "index.html",
|
37
|
+
"--line-numbers",
|
38
|
+
"--main", "README.txt",
|
39
|
+
"--inline-source"]
|
40
|
+
|
41
|
+
class Hoe
|
42
|
+
def extra_deps
|
43
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
+
@extra_deps
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generate all the Rake tasks
|
49
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
+
p.developer(AUTHOR, EMAIL)
|
52
|
+
p.description = DESCRIPTION
|
53
|
+
p.summary = DESCRIPTION
|
54
|
+
p.url = HOMEPATH
|
55
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
56
|
+
p.test_globs = ["test/**/test_*.rb"]
|
57
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
+
|
59
|
+
# == Optional
|
60
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
|
+
p.extra_deps = [ ['activesupport', '>= 2.0.2'], ['highline', '>= 1.4.0'], ['capistrano', '>= 2.2.0'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
62
|
+
|
63
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
68
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
69
|
+
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
70
|
+
hoe.rsync_args = '-av --delete --ignore-errors'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
16
|
+
|
17
|
+
require 'sprinkle'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
## Special package, anything that defines a 'source' package means build-essential should be installed for Ubuntu
|
2
|
+
|
3
|
+
package :build_essential do
|
4
|
+
description 'Build tools'
|
5
|
+
apt 'build-essential' do
|
6
|
+
# Update the sources and upgrade the lists before we build essentials
|
7
|
+
pre :install, ['aptitude update', 'aptitude safe-upgrade', 'aptitude full-upgrade']
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
package :mysql, :provides => :database do
|
2
|
+
description 'MySQL Database'
|
3
|
+
apt %w( mysql-server mysql-client libmysqlclient15-dev )
|
4
|
+
end
|
5
|
+
|
6
|
+
package :mysql_ruby_driver do
|
7
|
+
description 'Ruby MySQL database driver'
|
8
|
+
gem 'mysql'
|
9
|
+
|
10
|
+
verify do
|
11
|
+
ruby_can_load 'mysql'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Packages to install sqlite3 and the sqlite3 ruby driver.
|
2
|
+
package :sqlite3, :provides => :database do
|
3
|
+
description 'SQLite3 database'
|
4
|
+
apt 'sqlite3'
|
5
|
+
end
|
6
|
+
|
7
|
+
package :sqlite3_ruby_driver do
|
8
|
+
description 'Ruby SQLite3 library.'
|
9
|
+
apt 'libsqlite3-dev libsqlite3-ruby1.8'
|
10
|
+
|
11
|
+
requires :rubygems
|
12
|
+
|
13
|
+
verify do
|
14
|
+
ruby_can_load 'sqlite3'
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Contains software created by Phusion.nl which is Ruby Enterprise Edition
|
2
|
+
# and mod_rails
|
3
|
+
|
4
|
+
package :ruby_enterprise do
|
5
|
+
description 'Ruby Enterprise Edition'
|
6
|
+
version '1.8.6-20080810'
|
7
|
+
source 'http://rubyforge.org/frs/download.php/41040/ruby-enterprise-1.8.6-20080810.tar.gz' do
|
8
|
+
custom_install 'echo -en "\n\n\n\n" | ./installer'
|
9
|
+
|
10
|
+
# Modify the passenger conf file to point to REE
|
11
|
+
post :install, 'sed -i "s|^PassengerRuby [/a-zA-Z0-9.]*$|PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby|" /etc/apache2/extras/passenger.conf'
|
12
|
+
|
13
|
+
# Restart apache
|
14
|
+
post :install, '/etc/init.d/apache2 restart'
|
15
|
+
end
|
16
|
+
|
17
|
+
verify do
|
18
|
+
has_directory '/opt/ruby-enterprise-1.8.6-20080810'
|
19
|
+
has_executable '/opt/ruby-enterprise-1.8.6-20080810/bin/ruby'
|
20
|
+
end
|
21
|
+
|
22
|
+
requires :apache
|
23
|
+
requires :passenger
|
24
|
+
end
|
25
|
+
|
26
|
+
package :passenger, :provides => :appserver do
|
27
|
+
description 'Phusion Passenger (mod_rails)'
|
28
|
+
gem 'passenger' do
|
29
|
+
post :install, 'echo -en "\n\n\n\n" | passenger-install-apache2-module'
|
30
|
+
|
31
|
+
# Create the passenger conf file
|
32
|
+
post :install, 'mkdir /etc/apache2/extras'
|
33
|
+
post :install, 'touch /etc/apache2/extras/passenger.conf'
|
34
|
+
post :install, "echo 'Include /etc/apache2/extras/passenger.conf' >> /etc/apache2/apache2.conf"
|
35
|
+
|
36
|
+
[%q(LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so),
|
37
|
+
%q(PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3),
|
38
|
+
%q(PassengerRuby /usr/bin/ruby1.8),
|
39
|
+
%q(RailsEnv development)].each do |line|
|
40
|
+
post :install, "echo '#{line}' >> /etc/apache2/extras/passenger.conf"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Restart apache to note changes
|
44
|
+
post :install, '/etc/init.d/apache2 restart'
|
45
|
+
end
|
46
|
+
|
47
|
+
verify do
|
48
|
+
has_file '/etc/apache2/extras/passenger.conf'
|
49
|
+
has_file '/usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so'
|
50
|
+
has_directory '/usr/lib/ruby/gems/1.8/gems/passenger-2.0.3'
|
51
|
+
end
|
52
|
+
|
53
|
+
requires :apache
|
54
|
+
requires :apache2_prefork_dev
|
55
|
+
end
|
@@ -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
|
@@ -0,0 +1,17 @@
|
|
1
|
+
package :rubygems do
|
2
|
+
description 'Ruby Gems Package Management System'
|
3
|
+
version '1.2.0'
|
4
|
+
source "http://rubyforge.org/frs/download.php/38646/rubygems-#{version}.tgz" do
|
5
|
+
custom_install 'ruby setup.rb'
|
6
|
+
post :install, 'ln -s /usr/bin/gem1.8 /usr/bin/gem'
|
7
|
+
post :install, 'gem update'
|
8
|
+
post :install, 'gem update --system'
|
9
|
+
end
|
10
|
+
|
11
|
+
verify 'binary' do
|
12
|
+
has_file '/usr/bin/gem1.8'
|
13
|
+
has_symlink '/usr/bin/gem', '/usr/bin/gem1.8'
|
14
|
+
end
|
15
|
+
|
16
|
+
requires :ruby
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
package :git, :provides => :scm do
|
2
|
+
description 'Git Distributed Version Control'
|
3
|
+
version '1.5.6.3'
|
4
|
+
source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
5
|
+
requires :git_dependencies
|
6
|
+
end
|
7
|
+
|
8
|
+
package :git_dependencies do
|
9
|
+
description 'Git Build Dependencies'
|
10
|
+
apt 'git', :dependencies_only => true
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
package :apache, :provides => :webserver do
|
2
|
+
description 'Apache2 web server.'
|
3
|
+
apt 'apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert' do
|
4
|
+
post :install, 'a2enmod rewrite'
|
5
|
+
end
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_process 'apache2'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :apache2_prefork_dev do
|
13
|
+
description 'A dependency required by some packages.'
|
14
|
+
apt 'apache2-prefork-dev'
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= Example Rails Spinkle Deployment Script
|
2
|
+
|
3
|
+
The following example shows how you can provision Rails and associated packages onto a remote server (or set of servers).
|
4
|
+
|
5
|
+
== Usage:
|
6
|
+
|
7
|
+
$> sprinkle -s rails.rb
|
8
|
+
|
9
|
+
or in test mode:
|
10
|
+
|
11
|
+
$> sprinkle -t -s rails.rb
|
12
|
+
|
13
|
+
== Information
|
14
|
+
|
15
|
+
For more information, please see: http://github.com/crafterm/sprinkle/tree/master/README.txt
|
@@ -0,0 +1,9 @@
|
|
1
|
+
## Special package, anything that defines a 'source' package means build-essential should be installed for Ubuntu
|
2
|
+
|
3
|
+
package :build_essential do
|
4
|
+
description 'Build tools'
|
5
|
+
apt 'build-essential' do
|
6
|
+
# Update the sources and upgrade the lists before we build essentials
|
7
|
+
pre :install, 'apt-get update'
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
## Defines available packages
|
2
|
+
|
3
|
+
package :ruby do
|
4
|
+
description 'Ruby Virtual Machine'
|
5
|
+
version '1.8.6'
|
6
|
+
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz" # implicit :style => :gnu
|
7
|
+
requires :ruby_dependencies
|
8
|
+
end
|
9
|
+
|
10
|
+
package :ruby_dependencies do
|
11
|
+
description 'Ruby Virtual Machine Build Dependencies'
|
12
|
+
apt %w( bison zlib1g-dev libssl-dev libreadline5-dev libncurses5-dev file )
|
13
|
+
end
|
14
|
+
|
15
|
+
package :rubygems do
|
16
|
+
description 'Ruby Gems Package Management System'
|
17
|
+
version '1.2.0'
|
18
|
+
source "http://rubyforge.org/frs/download.php/38646/rubygems-#{version}.tgz" do
|
19
|
+
custom_install 'ruby setup.rb'
|
20
|
+
end
|
21
|
+
requires :ruby
|
22
|
+
end
|
23
|
+
|
24
|
+
package :rails do
|
25
|
+
description 'Ruby on Rails'
|
26
|
+
gem 'rails'
|
27
|
+
version '2.1.0'
|
28
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
package :git, :provides => :scm do
|
2
|
+
description 'Git Distributed Version Control'
|
3
|
+
version '1.5.6.3'
|
4
|
+
source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
5
|
+
requires :git_dependencies
|
6
|
+
end
|
7
|
+
|
8
|
+
package :git_dependencies do
|
9
|
+
description 'Git Build Dependencies'
|
10
|
+
apt 'git', :dependencies_only => true
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
package :sphinx, :provides => :search do
|
2
|
+
description 'MySQL full text search engine'
|
3
|
+
version '0.9.8-rc2'
|
4
|
+
source "http://www.sphinxsearch.com/downloads/sphinx-#{version}.tar.gz"
|
5
|
+
requires :mysql_dev
|
6
|
+
end
|
7
|
+
|
8
|
+
package :mysql_dev do
|
9
|
+
description 'MySQL Database development package'
|
10
|
+
apt %w( libmysqlclient15-dev )
|
11
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
package :mongrel do
|
2
|
+
description 'Mongrel Application Server'
|
3
|
+
gem 'mongrel'
|
4
|
+
version '1.1.4'
|
5
|
+
end
|
6
|
+
|
7
|
+
package :mongrel_cluster, :provides => :appserver do
|
8
|
+
description 'Cluster Management for Mongrel'
|
9
|
+
gem 'mongrel_cluster'
|
10
|
+
version '1.0.5'
|
11
|
+
requires :mongrel
|
12
|
+
end
|
13
|
+
|
14
|
+
package :apache, :provides => :webserver do
|
15
|
+
description 'Apache 2 HTTP Server'
|
16
|
+
version '2.2.9'
|
17
|
+
source "http://www.apache.org/dist/httpd/httpd-#{version}.tar.bz2" do
|
18
|
+
enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
|
19
|
+
prefix "/opt/local/apache2-#{version}"
|
20
|
+
post :install, 'install -m 755 support/apachectl /etc/init.d/apache2', 'update-rc.d -f apache2 defaults'
|
21
|
+
end
|
22
|
+
requires :apache_dependencies
|
23
|
+
end
|
24
|
+
|
25
|
+
package :apache_dependencies do
|
26
|
+
description 'Apache 2 HTTP Server Build Dependencies'
|
27
|
+
apt %w( openssl libtool mawk zlib1g-dev libssl-dev )
|
28
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#!/usr/bin/env sprinkle -s
|
2
|
+
|
3
|
+
# Annotated Example Sprinkle Rails deployment script
|
4
|
+
#
|
5
|
+
# This is an example Sprinkle script configured to install Rails from gems, Apache, Ruby,
|
6
|
+
# Sphinx and Git from source, and mysql and Git dependencies from apt on an Ubuntu system.
|
7
|
+
#
|
8
|
+
# Installation is configured to run via capistrano (and an accompanying deploy.rb recipe script).
|
9
|
+
# Source based packages are downloaded and built into /usr/local on the remote system.
|
10
|
+
#
|
11
|
+
# A sprinkle script is separated into 3 different sections. Packages, policies and deployment:
|
12
|
+
|
13
|
+
|
14
|
+
# Packages (separate files for brevity)
|
15
|
+
#
|
16
|
+
# Defines the world of packages as we know it. Each package has a name and
|
17
|
+
# set of metadata including its installer type (eg. apt, source, gem, etc). Packages can have
|
18
|
+
# relationships to each other via dependencies.
|
19
|
+
|
20
|
+
require 'packages/essential'
|
21
|
+
require 'packages/rails'
|
22
|
+
require 'packages/database'
|
23
|
+
require 'packages/server'
|
24
|
+
require 'packages/search'
|
25
|
+
require 'packages/scm'
|
26
|
+
|
27
|
+
|
28
|
+
# Policies
|
29
|
+
#
|
30
|
+
# Names a group of packages (optionally with versions) that apply to a particular set of roles:
|
31
|
+
#
|
32
|
+
# Associates the rails policy to the application servers. Contains rails, and surrounding
|
33
|
+
# packages. Note, appserver, database, webserver and search are all virtual packages defined above.
|
34
|
+
# If there's only one implementation of a virtual package, it's selected automatically, otherwise
|
35
|
+
# the user is requested to select which one to use.
|
36
|
+
|
37
|
+
policy :rails, :roles => :app do
|
38
|
+
requires :rails, :version => '2.1.0'
|
39
|
+
requires :appserver
|
40
|
+
requires :database
|
41
|
+
requires :webserver
|
42
|
+
requires :search
|
43
|
+
requires :scm
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Deployment
|
48
|
+
#
|
49
|
+
# Defines script wide settings such as a delivery mechanism for executing commands on the target
|
50
|
+
# system (eg. capistrano), and installer defaults (eg. build locations, etc):
|
51
|
+
#
|
52
|
+
# Configures spinkle to use capistrano for delivery of commands to the remote machines (via
|
53
|
+
# the named 'deploy' recipe). Also configures 'source' installer defaults to put package gear
|
54
|
+
# in /usr/local
|
55
|
+
|
56
|
+
deployment do
|
57
|
+
|
58
|
+
# mechanism for deployment
|
59
|
+
delivery :capistrano do
|
60
|
+
recipes 'deploy'
|
61
|
+
end
|
62
|
+
|
63
|
+
# source based package installer defaults
|
64
|
+
source do
|
65
|
+
prefix '/usr/local'
|
66
|
+
archives '/usr/local/sources'
|
67
|
+
builds '/usr/local/build'
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
# End of script, given the above information, Spinkle will apply the defined policy on all roles using the
|
73
|
+
# deployment settings specified.
|