engineyard-eycap 0.4.12 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.4.14 / 2009-08-31
2
+ * restored functionality to remove temporary compressed sql file after db:clone_prod_to_staging
3
+ * renamed gz extension files to bz2 in db:clone_to_local
4
+ * memcached: fix netcat not hanging up on a flush
5
+
6
+ == 0.4.13 / 2009-07-30
7
+ * changed Gemfile to absolute path
8
+ * merged changes from square/master for unshared_remote_cache cached deploy strategy
9
+
1
10
  == 0.4.12 / 2009-06-26
2
11
  * removed condition for dbhost that was useless and tested db:clone_prod_to_staging
3
12
 
data/Manifest.txt CHANGED
@@ -3,13 +3,14 @@ Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
5
  lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
6
- lib/capistrano/recipes/deploy/strategy/remote_cache.rb
6
+ lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb
7
7
  lib/eycap.rb
8
8
  lib/eycap/lib/ey_logger.rb
9
9
  lib/eycap/lib/ey_logger_hooks.rb
10
10
  lib/eycap/recipes.rb
11
11
  lib/eycap/recipes/backgroundrb.rb
12
12
  lib/eycap/recipes/database.rb
13
+ lib/eycap/recipes/bundler.rb
13
14
  lib/eycap/recipes/deploy.rb
14
15
  lib/eycap/recipes/ferret.rb
15
16
  lib/eycap/recipes/juggernaut.rb
@@ -0,0 +1,21 @@
1
+ require 'capistrano/recipes/deploy/strategy/remote_cache'
2
+
3
+ module Capistrano
4
+ module Deploy
5
+ module Strategy
6
+ class UnsharedRemoteCache < RemoteCache
7
+ def check!
8
+ super.check do |d|
9
+ d.remote.writable(repository_cache)
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def repository_cache
16
+ configuration[:repository_cache]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
data/lib/eycap.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eycap
2
- VERSION = '0.4.12'
2
+ VERSION = '0.4.14'
3
3
  end
data/lib/eycap/recipes.rb CHANGED
@@ -15,11 +15,10 @@ require 'eycap/recipes/tomcat'
15
15
  require 'eycap/recipes/juggernaut'
16
16
  require 'eycap/recipes/passenger'
17
17
  require 'eycap/recipes/apache'
18
+ require 'eycap/recipes/bundler'
18
19
 
19
20
  Capistrano::Configuration.instance(:must_exist).load do
20
-
21
21
  default_run_options[:pty] = true if respond_to?(:default_run_options)
22
22
  set :keep_releases, 3
23
23
  set :runner, defer { user }
24
-
25
24
  end
@@ -36,7 +36,7 @@ Capistrano::Configuration.instance(:must_exist).load do
36
36
  ch.send_data "#{dbpass}\n" if out=~ /^Password/
37
37
  end
38
38
  end
39
- run "rm -f #{backup_file}"
39
+ run "rm -f #{backup_file}.bz2"
40
40
  end
41
41
 
42
42
  desc "Backup your MySQL or PostgreSQL database to shared_path+/db_backups"
@@ -60,12 +60,12 @@ Capistrano::Configuration.instance(:must_exist).load do
60
60
  task :clone_to_local, :roles => :db, :only => {:primary => true} do
61
61
  backup_name
62
62
  dump
63
- get "#{backup_file}.bz2", "/tmp/#{application}.sql.gz"
63
+ get "#{backup_file}.bz2", "/tmp/#{application}.sql.bz2"
64
64
  development_info = YAML.load_file("config/database.yml")['development']
65
65
  if development_info['adapter'] == 'mysql'
66
- run_str = "bzcat /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} --password='#{development_info['password']}' -h #{development_info['host']} #{development_info['database']}"
66
+ run_str = "bzcat /tmp/#{application}.sql.bz2 | mysql -u #{development_info['username']} --password='#{development_info['password']}' -h #{development_info['host']} #{development_info['database']}"
67
67
  else
68
- run_str = "PGPASSWORD=#{development_info['password']} bzcat /tmp/#{application}.sql.gz | psql -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}"
68
+ run_str = "PGPASSWORD=#{development_info['password']} bzcat /tmp/#{application}.sql.bz2 | psql -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}"
69
69
  end
70
70
  %x!#{run_str}!
71
71
  end
@@ -14,7 +14,7 @@ Capistrano::Configuration.instance(:must_exist).load do
14
14
  end
15
15
  desc "Flush memcached - this assumes memcached is on port 11211"
16
16
  task :flush, :roles => [:app], :only => {:memcached => true} do
