engineyard-eycap 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.txt +2 -0
- data/lib/eycap/recipes/database.rb +13 -2
- data/lib/eycap.rb +1 -1
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.4.2 / 2009-02-11
|
2
|
+
* added condition to determine if the db:dump command is run against our
|
3
|
+
traditional offering or the new cloud offering
|
4
|
+
* fixed bug where if a production db host name doesn't have a -master at the
|
5
|
+
end it won't run the db:clone_prod_to_staging correctly
|
6
|
+
|
1
7
|
== 0.4.1 / 2009-01-09
|
2
8
|
* fixed bug for passenger:restart
|
3
9
|
|
data/README.txt
CHANGED
@@ -10,6 +10,8 @@ Also included is a deployment strategy, :filtered_remote_cache, which speeds up
|
|
10
10
|
|
11
11
|
* capistrano (http://capify.org) > 2.0.0, but recommended with > 2.2.0
|
12
12
|
|
13
|
+
* NOTE: If you're using a git repository we recommend capistrano 2.5.3 and greater.
|
14
|
+
|
13
15
|
== INSTALL:
|
14
16
|
|
15
17
|
$ gem sources -a http://gems.github.com/ (you only need to do this once)
|
@@ -13,13 +13,20 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
13
13
|
backup_name
|
14
14
|
on_rollback { run "rm -f #{backup_file}" }
|
15
15
|
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
16
|
-
if @environment_info['adapter'] == 'mysql'
|
16
|
+
if @environment_info['adapter'] == 'mysql' && production_dbhost.scan('-master') == true
|
17
17
|
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} #{production_database} -p > #{backup_file}" do |ch, stream, out|
|
18
18
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
19
19
|
end
|
20
20
|
run "mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database} < #{backup_file}" do |ch, stream, out|
|
21
21
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
22
22
|
end
|
23
|
+
elsif @environment_info['adapter'] == 'mysql' && production_dbhost.scan('-master') != true
|
24
|
+
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost + '-replica'} #{production_database} -p > #{backup_file}" do |ch, stream, out|
|
25
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
26
|
+
end
|
27
|
+
run "mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database} < #{backup_file}" do |ch, stream, out|
|
28
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
29
|
+
end
|
23
30
|
else
|
24
31
|
run "pg_dump -W -c -U #{dbuser} -h #{production_dbhost} -f #{backup_file} #{production_database}" do |ch, stream, out|
|
25
32
|
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
@@ -35,10 +42,14 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
35
42
|
task :dump, :roles => :db, :only => {:primary => true} do
|
36
43
|
backup_name
|
37
44
|
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
38
|
-
if @environment_info['adapter'] == 'mysql'
|
45
|
+
if @environment_info['adapter'] == 'mysql' && @environment_info['host'] != 'localhost' # For traditional offering
|
39
46
|
run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
40
47
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
41
48
|
end
|
49
|
+
elsif @environment_info['adapter'] == 'mysql' && @environment_info['host'] == 'localhost' # For Solo offering
|
50
|
+
run "mysqldump --add-drop-table -u #{sql_user} -h localhost -p #{sql_pass} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
51
|
+
ch.send_data "#{sql_pass}\n" if out=~ /^Enter password:/
|
52
|
+
end
|
42
53
|
else
|
43
54
|
run "pg_dump -W -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
44
55
|
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
data/lib/eycap.rb
CHANGED