RS IZ deploy stuffz
This commit is contained in:
parent
c63eac0fd9
commit
3aa2191365
10 changed files with 254 additions and 0 deletions
4
Capfile
Normal file
4
Capfile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
||||
15
config/sprinkle/README
Normal file
15
config/sprinkle/README
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
= Example Rails Sprinkle Deployment Script
|
||||
|
||||
The following example shows how you can provision Rails and associated packages onto a remote server (or set of servers).
|
||||
|
||||
== Usage:
|
||||
|
||||
$> sprinkle -s rails.rb
|
||||
|
||||
or in test mode:
|
||||
|
||||
$> sprinkle -t -s rails.rb
|
||||
|
||||
== Information
|
||||
|
||||
For more information, please see: http://github.com/crafterm/sprinkle/tree/master/README.markdown
|
||||
40
config/sprinkle/deploy.rb
Normal file
40
config/sprinkle/deploy.rb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
set :user, 'diasporaroot'
|
||||
set :scm_passphrase, "evankorth311"
|
||||
|
||||
role :app, 'ps25770.dreamhost.com', :primary => true
|
||||
# Source code
|
||||
set :scm, :git
|
||||
set :repository, "git://github.com:rsofaer/roxml.git"
|
||||
set :branch, "master"
|
||||
#set :repository_cache, "git_cache"
|
||||
#set :deploy_via, :remote_cache
|
||||
#set :ssh_options, { :forward_agent => true }
|
||||
|
||||
set :deploy_to, "/usr/local/diaspora"
|
||||
|
||||
namespace :bundler do
|
||||
task :create_symlink, :roles => :app do
|
||||
shared_dir = File.join(shared_path, 'bundle')
|
||||
release_dir = File.join(current_release, '.bundle')
|
||||
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
|
||||
end
|
||||
|
||||
task :bundle_new_release, :roles => :app do
|
||||
bundler.create_symlink
|
||||
run "cd #{release_path} && bundle install --without test"
|
||||
end
|
||||
|
||||
task :lock, :roles => :app do
|
||||
run "cd #{current_release} && bundle lock;"
|
||||
end
|
||||
|
||||
task :unlock, :roles => :app do
|
||||
run "cd #{current_release} && bundle unlock;"
|
||||
end
|
||||
end
|
||||
|
||||
# HOOKS
|
||||
after "deploy:update_code" do
|
||||
bundler.bundle_new_release
|
||||
# ...
|
||||
end
|
||||
76
config/sprinkle/diaspora.rb
Executable file
76
config/sprinkle/diaspora.rb
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
#!/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/database'
|
||||
require 'packages/server'
|
||||
require 'packages/scm'
|
||||
require 'packages/rails'
|
||||
|
||||
# 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 :diaspora, :roles => :app do
|
||||
requires :rubygems
|
||||
requires :bundler
|
||||
requires :diaspora_dependencies
|
||||
# requires :diaspora
|
||||
requires :appserver
|
||||
requires :database
|
||||
# requires :webserver
|
||||
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
|
||||
binary do
|
||||
prefix '/usr/local/bin'
|
||||
archives '/usr/local/sources'
|
||||
end
|
||||
end
|
||||
|
||||
# End of script, given the above information, Spinkle will apply the defined policy on all roles using the
|
||||
# deployment settings specified.
|
||||
0
config/sprinkle/packages/app.rb
Normal file
0
config/sprinkle/packages/app.rb
Normal file
22
config/sprinkle/packages/database.rb
Normal file
22
config/sprinkle/packages/database.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#package :mongo, :provides => :database do
|
||||
# description 'Mongodb'
|
||||
# version '1.4.3'
|
||||
# source "http://downloads.mongodb.org/src/mongodb-src-r#{version}.tar.gz"
|
||||
#end
|
||||
|
||||
package :mongodb, :provides => :database do
|
||||
description 'Mongodb debian package.'
|
||||
version '1.4.3'
|
||||
|
||||
binary "http://downloads.mongodb.org/linux/mongodb-linux-x86_64-static-legacy-#{version}.tgz" do
|
||||
post :install, "ln -s -f /usr/local/bin/mongodb-linux-x86_64-static-#{version}/bin/mongod /usr/bin/mongod"
|
||||
end
|
||||
end
|
||||
|
||||
package :mongo_driver do
|
||||
description 'Ruby mongo database driver'
|
||||
gem 'mongo'
|
||||
gem 'bson'
|
||||
gem 'bson_ext'
|
||||
requires :rubygems
|
||||
end
|
||||
9
config/sprinkle/packages/essential.rb
Normal file
9
config/sprinkle/packages/essential.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
## Special package, anything that defines a 'source' package means build-essential should be installed for Ubuntu
|
||||
|
||||
package :build_essential do
|
||||
description 'Build tools'
|
||||
apt 'build-essential' do
|
||||
# Update the sources and upgrade the lists before we build essentials
|
||||
pre :install, 'apt-get update'
|
||||
end
|
||||
end
|
||||
47
config/sprinkle/packages/rails.rb
Normal file
47
config/sprinkle/packages/rails.rb
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
## Defines available packages
|
||||
|
||||
package :ruby do
|
||||
description 'Ruby Virtual Machine'
|
||||
version '1.8.7'
|
||||
patchlevel '249'
|
||||
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p#{patchlevel}.tar.gz" # implicit :style => :gnu
|
||||
requires :ruby_dependencies
|
||||
end
|
||||
|
||||
package :ruby_dependencies do
|
||||
description 'Ruby Virtual Machine Build Dependencies'
|
||||
apt %w( bison zlib1g-dev libssl-dev libreadline5-dev libncurses5-dev file )
|
||||
end
|
||||
|
||||
package :rubygems do
|
||||
description 'Ruby Gems Package Management System'
|
||||
version '1.3.7'
|
||||
source "http://production.cf.rubygems.org/rubygems/rubygems-#{version}.tgz" do
|
||||
custom_install 'ruby setup.rb'
|
||||
end
|
||||
run( "PATH=$PATH:/var/lib/gems/1.8/bin")
|
||||
run( "export PATH")
|
||||
requires :ruby
|
||||
end
|
||||
|
||||
package :bundler do
|
||||
description 'bundler'
|
||||
version '0.9.26'
|
||||
gem 'bundler'
|
||||
requires :rubygems
|
||||
end
|
||||
|
||||
package :diaspora_dependencies do
|
||||
description 'random dependencies'
|
||||
apt %w(libxslt1.1 libxslt1-dev libxml2)
|
||||
end
|
||||
#package :diaspora do
|
||||
# description 'Diaspora'
|
||||
|
||||
=begin
|
||||
package :rails do
|
||||
description 'Ruby on Rails'
|
||||
gem 'rails'
|
||||
version '>=3.0.0b4'
|
||||
end
|
||||
=end
|
||||
12
config/sprinkle/packages/scm.rb
Normal file
12
config/sprinkle/packages/scm.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package :git, :provides => :scm do
|
||||
description 'Git Distributed Version Control'
|
||||
apt %w( git-core )
|
||||
#version '1.6.3.3'
|
||||
#source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
||||
#requires :git_dependencies
|
||||
end
|
||||
|
||||
package :git_dependencies do
|
||||
description 'Git Build Dependencies'
|
||||
apt 'git-core', :dependencies_only => true
|
||||
end
|
||||
29
config/sprinkle/packages/server.rb
Normal file
29
config/sprinkle/packages/server.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package :mongrel do
|
||||
description 'Mongrel Application Server'
|
||||
gem 'mongrel'
|
||||
version '1.1.5'
|
||||
end
|
||||
|
||||
package :mongrel_cluster, :provides => :appserver do
|
||||
description 'Cluster Management for Mongrel'
|
||||
gem 'mongrel_cluster'
|
||||
version '1.0.5'
|
||||
requires :mongrel
|
||||
end
|
||||
|
||||
package :apache, :provides => :webserver do
|
||||
description 'Apache 2 HTTP Server'
|
||||
version '2.2.15'
|
||||
|
||||
source "http://download.nextag.com/apache/httpd/httpd-#{version}.tar.bz2" do
|
||||
enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
|
||||
prefix "/opt/local/apache2-#{version}"
|
||||
post :install, 'install -m 755 support/apachectl /etc/init.d/apache2', 'update-rc.d -f apache2 defaults'
|
||||
end
|
||||
requires :apache_dependencies
|
||||
end
|
||||
|
||||
package :apache_dependencies do
|
||||
description 'Apache 2 HTTP Server Build Dependencies'
|
||||
apt %w( openssl libtool mawk zlib1g-dev libssl-dev )
|
||||
end
|
||||
Loading…
Reference in a new issue