17
- sudo "echo 'flush_all' | nc localhost 11211"
17
+ sudo "echo 'flush_all' | nc -q 1 localhost 11211"
18
18
  end
19
19
  desc "Symlink the memcached.yml file into place if it exists"
20
20
  task :symlink_configs, :roles => [:app], :only => {:memcached => true }, :except => { :no_release => true } do
@@ -24,5 +24,33 @@ Capistrano::Configuration.instance(:must_exist).load do
24
24
  task :stop, :roles => [:app], :except => {:mongrel => false} do
25
25
  sudo "/usr/bin/monit stop all -g #{monit_group}"
26
26
  end
27
- end
28
- end
27
+
28
+ desc <<-DESC
29
+ Start mongrels in a loop, with a defer of [default] 30 seconds between each single mongrel restart.
30
+ DESC
31
+ task :rolling_restart, :roles => [:app], :except => {:mongrel => false} do
32
+
33
+ set :mongrel_restart_delay, 30
34
+
35
+ # need a script due to weird escapes run by sudo "X".
36
+ script = File.open("/tmp/rolling.reboot", 'w+')
37
+ script.puts "#!/bin/bash"
38
+ script.puts "export monit_group=#{monit_group}"
39
+ script.puts "export mongrel_restart_delay=#{mongrel_restart_delay}"
40
+ # here's the need for single quoted - sed ? - (no escaping).
41
+ script.puts 'for port in $(monit summary | grep mongrel | sed -r \'s/[^0-9]*([0-9]+).*/\1/\'); do echo "Executing monit restart mongrel_${monit_group}_${port}"; /usr/bin/monit restart mongrel_${monit_group}_${port}; echo "sleeping $mongrel_restart_delay"; sleep ${mongrel_restart_delay}; done'
42
+ script.close
43
+
44
+ upload(script.path, script.path, :via=> :scp)
45
+
46
+ #it's in the script, on the remote server, execute it.
47
+ sudo "chmod +x #{script.path}"
48
+ sudo "#{script.path}"
49
+ #cleanup
50
+ sudo "rm #{script.path}"
51
+ require 'fileutils' ; FileUtils.rm(script.path)
52
+ puts "Done."
53
+ end
54
+
55
+ end #namespace
56
+ end #Capistrano::Configuration
@@ -31,14 +31,6 @@ Capistrano::Configuration.instance(:must_exist).load do
31
31
  sudo "/etc/init.d/nginx configtest"
32
32
  end
33
33
 
34
- desc "Tail the nginx access logs for this application"
35
- task :tail, :roles => :app do
36
- run "tail -f /var/log/engineyard/nginx/#{application}.access.log" do |channel, stream, data|
37
- puts "#{channel[:server]}: #{data}" unless data =~ /^10\.[01]\.0/ # skips lb pull pages
38
- break if stream == :err
39
- end
40
- end
41
-
42
34
  desc "Tail the nginx error logs on the app slices"
43
35
  task :tail_error, :roles => :app do
44
36
  run "tail -f /var/log/engineyard/nginx/error.log" do |channel, stream, data|
@@ -10,35 +10,35 @@ Capistrano::Configuration.instance(:must_exist).load do
10
10
  task :reindex, :roles => [:app], :only => {:sphinx => true} do
11
11
  run "/engineyard/bin/searchd #{application} reindex"
12
12
  end
13
-
13
+
14
14
  desc "Start Sphinx Searchd"
15
15
  task :start, :roles => [:app], :only => {:sphinx => true} do
16
16
  sudo "/usr/bin/monit start all -g sphinx_#{application}"
17
17
  end
18
-
18
+
19
19
  desc "Stop Sphinx Searchd"
20
20
  task :stop, :roles => [:app], :only => {:sphinx => true} do
21
21
  sudo "/usr/bin/monit stop all -g sphinx_#{application}"
22
22
  end
23
-
23
+
24
24
  desc "Restart Sphinx Searchd"
25
25
  task :restart, :roles => [:app], :only => {:sphinx => true} do
26
26
  sudo "/usr/bin/monit restart all -g sphinx_#{application}"
27
27
  end
28
-
28
+
29
29
  task :symlink, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
30
30
  run "if [ -d #{latest_release}/config/ultrasphinx ]; then mv #{latest_release}/config/ultrasphinx #{latest_release}/config/ultrasphinx.bak; fi"
31
31
  run "ln -nfs #{shared_path}/config/ultrasphinx #{latest_release}/config/ultrasphinx"
32
32
  end
