engineyard-eycap 0.3.7 → 0.3.8

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,6 @@
1
+ == 0.3.8 / 2008-09-22
2
+ * add PostgreSQL support to the database.rb recipe.
3
+
1
4
  == 0.3.7 / 2008-08-23
2
5
  * fix from customer for filtered_remote_cache to just use plain grep.
3
6
 
@@ -2,20 +2,20 @@ Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
3
  namespace :bdrb do
4
4
  desc "After update_code you want to reindex"
5
- task :reindex, :roles => :app, :only => {:backgroundrb => true} do
5
+ task :reindex, :roles => [:app, :backgroundrb], :only => {:backgroundrb => true} do
6
6
  run "/engineyard/bin/searchd #{application} reindex"
7
7
  end
8
8
 
9
9
  desc "Start Backgroundrb"
10
- task :start, :roles => :app, :only => {:backgroundrb => true} do
10
+ task :start, :roles => [:app, :backgroundrb], :only => {:backgroundrb => true} do
11
11
  sudo "/usr/bin/monit start all -g backgroundrb_#{application}"
12
12
  end
13
13
  desc "Stop Backgroundrb"
14
- task :stop, :roles => :app, :only => {:backgroundrb => true} do
14
+ task :stop, :roles => [:app, :backgroundrb], :only => {:backgroundrb => true} do
15
15
  sudo "/usr/bin/monit stop all -g backgroundrb_#{application}"
16
16
  end
17
17
  desc "Restart Backgroundrb"
18
- task :restart, :roles => :app, :only => {:backgroundrb => true} do
18
+ task :restart, :roles => [:app, :backgroundrb], :only => {:backgroundrb => true} do
19
19
  sudo "/usr/bin/monit restart all -g backgroundrb_#{application}"
20
20
  end
21
21
  end
@@ -12,15 +12,26 @@ Capistrano::Configuration.instance(:must_exist).load do
12
12
  task :clone_prod_to_staging, :roles => :db, :only => { :primary => true } do
13
13
  backup_name
14
14
  on_rollback { run "rm -f #{backup_file}" }
15
- run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{production_database} > #{backup_file}"
16
- run "mysql -u #{dbuser} -p#{dbpass} -h #{staging_dbhost} #{staging_database} < #{backup_file}"
15
+ prod_info = YAML.load_file("config/database.yml")["production"]
16
+ if prod_info['adapter'] == 'mysql'
17
+ run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{production_database} > #{backup_file}"
18
+ run "mysql -u #{dbuser} -p#{dbpass} -h #{staging_dbhost} #{staging_database} < #{backup_file}"
19
+ else
20
+ run "PGPASSWORD=#{dbpass} pg_dump -c -U #{dbuser} -h #{production_dbhost} -f #{backup_file} #{production_database}"
21
+ run "PGPASSWORD=#{dbpass} psql -U #{dbuser} -h #{staging_dbhost} -f #{backup_file} #{staging_database}"
22
+ end
17
23
  run "rm -f #{backup_file}"
18
24
  end
19
25
 
20
- desc "Backup your database to shared_path+/db_backups"
26
+ desc "Backup your MySQL or PostgreSQL database to shared_path+/db_backups"
21
27
  task :dump, :roles => :db, :only => {:primary => true} do
22
28
  backup_name
23
- run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
29
+ environment_info = YAML.load_file("config/database.yml")[rails_env]
30
+ if environment_info['adapter'] == 'mysql'
31
+ run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
32
+ else
33
+ run "PGPASSWORD=#{dbpass} pg_dump -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
34
+ end
24
35
  end
25
36
 
26
37
  desc "Sync your production database to your local workstation"
@@ -29,7 +40,11 @@ Capistrano::Configuration.instance(:must_exist).load do
29
40
  dump
30
41
  get "#{backup_file}.bz2", "/tmp/#{application}.sql.gz"
31
42
  development_info = YAML.load_file("config/database.yml")['development']
