crossroads_capistrano 1.4.18 → 1.4.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "crossroads_capistrano"
6
- s.version = "1.4.18"
6
+ s.version = "1.4.19"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Steve Kenworthy", "Ben Tillman", "Nathan Broadbent"]
9
9
  s.email = ["it_dept@crossroads.org.hk"]
@@ -21,5 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency('capistrano', ">= 2.6.0")
22
22
  s.add_dependency('capistrano-ext', ">= 1.2.1")
23
23
  s.add_dependency('capistrano_colors', ">= 0.5.4")
24
+ s.add_dependency('rvm', ">= 1.6.9")
24
25
  end
25
26
 
@@ -49,7 +49,7 @@ namespace :deploy do
49
49
  end
50
50
  desc "Check for project dependencies"
51
51
  task :check_dependencies, :roles => :db, :only => { :primary => true } do
52
- sudo "cd #{current_path} && RAILS_ENV=production rake check_dependencies"
52
+ sudo "cd #{current_path} && bundle exec rake check_dependencies RAILS_ENV=production"
53
53
  end
54
54
  desc "Remove cached-copy (when switching to a new repository, etc.)"
55
55
  task :remove_cached_copy, :roles => :db, :only => { :primary => true } do
@@ -7,7 +7,7 @@ namespace :cache do
7
7
  end
8
8
  desc "Clear memcache"
9
9
  task :memcache, :only => { :primary => true } do
10
- run "cd #{current_path} && RAILS_ENV=production rake cache:clear"
10
+ run "cd #{current_path} && bundle exec rake cache:clear RAILS_ENV=production"
11
11
  end
12
12
  desc "Clear view cache (tmp/cache/) used when memcached is unavailable"
13
13
  task :view do
@@ -36,6 +36,12 @@ namespace :log do
36
36
  sudo "rm -rf #{shared_path}/log && ln -fs /var/log/rails/#{application}-#{stage} #{shared_path}/log"
37
37
  sudo "chown -R #{httpd_user}:#{httpd_group} /var/log/rails/#{application}-#{stage}/"
38
38
  end
39
+
40
+ desc "Setup logrotate file (Requires /usr/sbin/logrotate and config/logrotate.conf)"
41
+ task :logrotate do
42
+ run "if [ -f /usr/sbin/logrotate ] && [ -f #{current_path}/config/logrotate.conf ]; then sed -e 's,@LOG_PATH@,/var/log/rails/#{application}-#{stage},g' #{current_path}/config/logrotate.conf > /etc/logrotate.d/#{application}-#{stage}; fi"
43
+ end
44
+
39
45
  end
40
46
 
41
47
  after "stack", "log:symlink_shared"
@@ -0,0 +1,47 @@
1
+ #
2
+ # Provides tasks to turn on maintenance pages whilst the build is being repaired.
3
+ #
4
+ # The maintenance files must exist in
5
+ # public/maintenance
6
+ #
7
+ # And Apache must be configured to use them. E.g.
8
+ #
9
+ # Alias /maintenance @DEPLOY_TO@/shared/system/maintenance
10
+ # <Directory "@DEPLOY_TO@/shared/system/maintenance/">
11
+ # Options FollowSymLinks
12
+ # AllowOverride None
13
+ # Order allow,deny
14
+ # Allow from all
15
+ # </Directory>
16
+ #
17
+ # RewriteRule ^/maintenance/.*\.(png|ico|jpg|gif) - [L]
18
+ #
19
+ # RewriteCond @DEPLOY_TO@/shared/system/maintenance/maintenance.html -f
20
+ # RewriteCond %{SCRIPT_FILENAME} !maintenance.html
21
+ # RewriteRule ^.*$ @DEPLOY_TO@/shared/system/maintenance/maintenance.html [L]
22
+ #
23
+
24
+ namespace :web do
25
+ desc <<-DESC
26
+ Present a maintenance page to visitors. Disables your application's web \
27
+ interface by writing a "maintenance-en.html" file to each web server. The \
28
+ servers must be configured to detect the presence of this file, and if \
29
+ it is present, always display it instead of performing the request.
30
+
31
+ The maintenance html pages are copied to shared/system/maintenance so they \
32
+ can still display when things go wrong in the release folder.
33
+ DESC
34
+ task :disable, :roles => :web, :except => { :no_release => true } do
35
+ run "cp -raf #{current_path}/public/maintenance/ #{deploy_to}/shared/system/"
36
+ end
37
+
38
+ desc <<-DESC
39
+ Makes the application web-accessible again. Removes the \
40
+ "maintenance.html" page generated by deploy:web:disable, which (if your \
41
+ web servers are configured correctly) will make your application \
42
+ web-accessible again.
43
+ DESC
44
+ task :enable, :roles => :web, :except => { :no_release => true } do
45
+ run "rm -rf #{deploy_to}/shared/system/maintenance"
46
+ end
47
+ end
@@ -39,41 +39,43 @@ namespace :passenger do
39
39
  end