33
33
  end
34
-
34
+
35
35
  namespace :acts_as_sphinx do
36
36
  desc "After update_code you to to reindex"
37
37
  task :reindex, :roles => [:app], :only => {:sphinx => true} do
38
38
  run "/engineyard/bin/acts_as_sphinx_searchd #{application} reindex"
39
39
  end
40
40
  end
41
-
41
+
42
42
  namespace :thinking_sphinx do
43
43
  desc "After update_code you want to configure, then reindex"
44
44
  task :configure, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
@@ -49,7 +49,7 @@ Capistrano::Configuration.instance(:must_exist).load do
49
49
  task :reindex, :roles => [:app], :only => {:sphinx => true} do
50
50
  run "/engineyard/bin/thinking_sphinx_searchd #{application} reindex"
51
51
  end
52
-
52
+
53
53
  task :symlink, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
54
54
  run "if [ -d #{latest_release}/config/thinkingsphinx ]; then mv #{latest_release}/config/thinkingsphinx #{latest_release}/config/thinkingsphinx.bak; fi"
55
55
  run "ln -nfs #{shared_path}/config/thinkingsphinx #{latest_release}/config/thinkingsphinx"
@@ -73,4 +73,4 @@ Capistrano::Configuration.instance(:must_exist).load do
73
73
  run "ln -nfs #{shared_path}/config/ultrasphinx #{latest_release}/config/ultrasphinx"
74
74
  end
75
75
  end
76
- end
76
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-eycap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.12
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Engine Yard
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-09 00:00:00 -08:00
12
+ date: 2009-08-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -48,7 +48,7 @@ files:
48
48
  - README.txt
49
49
  - Rakefile
50
50
  - lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
51
- - lib/capistrano/recipes/deploy/strategy/remote_cache.rb
51
+ - lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb
52
52
  - lib/eycap.rb
53
53
  - lib/eycap/lib/ey_logger.rb
54
54
  - lib/eycap/lib/ey_logger_hooks.rb
@@ -73,6 +73,7 @@ files:
73
73
  - test/test_helper.rb
74
74
  has_rdoc: true
75
75
  homepage: http://github.com/engineyard/eycap/tree/master
76
+ licenses:
76
77
  post_install_message:
77
78
  rdoc_options:
78
79
  - --main
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  requirements: []
95
96
 
96
97
  rubyforge_project: eycap
97
- rubygems_version: 1.2.0
98
+ rubygems_version: 1.3.5
98
99
  signing_key:
99
100
  specification_version: 2
100
101
  summary: Capistrano tasks for Engine Yard slices
@@ -1,56 +0,0 @@
1
- require 'capistrano/recipes/deploy/strategy/remote'
2
-
3
- module Capistrano
4
- module Deploy
5
- module Strategy
6
-
7
- # Implements the deployment strategy that keeps a cached checkout of
8
- # the source code on each remote server. Each deploy simply updates the
9
- # cached checkout, and then does a copy from the cached copy to the
10
- # final deployment location.
11
- class RemoteCache < Remote
12
- # Executes the SCM command for this strategy and writes the REVISION
13
- # mark file to each host.
14
- def deploy!
15
- update_repository_cache
16
- copy_repository_cache
17
- end
18
-
19
- def check!
20
- super.check do |d|
21
- d.remote.writable(shared_path)
22
- end
23
- end
24
-
25
- private
26
-
27
- def repository_cache
28
- File.join(configuration[:repository_cache] || "cached-copy")
29
- end
30
-
31
- def update_repository_cache
32
- logger.trace "updating the cached checkout on all servers"
33
- command = "if [ -d #{repository_cache} ]; then " +
34
- "#{source.sync(revision, repository_cache)}; " +
35
- "else #{source.checkout(revision, repository_cache)}; fi"
36
- scm_run(command)
37
- end
38
-
39
- def copy_repository_cache
40
- logger.trace "copying the cached version to #{configuration[:release_path]}"
41
- if copy_exclude.empty?
42
- run "cp -RPp #{repository_cache} #{configuration[:release_path]} && #{mark}"
43
- else
44
- exclusions = copy_exclude.map { |e| "--exclude=\"#{e}\"" }.join(' ')
45
- run "rsync -lrp #{exclusions} #{repository_cache}/* #{configuration[:release_path]} && #{mark}"
46
- end
47
- end
48
-
49
- def copy_exclude
50
- @copy_exclude ||= Array(configuration.fetch(:copy_exclude, []))
51
- end
52
- end
53
-
54
- end
55
- end
56
- end