engineyard-eycap 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/eycap/recipes/database.rb +16 -6
- data/lib/eycap/recipes/memcached.rb +4 -0
- data/lib/eycap.rb +1 -1
- metadata +3 -1
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.4.3 / 2009-02-11
|
2
|
+
* updated db:dump command for Engine Yard Solo offering, fixing a bug where
|
3
|
+
the dbname wasn't included.
|
4
|
+
|
1
5
|
== 0.4.2 / 2009-02-11
|
2
6
|
* added condition to determine if the db:dump command is run against our
|
3
7
|
traditional offering or the new cloud offering
|
@@ -10,9 +10,21 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
10
10
|
|
11
11
|
desc "Clone Production Database to Staging Database."
|
12
12
|
task :clone_prod_to_staging, :roles => :db, :only => { :primary => true } do
|
13
|
+
|
14
|
+
# This task currently runs only on traditional EY offerings.
|
15
|
+
# You need to have both a production and staging environment defined in
|
16
|
+
# your deploy.rb file.
|
17
|
+
|
13
18
|
backup_name
|
14
19
|
on_rollback { run "rm -f #{backup_file}" }
|
15
20
|
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
21
|
+
|
22
|
+
# If the production db hostname has a trailing -master string, substitute
|
23
|
+
# it with -replica.
|
24
|
+
# Elsif the production db hostname doesn't have a trailing -master, just
|
25
|
+
# append -replica.
|
26
|
+
# Else you're using PostgreSQL and we'll dump it that way.
|
27
|
+
|
16
28
|
if @environment_info['adapter'] == 'mysql' && production_dbhost.scan('-master') == true
|
17
29
|
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} #{production_database} -p > #{backup_file}" do |ch, stream, out|
|
18
30
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
@@ -42,14 +54,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
42
54
|
task :dump, :roles => :db, :only => {:primary => true} do
|
43
55
|
backup_name
|
44
56
|
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
45
|
-
if @environment_info['adapter'] == 'mysql'
|
46
|
-
|
57
|
+
if @environment_info['adapter'] == 'mysql'
|
58
|
+
dbhost = @environment_info['host']
|
59
|
+
dbhost = environment_dbhost.sub('-master', '') + '-replica' if dbhost != 'localhost' # added for Solo offering, which uses localhost
|
60
|
+
run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
47
61
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
48
62
|
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
|
53
63
|
else
|
54
64
|
run "pg_dump -W -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
55
65
|
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
@@ -12,6 +12,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
12
12
|
task :restart, :roles => [:app], :only => {:memcached => true} do
|
13
13
|
sudo "/etc/init.d/memcached restart"
|
14
14
|
end
|
15
|
+
desc "Flush memcached - this assumes memcached is on port 11211"
|
16
|
+
task :flush, :roles => [:app], :only => {:memcached => true} do
|
17
|
+
sudo "echo 'flush_all' | nc localhost 11211"
|
18
|
+
end
|
15
19
|
desc "Symlink the memcached.yml file into place if it exists"
|
16
20
|
task :symlink_configs, :roles => [:app], :only => {:memcached => true }, :except => { :no_release => true } do
|
17
21
|
run "if [ -f #{shared_path}/config/memcached.yml ]; then ln -nfs #{shared_path}/config/memcached.yml #{latest_release}/config/memcached.yml; fi"
|
data/lib/eycap.rb
CHANGED
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.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Engine Yard
|
@@ -14,6 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capistrano
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: hoe
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|