public
Rubygem
Description: Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails or Merb stack on a brand new slice directly after its been created
Homepage: http://sprinkle.rubyforge.org/
Clone URL: git://github.com/crafterm/sprinkle.git
sprinkle / examples / rails / rails.rb
100755 74 lines (59 sloc) 2.412 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env sprinkle -s
 
# Annotated Example Sprinkle Rails deployment script
#
# This is an example Sprinkle script configured to install Rails from gems, Apache, Ruby,
# Sphinx and Git from source, and mysql and Git dependencies from apt on an Ubuntu system.
#
# Installation is configured to run via capistrano (and an accompanying deploy.rb recipe script).
# Source based packages are downloaded and built into /usr/local on the remote system.
#
# A sprinkle script is separated into 3 different sections. Packages, policies and deployment:
 
 
# Packages (separate files for brevity)
#
# Defines the world of packages as we know it. Each package has a name and
# set of metadata including its installer type (eg. apt, source, gem, etc). Packages can have
# relationships to each other via dependencies.
 
require 'packages/essential'
require 'packages/rails'
require 'packages/database'
require 'packages/server'
require 'packages/search'
require 'packages/scm'
 
 
# Policies
#
# Names a group of packages (optionally with versions) that apply to a particular set of roles:
#
# Associates the rails policy to the application servers. Contains rails, and surrounding
# packages. Note, appserver, database, webserver and search are all virtual packages defined above.
# If there's only one implementation of a virtual package, it's selected automatically, otherwise
# the user is requested to select which one to use.
 
policy :rails, :roles => :app do
  requires :rails, :version => '2.1.0'
  requires :appserver
  requires :database
  requires :webserver
  requires :search
  requires :scm
end
 
 
# Deployment
#
# Defines script wide settings such as a delivery mechanism for executing commands on the target
# system (eg. capistrano), and installer defaults (eg. build locations, etc):
#
# Configures spinkle to use capistrano for delivery of commands to the remote machines (via
# the named 'deploy' recipe). Also configures 'source' installer defaults to put package gear
# in /usr/local
 
deployment do
 
  # mechanism for deployment
  delivery :capistrano do
    recipes 'deploy'
  end
 
  # source based package installer defaults
  source do
    prefix '/usr/local'
    archives '/usr/local/sources'
    builds '/usr/local/build'
  end
 
end
 
# End of script, given the above information, Spinkle will apply the defined policy on all roles using the
# deployment settings specified.