32
- run_str = "bzcat /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} -p#{development_info['password']} -h #{development_info['host']} #{development_info['database']}"
43
+ if development_info['adapter'] == 'mysql'
44
+ run_str = "bzcat /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} -p#{development_info['password']} -h #{development_info['host']} #{development_info['database']}"
45
+ else
46
+ run_str = "PGPASSWORD=#{development_info['password']} bzcat /tmp/#{application}.sql.gz | psql -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}"
47
+ end
33
48
  %x!#{run_str}!
34
49
  end
35
50
  end
@@ -2,7 +2,7 @@ Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
3
  namespace :ferret do
4
4
  desc "After update_code you want to symlink the index and ferret_server.yml file into place"
5
- task :symlink_configs, :roles => :app, :except => {:no_release => true} do
5
+ task :symlink_configs, :roles => [:app, :ferret], :except => {:no_release => true, :ferret => false} do
6
6
  run <<-CMD
7
7
  cd #{latest_release} &&
8
8
  ln -nfs #{shared_path}/config/ferret_server.yml #{latest_release}/config/ferret_server.yml &&
@@ -12,7 +12,7 @@ Capistrano::Configuration.instance(:must_exist).load do
12
12
  end
13
13
  [:start,:stop,:restart].each do |op|
14
14
  desc "#{op} ferret server"
15
- task op, :roles => :app, :except => {:no_release => true} do
15
+ task op, :roles => [:app, :ferret], :except => {:no_release => true, :ferret => false} do
16
16
  sudo "/usr/bin/monit #{op} all -g ferret_#{application}"
17
17
  end
18
18
  end
@@ -2,7 +2,7 @@ Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
3
  namespace :juggernaut do
4
4
  desc "After update_code you want to symlink the juggernaut.yml file into place"
5
- task :symlink_configs, :roles => :app, :except => {:no_release => true} do
5
+ task :symlink_configs, :roles => [:app, :juggernaut], :except => {:no_release => true, :juggernaut => false} do
6
6
  run <<-CMD
7
7
  cd #{latest_release} &&
8
8
  ln -nfs #{shared_path}/config/juggernaut.yml #{latest_release}/config/juggernaut.yml &&
@@ -11,7 +11,7 @@ Capistrano::Configuration.instance(:must_exist).load do
11
11
  end
12
12
  [:start,:stop,:restart].each do |op|
13
13
  desc "#{op} juggernaut server"
14
- task op, :roles => :app, :except => {:no_release => true} do
14
+ task op, :roles => [:app, :juggernaut], :except => {:no_release => true, :juggernaut => false} do
15
15
  sudo "/usr/bin/monit #{op} all -g juggernaut_#{application}"
16
16
  end
17
17
  end
@@ -1,19 +1,19 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
2
  namespace :memcached do
3
3
  desc "Start memcached"
4
- task :start, :roles => :app, :only => {:memcached => true} do
4
+ task :start, :roles => [:app, :memcached], :only => {:memcached => true} do
5
5
  sudo "/etc/init.d/memcached start"
6
6
  end
7
7
  desc "Stop memcached"
8
- task :stop, :roles => :app, :only => {:memcached => true} do
8
+ task :stop, :roles => [:app, :memcached], :only => {:memcached => true} do
9
9
  sudo "/etc/init.d/memcached stop"
10
10
  end
11
11
  desc "Restart memcached"
12
- task :restart, :roles => :app, :only => {:memcached => true} do
12
+ task :restart, :roles => [:app, :memcached], :only => {:memcached => true} do
13
13
  sudo "/etc/init.d/memcached restart"
14
14
  end
15
15
  desc "Symlink the memcached.yml file into place if it exists"
16
- task :symlink_configs, :roles => :app, :only => {:memcached => true }, :except => { :no_release => true } do
16
+ task :symlink_configs, :roles => [:app, :memcached], :only => {:memcached => true }, :except => { :no_release => true } do
17
17
  run "if [ -f #{shared_path}/config/memcached.yml ]; then ln -nfs #{shared_path}/config/memcached.yml #{latest_release}/config/memcached.yml; fi"
