capistrano-ash 1.1.8 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +7 -91
- data/VERSION +1 -1
- data/lib/ash/base.rb +4 -4
- data/lib/ash/drupal.rb +9 -9
- data/lib/ash/drupal_shared_hosting.rb +1 -1
- data/lib/ash/hosted_magento.rb +9 -2
- data/lib/ash/magento.rb +11 -10
- data/lib/ash/wordpress.rb +3 -3
- data/lib/ash/zend_doctrine.rb +2 -2
- metadata +3 -5
data/README.textile
CHANGED
@@ -24,6 +24,13 @@ h2. Deploying Magento
|
|
24
24
|
|
25
25
|
Check the "Wiki":https://github.com/augustash/capistrano-ash/wiki for detailed installation instructions.
|
26
26
|
|
27
|
+
h2. Deploying WordPress
|
28
|
+
|
29
|
+
Check the "Wiki":https://github.com/augustash/capistrano-ash/wiki for detailed installation instructions.
|
30
|
+
|
31
|
+
"WordPress on shared hosting":https://github.com/augustash/capistrano-ash/wiki/WordPress-Shared-Hosting-Example
|
32
|
+
"WordPress on virtual or dedicated servers":https://github.com/augustash/capistrano-ash/wiki/WordPress-Private-Server-Example
|
33
|
+
|
27
34
|
h2. Deploying Drupal example
|
28
35
|
|
29
36
|
The capistrano/ash/drupal library takes a hash of Drupal multisites in the following format.
|
@@ -236,94 +243,3 @@ h3. config/deploy/production.rb
|
|
236
243
|
</code>
|
237
244
|
</pre>
|
238
245
|
|
239
|
-
h2. WordPress example
|
240
|
-
|
241
|
-
h3. Capfile
|
242
|
-
|
243
|
-
<pre>
|
244
|
-
<code>
|
245
|
-
# Capfile
|
246
|
-
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
247
|
-
|
248
|
-
# --------------------------------------------
|
249
|
-
# :application HAS TO BE DEFINED BEFORE
|
250
|
-
# REQUIRING 'ash/wordpress' LIBRARY
|
251
|
-
# --------------------------------------------
|
252
|
-
set :application, "WP_EXAMPLE.com"
|
253
|
-
|
254
|
-
# --------------------------------------------
|
255
|
-
# Define required Gems/libraries
|
256
|
-
# --------------------------------------------
|
257
|
-
require 'ash/wordpress'
|
258
|
-
|
259
|
-
# --------------------------------------------
|
260
|
-
# Setting defaults
|
261
|
-
# --------------------------------------------
|
262
|
-
# IP-address or host's servername
|
263
|
-
role :app, "wpexample.com"
|
264
|
-
role :web, "wpexample.com"
|
265
|
-
role :db, "wpexample.com", :primary => true
|
266
|
-
|
267
|
-
# VCS information.
|
268
|
-
set :repository, "https://svn.example.com/REPO/trunk"
|
269
|
-
set :scm_username, "SVN_USER"
|
270
|
-
set :scm_password, proc{Capistrano::CLI.password_prompt("Subversion password for '#{scm_username}':")}
|
271
|
-
|
272
|
-
# SSH login credentials
|
273
|
-
set :user, "SSH_USER"
|
274
|
-
set :password, proc{Capistrano::CLI.password_prompt("SSH password for '#{user}':")}
|
275
|
-
|
276
|
-
# Deploy to file path
|
277
|
-
set(:deploy_to) { "/home/CLIENT_CODE/#{application}/#{stage}" }
|
278
|
-
|
279
|
-
# Database credentials
|
280
|
-
set :dbuser, "DB_USER"
|
281
|
-
|
282
|
-
# Set Excluded directories/files (relative to the application's root path)
|
283
|
-
set(:backup_exclude) { [ "wp-content/cache" ] }
|
284
|
-
|
285
|
-
# --------------------------------------------
|
286
|
-
# Application Specific Methods
|
287
|
-
# --------------------------------------------
|
288
|
-
namespace :app do
|
289
|
-
desc "Removes any additional unnecessary files or directories after deploy:finalize_update"
|
290
|
-
task :finalize_update, :except => { :no_release => true } do
|
291
|
-
logger.debug "Removing additional files"
|
292
|
-
run "rm -Rf #{latest_release}/htaccess.dist"
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
# --------------------------------------------
|
297
|
-
# Callbacks
|
298
|
-
# --------------------------------------------
|
299
|
-
before "deploy:update_code", "deploy:setup_backup"
|
300
|
-
after "deploy:setup_backup", "backup"
|
301
|
-
after "deploy:finalize_update", "app:finalize_update"
|
302
|
-
</code>
|
303
|
-
</pre>
|
304
|
-
|
305
|
-
h3. config/deploy/staging.rb
|
306
|
-
|
307
|
-
<pre>
|
308
|
-
<code>
|
309
|
-
# config/deploy/staging.rb
|
310
|
-
# Database Name
|
311
|
-
set :dbname, "DB_NAME"
|
312
|
-
|
313
|
-
# Backups Path (/home/CLIENT_CODE/#{application}/staging/backups)
|
314
|
-
set :backups_path, "#{deploy_to}/backups"
|
315
|
-
</code>
|
316
|
-
</pre>
|
317
|
-
|
318
|
-
h3. config/deploy/production.rb
|
319
|
-
|
320
|
-
<pre>
|
321
|
-
<code>
|
322
|
-
# config/deploy/production.rb
|
323
|
-
# Database Name
|
324
|
-
set :dbname, "DB_NAME"
|
325
|
-
|
326
|
-
# Backups Path (/home/CLIENT_CODE/#{application}/production/backups)
|
327
|
-
set :backups_path, "#{deploy_to}/backups"
|
328
|
-
</code>
|
329
|
-
</pre>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.10
|
data/lib/ash/base.rb
CHANGED
@@ -90,7 +90,7 @@ configuration.load do
|
|
90
90
|
# --------------------------------------------
|
91
91
|
namespace :ash do
|
92
92
|
desc "Set standard permissions for Ash servers"
|
93
|
-
task :fixperms, :except => { :no_release => true } do
|
93
|
+
task :fixperms, :roles => :web, :except => { :no_release => true } do
|
94
94
|
# chmod the files and directories.
|
95
95
|
try_sudo "find #{latest_release} -type d -exec chmod 755 {} \\;"
|
96
96
|
try_sudo "find #{latest_release} -type f -exec chmod 644 {} \\;"
|
@@ -107,7 +107,7 @@ configuration.load do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
desc 'Copy distribution htaccess file'
|
110
|
-
task :htaccess do
|
110
|
+
task :htaccess, :roles => :web do
|
111
111
|
run "mv #{latest_release}/htaccess.dist #{latest_release}/.htaccess" if
|
112
112
|
remote_file_exists?("#{latest_release}/htaccess.dist")
|
113
113
|
end
|
@@ -119,12 +119,12 @@ configuration.load do
|
|
119
119
|
namespace :php do
|
120
120
|
namespace :apc do
|
121
121
|
desc "Disable the APC administrative panel"
|
122
|
-
task :disable, :except => { :no_release => true } do
|
122
|
+
task :disable, :roles => :web, :except => { :no_release => true } do
|
123
123
|
run "rm #{current_path}/apc.php"
|
124
124
|
end
|
125
125
|
|
126
126
|
desc "Enable the APC administrative panel"
|
127
|
-
task :enable, :except => { :no_release => true } do
|
127
|
+
task :enable, :roles => :web, :except => { :no_release => true } do
|
128
128
|
run "ln -s /usr/local/lib/php/apc.php #{current_path}/apc.php"
|
129
129
|
end
|
130
130
|
end
|
data/lib/ash/drupal.rb
CHANGED
@@ -35,7 +35,7 @@ configuration.load do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
desc "Setup shared application directories and permissions after initial setup"
|
38
|
-
task :setup_shared
|
38
|
+
task :setup_shared do
|
39
39
|
# remove Capistrano specific directories
|
40
40
|
run "rm -Rf #{shared_path}/log"
|
41
41
|
run "rm -Rf #{shared_path}/pids"
|
@@ -51,7 +51,7 @@ configuration.load do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
54
|
-
task :finalize_update, :except => { :no_release => true } do
|
54
|
+
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
55
55
|
# remove shared directories
|
56
56
|
multisites.each_pair do |folder, url|
|
57
57
|
run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
|
@@ -61,14 +61,14 @@ configuration.load do
|
|
61
61
|
|
62
62
|
namespace :web do
|
63
63
|
desc "Disable the application and show a message screen"
|
64
|
-
task :disable do
|
64
|
+
task :disable, :roles => :web do
|
65
65
|
multisites.each_pair do |folder, url|
|
66
66
|
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes site_offline 1"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
desc "Enable the application and remove the message screen"
|
71
|
-
task :enable do
|
71
|
+
task :enable, :roles => :web do
|
72
72
|
multisites.each_pair do |folder, url|
|
73
73
|
run "#{drush_bin} -l #{url} -r #{latest_release} vdel --yes site_offline"
|
74
74
|
end
|
@@ -98,7 +98,7 @@ configuration.load do
|
|
98
98
|
# --------------------------------------------
|
99
99
|
namespace :drupal do
|
100
100
|
desc "Symlink shared directories"
|
101
|
-
task :symlink, :except => { :no_release => true } do
|
101
|
+
task :symlink, :roles => :web, :except => { :no_release => true } do
|
102
102
|
multisites.each_pair do |folder, url|
|
103
103
|
# symlinks the appropriate environment's settings.php file
|
104
104
|
symlink_config_file
|
@@ -115,7 +115,7 @@ configuration.load do
|
|
115
115
|
settings.<environment>.php => new default
|
116
116
|
settings.php.<environment> => deprecated
|
117
117
|
DESC
|
118
|
-
task :symlink_config_file, :except => { :no_release => true} do
|
118
|
+
task :symlink_config_file, :roles => :web, :except => { :no_release => true} do
|
119
119
|
multisites.each_pair do |folder, url|
|
120
120
|
drupal_app_site_dir = " #{latest_release}/sites/#{url}"
|
121
121
|
|
@@ -131,21 +131,21 @@ configuration.load do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
desc "Replace local database paths with remote paths"
|
134
|
-
task :updatedb, :except => { :no_release => true } do
|
134
|
+
task :updatedb, :roles => :web, :except => { :no_release => true } do
|
135
135
|
multisites.each_pair do |folder, url|
|
136
136
|
run "#{drush_bin} -l #{url} -r #{current_path} sqlq \"UPDATE {files} SET filepath = REPLACE(filepath,'sites/#{folder}/files','sites/#{url}/files');\""
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
140
|
desc "Clear all Drupal cache"
|
141
|
-
task :clearcache, :except => { :no_release => true } do
|
141
|
+
task :clearcache, :roles => :web, :except => { :no_release => true } do
|
142
142
|
multisites.each_pair do |folder, url|
|
143
143
|
run "#{drush_bin} -l #{url} -r #{current_path} cache-clear all"
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
desc "Protect system files"
|
148
|
-
task :protect, :except => { :no_release => true } do
|
148
|
+
task :protect, :roles => :web, :except => { :no_release => true } do
|
149
149
|
multisites.each_pair do |folder, url|
|
150
150
|
run "chmod 644 #{latest_release}/sites/#{url}/settings.php*"
|
151
151
|
end
|
@@ -11,7 +11,7 @@ configuration.load do
|
|
11
11
|
# --------------------------------------------
|
12
12
|
namespace :deploy do
|
13
13
|
desc "Setup shared application directories and permissions after initial setup"
|
14
|
-
task :setup_shared
|
14
|
+
task :setup_shared do
|
15
15
|
# remove Capistrano specific directories
|
16
16
|
run "rm -Rf #{shared_path}/log"
|
17
17
|
run "rm -Rf #{shared_path}/pids"
|
data/lib/ash/hosted_magento.rb
CHANGED
@@ -38,7 +38,7 @@ configuration.load do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
41
|
-
task :finalize_update, :except => { :no_release => true } do
|
41
|
+
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
42
42
|
# synchronize media directory with shared data
|
43
43
|
run "rsync -rltDvzog #{latest_release}/media/ #{shared_path}/media/"
|
44
44
|
|
@@ -56,12 +56,19 @@ configuration.load do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
namespace :magento do
|
60
|
+
desc "Purge Magento cache directory"
|
61
|
+
task :purge_cache, :roles => :web, :except => { :no_release => true } do
|
62
|
+
run "rm -Rf #{shared_path}/var/cache/*"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
59
66
|
# --------------------------------------------
|
60
67
|
# Overloaded Ash tasks
|
61
68
|
# --------------------------------------------
|
62
69
|
namespace :ash do
|
63
70
|
desc "Set standard permissions for Ash servers"
|
64
|
-
task :fixperms, :except => { :no_release => true } do
|
71
|
+
task :fixperms, :roles => :web, :except => { :no_release => true } do
|
65
72
|
# chmod the files and directories.
|
66
73
|
run "find #{latest_release} -type d -exec chmod 755 {} \\;"
|
67
74
|
run "find #{latest_release} -type f -exec chmod 644 {} \\;"
|
data/lib/ash/magento.rb
CHANGED
@@ -25,7 +25,8 @@ configuration.load do
|
|
25
25
|
task :setup_local do
|
26
26
|
# attempt to create files needed for proper deployment
|
27
27
|
system("cp .htaccess htaccess.dist")
|
28
|
-
system("
|
28
|
+
system("cp app/etc/local.xml app/etc/local.xml.staging")
|
29
|
+
system("cp app/etc/local.xml app/etc/local.xml.production")
|
29
30
|
end
|
30
31
|
|
31
32
|
desc "Setup shared application directories and permissions after initial setup"
|
@@ -46,7 +47,7 @@ configuration.load do
|
|
46
47
|
end
|
47
48
|
|
48
49
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
49
|
-
task :finalize_update, :except => { :no_release => true } do
|
50
|
+
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
50
51
|
# synchronize media directory with shared data
|
51
52
|
sudo "rsync -rltDvzog #{latest_release}/media/ #{shared_path}/media/"
|
52
53
|
sudo "chmod -R 777 #{shared_path}/media/"
|
@@ -66,12 +67,12 @@ configuration.load do
|
|
66
67
|
|
67
68
|
namespace :web do
|
68
69
|
desc "Disable the application and show a message screen"
|
69
|
-
task :disable, :except => { :no_release => true } do
|
70
|
+
task :disable, :roles => :web, :except => { :no_release => true } do
|
70
71
|
run "touch #{current_path}/maintenance.flag"
|
71
72
|
end
|
72
73
|
|
73
74
|
desc "Enable the application and remove the message screen"
|
74
|
-
task :enable, :except => { :no_release => true } do
|
75
|
+
task :enable, :roles => :web, :except => { :no_release => true } do
|
75
76
|
run "rm #{current_path}/maintenance.flag"
|
76
77
|
end
|
77
78
|
end
|
@@ -82,7 +83,7 @@ configuration.load do
|
|
82
83
|
# --------------------------------------------
|
83
84
|
namespace :magento do
|
84
85
|
desc "Set appropriate configuration values for the stage"
|
85
|
-
task :activate_config, :except => { :no_release => true } do
|
86
|
+
task :activate_config, :roles => :web, :except => { :no_release => true } do
|
86
87
|
case true
|
87
88
|
when remote_file_exists?("#{latest_release}/app/etc/local.#{stage}.xml")
|
88
89
|
run "cp -f #{latest_release}/app/etc/local.#{stage}.xml #{latest_release}/app/etc/local.xml"
|
@@ -92,7 +93,7 @@ configuration.load do
|
|
92
93
|
end
|
93
94
|
|
94
95
|
desc "Symlink shared directories"
|
95
|
-
task :symlink, :except => { :no_release => true } do
|
96
|
+
task :symlink, :roles => :web, :except => { :no_release => true } do
|
96
97
|
run "ln -nfs #{shared_path}/includes #{current_release}/includes"
|
97
98
|
run "ln -nfs #{shared_path}/media #{current_release}/media"
|
98
99
|
run "ln -nfs #{shared_path}/sitemap #{current_release}/sitemap"
|
@@ -100,12 +101,12 @@ configuration.load do
|
|
100
101
|
end
|
101
102
|
|
102
103
|
desc "Purge Magento cache directory"
|
103
|
-
task :purge_cache, :except => { :no_release => true } do
|
104
|
+
task :purge_cache, :roles => :web, :except => { :no_release => true } do
|
104
105
|
sudo "rm -Rf #{shared_path}/var/cache/*"
|
105
106
|
end
|
106
107
|
|
107
108
|
desc "Watch Magento system log"
|
108
|
-
task :watch_logs, :except => { :no_release => true } do
|
109
|
+
task :watch_logs, :roles => :web, :except => { :no_release => true } do
|
109
110
|
run "tail -f #{shared_path}/var/log/system.log" do |channel, stream, data|
|
110
111
|
puts # for an extra line break before the host name
|
111
112
|
puts "#{channel[:host]}: #{data}"
|
@@ -114,7 +115,7 @@ configuration.load do
|
|
114
115
|
end
|
115
116
|
|
116
117
|
desc "Watch Magento exception log"
|
117
|
-
task :watch_exceptions, :except => { :no_release => true } do
|
118
|
+
task :watch_exceptions, :roles => :web, :except => { :no_release => true } do
|
118
119
|
run "tail -f #{shared_path}/var/log/exception.log" do |channel, stream, data|
|
119
120
|
puts # for an extra line break before the host name
|
120
121
|
puts "#{channel[:host]}: #{data}"
|
@@ -129,4 +130,4 @@ configuration.load do
|
|
129
130
|
|
130
131
|
# update core_config_data; set value = "domain" where scope_id = 0 and path = "web/unsecure/base_url"
|
131
132
|
|
132
|
-
end
|
133
|
+
end
|
data/lib/ash/wordpress.rb
CHANGED
@@ -40,7 +40,7 @@ namespace :deploy do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
43
|
-
task :finalize_update, :except => { :no_release => true } do
|
43
|
+
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
44
44
|
# remove shared directories
|
45
45
|
run "rm -Rf #{latest_release}/#{uploads_path}"
|
46
46
|
run "rm -Rf #{latest_release}/wp-content/cache"
|
@@ -56,14 +56,14 @@ end
|
|
56
56
|
# --------------------------------------------
|
57
57
|
namespace :wordpress do
|
58
58
|
desc "Links the correct settings file"
|
59
|
-
task :symlink do
|
59
|
+
task :symlink, :roles => :web, :except => { :no_release => true } do
|
60
60
|
run "ln -nfs #{shared_path}/uploads #{current_release}/#{uploads_path}"
|
61
61
|
run "ln -nfs #{shared_path}/cache #{current_release}/wp-content/cache"
|
62
62
|
run "ln -nfs #{latest_release}/wp-config.php.#{stage} #{latest_release}/wp-config.php"
|
63
63
|
end
|
64
64
|
|
65
65
|
desc "Set URL in database"
|
66
|
-
task :updatedb do
|
66
|
+
task :updatedb, :roles => :db, :except => { :no_release => true } do
|
67
67
|
run "mysql -u #{dbuser} -p #{dbpass} #{dbname} -e 'UPDATE #{dbprefix}options SET option_value = \"#{application}\" WHERE option_name = \"siteurl\" OR option_name = \"home\"'"
|
68
68
|
end
|
69
69
|
|
data/lib/ash/zend_doctrine.rb
CHANGED
@@ -40,7 +40,7 @@ configuration.load do
|
|
40
40
|
|
41
41
|
namespace :zend do
|
42
42
|
desc "Symlink shared directories"
|
43
|
-
task :symlink, :except => { :no_release => true } do
|
43
|
+
task :symlink, :roles => :web, :except => { :no_release => true } do
|
44
44
|
run "ln -nfs #{shared_path}/var #{current_release}/var"
|
45
45
|
run "ln -nfs #{shared_path}/system #{current_release}/public/system"
|
46
46
|
run "mv #{current_release}/application/configs/application.ini.dist #{current_release}/application/configs/application.ini"
|
@@ -61,7 +61,7 @@ configuration.load do
|
|
61
61
|
|
62
62
|
namespace :doctrine do
|
63
63
|
desc "Run Doctrine Migrations"
|
64
|
-
task :migrate, :except => { :no_release => true } do
|
64
|
+
task :migrate, :roles => :web, :except => { :no_release => true } do
|
65
65
|
puts "Running Doctrine Migrations..."
|
66
66
|
run "cd #{current_release} && ./scripts/doctrine-cli migrate"
|
67
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-08-23 00:00:00.000000000Z
|
14
13
|
dependencies: []
|
15
14
|
description: August Ash recipes for Capistrano
|
16
15
|
email: code@augustash.com
|
@@ -34,7 +33,6 @@ files:
|
|
34
33
|
- lib/ash/wordpress_shared_hosting.rb
|
35
34
|
- lib/ash/zend_doctrine.rb
|
36
35
|
- lib/ash/zend_doctrine_shared_hosting.rb
|
37
|
-
has_rdoc: true
|
38
36
|
homepage: https://github.com/augustash/capistrano-ash
|
39
37
|
licenses: []
|
40
38
|
post_install_message:
|
@@ -55,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
53
|
version: '0'
|
56
54
|
requirements: []
|
57
55
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.6
|
56
|
+
rubygems_version: 1.8.6
|
59
57
|
signing_key:
|
60
58
|
specification_version: 3
|
61
59
|
summary: Useful task libraries for August Ash recipes for Capistrano
|