Skip to content

Commit ff03f24

Browse files
committed
multistage script
1 parent 904a60b commit ff03f24

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

Capfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
2+
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
3+
4+
load 'config/deploy' # remove this line to skip loading any of the default tasks

config/deploy.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
set :application, "set your application name here"
2+
set :repository, "set your repository location here"
3+
4+
set :scm, :subversion
5+
set :stages, %w(test, production, ci)
6+
set :default_stage, 'test'
7+
require 'capistrano/ext/multistage'
8+
9+
after :deploy, "init:set_permissions"
10+
11+
namespace :deploy do
12+
13+
task :restart, :roles => :app do
14+
# restart your web server here
15+
sudo "/usr/sbin/apache2ctl graceful"
16+
end
17+
18+
end
19+
20+
namespace :init do
21+
22+
task :set_permissions, :except => { :no_release => true } do
23+
# chown the new directory to www-data:www-data
24+
sudo "chown -R www-data:www-data #{latest_release}"
25+
end
26+
27+
end

config/deploy/ci.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set :application, "App Name"
2+
set :rails_env, 'ci'
3+
ENV['RAILS_ENV'] = RAILS_ENV = rails_env
4+
5+
set :default_environment, {"RAILS_ENV" => rails_env}
6+
puts "*** Deploying to \033[1;41m #{fetch(:rails_env)} \033[0m"
7+
role :web, "your web-server here" # Your HTTP server, Apache/etc
8+
role :app, "your app-server here" # This may be the same as your `Web` server
9+
role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
10+
role :db, "your slave db-server here"
11+
set :deploy_to 'var/lib/rails/%s' % application
12+
set :user, 'root'

config/deploy/production.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set :application, "App Name"
2+
set :rails_env, 'production'
3+
ENV['RAILS_ENV'] = RAILS_ENV = rails_env
4+
5+
set :default_environment, {"RAILS_ENV" => rails_env}
6+
puts "*** Deploying to \033[1;41m #{fetch(:rails_env)} \033[0m"
7+
role :web, "your web-server here" # Your HTTP server, Apache/etc
8+
role :app, "your app-server here" # This may be the same as your `Web` server
9+
role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
10+
role :db, "your slave db-server here"
11+
set :deploy_to 'var/lib/rails/%s' % application
12+
set :user, 'root'

config/deploy/test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set :application, "App Name"
2+
set :rails_env, 'test'
3+
ENV['RAILS_ENV'] = RAILS_ENV = rails_env
4+
5+
set :default_environment, {"RAILS_ENV" => rails_env}
6+
puts "*** Deploying to \033[1;41m #{fetch(:rails_env)} \033[0m"
7+
role :web, "your web-server here" # Your HTTP server, Apache/etc
8+
role :app, "your app-server here" # This may be the same as your `Web` server
9+
role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
10+
role :db, "your slave db-server here"
11+
set :deploy_to 'var/lib/rails/%s' % application
12+
set :user, 'root'

0 commit comments

Comments
 (0)