engineyard-eycap 0.3.11 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +2 -0
- data/README.txt +1 -1
- data/Rakefile +1 -1
- data/lib/eycap.rb +1 -1
- data/lib/eycap/recipes.rb +2 -0
- data/lib/eycap/recipes/apache.rb +10 -0
- data/lib/eycap/recipes/database.rb +24 -9
- data/lib/eycap/recipes/passenger.rb +10 -0
- metadata +5 -3
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -17,7 +17,7 @@ Also included is a deployment strategy, :filtered_remote_cache, which speeds up
|
|
17
17
|
|
18
18
|
== SOURCE:
|
19
19
|
|
20
|
-
|
20
|
+
eycap's git repo is available on GitHub, which can be browsed at:
|
21
21
|
|
22
22
|
http://github.com/engineyard/eycap
|
23
23
|
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ Hoe.new('eycap', Eycap::VERSION) do |p|
|
|
7
7
|
p.email = 'tech@engineyard.com'
|
8
8
|
p.summary = 'Capistrano tasks for Engine Yard slices'
|
9
9
|
p.description = 'A bunch of useful recipes to help deployment to Engine Yard slices'
|
10
|
-
p.url = 'http://eycap
|
10
|
+
p.url = 'http://github.com/engineyard/eycap/tree/master'
|
11
11
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
12
12
|
p.extra_deps << ['capistrano', '>= 2.2.0']
|
13
13
|
end
|
data/lib/eycap.rb
CHANGED
data/lib/eycap/recipes.rb
CHANGED
@@ -13,6 +13,8 @@ require 'eycap/recipes/solr'
|
|
13
13
|
require 'eycap/recipes/monit'
|
14
14
|
require 'eycap/recipes/tomcat'
|
15
15
|
require 'eycap/recipes/juggernaut'
|
16
|
+
require 'eycap/recipes/passenger'
|
17
|
+
require 'eycap/recipes/apache'
|
16
18
|
|
17
19
|
Capistrano::Configuration.instance(:must_exist).load do
|
18
20
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
namespace :apache do
|
3
|
+
[:stop, :start, :restart, :reload].each do |action|
|
4
|
+
desc "#{action.to_s.capitalize} Apache"
|
5
|
+
task action, :roles => :web do
|
6
|
+
sudo "/etc/init.d/apache2 #{action.to_s}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -14,11 +14,19 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
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
16
|
if @environment_info['adapter'] == 'mysql'
|
17
|
-
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')}
|
18
|
-
|
17
|
+
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} #{production_database} -p > #{backup_file}" do |ch, stream, out|
|
18
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
19
|
+
end
|
20
|
+
run "mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database} < #{backup_file}" do |ch, stream, out|
|
21
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
22
|
+
end
|
19
23
|
else
|
20
|
-
run "
|
21
|
-
|
24
|
+
run "pg_dump -W -c -U #{dbuser} -h #{production_dbhost} -f #{backup_file} #{production_database}" do |ch, stream, out|
|
25
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
26
|
+
end
|
27
|
+
run "psql -W -U #{dbuser} -h #{staging_dbhost} -f #{backup_file} #{staging_database}" do |ch, stream, out|
|
28
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
29
|
+
end
|
22
30
|
end
|
23
31
|
run "rm -f #{backup_file}"
|
24
32
|
end
|
@@ -28,9 +36,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
28
36
|
backup_name
|
29
37
|
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
30
38
|
if @environment_info['adapter'] == 'mysql'
|
31
|
-
run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p
|
39
|
+
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
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
41
|
+
end
|
32
42
|
else
|
33
|
-
run "
|
43
|
+
run "pg_dump -W -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
44
|
+
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
36
48
|
|
@@ -41,11 +53,14 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
41
53
|
get "#{backup_file}.bz2", "/tmp/#{application}.sql.gz"
|
42
54
|
development_info = YAML.load_file("config/database.yml")['development']
|
43
55
|
if development_info['adapter'] == 'mysql'
|
44
|
-
|
56
|
+
run "bzcat /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} -p -h #{development_info['host']} #{development_info['database']}" do |ch, stream, out |
|
57
|
+
ch.send_data "#{development_info['password']}\n" if out=~ /Enter password:/
|
58
|
+
end
|
45
59
|
else
|
46
|
-
|
60
|
+
run "bzcat /tmp/#{application}.sql.gz | psql -W -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}" do |ch, stream, out |
|
61
|
+
ch.send_data "#{development_info['password']}\n" if out=~ /^Password:/
|
62
|
+
end
|
47
63
|
end
|
48
|
-
%x!#{run_str}!
|
49
64
|
end
|
50
65
|
end
|
51
66
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
namespace :passenger do
|
3
|
+
desc <<-DESC
|
4
|
+
Restart the passenger module to reload the application after deploying.
|
5
|
+
DESC
|
6
|
+
task :restart, :roles => [:app], :except => {:no_release => true} do
|
7
|
+
sudo "touch #{current_path}/tmp/restart.txt"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
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
|
+
version: 0.4.0
|
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:
|
12
|
+
date: 2009-01-09 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -59,15 +59,17 @@ files:
|
|
59
59
|
- lib/eycap/recipes/mongrel.rb
|
60
60
|
- lib/eycap/recipes/monit.rb
|
61
61
|
- lib/eycap/recipes/nginx.rb
|
62
|
+
- lib/eycap/recipes/passenger.rb
|
62
63
|
- lib/eycap/recipes/slice.rb
|
63
64
|
- lib/eycap/recipes/solr.rb
|
64
65
|
- lib/eycap/recipes/sphinx.rb
|
65
66
|
- lib/eycap/recipes/templates/maintenance.rhtml
|
66
67
|
- lib/eycap/recipes/tomcat.rb
|
68
|
+
- lib/eycap/recipes/apache.rb
|
67
69
|
- test/test_eycap.rb
|
68
70
|
- test/test_helper.rb
|
69
71
|
has_rdoc: true
|
70
|
-
homepage: http://eycap
|
72
|
+
homepage: http://github.com/engineyard/eycap/tree/master
|
71
73
|
post_install_message:
|
72
74
|
rdoc_options:
|
73
75
|
- --main
|