capistrano-ash 0.0.19 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +14 -0
- data/README.textile +202 -1
- data/VERSION +1 -1
- data/capistrano-ash.gemspec +4 -4
- data/lib/ash/base.rb +1 -1
- data/lib/ash/drupal.rb +80 -76
- data/lib/ash/hosted_magento.rb +139 -0
- data/lib/ash/magento.rb +9 -2
- metadata +5 -12
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 1.0.0
|
2
|
+
* Added the drupal:htaccess task for copying distributed .htaccess files
|
3
|
+
* Added example Drupal Capfile and staging/production deployment files
|
4
|
+
* Version bump to 1.0
|
5
|
+
|
6
|
+
== 0.0.20
|
7
|
+
|
8
|
+
* Added AAI-hosted Magento script
|
9
|
+
* Added "setup_local" task for Magento script
|
10
|
+
|
11
|
+
== 0.0.19
|
12
|
+
|
13
|
+
* Added the backup:cleanup method to remove old backups from the servers. You can over-ride the number of kept backups with the :keep_backups variable (default is 10). Warning: this will permanently remove the backups from the server solely based on the timestamp.
|
14
|
+
|
1
15
|
== 0.0.16
|
2
16
|
|
3
17
|
* Removed the extra 's' from the callback section that was supposed to call deploy:setup_backup
|
data/README.textile
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
h2. Deploying Magento
|
2
|
+
|
3
|
+
Check the "Wiki":https://github.com/augustash/capistrano-ash/wiki for detailed installation instructions.
|
4
|
+
|
1
5
|
h2. Deploying Drupal example
|
2
6
|
|
3
7
|
The capistrano/ash/drupal library takes a hash of Drupal multisites in the following format.
|
@@ -6,6 +10,97 @@ The capistrano/ash/drupal library takes a hash of Drupal multisites in the follo
|
|
6
10
|
|
7
11
|
where each key is a folder in your @sites@ directory and each value is the URL of the multisite. If you are not using multisites, just exclude the @:multisites@ variable definition.
|
8
12
|
|
13
|
+
|
14
|
+
h3. Capfile
|
15
|
+
|
16
|
+
<pre>
|
17
|
+
<code>
|
18
|
+
# Capfile
|
19
|
+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
20
|
+
|
21
|
+
# --------------------------------------------
|
22
|
+
# :application HAS TO BE DEFINED BEFORE
|
23
|
+
# REQUIRING 'ash/drupal' LIBRARY
|
24
|
+
# --------------------------------------------
|
25
|
+
set :application, "bestappever.com"
|
26
|
+
set :stages, %w(staging production)
|
27
|
+
|
28
|
+
# --------------------------------------------
|
29
|
+
# Define required Gems/libraries
|
30
|
+
# --------------------------------------------
|
31
|
+
require 'ash/drupal'
|
32
|
+
|
33
|
+
# --------------------------------------------
|
34
|
+
# Setting defaults
|
35
|
+
# --------------------------------------------
|
36
|
+
# IP-address or host's servername
|
37
|
+
role :app, "bestappever.com"
|
38
|
+
role :web, "bestappever.com"
|
39
|
+
role :db, "bestappever.com", :primary => true
|
40
|
+
|
41
|
+
# VCS information.
|
42
|
+
set :repository, "https://svn.example.com/REPO/trunk"
|
43
|
+
set :scm_username, "SVN_USER"
|
44
|
+
set :scm_password, proc{Capistrano::CLI.password_prompt("Subversion password for '#{scm_username}':")}
|
45
|
+
|
46
|
+
# SSH login credentials
|
47
|
+
set :user, "SSH_USER"
|
48
|
+
set :password, proc{Capistrano::CLI.password_prompt("SSH password for '#{user}':")}
|
49
|
+
|
50
|
+
# Deploy to file path
|
51
|
+
set(:deploy_to) { "/var/www/#{application}/#{stage}" }
|
52
|
+
|
53
|
+
# Database credentials
|
54
|
+
set :dbuser, "DB_USER_NAME"
|
55
|
+
|
56
|
+
# Define which files or directories you want to exclude from being backed up
|
57
|
+
set(:backup_exclude) { [ "var/" ] }
|
58
|
+
|
59
|
+
|
60
|
+
# --------------------------------------------
|
61
|
+
# Drupal Multi-Sites
|
62
|
+
# --------------------------------------------
|
63
|
+
# Setting which folder in the sites directory to use
|
64
|
+
set :multisites, {
|
65
|
+
'bestapp' => 'bestappever.com',
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
# --------------------------------------------
|
70
|
+
# Callbacks - Set Before/After Precedence
|
71
|
+
# --------------------------------------------
|
72
|
+
before "deploy:update_code", "deploy:setup_backup"
|
73
|
+
after "deploy:setup_backup", "backup"
|
74
|
+
</code>
|
75
|
+
</pre>
|
76
|
+
|
77
|
+
h3. config/deploy/staging.rb
|
78
|
+
|
79
|
+
<pre>
|
80
|
+
<code>
|
81
|
+
# config/deploy/staging.rb
|
82
|
+
# Database Name
|
83
|
+
set :dbname, "DB_NAME"
|
84
|
+
|
85
|
+
# Backups Path (/var/www/#{application}/staging/backups)
|
86
|
+
set :backups_path, "#{deploy_to}/backups"
|
87
|
+
</code>
|
88
|
+
</pre>
|
89
|
+
|
90
|
+
h3. config/deploy/production.rb
|
91
|
+
|
92
|
+
<pre>
|
93
|
+
<code>
|
94
|
+
# config/deploy/production.rb
|
95
|
+
# Database Name
|
96
|
+
set :dbname, "DB_NAME"
|
97
|
+
|
98
|
+
# Backups Path (/var/www/#{application}/production/backups)
|
99
|
+
set :backups_path, "#{deploy_to}/backups"
|
100
|
+
</code>
|
101
|
+
</pre>
|
102
|
+
|
103
|
+
|
9
104
|
h2. Deploying Zend or Zend/Doctrine example
|
10
105
|
|
11
106
|
h3. Capfile
|
@@ -16,7 +111,7 @@ h3. Capfile
|
|
16
111
|
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
17
112
|
|
18
113
|
# --------------------------------------------
|
19
|
-
# :
|
114
|
+
# :application HAS TO BE DEFINED BEFORE
|
20
115
|
# REQUIRING 'ash/zend_doctrine' LIBRARY
|
21
116
|
# --------------------------------------------
|
22
117
|
set :application, "BEST_APP_EVER"
|
@@ -84,6 +179,13 @@ h3. config/deploy/staging.rb
|
|
84
179
|
<pre>
|
85
180
|
<code>
|
86
181
|
# config/deploy/staging.rb
|
182
|
+
|
183
|
+
# Deploy site using Capistrano
|
184
|
+
#
|
185
|
+
# Usage:
|
186
|
+
# cap staging deploy:setup
|
187
|
+
# cap staging deploy
|
188
|
+
|
87
189
|
# Database Name
|
88
190
|
set :dbname, "DB_NAME"
|
89
191
|
|
@@ -97,6 +199,13 @@ h3. config/deploy/production.rb
|
|
97
199
|
<pre>
|
98
200
|
<code>
|
99
201
|
# config/deploy/production.rb
|
202
|
+
|
203
|
+
# Deploy site using Capistrano
|
204
|
+
#
|
205
|
+
# Usage:
|
206
|
+
# cap production deploy:setup
|
207
|
+
# cap production deploy
|
208
|
+
|
100
209
|
# Database Name
|
101
210
|
set :dbname, "DB_NAME"
|
102
211
|
|
@@ -104,3 +213,95 @@ h3. config/deploy/production.rb
|
|
104
213
|
set :backups_path, "#{deploy_to}/backups"
|
105
214
|
</code>
|
106
215
|
</pre>
|
216
|
+
|
217
|
+
h2. WordPress example
|
218
|
+
|
219
|
+
h3. Capfile
|
220
|
+
|
221
|
+
<pre>
|
222
|
+
<code>
|
223
|
+
# Capfile
|
224
|
+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
225
|
+
|
226
|
+
# --------------------------------------------
|
227
|
+
# :application HAS TO BE DEFINED BEFORE
|
228
|
+
# REQUIRING 'ash/wordpress' LIBRARY
|
229
|
+
# --------------------------------------------
|
230
|
+
set :application, "WP_EXAMPLE.com"
|
231
|
+
|
232
|
+
# --------------------------------------------
|
233
|
+
# Define required Gems/libraries
|
234
|
+
# --------------------------------------------
|
235
|
+
require 'ash/wordpress'
|
236
|
+
|
237
|
+
# --------------------------------------------
|
238
|
+
# Setting defaults
|
239
|
+
# --------------------------------------------
|
240
|
+
# IP-address or host's servername
|
241
|
+
role :app, "wpexample.com"
|
242
|
+
role :web, "wpexample.com"
|
243
|
+
role :db, "wpexample.com", :primary => true
|
244
|
+
|
245
|
+
# VCS information.
|
246
|
+
set :repository, "https://svn.example.com/REPO/trunk"
|
247
|
+
set :scm_username, "SVN_USER"
|
248
|
+
set :scm_password, proc{Capistrano::CLI.password_prompt("Subversion password for '#{scm_username}':")}
|
249
|
+
|
250
|
+
# SSH login credentials
|
251
|
+
set :user, "SSH_USER"
|
252
|
+
set :password, proc{Capistrano::CLI.password_prompt("SSH password for '#{user}':")}
|
253
|
+
|
254
|
+
# Deploy to file path
|
255
|
+
set(:deploy_to) { "/home/CLIENT_CODE/#{application}/#{stage}" }
|
256
|
+
|
257
|
+
# Database credentials
|
258
|
+
set :dbuser, "DB_USER"
|
259
|
+
|
260
|
+
# Set Excluded directories/files (relative to the application's root path)
|
261
|
+
set(:backup_exclude) { [ "wp-content/cache" ] }
|
262
|
+
|
263
|
+
# --------------------------------------------
|
264
|
+
# Application Specific Methods
|
265
|
+
# --------------------------------------------
|
266
|
+
namespace :app do
|
267
|
+
desc "Removes any additional unnecessary files or directories after deploy:finalize_update"
|
268
|
+
task :finalize_update, :except => { :no_release => true } do
|
269
|
+
logger.debug "Removing additional files"
|
270
|
+
run "rm -Rf #{latest_release}/htaccess.dist"
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
# --------------------------------------------
|
275
|
+
# Callbacks
|
276
|
+
# --------------------------------------------
|
277
|
+
before "deploy:update_code", "deploy:setup_backup"
|
278
|
+
after "deploy:setup_backup", "backup"
|
279
|
+
after "deploy:finalize_update", "app:finalize_update"
|
280
|
+
</code>
|
281
|
+
</pre>
|
282
|
+
|
283
|
+
h3. config/deploy/staging.rb
|
284
|
+
|
285
|
+
<pre>
|
286
|
+
<code>
|
287
|
+
# config/deploy/staging.rb
|
288
|
+
# Database Name
|
289
|
+
set :dbname, "DB_NAME"
|
290
|
+
|
291
|
+
# Backups Path (/home/CLIENT_CODE/#{application}/staging/backups)
|
292
|
+
set :backups_path, "#{deploy_to}/backups"
|
293
|
+
</code>
|
294
|
+
</pre>
|
295
|
+
|
296
|
+
h3. config/deploy/production.rb
|
297
|
+
|
298
|
+
<pre>
|
299
|
+
<code>
|
300
|
+
# config/deploy/production.rb
|
301
|
+
# Database Name
|
302
|
+
set :dbname, "DB_NAME"
|
303
|
+
|
304
|
+
# Backups Path (/home/CLIENT_CODE/#{application}/production/backups)
|
305
|
+
set :backups_path, "#{deploy_to}/backups"
|
306
|
+
</code>
|
307
|
+
</pre>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
1.0.0
|
data/capistrano-ash.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{capistrano-ash}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["August Ash"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-05-17}
|
13
13
|
s.description = %q{August Ash recipes for Capistrano}
|
14
14
|
s.email = %q{jake@augustash.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -24,17 +24,17 @@ Gem::Specification.new do |s|
|
|
24
24
|
"lib/ash/base.rb",
|
25
25
|
"lib/ash/common.rb",
|
26
26
|
"lib/ash/drupal.rb",
|
27
|
+
"lib/ash/hosted_magento.rb",
|
27
28
|
"lib/ash/magento.rb",
|
28
29
|
"lib/ash/wordpress.rb",
|
29
30
|
"lib/ash/zend_doctrine.rb"
|
30
31
|
]
|
31
32
|
s.homepage = %q{https://github.com/augustash/capistrano-ash}
|
32
33
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.
|
34
|
+
s.rubygems_version = %q{1.6.2}
|
34
35
|
s.summary = %q{Useful task libraries for August Ash recipes for Capistrano}
|
35
36
|
|
36
37
|
if s.respond_to? :specification_version then
|
37
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
38
|
s.specification_version = 3
|
39
39
|
|
40
40
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/ash/base.rb
CHANGED
@@ -50,7 +50,7 @@ configuration.load do
|
|
50
50
|
set :copy_strategy, :checkout
|
51
51
|
set :copy_compression, :bz2
|
52
52
|
set :copy_exclude, [".svn", ".DS_Store", "*.sample", "LICENSE*", "Capfile",
|
53
|
-
"config", "*.rb", "*.sql", "nbproject", "_template"]
|
53
|
+
"RELEASE*", "config", "*.rb", "*.sql", "nbproject", "_template"]
|
54
54
|
|
55
55
|
# phpMyAdmin version
|
56
56
|
set :pma_version, "3.3.8"
|
data/lib/ash/drupal.rb
CHANGED
@@ -7,115 +7,119 @@ configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
|
7
7
|
|
8
8
|
configuration.load do
|
9
9
|
|
10
|
-
# --------------------------------------------
|
11
|
-
# Setting defaults
|
12
|
-
# --------------------------------------------
|
13
|
-
proc{_cset( :multisites, {"default" => "#{application}"} )}
|
14
|
-
set :drush_bin, "drush"
|
10
|
+
# --------------------------------------------
|
11
|
+
# Setting defaults
|
12
|
+
# --------------------------------------------
|
13
|
+
proc{_cset( :multisites, {"default" => "#{application}"} )}
|
14
|
+
set :drush_bin, "drush"
|
15
15
|
|
16
|
-
# --------------------------------------------
|
17
|
-
# Calling our Methods
|
18
|
-
# --------------------------------------------
|
19
|
-
after "deploy:setup", "deploy:setup_shared"
|
20
|
-
after "deploy:finalize_update", "ash:fixperms"
|
21
|
-
after "ash:fixperms", "drupal:protect"
|
22
|
-
after "deploy:symlink", "drupal:symlink"
|
23
|
-
after "deploy", "drupal:clearcache"
|
24
|
-
after "deploy", "
|
16
|
+
# --------------------------------------------
|
17
|
+
# Calling our Methods
|
18
|
+
# --------------------------------------------
|
19
|
+
after "deploy:setup", "deploy:setup_shared"
|
20
|
+
after "deploy:finalize_update", "ash:fixperms"
|
21
|
+
after "ash:fixperms", "drupal:protect"
|
22
|
+
after "deploy:symlink", "drupal:symlink"
|
23
|
+
after "deploy", "drupal:clearcache"
|
24
|
+
after "deploy", "drupal:htaccess"
|
25
|
+
after "deploy", "deploy:cleanup"
|
25
26
|
|
26
|
-
# --------------------------------------------
|
27
|
-
# Overloaded Methods
|
28
|
-
# --------------------------------------------
|
29
|
-
namespace :deploy do
|
27
|
+
# --------------------------------------------
|
28
|
+
# Overloaded Methods
|
29
|
+
# --------------------------------------------
|
30
|
+
namespace :deploy do
|
30
31
|
desc "Setup shared application directories and permissions after initial setup"
|
31
32
|
task :setup_shared, :roles => :web do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
# remove Capistrano specific directories
|
34
|
+
run "rm -Rf #{shared_path}/log"
|
35
|
+
run "rm -Rf #{shared_path}/pids"
|
36
|
+
run "rm -Rf #{shared_path}/system"
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
# create shared directories
|
39
|
+
multisites.each_pair do |folder, url|
|
40
|
+
run "mkdir -p #{shared_path}/#{url}/files"
|
41
|
+
end
|
41
42
|
|
42
|
-
|
43
|
-
|
43
|
+
# set correct permissions
|
44
|
+
run "chmod -R 777 #{shared_path}/*"
|
44
45
|
end
|
45
46
|
|
46
47
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
47
48
|
task :finalize_update, :except => { :no_release => true } do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
# remove shared directories
|
50
|
+
multisites.each_pair do |folder, url|
|
51
|
+
run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
|
52
|
+
run "rm -Rf #{latest_release}/sites/#{url}/files"
|
53
|
+
end
|
53
54
|
end
|
54
55
|
|
55
56
|
namespace :web do
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
57
|
+
desc "Disable the application and show a message screen"
|
58
|
+
task :disable do
|
59
|
+
multisites.each_pair do |folder, url|
|
60
|
+
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes site_offline 1"
|
61
61
|
end
|
62
|
+
end
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
64
|
+
desc "Enable the application and remove the message screen"
|
65
|
+
task :enable do
|
66
|
+
multisites.each_pair do |folder, url|
|
67
|
+
run "#{drush_bin} -l #{url} -r #{latest_release} vdel --yes site_offline"
|
68
68
|
end
|
69
|
+
end
|
69
70
|
end
|
70
|
-
end
|
71
|
+
end
|
71
72
|
|
72
|
-
namespace :backup do
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
namespace :backup do
|
74
|
+
desc "Perform a backup of database files"
|
75
|
+
task :db, :roles => :db do
|
76
|
+
puts "Backing up the database now and putting dump file in the previous release directory"
|
77
|
+
multisites.each_pair do |folder, url|
|
78
|
+
# define the filename (include the current_path so the dump file will be within the dirrectory)
|
79
|
+
filename = "#{current_path}/#{folder}_dump-#{Time.now.to_s.gsub(/ /, "_")}.sql.gz"
|
80
|
+
# dump the database for the proper environment
|
81
|
+
run "#{drush_bin} -l #{url} -r #{current_path} sql-dump | gzip -c --best > #{filename}"
|
82
|
+
end
|
81
83
|
end
|
82
84
|
end
|
83
|
-
end
|
84
85
|
|
85
|
-
# --------------------------------------------
|
86
|
-
# Drupal-specific methods
|
87
|
-
# --------------------------------------------
|
88
|
-
namespace :drupal do
|
86
|
+
# --------------------------------------------
|
87
|
+
# Drupal-specific methods
|
88
|
+
# --------------------------------------------
|
89
|
+
namespace :drupal do
|
89
90
|
desc "Symlink shared directories"
|
90
91
|
task :symlink, :except => { :no_release => true } do
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
multisites.each_pair do |folder, url|
|
93
|
+
run "ln -nfs #{shared_path}/#{url}/files #{current_release}/sites/#{url}/files"
|
94
|
+
run "ln -nfs #{latest_release}/sites/#{url}/settings.php.#{stage} #{latest_release}/sites/#{url}/settings.php"
|
95
|
+
run "#{drush_bin} -l #{url} -r #{current_path} vset --yes file_directory_path sites/#{url}/files"
|
96
|
+
end
|
96
97
|
end
|
97
98
|
|
98
99
|
desc "Replace local database paths with remote paths"
|
99
100
|
task :updatedb, :except => { :no_release => true } do
|
100
|
-
|
101
|
-
|
102
|
-
|
101
|
+
multisites.each_pair do |folder, url|
|
102
|
+
run "#{drush_bin} -l #{url} -r #{current_path} sqlq \"UPDATE {files} SET filepath = REPLACE(filepath,'sites/#{folder}/files','sites/#{url}/files');\""
|
103
|
+
end
|
103
104
|
end
|
104
105
|
|
105
106
|
desc "Clear all Drupal cache"
|
106
107
|
task :clearcache, :except => { :no_release => true } do
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
multisites.each_pair do |folder, url|
|
109
|
+
run "#{drush_bin} -l #{url} -r #{current_path} cache-clear all"
|
110
|
+
end
|
110
111
|
end
|
111
|
-
|
112
|
+
|
112
113
|
desc "Protect system files"
|
113
114
|
task :protect, :except => { :no_release => true } do
|
114
|
-
|
115
|
-
|
116
|
-
|
115
|
+
multisites.each_pair do |folder, url|
|
116
|
+
run "chmod 644 #{latest_release}/sites/#{url}/settings.php*"
|
117
|
+
end
|
117
118
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
119
|
+
|
120
|
+
desc 'Copy over htaccess file'
|
121
|
+
task :htaccess do
|
122
|
+
run "cp #{latest_release}/htaccess.dist #{latest_release}/.htaccess"
|
123
|
+
end
|
124
|
+
end
|
121
125
|
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# Required base libraries
|
2
|
+
require 'ash/base'
|
3
|
+
|
4
|
+
# Bootstrap Capistrano instance
|
5
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
6
|
+
Capistrano::Configuration.instance(:must_exist) :
|
7
|
+
Capistrano.configuration(:must_exist)
|
8
|
+
|
9
|
+
configuration.load do
|
10
|
+
# --------------------------------------------
|
11
|
+
# Default variables
|
12
|
+
# --------------------------------------------
|
13
|
+
set :scm_username, "remotesvn"
|
14
|
+
|
15
|
+
# --------------------------------------------
|
16
|
+
# Task chains
|
17
|
+
# --------------------------------------------
|
18
|
+
after "deploy:setup", "deploy:setup_local"
|
19
|
+
after "deploy:finalize_update", "magento:activate_config"
|
20
|
+
after "deploy:symlink", "magento:symlink"
|
21
|
+
after "deploy", "magento:purge_cache"
|
22
|
+
|
23
|
+
# --------------------------------------------
|
24
|
+
# Overloaded tasks
|
25
|
+
# --------------------------------------------
|
26
|
+
namespace :deploy do
|
27
|
+
desc "Setup local files necessary for deployment"
|
28
|
+
task :setup_local do
|
29
|
+
# attempt to create files needed for proper deployment
|
30
|
+
system("touch htaccess.dist app/etc/local.xml.staging app/etc/local.xml.production")
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Setup shared application directories and permissions after initial setup"
|
34
|
+
task :setup_shared do
|
35
|
+
# remove Capistrano specific directories
|
36
|
+
run "rm -Rf #{shared_path}/log"
|
37
|
+
run "rm -Rf #{shared_path}/pids"
|
38
|
+
run "rm -Rf #{shared_path}/system"
|
39
|
+
|
40
|
+
# create shared directories
|
41
|
+
run "mkdir -p #{shared_path}/includes"
|
42
|
+
run "mkdir -p #{shared_path}/media"
|
43
|
+
run "mkdir -p #{shared_path}/sitemap"
|
44
|
+
run "mkdir -p #{shared_path}/var"
|
45
|
+
|
46
|
+
# set correct permissions
|
47
|
+
run "chmod 755 #{shared_path}/*"
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
51
|
+
task :finalize_update, :except => { :no_release => true } do
|
52
|
+
# synchronize media directory with shared data
|
53
|
+
run "rsync -rltDvzog #{latest_release}/media/ #{shared_path}/media/"
|
54
|
+
|
55
|
+
# put ".htaccess" in place
|
56
|
+
run "mv #{latest_release}/htaccess.dist #{latest_release}/.htaccess"
|
57
|
+
|
58
|
+
# remove directories that will be shared
|
59
|
+
run "rm -Rf #{latest_release}/includes"
|
60
|
+
run "rm -Rf #{latest_release}/media"
|
61
|
+
run "rm -Rf #{latest_release}/sitemap"
|
62
|
+
run "rm -Rf #{latest_release}/var"
|
63
|
+
|
64
|
+
# set the file and directory permissions
|
65
|
+
ash.fixperms
|
66
|
+
end
|
67
|
+
|
68
|
+
namespace :web do
|
69
|
+
desc "Disable the application and show a message screen"
|
70
|
+
task :disable, :except => { :no_release => true } do
|
71
|
+
run "touch #{current_path}/maintenance.flag"
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Enable the application and remove the message screen"
|
75
|
+
task :enable, :except => { :no_release => true } do
|
76
|
+
run "rm #{current_path}/maintenance.flag"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# --------------------------------------------
|
82
|
+
# Overloaded Ash tasks
|
83
|
+
# --------------------------------------------
|
84
|
+
namespace :ash do
|
85
|
+
desc "Set standard permissions for Ash servers"
|
86
|
+
task :fixperms, :except => { :no_release => true } do
|
87
|
+
# chmod the files and directories.
|
88
|
+
run "find #{latest_release} -type d -exec chmod 755 {} \\;"
|
89
|
+
run "find #{latest_release} -type f -exec chmod 644 {} \\;"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# --------------------------------------------
|
94
|
+
# Magento specific tasks
|
95
|
+
# --------------------------------------------
|
96
|
+
namespace :magento do
|
97
|
+
desc "Set appropriate configuration values for the stage"
|
98
|
+
task :activate_config, :except => { :no_release => true } do
|
99
|
+
run "cp -f #{latest_release}/app/etc/local.xml.#{stage} #{latest_release}/app/etc/local.xml"
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "Symlink shared directories"
|
103
|
+
task :symlink, :except => { :no_release => true } do
|
104
|
+
run "ln -nfs #{shared_path}/includes #{current_release}/includes"
|
105
|
+
run "ln -nfs #{shared_path}/media #{current_release}/media"
|
106
|
+
run "ln -nfs #{shared_path}/sitemap #{current_release}/sitemap"
|
107
|
+
run "ln -nfs #{shared_path}/var #{current_release}/var"
|
108
|
+
end
|
109
|
+
|
110
|
+
desc "Purge Magento cache directory"
|
111
|
+
task :purge_cache, :except => { :no_release => true } do
|
112
|
+
run "rm -Rf #{shared_path}/var/cache/*"
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "Watch Magento system log"
|
116
|
+
task :watch_logs, :except => { :no_release => true } do
|
117
|
+
run "tail -f #{shared_path}/var/log/system.log" do |channel, stream, data|
|
118
|
+
puts # for an extra line break before the host name
|
119
|
+
puts "#{channel[:host]}: #{data}"
|
120
|
+
break if stream == :err
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
desc "Watch Magento exception log"
|
125
|
+
task :watch_exceptions, :except => { :no_release => true } do
|
126
|
+
run "tail -f #{shared_path}/var/log/exception.log" do |channel, stream, data|
|
127
|
+
puts # for an extra line break before the host name
|
128
|
+
puts "#{channel[:host]}: #{data}"
|
129
|
+
break if stream == :err
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# --------------------------------------------
|
135
|
+
# Custom tasks
|
136
|
+
# --------------------------------------------
|
137
|
+
|
138
|
+
# update core_config_data; set value = "domain" where scope_id = 0 and path = "web/unsecure/base_url"
|
139
|
+
end
|
data/lib/ash/magento.rb
CHANGED
@@ -10,6 +10,7 @@ configuration.load do
|
|
10
10
|
# --------------------------------------------
|
11
11
|
# Task chains
|
12
12
|
# --------------------------------------------
|
13
|
+
after "deploy:setup", "deploy:setup_local"
|
13
14
|
after "deploy:setup_shared", "pma:install"
|
14
15
|
after "deploy:finalize_update", "magento:activate_config"
|
15
16
|
after "deploy:symlink", "magento:symlink"
|
@@ -19,6 +20,12 @@ configuration.load do
|
|
19
20
|
# Overloaded tasks
|
20
21
|
# --------------------------------------------
|
21
22
|
namespace :deploy do
|
23
|
+
desc "Setup local files necessary for deployment"
|
24
|
+
task :setup_local do
|
25
|
+
# attempt to create files needed for proper deployment
|
26
|
+
system("touch app/etc/local.xml.staging app/etc/local.xml.production")
|
27
|
+
end
|
28
|
+
|
22
29
|
desc "Setup shared application directories and permissions after initial setup"
|
23
30
|
task :setup_shared do
|
24
31
|
# remove Capistrano specific directories
|
@@ -41,7 +48,7 @@ configuration.load do
|
|
41
48
|
# synchronize media directory with shared data
|
42
49
|
sudo "rsync -rltDvzog #{latest_release}/media/ #{shared_path}/media/"
|
43
50
|
sudo "chmod -R 777 #{shared_path}/media/"
|
44
|
-
|
51
|
+
|
45
52
|
# remove directories that will be shared
|
46
53
|
run "rm -Rf #{latest_release}/includes"
|
47
54
|
run "rm -Rf #{latest_release}/media"
|
@@ -114,4 +121,4 @@ configuration.load do
|
|
114
121
|
|
115
122
|
# update core_config_data; set value = "domain" where scope_id = 0 and path = "web/unsecure/base_url"
|
116
123
|
|
117
|
-
end
|
124
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 19
|
9
|
-
version: 0.0.19
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- August Ash
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-05-17 00:00:00 -05:00
|
18
14
|
default_executable:
|
19
15
|
dependencies: []
|
20
16
|
|
@@ -35,6 +31,7 @@ files:
|
|
35
31
|
- lib/ash/base.rb
|
36
32
|
- lib/ash/common.rb
|
37
33
|
- lib/ash/drupal.rb
|
34
|
+
- lib/ash/hosted_magento.rb
|
38
35
|
- lib/ash/magento.rb
|
39
36
|
- lib/ash/wordpress.rb
|
40
37
|
- lib/ash/zend_doctrine.rb
|
@@ -52,21 +49,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
49
|
requirements:
|
53
50
|
- - ">="
|
54
51
|
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 0
|
57
52
|
version: "0"
|
58
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
54
|
none: false
|
60
55
|
requirements:
|
61
56
|
- - ">="
|
62
57
|
- !ruby/object:Gem::Version
|
63
|
-
segments:
|
64
|
-
- 0
|
65
58
|
version: "0"
|
66
59
|
requirements: []
|
67
60
|
|
68
61
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
62
|
+
rubygems_version: 1.6.2
|
70
63
|
signing_key:
|
71
64
|
specification_version: 3
|
72
65
|
summary: Useful task libraries for August Ash recipes for Capistrano
|