18
18
  end
19
19
  end
@@ -4,7 +4,7 @@ Capistrano::Configuration.instance(:must_exist).load do
4
4
  Start Mongrel processes on the app server. This uses the :use_sudo variable to determine whether to use sudo or not. By default, :use_sudo is
5
5
  set to true.
6
6
  DESC
7
- task :start, :roles => :app do
7
+ task :start, :roles => [:app, :mongrel], :except => {:mongrel => false} do
8
8
  sudo "/usr/bin/monit start all -g #{monit_group}"
9
9
  end
10
10
 
@@ -12,7 +12,7 @@ Capistrano::Configuration.instance(:must_exist).load do
12
12
  Restart the Mongrel processes on the app server by starting and stopping the cluster. This uses the :use_sudo
13
13
  variable to determine whether to use sudo or not. By default, :use_sudo is set to true.
14
14
  DESC
15
- task :restart, :roles => :app do
15
+ task :restart, :roles => [:app, :mongrel], :except => {:mongrel => false} do
16
16
  sudo "/usr/bin/monit restart all -g #{monit_group}"
17
17
  end
18
18
 
@@ -21,7 +21,7 @@ Capistrano::Configuration.instance(:must_exist).load do
21
21
  variable to determine whether to use sudo or not. By default, :use_sudo is
22
22
  set to true.
23
23
  DESC
24
- task :stop, :roles => :app do
24
+ task :stop, :roles => [:app, :mongrel], :except => {:mongrel => false} do
25
25
  sudo "/usr/bin/monit stop all -g #{monit_group}"
26
26
  end
27
27
  end
@@ -2,7 +2,7 @@ Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
3
  namespace :solr do
4
4
  desc "After update_code you want to symlink the index and ferret_server.yml file into place"
5
- task :symlink_configs, :roles => :app, :except => {:no_release => true} do
5
+ task :symlink_configs, :roles => [:app, :solr], :except => {:no_release => true} do
6
6
  run <<-CMD
7
7
  cd #{latest_release} && ln -nfs #{shared_path}/config/solr.yml #{latest_release}/config/solr.yml
8
8
  CMD
@@ -10,14 +10,14 @@ Capistrano::Configuration.instance(:must_exist).load do
10
10
 
11
11
  [:start,:stop,:restart].each do |op|
12
12
  desc "#{op} ferret server"
13
- task op, :roles => :app, :only => {:solr => true} do
13
+ task op, :roles => [:app, :solr], :only => {:solr => true} do
14
14
  sudo "/usr/bin/monit #{op} all -g solr_#{application}"
15
15
  end
16
16
  end
17
17
 
18
18
  namespace :tail do
19
19
  desc "Tail the Solr logs this environment"
20
- task :logs, :roles => :app, :only => {:solr => true} do
20
+ task :logs, :roles => [:app, :solr], :only => {:solr => true} do
21
21
  run "tail -f /var/log/engineyard/solr/#{application}.log" do |channel, stream, data|
22
22
  puts # for an extra line break before the host name
23
23
  puts "#{channel[:server]} -> #{data}"
@@ -25,7 +25,7 @@ Capistrano::Configuration.instance(:must_exist).load do
25
25
  end
26
26
  end
27
27
  desc "Tail the Solr error logs this environment"
28
- task :errors, :roles => :app, :only => {:solr => true} do
28
+ task :errors, :roles => [:app, :solr], :only => {:solr => true} do
29
29
  run "tail -f /var/log/engineyard/solr/#{application}.err.log" do |channel, stream, data|
30
30
  puts # for an extra line break before the host name
31
31
  puts "#{channel[:server]} -> #{data}"
@@ -2,28 +2,28 @@ Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
3
  namespace :sphinx do
4
4
  desc "After update_code you want to configure, then reindex"
5
- task :configure, :roles => :app, :only => {:sphinx => true}, :except => {:no_release => true} do
5
+ task :configure, :roles => [:app, :sphinx], :only => {:sphinx => true}, :except => {:no_release => true} do
6
6
  run "/engineyard/bin/searchd #{application} configure"
