squirrel-eycap 0.4.10 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.4.12 / 2009-06-26
2
+ * removed condition for dbhost that was useless and tested db:clone_prod_to_staging
3
+
4
+ == 0.4.11 / 2009-06-25
5
+ * changed nginx start and restart to give output to cap
6
+ * fixed db:clone_to_local task
7
+
1
8
  == 0.4.10 / 2009-06-24
2
9
  * using nohup on nginx start and restart
3
10
 
data/lib/eycap.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eycap
2
- VERSION = '0.4.10'
2
+ VERSION = '0.4.12'
3
3
  end
@@ -21,7 +21,7 @@ Capistrano::Configuration.instance(:must_exist).load do
21
21
 
22
22
  if @environment_info['adapter'] == 'mysql'
23
23
  dbhost = @environment_info['host']
24
- dbhost = environment_dbhost.sub('-master', '') + '-replica' if dbhost != 'localhost' # added for Solo offering, which uses localhost
24
+ dbhost = environment_dbhost.sub('-master', '') + '-replica'
25
25
  run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
26
26
  ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
27
27
  end
@@ -63,14 +63,11 @@ Capistrano::Configuration.instance(:must_exist).load do
63
63
  get "#{backup_file}.bz2", "/tmp/#{application}.sql.gz"
64
64
  development_info = YAML.load_file("config/database.yml")['development']
65
65
  if development_info['adapter'] == 'mysql'
66
- run "bzcat /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} -p -h #{development_info['host']} #{development_info['database']}" do |ch, stream, out |
67
- ch.send_data "#{development_info['password']}\n" if out=~ /Enter password:/
68
- end
66
+ run_str = "bzcat /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} --password='#{development_info['password']}' -h #{development_info['host']} #{development_info['database']}"
69
67
  else
70
- run "bzcat /tmp/#{application}.sql.gz | psql -W -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}" do |ch, stream, out |
71
- ch.send_data "#{development_info['password']}\n" if out=~ /^Password/
72
- end
68
+ run_str = "PGPASSWORD=#{development_info['password']} bzcat /tmp/#{application}.sql.gz | psql -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}"
73
69
  end
70
+ %x!#{run_str}!
74
71
  end
75
72
  end
76
73
 
@@ -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
@@ -3,12 +3,12 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :nginx do
4
4
  desc "Start Nginx on the app slices."
5
5
  task :start, :roles => :app do
6
- sudo "nohup /etc/init.d/nginx start > /dev/null"
6
+ sudo "nohup /etc/init.d/nginx start 2>&1 | cat"
7
7
  end
8
8
 
9
9
  desc "Restart the Nginx processes on the app slices."
10
10
  task :restart , :roles => :app do
11
- sudo "nohup /etc/init.d/nginx restart > /dev/null"
11
+ sudo "nohup /etc/init.d/nginx restart 2>&1 | cat"
12
12
  end
13
13
 
14
14
  desc "Stop the Nginx processes on the app slices."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squirrel-eycap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Engine Yard