engineyard-eycap 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -1
- data/lib/eycap.rb +1 -1
- data/lib/eycap/lib/ey_logger.rb +1 -0
- data/lib/eycap/recipes/database.rb +3 -3
- data/lib/eycap/recipes/deploy.rb +42 -4
- data/lib/eycap/recipes/ferret.rb +4 -4
- data/lib/eycap/recipes/juggernaut.rb +3 -2
- data/lib/eycap/recipes/memcached.rb +1 -1
- data/lib/eycap/recipes/solr.rb +2 -2
- data/lib/eycap/recipes/sphinx.rb +2 -2
- metadata +2 -2
data/History.txt
CHANGED
data/lib/eycap.rb
CHANGED
data/lib/eycap/lib/ey_logger.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Capistrano::Configuration.instance(:must_exist).load do
|
2
2
|
|
3
3
|
namespace :db do
|
4
|
-
task :backup_name, :only => { :primary => true } do
|
4
|
+
task :backup_name, :roles => :db, :only => { :primary => true } do
|
5
5
|
now = Time.now
|
6
6
|
run "mkdir -p #{shared_path}/db_backups"
|
7
7
|
backup_time = [now.year,now.month,now.day,now.hour,now.min,now.sec].join('-')
|
@@ -12,7 +12,7 @@ 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
|
15
|
+
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{production_database} > #{backup_file}"
|
16
16
|
run "mysql -u #{dbuser} -p#{dbpass} -h #{staging_dbhost} #{staging_database} < #{backup_file}"
|
17
17
|
run "rm -f #{backup_file}"
|
18
18
|
end
|
@@ -20,7 +20,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
20
20
|
desc "Backup your database to shared_path+/db_backups"
|
21
21
|
task :dump, :roles => :db, :only => {:primary => true} do
|
22
22
|
backup_name
|
23
|
-
run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost
|
23
|
+
run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
|
24
24
|
end
|
25
25
|
|
26
26
|
desc "Sync your production database to your local workstation"
|
data/lib/eycap/recipes/deploy.rb
CHANGED
@@ -13,11 +13,49 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
13
13
|
desc "Link the database.yml and mongrel_cluster.yml files into the current release path."
|
14
14
|
task :symlink_configs, :roles => :app, :except => {:no_release => true} do
|
15
15
|
run <<-CMD
|
16
|
-
cd #{
|
17
|
-
ln -nfs #{shared_path}/config/database.yml #{
|
18
|
-
ln -nfs #{shared_path}/config/mongrel_cluster.yml #{
|
16
|
+
cd #{latest_release} &&
|
17
|
+
ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml &&
|
18
|
+
ln -nfs #{shared_path}/config/mongrel_cluster.yml #{latest_release}/config/mongrel_cluster.yml
|
19
19
|
CMD
|
20
20
|
end
|
21
|
+
|
22
|
+
desc <<-DESC
|
23
|
+
Run the migrate rake task. By default, it runs this in most recently \
|
24
|
+
deployed version of the app. However, you can specify a different release \
|
25
|
+
via the migrate_target variable, which must be one of :latest (for the \
|
26
|
+
default behavior), or :current (for the release indicated by the \
|
27
|
+
`current' symlink). Strings will work for those values instead of symbols, \
|
28
|
+
too. You can also specify additional environment variables to pass to rake \
|
29
|
+
via the migrate_env variable. Finally, you can specify the full path to the \
|
30
|
+
rake executable by setting the rake variable. The defaults are:
|
31
|
+
|
32
|
+
set :rake, "rake"
|
33
|
+
set :framework, "merb"
|
34
|
+
set :merb_env, "production"
|
35
|
+
set :migrate_env, ""
|
36
|
+
set :migrate_target, :latest
|
37
|
+
DESC
|
38
|
+
task :migrate, :roles => :db, :only => { :primary => true } do
|
39
|
+
rake = fetch(:rake, "rake")
|
40
|
+
|
41
|
+
framework = fetch(:framework, "rails")
|
42
|
+
if framework.match(/^rails$/i)
|
43
|
+
app_env = fetch(:rails_env, "production")
|
44
|
+
else
|
45
|
+
app_env = fetch("#{framework.downcase}_env".to_sym, "production")
|
46
|
+
end
|
47
|
+
|
48
|
+
migrate_env = fetch(:migrate_env, "")
|
49
|
+
migrate_target = fetch(:migrate_target, :latest)
|
50
|
+
|
51
|
+
directory = case migrate_target.to_sym
|
52
|
+
when :current then current_path
|
53
|
+
when :latest then current_release
|
54
|
+
else raise ArgumentError, "unknown migration target #{migrate_target.inspect}"
|
55
|
+
end
|
56
|
+
|
57
|
+
run "cd #{directory}; #{rake} #{framework.upcase}_ENV=#{app_env} #{migrate_env} db:migrate"
|
58
|
+
end
|
21
59
|
|
22
60
|
desc "Display the maintenance.html page while deploying with migrations. Then it restarts and enables the site again."
|
23
61
|
task :long do
|
@@ -87,4 +125,4 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
87
125
|
end
|
88
126
|
end
|
89
127
|
|
90
|
-
end
|
128
|
+
end
|
data/lib/eycap/recipes/ferret.rb
CHANGED
@@ -4,10 +4,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
4
4
|
desc "After update_code you want to symlink the index and ferret_server.yml file into place"
|
5
5
|
task :symlink_configs, :roles => :app, :except => {:no_release => true} do
|
6
6
|
run <<-CMD
|
7
|
-
cd #{
|
8
|
-
ln -nfs #{shared_path}/config/ferret_server.yml #{
|
9
|
-
if [ -d #{
|
10
|
-
ln -nfs #{shared_path}/index #{
|
7
|
+
cd #{latest_release} &&
|
8
|
+
ln -nfs #{shared_path}/config/ferret_server.yml #{latest_release}/config/ferret_server.yml &&
|
9
|
+
if [ -d #{latest_release}/index ]; then mv #{latest_release}/index #{latest_release}/index.bak; fi &&
|
10
|
+
ln -nfs #{shared_path}/index #{latest_release}/index
|
11
11
|
CMD
|
12
12
|
end
|
13
13
|
[:start,:stop,:restart].each do |op|
|
@@ -4,8 +4,9 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
4
4
|
desc "After update_code you want to symlink the juggernaut.yml file into place"
|
5
5
|
task :symlink_configs, :roles => :app, :except => {:no_release => true} do
|
6
6
|
run <<-CMD
|
7
|
-
cd #{
|
8
|
-
ln -nfs #{shared_path}/config/juggernaut.yml #{
|
7
|
+
cd #{latest_release} &&
|
8
|
+
ln -nfs #{shared_path}/config/juggernaut.yml #{latest_release}/config/juggernaut.yml &&
|
9
|
+
ln -nfs #{shared_path}/config/juggernaut_hosts.yml #{latest_release}/config/juggernaut_hosts.yml
|
9
10
|
CMD
|
10
11
|
end
|
11
12
|
[:start,:stop,:restart].each do |op|
|
@@ -14,7 +14,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
14
14
|
end
|
15
15
|
desc "Symlink the memcached.yml file into place if it exists"
|
16
16
|
task :symlink_configs, :roles => :app, :only => {:memcached => true }, :except => { :no_release => true } do
|
17
|
-
run "if [ -f #{shared_path}/config/memcached.yml ]; then ln -nfs #{shared_path}/config/memcached.yml #{
|
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
|
20
20
|
end
|
data/lib/eycap/recipes/solr.rb
CHANGED
@@ -4,7 +4,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
4
4
|
desc "After update_code you want to symlink the index and ferret_server.yml file into place"
|
5
5
|
task :symlink_configs, :roles => :app, :except => {:no_release => true} do
|
6
6
|
run <<-CMD
|
7
|
-
cd #{
|
7
|
+
cd #{latest_release} && ln -nfs #{shared_path}/config/solr.yml #{latest_release}/config/solr.yml
|
8
8
|
CMD
|
9
9
|
end
|
10
10
|
|
@@ -34,4 +34,4 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
end
|
37
|
+
end
|
data/lib/eycap/recipes/sphinx.rb
CHANGED
@@ -26,8 +26,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
26
26
|
|
27
27
|
desc "Symlink the sphinx config file"
|
28
28
|
task :symlink, :roles => :app, :only => {:sphinx => true}, :except => {:no_release => true} do
|
29
|
-
run "if [ -d #{
|
30
|
-
run "ln -nfs #{shared_path}/config/ultrasphinx #{
|
29
|
+
run "if [ -d #{latest_release}/config/ultrasphinx ]; then mv #{latest_release}/config/ultrasphinx #{latest_release}/config/ultrasphinx.bak; fi"
|
30
|
+
run "ln -nfs #{shared_path}/config/ultrasphinx #{latest_release}/config/ultrasphinx"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
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.
|
4
|
+
version: 0.3.4
|
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-05-
|
12
|
+
date: 2008-05-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|