Skip to content

Commit

Permalink
Added first cut of scripts to the repository
Browse files Browse the repository at this point in the history
Added .gitignore
Added a README for brevity
  • Loading branch information
benschwarz committed Dec 23, 2008
0 parents commit 928b6f5
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config/deploy.rb
3 changes: 3 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
20 changes: 20 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Scripts for [Sprinkle](http://github.com/crafterm/sprinkle/ "Sprinkle"), the provisioning tool

Deploy a basic stack for running rack based ruby applications with ease!

* Apache (Apt)
* Ruby enterprise (Source) [includes rubygems]
* Passenger (Rubygem)
* Libmemcached (Source)
* MySQL (Apt)
* Git (Apt)

### Requirements
* Ruby
* Capistrano
* Sprinkle (github.com/crafterm/sprinkle)
* An Ubuntu based VPS (known to not work on Debian Etch, haven't looked into why)

### Thanks

Marcus Crafter and other Sprinkle contributors
10 changes: 10 additions & 0 deletions config/deploy.rb.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set :application, "your-app"
set :repository, "git@github.com:you/your-app.git"
set :server_url, "your-app-server.com"
set :scm, :git

role :app, server_url
role :web, server_url
role :db, server_url, :primary => true

set :deploy_to, "/var/www/#{application}"
27 changes: 27 additions & 0 deletions config/install.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Require our stack
%w(essential server scm ruby_enterprise mysql memcached).each do |r|
require "stack/#{r}"
end

policy :ffolio, :roles => :app do
requires :ruby
requires :appserver
requires :database
requires :webserver
requires :scm
requires :memcached
end

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
Binary file added config/stack/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions config/stack/essential.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package :build_essential do
description 'Build tools'
apt 'build-essential'
end
9 changes: 9 additions & 0 deletions config/stack/memcached.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package :memcached_daemon, :provides => :memcached do
description 'Memcached, a distributed memory object store'
apt %w( memcached )
end

package :libmemcached do
source 'http://download.tangent.org/libmemcached-0.25.tar.gz'
requires :memcached
end
11 changes: 11 additions & 0 deletions config/stack/mysql.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package :mysql, :provides => :database do
description 'MySQL Database'
apt %w( mysql-server mysql-client libmysqlclient15-dev )
end

package :mysql_driver do
description 'Ruby MySQL database driver'
gem 'mysql'

requires :ruby
end
20 changes: 20 additions & 0 deletions config/stack/ruby_enterprise.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package :ruby_enterprise, :provides => :ruby do
description 'Ruby Enterprise Edition'
version '1.8.6-20081215'
source 'http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz' do
custom_install 'echo -en "\n\n\n\n" | ./installer'

# Modify the passenger conf file to point to REE
post :install, 'sed -i "s|^PassengerRuby [/a-zA-Z0-9.]*$|PassengerRuby /opt/ruby-enterprise-1.8.6-20081215/bin/ruby|" /etc/apache2/extras/passenger.conf'

# Restart apache
post :install, '/etc/init.d/apache2 restart'
end

verify do
has_directory '/opt/ruby-enterprise-1.8.6-20081215'
has_executable '/opt/ruby-enterprise-1.8.6-20081215/bin/ruby'
end

requires :apache
end
11 changes: 11 additions & 0 deletions config/stack/scm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package :git, :provides => :scm do
description 'Git Distributed Version Control'
version '1.5.6.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', :dependencies_only => true
end
48 changes: 48 additions & 0 deletions config/stack/server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contains software created by Phusion.nl which is Ruby Enterprise Edition
# and mod_rails
package :passenger, :provides => :appserver do
description 'Phusion Passenger (mod_rails)'
gem 'passenger' do
post :install, 'echo -en "\n\n\n\n" | passenger-install-apache2-module'

# Create the passenger conf file
post :install, 'mkdir /etc/apache2/extras'
post :install, 'touch /etc/apache2/extras/passenger.conf'
post :install, "echo 'Include /etc/apache2/extras/passenger.conf' >> /etc/apache2/apache2.conf"

[%q(LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so),
%q(PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6),
%q(PassengerRuby /usr/bin/ruby1.8),
%q(RailsEnv development)].each do |line|
post :install, "echo '#{line}' >> /etc/apache2/extras/passenger.conf"
end

# Restart apache to note changes
post :install, '/etc/init.d/apache2 restart'
end

verify do
has_file '/etc/apache2/extras/passenger.conf'
has_file '/usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so'
has_directory '/usr/lib/ruby/gems/1.8/gems/passenger-2.0.6'
end

requires :apache
requires :apache2_prefork_dev
end

package :apache, :provides => :webserver do
description 'Apache2 web server.'
apt 'apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert' do
post :install, 'a2enmod rewrite'
end

verify do
has_process 'apache2'
end
end

package :apache2_prefork_dev do
description 'A dependency required by some packages.'
apt 'apache2-prefork-dev'
end

0 comments on commit 928b6f5

Please sign in to comment.