40
40
 
41
41
  task :install_deps, :roles => :web do
42
- yum.install( {:base => %w(curl-devel httpd-devel apr-devel)}, :stable )
42
+ yum.install( {:base => %w(curl-devel httpd-devel apr-devel openssl-devel zlib-devel e2fsprogs-devel krb5-devel)}, :stable )
43
43
  sudo "rm -rf /etc/httpd/conf.d/ssl.conf"
44
44
  end
45
45
 
46
46
  desc "Set up Apache and Passenger config files"
47
47
  task :config, :roles => :web do
48
- # You can set the following paths from your deploy.rb file, if needed.
49
- set :httpd_site_conf_path, "/etc/httpd/sites-enabled/010-#{application}-#{stage}.conf" unless exists?(:httpd_site_conf_path)
50
- set :passenger_conf_path, "/etc/httpd/mods-enabled/passenger.conf" unless exists?(:passenger_conf_path)
48
+ unless (exists?(:no_passenger_conf) && no_passenger_conf)
49
+ # You can set the following paths from your deploy.rb file, if needed.
50
+ set :httpd_site_conf_path, "/etc/httpd/sites-enabled/010-#{application}-#{stage}.conf" unless exists?(:httpd_site_conf_path)
51
+ set :passenger_conf_path, "/etc/httpd/mods-enabled/passenger.conf" unless exists?(:passenger_conf_path)
51
52
 
52
- if exists?(:rvm_ruby_string) # Deploying with RVM
53
- ruby_root = "/usr/local/rvm/wrappers/#{rvm_ruby_string}/ruby"
54
- passenger_root = "/usr/local/rvm/gems/#{rvm_ruby_string}/gems/passenger-#{passenger_version}"
55
- else # System Ruby
56
- ruby_root = capture("which ruby").strip
57
- gem_path = capture("ruby -r rubygems -e 'p Gem.path.detect{|p|p.include? \"/usr\"}'").strip.gsub('"','')
58
- passenger_root = "#{gem_path}/gems/passenger-#{passenger_version}"
53
+ if exists?(:rvm_ruby_string) # Deploying with RVM
54
+ ruby_root = "/usr/local/rvm/wrappers/#{rvm_ruby_string}/ruby"
55
+ passenger_root = "/usr/local/rvm/gems/#{rvm_ruby_string}/gems/passenger-#{passenger_version}"
56
+ else # System Ruby
57
+ ruby_root = capture("which ruby").strip
58
+ gem_path = capture("ruby -r rubygems -e 'p Gem.path.detect{|p|p.include? \"/usr\"}'").strip.gsub('"','')
59
+ passenger_root = "#{gem_path}/gems/passenger-#{passenger_version}"
60
+ end
61
+ # httpd conf
62
+ sudo "cp -f #{release_path}/config/httpd-rails.conf #{httpd_site_conf_path}"
63
+ sed httpd_site_conf_path, {"DEPLOY_TO" => deploy_to,
64
+ "IP_ADDR" => ip_address,
65
+ "SERVER_NAME" => site_domain_name,
66
+ "SITE_DOMAIN_NAME" => site_domain_name,
67
+ "HTTP_PORT" => http_port,
68
+ "HTTPS_PORT" => https_port}
69
+ # passenger conf
70
+ sudo "cp -f #{release_path}/config/passenger.conf #{passenger_conf_path}"
71
+ sed passenger_conf_path, {"PASSENGER_ROOT" => passenger_root,
72
+ "RUBY_ROOT" => ruby_root}
59
73
  end
