capistrano-ash 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/Rakefile +8 -4
- data/VERSION +1 -1
- data/capistrano-ash.gemspec +18 -12
- data/lib/ash/base.rb +96 -16
- data/lib/ash/common.rb +2 -2
- data/lib/ash/drupal.rb +40 -9
- data/lib/ash/magento.rb +26 -32
- data/lib/ash/performance.rb +41 -0
- data/lib/ash/zend_doctrine.rb +15 -0
- metadata +32 -17
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2JmNTc0MjY3YmNiYzM3NWI2NzA5N2RiNjE3OThkYjZhMDk3YjUyYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
YzgyZDIyOWQ5ZmVhYTJiMThmNDI1Njc2MmVkOWYzNzFiMDc4NWNmYg==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2JjNDc2ODhlMWYwNzFlYmM0ZjZkMmRiYmNhODY0NzAxZjQxMzJmMTc1MWU5
|
10
|
+
NDhmZTcxNzY5MGM5MTlmYmQxYzY3MjlkYTc5OWU4YWVhZDNkMmNmNGVhNWJm
|
11
|
+
NDliZDczNTA0ZDRhNjM4NzkxNTM1MmU1MDE0NDBmOWU1NDE1MWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWFmZGZkZWU5NjY3YTMzNmM0MzE3MGQxMGNiYmZiYjFlZTI3MDhhYTk2NDdl
|
14
|
+
NDA5NjZjMzU5YjcyMWQ2YjkxZGUxOWQ1ZDcyMWZmZmY5MTU2NDU3YWZmMzdh
|
15
|
+
MzBlMmVkMDczMzY3MDRjMzdhZTc5M2M4NDQxMmYzOTc3OWQxZDM=
|
data/Rakefile
CHANGED
@@ -11,10 +11,14 @@ begin
|
|
11
11
|
gemspec.homepage = "https://github.com/augustash/capistrano-ash"
|
12
12
|
gemspec.authors = ["August Ash"]
|
13
13
|
# Gem dependencies
|
14
|
-
gemspec.add_dependency('capistrano', '~> 2.15.
|
15
|
-
gemspec.add_dependency('capistrano-ext')
|
16
|
-
gemspec.add_dependency('railsless-deploy')
|
17
|
-
gemspec.add_dependency('capistrano_colors')
|
14
|
+
gemspec.add_dependency('capistrano', '~> 2.15.5')
|
15
|
+
gemspec.add_dependency('capistrano-ext', '~> 1.2')
|
16
|
+
gemspec.add_dependency('railsless-deploy', '~> 1.1')
|
17
|
+
gemspec.add_dependency('capistrano_colors', '~> 0.5')
|
18
|
+
|
19
|
+
# Net-SSH issues
|
20
|
+
# see https://github.com/capistrano/capistrano/issues/927
|
21
|
+
gemspec.add_dependency('net-ssh', '2.7.0')
|
18
22
|
|
19
23
|
end
|
20
24
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
data/capistrano-ash.gemspec
CHANGED
@@ -2,19 +2,25 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: capistrano-ash 1.4.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
8
|
+
s.name = "capistrano-ash"
|
9
|
+
s.version = "1.4.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
s.
|
16
|
-
s.
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["August Ash"]
|
14
|
+
s.date = "2014-03-27"
|
15
|
+
s.description = "August Ash recipes for Capistrano"
|
16
|
+
s.email = "code@augustash.com"
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.textile"
|
20
|
+
]
|
21
|
+
s.files = [
|
17
22
|
"CHANGELOG.rdoc",
|
23
|
+
"LICENSE.txt",
|
18
24
|
"README.textile",
|
19
25
|
"Rakefile",
|
20
26
|
"VERSION",
|
@@ -26,14 +32,14 @@ Gem::Specification.new do |s|
|
|
26
32
|
"lib/ash/hosted_magento.rb",
|
27
33
|
"lib/ash/magento.rb",
|
28
34
|
"lib/ash/wordpress.rb",
|
35
|
+
"lib/ash/wordpress_nested.rb",
|
29
36
|
"lib/ash/wordpress_shared_hosting.rb",
|
30
37
|
"lib/ash/zend_doctrine.rb",
|
31
38
|
"lib/ash/zend_doctrine_shared_hosting.rb"
|
32
39
|
]
|
33
|
-
s.homepage
|
34
|
-
s.
|
35
|
-
s.
|
36
|
-
s.summary = "Useful task libraries for August Ash recipes for Capistrano"
|
40
|
+
s.homepage = "https://github.com/augustash/capistrano-ash"
|
41
|
+
s.rubygems_version = "2.2.2"
|
42
|
+
s.summary = "Useful task libraries for August Ash recipes for Capistrano"
|
37
43
|
|
38
44
|
if s.respond_to? :specification_version then
|
39
45
|
s.specification_version = 4
|
data/lib/ash/base.rb
CHANGED
@@ -39,10 +39,11 @@ configuration.load do
|
|
39
39
|
set :dbpass, proc{Capistrano::CLI.password_prompt("Database password for '#{dbuser}':")}
|
40
40
|
set :dbname, proc{text_prompt("Database name: ")}
|
41
41
|
_cset :mysqldump, "mysqldump"
|
42
|
-
_cset :dump_options, "--single-transaction --create-options --quick --triggers --routines"
|
42
|
+
_cset :dump_options, "--single-transaction --create-options --quick --triggers --routines --force --opt --skip-lock-tables"
|
43
|
+
_cset :ignore_tables, []
|
43
44
|
|
44
45
|
# Source Control
|
45
|
-
set :group_writable, false
|
46
|
+
# set :group_writable, false
|
46
47
|
set :use_sudo, false
|
47
48
|
set :scm, :git
|
48
49
|
set :git_enable_submodules, 1 if fetch(:scm, :git)
|
@@ -59,6 +60,13 @@ configuration.load do
|
|
59
60
|
# phpMyAdmin version
|
60
61
|
set :pma_version, "3.4.5"
|
61
62
|
|
63
|
+
# FIX capistrano 2.15.4+ use of `try_sudo` with capture commands (shouldn't need sudo for `ls` and `cat` commands)
|
64
|
+
set(:releases) { capture("ls -x #{releases_path}", :except => { :no_release => true }).split.sort }
|
65
|
+
set(:current_revision) { capture("cat #{current_path}/REVISION", :except => { :no_release => true }).chomp }
|
66
|
+
set(:latest_revision) { capture("cat #{current_release}/REVISION", :except => { :no_release => true }).chomp }
|
67
|
+
set(:previous_revision) { capture("cat #{previous_release}/REVISION", :except => { :no_release => true }).chomp if previous_release }
|
68
|
+
|
69
|
+
|
62
70
|
# Backups Path
|
63
71
|
_cset(:backups_path) { File.join(deploy_to, "backups") }
|
64
72
|
_cset(:tmp_backups_path) { File.join("#{backups_path}", "tmp") }
|
@@ -110,7 +118,8 @@ configuration.load do
|
|
110
118
|
dirs = [deploy_to, releases_path, shared_path]
|
111
119
|
dirs += shared_children.map { |d| File.join(shared_path, d.split('/').last) }
|
112
120
|
run "mkdir -p #{dirs.join(' ')}"
|
113
|
-
run "chmod
|
121
|
+
run "#{try_sudo} chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
|
122
|
+
# run "chmod 755 #{dirs.join(' ')}" if fetch(:group_writable, true)
|
114
123
|
end
|
115
124
|
|
116
125
|
desc "Setup shared application directories and permissions after initial setup"
|
@@ -131,6 +140,33 @@ configuration.load do
|
|
131
140
|
create_symlink
|
132
141
|
end
|
133
142
|
|
143
|
+
desc <<-DESC
|
144
|
+
Updates the symlink to the most recently deployed version. Capistrano works \
|
145
|
+
by putting each new release of your application in its own directory. When \
|
146
|
+
you deploy a new version, this task's job is to update the `current' symlink \
|
147
|
+
to point at the new version. You will rarely need to call this task \
|
148
|
+
directly; instead, use the `deploy' task (which performs a complete \
|
149
|
+
deploy, including `restart') or the 'update' task (which does everything \
|
150
|
+
except `restart').
|
151
|
+
|
152
|
+
AAI OVERRIDES:
|
153
|
+
removes use of try_sudo with symlink command because we use try_sudo \
|
154
|
+
(set :use_sudo, true) for several common deploy-related tasks, but symlinks \
|
155
|
+
are not part of the tasks that truly require sudo privileges
|
156
|
+
|
157
|
+
DESC
|
158
|
+
task :create_symlink, :except => { :no_release => true } do
|
159
|
+
on_rollback do
|
160
|
+
if previous_release
|
161
|
+
run "#{try_sudo} rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true"
|
162
|
+
else
|
163
|
+
logger.important "no previous release to rollback to, rollback of symlink skipped"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
run "#{try_sudo} rm -f #{current_path} && ln -s #{latest_release} #{current_path}"
|
168
|
+
end
|
169
|
+
|
134
170
|
desc <<-DESC
|
135
171
|
Clean up old releases. By default, the last 5 releases are kept on each \
|
136
172
|
server (though you can change this with the keep_releases variable). All \
|
@@ -164,7 +200,7 @@ configuration.load do
|
|
164
200
|
# adding a chown -R method to fix permissions on the directory
|
165
201
|
# this should help with issues related to permission denied
|
166
202
|
# as in issues #28 and #30
|
167
|
-
run "
|
203
|
+
run "chown -R #{user}:#{user} #{dir}" if remote_dir_exists?(dir)
|
168
204
|
|
169
205
|
set_perms_dirs(dir)
|
170
206
|
set_perms_files(dir)
|
@@ -178,6 +214,26 @@ configuration.load do
|
|
178
214
|
end
|
179
215
|
end
|
180
216
|
end
|
217
|
+
|
218
|
+
namespace :rollback do
|
219
|
+
desc <<-DESC
|
220
|
+
[internal] Points the current symlink at the previous revision.
|
221
|
+
This is called by the rollback sequence, and should rarely (if
|
222
|
+
ever) need to be called directly.
|
223
|
+
|
224
|
+
AAI OVERRIDES:
|
225
|
+
removes use of try_sudo with symlink command because we use try_sudo \
|
226
|
+
(set :use_sudo, true) for several common deploy-related tasks, but symlinks \
|
227
|
+
are not part of the tasks that truly require sudo privileges
|
228
|
+
DESC
|
229
|
+
task :revision, :except => { :no_release => true } do
|
230
|
+
if previous_release
|
231
|
+
run "#{try_sudo} rm #{current_path}; ln -s #{previous_release} #{current_path}"
|
232
|
+
else
|
233
|
+
abort "could not rollback the code because there is no prior release"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
181
237
|
end
|
182
238
|
|
183
239
|
# --------------------------------------------
|
@@ -270,12 +326,12 @@ EOF
|
|
270
326
|
# NGINX tasks
|
271
327
|
# --------------------------------------------
|
272
328
|
namespace :nginx do
|
273
|
-
%w(start stop restart status).each do |cmd|
|
329
|
+
%w(start stop restart reload status).each do |cmd|
|
274
330
|
desc "[internal] - #{cmd.upcase} nginx and php-fpm"
|
275
331
|
task cmd.to_sym, :roles => :web do
|
276
332
|
|
277
|
-
nginx_cmd = fetch(:nginx_init_command, "
|
278
|
-
phpfpm_cmd = fetch(:phpfpm_init_command, "
|
333
|
+
nginx_cmd = fetch(:nginx_init_command, "service nginx")
|
334
|
+
phpfpm_cmd = fetch(:phpfpm_init_command, "service php5-fpm")
|
279
335
|
|
280
336
|
run "#{try_sudo} #{nginx_cmd} #{cmd}"
|
281
337
|
run "#{try_sudo} #{phpfpm_cmd} #{cmd}"
|
@@ -400,9 +456,9 @@ EOF
|
|
400
456
|
desc "Perform a backup of web and database files"
|
401
457
|
task :default do
|
402
458
|
deploy.setup_backup
|
403
|
-
db
|
404
|
-
web
|
405
|
-
cleanup
|
459
|
+
backup.db
|
460
|
+
backup.web
|
461
|
+
backup.cleanup
|
406
462
|
end
|
407
463
|
|
408
464
|
desc <<-DESC
|
@@ -458,10 +514,11 @@ EOF
|
|
458
514
|
end
|
459
515
|
|
460
516
|
desc "Perform a backup of database files"
|
461
|
-
task :db, :roles => :
|
517
|
+
task :db, :roles => :web do
|
462
518
|
if previous_release
|
463
519
|
mysqldump = fetch(:mysqldump, "mysqldump")
|
464
520
|
dump_options = fetch(:dump_options, "--single-transaction --create-options --quick")
|
521
|
+
dbhost = fetch(:db_remote_host, 'localhost')
|
465
522
|
|
466
523
|
puts "Backing up the database now and putting dump file in the previous release directory"
|
467
524
|
|
@@ -469,11 +526,34 @@ EOF
|
|
469
526
|
# which we'll tarball in the backup:web task
|
470
527
|
run "mkdir -p #{tmp_backups_path}/#{release_name}"
|
471
528
|
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
529
|
+
now = Time.now.to_s.gsub(/ /, "_")
|
530
|
+
# ignored db tables
|
531
|
+
ignore_tables = fetch(:ignore_tables, [])
|
532
|
+
if !ignore_tables.empty?
|
533
|
+
ignore_tables_str = ''
|
534
|
+
ignore_tables.each{ |t| ignore_tables_str << "--ignore-table='#{dbname}'.'" + t + "' " }
|
535
|
+
|
536
|
+
# define the filenames (include the current_path so the dump file will be within the directory)
|
537
|
+
data_filename = "#{tmp_backups_path}/#{release_name}/#{dbname}_data_dump-#{now}.sql.gz"
|
538
|
+
structure_filename = "#{tmp_backups_path}/#{release_name}/#{dbname}_structure_dump-#{now}.sql.gz"
|
539
|
+
|
540
|
+
# dump the database structure for the proper environment
|
541
|
+
run "#{mysqldump} --single-transaction --create-options --quick --triggers --routines --no-data -h #{dbhost} -u #{dbuser} -p #{dbname} | gzip -c --best > #{structure_filename}" do |ch, stream, out|
|
542
|
+
ch.send_data "#{dbpass}\n" if out =~ /^Enter password:/
|
543
|
+
end
|
544
|
+
|
545
|
+
# dump the database data for the proper environment
|
546
|
+
run "#{mysqldump} #{dump_options} -h #{dbhost} -u #{dbuser} -p #{dbname} #{ignore_tables_str} | gzip -c --best > #{data_filename}" do |ch, stream, out|
|
547
|
+
ch.send_data "#{dbpass}\n" if out =~ /^Enter password:/
|
548
|
+
end
|
549
|
+
else
|
550
|
+
# define the filename (include the current_path so the dump file will be within the directory)
|
551
|
+
filename = "#{tmp_backups_path}/#{release_name}/#{dbname}_dump-#{now}.sql.gz"
|
552
|
+
|
553
|
+
# dump the database for the proper environment
|
554
|
+
run "#{mysqldump} #{dump_options} -h #{dbhost} -u #{dbuser} -p #{dbname} | gzip -c --best > #{filename}" do |ch, stream, out|
|
555
|
+
ch.send_data "#{dbpass}\n" if out =~ /^Enter password:/
|
556
|
+
end
|
477
557
|
end
|
478
558
|
else
|
479
559
|
logger.important "no previous release to backup to; backup of database skipped"
|
data/lib/ash/common.rb
CHANGED
@@ -45,7 +45,7 @@ end
|
|
45
45
|
# set the permissions for files recurisvely from the starting directory (dir_path)
|
46
46
|
def set_perms_files(dir_path, perm = 644)
|
47
47
|
begin
|
48
|
-
run "find #{dir_path} -type f -print0 | xargs -0 #{try_sudo} chmod #{perm}" if remote_dir_exists?(dir_path)
|
48
|
+
run "find #{dir_path} -type f -print0 | xargs -0 -L 500 #{try_sudo} chmod #{perm}" if remote_dir_exists?(dir_path)
|
49
49
|
rescue Exception => e
|
50
50
|
logger.important "FAILED to set permissions of #{perm} on files within #{dir_path}!"
|
51
51
|
logger.important e.message
|
@@ -62,7 +62,7 @@ end
|
|
62
62
|
# set the permissions for directories recursively from the starting directory (dir_path)
|
63
63
|
def set_perms_dirs(dir_path, perm = 755)
|
64
64
|
begin
|
65
|
-
run "find #{dir_path} -type d -print0 | xargs -0 #{try_sudo} chmod #{perm}" if remote_dir_exists?(dir_path)
|
65
|
+
run "find #{dir_path} -type d -print0 | xargs -0 -L 500 #{try_sudo} chmod #{perm}" if remote_dir_exists?(dir_path)
|
66
66
|
rescue Exception => e
|
67
67
|
logger.important "FAILED to set permissions of #{perm} on directories within #{dir_path}!"
|
68
68
|
logger.important e.message
|
data/lib/ash/drupal.rb
CHANGED
@@ -27,7 +27,7 @@ configuration.load do
|
|
27
27
|
# to just using `sudo` due to the concatenation in the sudo method.
|
28
28
|
#
|
29
29
|
# This assumes that you have set up your SSH user to have passwordless sudo
|
30
|
-
# setup for common commands (e.g.,
|
30
|
+
# setup for common commands (e.g., chmod, rm, rsync, etc.)
|
31
31
|
#
|
32
32
|
# (see: https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/configuration/actions/invocation.rb#L229-L237)
|
33
33
|
set :sudo_prompt, ''
|
@@ -62,8 +62,8 @@ configuration.load do
|
|
62
62
|
after "deploy", "drupal:symlink"
|
63
63
|
after "drupal:symlink_config_file", "drupal:run_makefiles"
|
64
64
|
after "drupal:symlink","drupal:protect"
|
65
|
+
after "drupal:symlink", "compass"
|
65
66
|
after "drupal:symlink", "drupal:clearcache"
|
66
|
-
before "drupal:clearcache", "compass"
|
67
67
|
after "deploy", "deploy:cleanup"
|
68
68
|
|
69
69
|
# --------------------------------------------
|
@@ -97,7 +97,7 @@ configuration.load do
|
|
97
97
|
# remove shared directories
|
98
98
|
multisites.each_pair do |folder, url|
|
99
99
|
if folder != url
|
100
|
-
|
100
|
+
run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
|
101
101
|
end
|
102
102
|
try_sudo "rm -Rf #{latest_release}/sites/#{url}/files"
|
103
103
|
end
|
@@ -143,7 +143,7 @@ configuration.load do
|
|
143
143
|
|
144
144
|
namespace :backup do
|
145
145
|
desc "Perform a backup of database files"
|
146
|
-
task :db, :roles => :
|
146
|
+
task :db, :roles => :web do
|
147
147
|
if previous_release
|
148
148
|
puts "Backing up the database now and putting dump file in the previous release directory"
|
149
149
|
|
@@ -151,11 +151,42 @@ configuration.load do
|
|
151
151
|
# which we'll tarball in the backup:web task
|
152
152
|
run "mkdir -p #{tmp_backups_path}/#{release_name}"
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
154
|
+
now = Time.now.to_s.gsub(/ /, "_")
|
155
|
+
# ignored db tables
|
156
|
+
ignore_tables = fetch(:ignore_tables, [])
|
157
|
+
structure_tables_key = fetch(:structure_tables_key, 'structure-tables')
|
158
|
+
|
159
|
+
if !ignore_tables.empty?
|
160
|
+
if ignore_tables.is_a?(String)
|
161
|
+
ignore_tables_str = ignore_tables
|
162
|
+
else
|
163
|
+
ignore_tables_str = ignore_tables.join(',')
|
164
|
+
end
|
165
|
+
|
166
|
+
# define the filenames (include the current_path so the dump file will be within the directory)
|
167
|
+
data_filename = "#{tmp_backups_path}/#{release_name}/#{dbname}_data_dump-#{now}.sql.gz"
|
168
|
+
structure_filename = "#{tmp_backups_path}/#{release_name}/#{dbname}_structure_dump-#{now}.sql.gz"
|
169
|
+
|
170
|
+
if ignore_tables_str == 'common'
|
171
|
+
skip_tables_opt = "--skip-tables-key"
|
172
|
+
else
|
173
|
+
skip_tables_opt = "--skip-tables-list"
|
174
|
+
end
|
175
|
+
|
176
|
+
multisites.each_pair do |folder, url|
|
177
|
+
# dump the database structure for the proper environment (structure dump of common tables)
|
178
|
+
run "#{drush_bin} -l #{url} -r #{current_path} sql-dump --structure-tables-key=#{structure_tables_key} | gzip -c --best > #{structure_filename}"
|
179
|
+
|
180
|
+
# dump the database data for the proper environment
|
181
|
+
run "#{drush_bin} -l #{url} -r #{current_path} sql-dump #{skip_tabls_opt}=#{ignore_tables_str} | gzip -c --best > #{data_filename}"
|
182
|
+
end
|
183
|
+
else
|
184
|
+
multisites.each_pair do |folder, url|
|
185
|
+
# define the filename (include the current_path so the dump file will be within the directory)
|
186
|
+
filename = "#{tmp_backups_path}/#{release_name}/#{folder}_dump-#{now}.sql.gz"
|
187
|
+
# dump the database for the proper environment (skip standard tables)
|
188
|
+
run "#{drush_bin} -l #{url} -r #{current_path} sql-dump --skip-tables-key=common | gzip -c --best > #{filename}"
|
189
|
+
end
|
159
190
|
end
|
160
191
|
else
|
161
192
|
logger.important "no previous release to backup; backup of database skipped"
|
data/lib/ash/magento.rb
CHANGED
@@ -27,7 +27,7 @@ configuration.load do
|
|
27
27
|
# to just using `sudo` due to the concatenation in the sudo method.
|
28
28
|
#
|
29
29
|
# This assumes that you have set up your SSH user to have passwordless sudo
|
30
|
-
# setup for common commands (e.g.,
|
30
|
+
# setup for common commands (e.g., chmod, rm, rsync, etc.)
|
31
31
|
#
|
32
32
|
# (see: https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/configuration/actions/invocation.rb#L229-L237)
|
33
33
|
set :sudo_prompt, ''
|
@@ -38,11 +38,20 @@ configuration.load do
|
|
38
38
|
set :enable_modules, []
|
39
39
|
set :disable_modules, %w(Ash_Bar)
|
40
40
|
|
41
|
+
|
42
|
+
# --------------------------------------------
|
43
|
+
# Database/Backup Variables
|
44
|
+
# --------------------------------------------
|
45
|
+
set :ignore_tables, %w(core_cache core_cache_option core_cache_tag core_session log_customer log_quote log_summary log_summary_type log_url log_url_info log_visitor log_visitor_info log_visitor_online enterprise_logging_event enterprise_logging_event_changes index_event index_process_event report_event report_viewed_product_index dataflow_batch_export dataflow_batch_import)
|
46
|
+
|
47
|
+
# don't backup the media and var directories within the root
|
48
|
+
# of Magento project (these are already in the shared directory)
|
49
|
+
set :backup_exclude, %w(media var)
|
50
|
+
|
41
51
|
# --------------------------------------------
|
42
52
|
# Task chains
|
43
53
|
# --------------------------------------------
|
44
54
|
after "deploy:setup", "deploy:setup_local"
|
45
|
-
# after "deploy:setup_shared", "pma:install"
|
46
55
|
after "deploy:finalize_update", "magento:activate_config"
|
47
56
|
# after "deploy:create_symlink", "magento:symlink"
|
48
57
|
|
@@ -118,6 +127,20 @@ configuration.load do
|
|
118
127
|
end
|
119
128
|
end
|
120
129
|
|
130
|
+
namespace :compass do
|
131
|
+
desc "Compile SASS stylesheets and upload to remote server"
|
132
|
+
task :default do
|
133
|
+
# optional way to skip compiling of stylesheets and just upload them to the servers
|
134
|
+
skip_compass_compile = fetch(:skip_compass_compile, false)
|
135
|
+
|
136
|
+
compass.compile unless skip_compass_compile
|
137
|
+
compass.upload_stylesheets
|
138
|
+
# fixperms for skin directory instead of the whole application (faster deploys)
|
139
|
+
set_perms_dirs("#{latest_release}/skin")
|
140
|
+
set_perms_files("#{latest_release}/skin")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
121
144
|
# --------------------------------------------
|
122
145
|
# Magento specific tasks
|
123
146
|
# --------------------------------------------
|
@@ -166,7 +189,7 @@ configuration.load do
|
|
166
189
|
|
167
190
|
desc "Clear the Magento Cache"
|
168
191
|
task :cc, :roles => [:web, :app], :except => { :no_release => true } do
|
169
|
-
|
192
|
+
run "chown -R #{user}:#{user} #{shared_path}/var/*"
|
170
193
|
magento.purge_cache
|
171
194
|
end
|
172
195
|
|
@@ -201,33 +224,4 @@ configuration.load do
|
|
201
224
|
end
|
202
225
|
end
|
203
226
|
|
204
|
-
# --------------------------------------------
|
205
|
-
# Override the base.rb backup tasks
|
206
|
-
# --------------------------------------------
|
207
|
-
namespace :backup do
|
208
|
-
desc "Perform a backup of ONLY database SQL files"
|
209
|
-
task :default do
|
210
|
-
deploy.setup_backup
|
211
|
-
db
|
212
|
-
cleanup
|
213
|
-
end
|
214
|
-
|
215
|
-
desc "Perform a backup of database files"
|
216
|
-
task :db, :roles => :db do
|
217
|
-
if previous_release
|
218
|
-
puts "Backing up the database now and putting dump file in the #{stage}/backups directory"
|
219
|
-
|
220
|
-
# define the filename (dump the SQL file directly to the backups directory)
|
221
|
-
filename = "#{backups_path}/#{dbname}_dump-#{Time.now.to_s.gsub(/ /, "_")}.sql.gz"
|
222
|
-
|
223
|
-
# dump the database for the proper environment
|
224
|
-
run "#{mysqldump} #{dump_options} -u #{dbuser} -p #{dbname} | gzip -c --best > #{filename}" do |ch, stream, out|
|
225
|
-
ch.send_data "#{dbpass}\n" if out =~ /^Enter password:/
|
226
|
-
end
|
227
|
-
else
|
228
|
-
logger.important "no previous release to backup to; backup of database skipped"
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
227
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do |config|
|
2
|
+
start_times = {}
|
3
|
+
end_times = {}
|
4
|
+
order = []
|
5
|
+
|
6
|
+
on :before do
|
7
|
+
order << [:start, current_task]
|
8
|
+
start_times[current_task] = Time.now
|
9
|
+
end
|
10
|
+
|
11
|
+
on :after do
|
12
|
+
order << [:end, current_task]
|
13
|
+
end_times[current_task] = Time.now
|
14
|
+
end
|
15
|
+
|
16
|
+
config.on :exit do
|
17
|
+
print_report(start_times, end_times, order)
|
18
|
+
end
|
19
|
+
|
20
|
+
def print_report(start_times, end_times, order)
|
21
|
+
def l(s)
|
22
|
+
logger.info s
|
23
|
+
end
|
24
|
+
|
25
|
+
l " Performance Report"
|
26
|
+
l "=========================================================="
|
27
|
+
|
28
|
+
indent = 0
|
29
|
+
(order + [nil]).each_cons(2) do |payload1, payload2|
|
30
|
+
action, task = payload1
|
31
|
+
if action == :start
|
32
|
+
l "#{".." * indent}#{task.fully_qualified_name}" unless task == payload2.last
|
33
|
+
indent += 1
|
34
|
+
else
|
35
|
+
indent -= 1
|
36
|
+
l "#{".." * indent}#{task.fully_qualified_name} #{(end_times[task] - start_times[task]).to_i}s"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
l "=========================================================="
|
40
|
+
end
|
41
|
+
end
|
data/lib/ash/zend_doctrine.rb
CHANGED
@@ -8,6 +8,21 @@ configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
|
8
8
|
Capistrano.configuration(:must_exist)
|
9
9
|
|
10
10
|
configuration.load do
|
11
|
+
# --------------------------------------------
|
12
|
+
# try_sudo configuration
|
13
|
+
# --------------------------------------------
|
14
|
+
set :use_sudo, true # allow try_sudo methods to actually run via sudo
|
15
|
+
# set(:admin_runner) {"#{user}"} # specify the :admin_runner if you need to run it as another user other than root
|
16
|
+
|
17
|
+
# Clear out the default prompt (i.e., `sudo -p 'sudo password: '`) to fall back
|
18
|
+
# to just using `sudo` due to the concatenation in the sudo method.
|
19
|
+
#
|
20
|
+
# This assumes that you have set up your SSH user to have passwordless sudo
|
21
|
+
# setup for common commands (e.g., chmod, rm, rsync, etc.)
|
22
|
+
#
|
23
|
+
# (see: https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/configuration/actions/invocation.rb#L229-L237)
|
24
|
+
set :sudo_prompt, ''
|
25
|
+
|
11
26
|
# --------------------------------------------
|
12
27
|
# Calling our Methods
|
13
28
|
# --------------------------------------------
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- August Ash
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,56 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.15.
|
19
|
+
version: 2.15.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.15.
|
26
|
+
version: 2.15.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano-ext
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: railsless-deploy
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: capistrano_colors
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.5'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: net-ssh
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 2.7.0
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - '='
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.7.0
|
69
83
|
description: August Ash recipes for Capistrano
|
70
84
|
email: code@augustash.com
|
71
85
|
executables: []
|
@@ -86,6 +100,7 @@ files:
|
|
86
100
|
- lib/ash/drupal_shared_hosting.rb
|
87
101
|
- lib/ash/hosted_magento.rb
|
88
102
|
- lib/ash/magento.rb
|
103
|
+
- lib/ash/performance.rb
|
89
104
|
- lib/ash/wordpress.rb
|
90
105
|
- lib/ash/wordpress_nested.rb
|
91
106
|
- lib/ash/wordpress_shared_hosting.rb
|
@@ -110,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
125
|
version: '0'
|
111
126
|
requirements: []
|
112
127
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.2.2
|
114
129
|
signing_key:
|
115
130
|
specification_version: 4
|
116
131
|
summary: Useful task libraries for August Ash recipes for Capistrano
|