-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcapistrano.rb
51 lines (43 loc) · 1.34 KB
/
capistrano.rb
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
gem "capistrano"
run "bundle install"
capify!
app_name = ask "\r\nEnter the application name:"
server = ask "\r\nEnter the servername or IP:"
git_repo = ask "\r\nEnter the git repo URL, e.g. [email protected]:recrea/app.git :"
file 'config/deploy.rb', <<-FILE
# Bundler Integration
# http://github.com/carlhuda/bundler/blob/master/lib/bundler/capistrano.rb
require 'bundler/capistrano'
# Application Settings
set :application, "#{app_name}"
set :user, "deployer"
set :password, "deployer"
set :deploy_to, "/var/rails/#{app_name}"
set :rails_env, "production"
set :use_sudo, false
set :keep_releases, 5
# Git Settings
set :scm, :git
set :branch, "master"
set :repository, "#{git_repo}"
set :deploy_via, :remote_cache
# Uses local instead of remote server keys, good for github ssh key deploy.
ssh_options[:forward_agent] = true
# Server Roles
role :web, "#{server}"
role :app, "#{server}"
role :db, "#{server}", :primary => true
# Passenger Deploy Reconfigure
namespace :deploy do
desc "Restart passenger process"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch \#{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "\#{t} does nothing for passenger"
task t, :roles => :app do ; end
end
end
FILE
git :add => '.'
git :commit => '-m "capistrano"'