60
- # httpd conf
61
- sudo "cp -f #{release_path}/config/httpd-rails.conf #{httpd_site_conf_path}"
62
- sed httpd_site_conf_path, {"DEPLOY_TO" => deploy_to,
63
- "IP_ADDR" => ip_address,
64
- "SERVER_NAME" => site_domain_name,
65
- "SITE_DOMAIN_NAME" => site_domain_name,
66
- "HTTP_PORT" => http_port,
67
- "HTTPS_PORT" => https_port}
68
- # passenger conf
69
- sudo "cp -f #{release_path}/config/passenger.conf #{passenger_conf_path}"
70
- sed passenger_conf_path, {"PASSENGER_ROOT" => passenger_root,
71
- "RUBY_ROOT" => ruby_root}
72
74
  end
73
75
  end
74
76
 
75
77
  before "deploy:cold", "passenger:install"
76
- after "deploy:update_code", "passenger:config" unless (exists?(:no_passenger_conf) && no_passenger_conf)
78
+ after "deploy:update_code", "passenger:config"
77
79
  before "deploy:start", "deploy:apache_permissions"
78
80
  before "deploy:restart", "deploy:apache_permissions"
79
81
 
@@ -2,17 +2,17 @@ namespace :ts do
2
2
 
3
3
  desc "Index data for Sphinx using Thinking Sphinx's settings"
4
4
  task :in do
5
- run "cd #{current_path} && RAILS_ENV=production rake ts:in"
5
+ run "cd #{current_path} && bundle exec rake ts:in RAILS_ENV=production"
6
6
  end
7
7
 
8
8
  desc "Stop sphinx"
9
9
  task :stop do
10
- run "cd #{current_path} && RAILS_ENV=production rake ts:stop"
10
+ run "cd #{current_path} && bundle exec rake ts:stop RAILS_ENV=production"
11
11
  end
12
12
 
13
13
  desc "Start sphinx"
14
14
  task :start do
15
- run "cd #{current_path} && RAILS_ENV=production rake ts:start"
15
+ run "cd #{current_path} && bundle exec rake ts:start RAILS_ENV=production"
16
16
  run "chown #{httpd_user}:#{httpd_group} #{shared_path}/log/searchd.production.pid"
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ namespace :ts do
26
26
  task :recover do
27
27
  stop
28
28
  run "cd #{shared_path}/db/sphinx/ && rm -rf production"
29
- run "cd #{current_path} && RAILS_ENV=production rake ts:in"
29
+ run "cd #{current_path} && bundle exec rake ts:in RAILS_ENV=production"
30
30
  start
31
31
  end
32
32
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crossroads_capistrano
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 18
10
- version: 1.4.18
9
+ - 19
10
+ version: 1.4.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve Kenworthy
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-06-16 00:00:00 +08:00
20
+ date: 2011-06-21 00:00:00 +08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -68,6 +68,22 @@ dependencies:
68
68
  version: 0.5.4
69
69
  type: :runtime
70
70
  version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: rvm
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 29
80
+ segments:
81
+ - 1
82
+ - 6
83
+ - 9
84
+ version: 1.6.9
85
+ type: :runtime
86
+ version_requirements: *id004
71
87
  description: A Crossroads Foundation collection of generic capistrano recipes.
72
88
  email:
73
89
  - it_dept@crossroads.org.hk
@@ -93,6 +109,7 @@ files:
93
109
  - lib/crossroads_capistrano/recipes/hoptoad.rb
94
110
  - lib/crossroads_capistrano/recipes/ldap.rb
95
111
  - lib/crossroads_capistrano/recipes/log.rb
112
+ - lib/crossroads_capistrano/recipes/maintenance.rb
96
113
  - lib/crossroads_capistrano/recipes/mysql.rb
97
114
  - lib/crossroads_capistrano/recipes/newrelic.rb
98
115
  - lib/crossroads_capistrano/recipes/passenger.rb