7
7
  end
8
8
 
9
9
  desc "After configure you want to reindex"
10
- task :reindex, :roles => :app, :only => {:sphinx => true} do
10
+ task :reindex, :roles => [:app, :sphinx], :only => {:sphinx => true} do
11
11
  run "/engineyard/bin/searchd #{application} reindex"
12
12
  end
13
13
 
14
14
  desc "Start Sphinx Searchd"
15
- task :start, :roles => :app, :only => {:sphinx => true} do
15
+ task :start, :roles => [:app, :sphinx], :only => {:sphinx => true} do
16
16
  sudo "/usr/bin/monit start all -g sphinx_#{application}"
17
17
  end
18
18
  desc "Stop Sphinx Searchd"
19
- task :stop, :roles => :app, :only => {:sphinx => true} do
19
+ task :stop, :roles => [:app, :sphinx], :only => {:sphinx => true} do
20
20
  sudo "/usr/bin/monit stop all -g sphinx_#{application}"
21
21
  end
22
22
  desc "Restart Sphinx Searchd"
23
- task :restart, :roles => :app, :only => {:sphinx => true} do
23
+ task :restart, :roles => [:app, :sphinx], :only => {:sphinx => true} do
24
24
  sudo "/usr/bin/monit restart all -g sphinx_#{application}"
25
25
  end
26
- task :symlink, :roles => :app, :only => {:sphinx => true}, :except => {:no_release => true} do
26
+ task :symlink, :roles => [:app, :sphinx], :only => {:sphinx => true}, :except => {:no_release => true} do
27
27
  run "if [ -d #{latest_release}/config/ultrasphinx ]; then mv #{latest_release}/config/ultrasphinx #{latest_release}/config/ultrasphinx.bak; fi"
28
28
  run "ln -nfs #{shared_path}/config/ultrasphinx #{latest_release}/config/ultrasphinx"
29
29
  end
@@ -32,7 +32,7 @@ Capistrano::Configuration.instance(:must_exist).load do
32
32
 
33
33
  namespace :thinking_sphinx do
34
34
  desc "Symlink the thinking sphinx config file and directory"
35
- task :symlink, :roles => :app, :only => {:sphinx => true}, :except => {:no_release => true} do
35
+ task :symlink, :roles => [:app, :sphinx], :only => {:sphinx => true}, :except => {:no_release => true} do
36
36
  run "if [ -d #{latest_release}/config/thinkingsphinx ]; then mv #{latest_release}/config/thinkingsphinx #{latest_release}/config/thinkingsphinx.bak; fi"
37
37
  run "ln -nfs #{shared_path}/config/thinkingsphinx #{latest_release}/config/thinkingsphinx"
38
38
  run "ln -nfs #{shared_path}/config/sphinx.yml #{latest_release}/config/sphinx.yml"
@@ -1,15 +1,15 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
2
  namespace :tomcat do
3
3
  desc "Start tomcat"
4
- task :start, :roles => :app, :only => {:tomcat => true} do
4
+ task :start, :roles => [:app, :tomcat], :only => {:tomcat => true} do
5
5
  sudo "/etc/init.d/tomcat start"
6
6
  end
7
7
  desc "Stop tomcat"
8
- task :stop, :roles => :app, :only => {:tomcat => true} do
8
+ task :stop, :roles => [:app, :tomcat], :only => {:tomcat => true} do
9
9
  sudo "/etc/init.d/tomcat stop"
10
10
  end
11
11
  desc "Restart tomcat"
12
- task :restart, :roles => :app, :only => {:tomcat => true} do
12
+ task :restart, :roles => [:app, :tomcat], :only => {:tomcat => true} do
13
13
  sudo "/etc/init.d/tomcat restart"
14
14
  end
15
15
  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.3.7
4
+ version: 0.3.8
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: 2008-08-23 00:00:00 -07:00
12
+ date: 2008-09-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency