capistrano-magento2 0.8.9 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/README.md +23 -23
- data/capistrano-magento2.gemspec +3 -3
- data/lib/capistrano/magento2.rb +0 -22
- data/lib/capistrano/magento2/defaults.rb +7 -5
- data/lib/capistrano/magento2/version.rb +1 -1
- data/lib/capistrano/tasks/deploy.rake +9 -13
- data/lib/capistrano/tasks/magento.rake +65 -105
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b6164feaca7194a6bd34c839c8a11f6faa3e05dee906b015307fe88c51c262b
|
4
|
+
data.tar.gz: 51dcbf3463797d5cfcd682560ec44434f418bd5d365fd2d2afc3b93724b637b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d25dbda35cbd711cd6d067f68deb40c6d2e1712483ada876f6b5b4703110c705246d7f96e01d4af8114ad322258225644e2fa13d4df5b6d076c7304d148a0707
|
7
|
+
data.tar.gz: b7a12464ce89a05041040bb87ecc2e89268f12bd1aebbc5444f3b366ed4b9ef16f6d26f7401917869375e15940b6b77fc41ee885d6c73e71f02880a3c8c4ccd6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,57 @@
|
|
1
1
|
# Capistrano::Magento2 Change Log
|
2
2
|
|
3
|
+
0.9.4
|
4
|
+
=========
|
5
|
+
|
6
|
+
* Updated to now set SELinux context on `var` directory with default type of `httpd_sys_rw_content_t` to allow application writes where SELinux is enabled.
|
7
|
+
|
8
|
+
0.9.3
|
9
|
+
=========
|
10
|
+
|
11
|
+
* Updated to now specify `--non-interactive` flag on `app:config:import` so CLI command will not hang trying for user input.
|
12
|
+
|
13
|
+
0.9.2
|
14
|
+
=========
|
15
|
+
|
16
|
+
* Fixed issue preventing use of `after` tasks on `magento:cache:flush` from being used to trigger service reloads at end of deployment ([issue #143](https://github.com/davidalger/capistrano-magento2/issues/143))
|
17
|
+
* Updated to use DSL method `invoke!` to call iterant tasks ([see capistrano/capistrano/pull/1911](https://github.com/capistrano/capistrano/pull/1911)))
|
18
|
+
|
19
|
+
0.9.1
|
20
|
+
=========
|
21
|
+
|
22
|
+
* Fixed regression in 0.9.0 where relying on the `-l` flag broke multilingual static content deployment ([issue #141](https://github.com/davidalger/capistrano-magento2/issues/141))
|
23
|
+
|
24
|
+
0.9.0
|
25
|
+
=========
|
26
|
+
|
27
|
+
**Upgrade Notes:**
|
28
|
+
|
29
|
+
As of this release only Magento 2.3 and later are supported and **support has been dropped for prior versions** which have long since reached their end-of-life. Moving forward versions past their EOL will no longer be supported by subsequent releases of this gem. Older versions of this gem may continue to be used to deploy older and EOL versions.
|
30
|
+
|
31
|
+
If using a `Gemfile` with Bundler to lock versions of dependencies used for execution, the version lock on `capistrano` should be updated to `~>1.13` to match the minimal requirement of this release, otherwise `bundle update` will fail to update to version `0.9.0` of this gem. The following is recommended:
|
32
|
+
|
33
|
+
```
|
34
|
+
gem 'capistrano', '~> 3.14'
|
35
|
+
gem 'capistrano-magento2', '~> 0.9'
|
36
|
+
```
|
37
|
+
|
38
|
+
If a capistrano version lock is present in a projects `deploy.rb` it will also need to be updated:
|
39
|
+
|
40
|
+
```
|
41
|
+
lock '~> 3.14'
|
42
|
+
```
|
43
|
+
|
44
|
+
**Change Summary:**
|
45
|
+
|
46
|
+
* Dropped support for EOL versions of Magento and scrubbed all gated logic around legacy behaviors in 2.1.x and 2.2.x
|
47
|
+
* Removed `magento:deploy:version_check` task and associated warning when attempting to deploy unsupported versions of Magento
|
48
|
+
* Updated required version of `capistrano` to `~> 1.13` (>=1.13 and less than 2.0)
|
49
|
+
* Resolved inability to use `--dry-run` flag ([issue #128](https://github.com/davidalger/capistrano-magento2/issues/128)) as made possible by the removal of all version related gating logic.
|
50
|
+
* Dropped explicit default of `:magento_deploy_languages`; will now only be passed to `bin/magento` call when set in project configuration.
|
51
|
+
* Updated zero-down deployment logic to rely on `app:config:status` to detect config changes rather than the md5sum of config.php in current and release directories.
|
52
|
+
* Added `magento:app:config:status` to available commands for manual execution.
|
53
|
+
* Fixes issue in 2.3.4 and later where app:config:import may fail if cache:flush is not run immediately prior ([issue #138](https://github.com/davidalger/capistrano-magento2/issues/138))
|
54
|
+
|
3
55
|
0.8.9
|
4
56
|
=========
|
5
57
|
|
data/README.md
CHANGED
@@ -6,7 +6,10 @@ A Capistrano extension for Magento 2 deployments. Takes care of specific Magento
|
|
6
6
|
|
7
7
|
## Supported Magento Versions
|
8
8
|
|
9
|
-
|
9
|
+
The following describes minimum Magento versions supported by releases of this gem. Please use an earlier version to deploy older releases of Magento not supported by the most recent iterations of this gem.
|
10
|
+
|
11
|
+
* Version 0.9.x supports deployment of Magento 2.3.0 and later.
|
12
|
+
* Version 0.7.x supports deployment of Magento 2.1.1 and later.
|
10
13
|
|
11
14
|
## Installation
|
12
15
|
|
@@ -118,35 +121,35 @@ Before you can use Capistrano to deploy, you must configure the `config/deploy.r
|
|
118
121
|
|
119
122
|
### Magento Deploy Settings
|
120
123
|
|
121
|
-
| setting | default
|
122
|
-
| ------------------------------ |
|
123
|
-
| `:magento_deploy_setup_role` | `:all`
|
124
|
-
| `:magento_deploy_cache_shared` | `true`
|
125
|
-
| `:magento_deploy_languages` | `[
|
126
|
-
| `:magento_deploy_themes` | `[]`
|
127
|
-
| `:magento_deploy_jobs` | `
|
128
|
-
| `:magento_deploy_composer` | `true`
|
129
|
-
| `:magento_deploy_production` | `true`
|
130
|
-
| `:magento_deploy_no_dev` | `true`
|
131
|
-
| `:magento_deploy_maintenance` | `true`
|
132
|
-
| `:magento_deploy_confirm` | `[]`
|
133
|
-
| `:magento_deploy_chmod_d` | `2770` | Default permissions applied to all directories in the release path
|
134
|
-
| `:magento_deploy_chmod_f` | `0660` | Default permissions applied to all non-executable files in the release path
|
124
|
+
| setting | default | what it does
|
125
|
+
| ------------------------------ | -------- | ---
|
126
|
+
| `:magento_deploy_setup_role` | `:all` | Role from which primary host is chosen to run things like setup:upgrade on
|
127
|
+
| `:magento_deploy_cache_shared` | `true` | If true, cache operations are restricted to the primary node in setup role
|
128
|
+
| `:magento_deploy_languages` | `[]` | Array of languages passed to static content deploy routine
|
129
|
+
| `:magento_deploy_themes` | `[]` | Array of themes passed to static content deploy
|
130
|
+
| `:magento_deploy_jobs` | `nil` | Number of threads to use for static content deploy
|
131
|
+
| `:magento_deploy_composer` | `true` | Enables composer install behavior in the built-in deploy routine
|
132
|
+
| `:magento_deploy_production` | `true` | Enables production specific DI compilation and static content generation
|
133
|
+
| `:magento_deploy_no_dev` | `true` | Enables use of --no-dev flag on composer install
|
134
|
+
| `:magento_deploy_maintenance` | `true` | Enables use of maintenance mode while magento:setup:upgrade runs
|
135
|
+
| `:magento_deploy_confirm` | `[]` | Used to require confirmation of deployment to a set of capistrano stages
|
136
|
+
| `:magento_deploy_chmod_d` | `'2770'` | Default permissions applied to all directories in the release path
|
137
|
+
| `:magento_deploy_chmod_f` | `'0660'` | Default permissions applied to all non-executable files in the release path
|
135
138
|
| `:magento_deploy_chmod_x` | `['bin/magento']` | Default list of files in release path to set executable bit on
|
136
|
-
| `:
|
139
|
+
| `:magento_deploy_chcon_dirs` | `['var']` | Default list of directories on which to recursively set an SELinux context type
|
140
|
+
| `:magento_deploy_chcon_type` | `httpd_sys_rw_content_t` | Default SELinux context type to set on directories which should be writeable by application
|
141
|
+
| `:magento_deploy_strategy` | `nil` | Can be `quick`, `standard` or `compact`
|
137
142
|
|
138
143
|
#### Example Usage
|
139
144
|
|
140
145
|
Add a line similar to the following in `config/deploy.rb` to set a custom value on one of the above settings:
|
141
146
|
|
142
147
|
```ruby
|
148
|
+
set :magento_deploy_jobs, '$(nproc)'
|
149
|
+
set :magento_deploy_themes, ['Magento/backend', 'Magento/blank']
|
143
150
|
set :magento_deploy_languages, ['en_US', 'en_CA']
|
144
151
|
```
|
145
152
|
|
146
|
-
```ruby
|
147
|
-
set :magento_deploy_composer, false
|
148
|
-
```
|
149
|
-
|
150
153
|
### Capistrano Built-Ins
|
151
154
|
|
152
155
|
For the sake of simplicity in new project setups `:linked_dirs` and `:linked_files` are pre-configured per the following.
|
@@ -154,7 +157,6 @@ For the sake of simplicity in new project setups `:linked_dirs` and `:linked_fil
|
|
154
157
|
```ruby
|
155
158
|
set :linked_files, [
|
156
159
|
'app/etc/env.php',
|
157
|
-
'app/etc/config.local.php',
|
158
160
|
'var/.setup_cronjob_status',
|
159
161
|
'var/.update_cronjob_status'
|
160
162
|
]
|
@@ -178,8 +180,6 @@ If you would like to customize the linked files or directories for your project,
|
|
178
180
|
append :linked_dirs, 'path/to/link'
|
179
181
|
```
|
180
182
|
|
181
|
-
Support for a `app/etc/config.local.php` configuration file was added to Magento 2.1.6. This file will be linked in from the `shared/app/etc` directory as of v0.6.4 of this gem. If this file is present in the project repository, the file will not be linked.
|
182
|
-
|
183
183
|
### Composer Auth Credentials
|
184
184
|
|
185
185
|
Magento 2's composer repository requires auth credentials to install. These can be set on target servers in a global composer `auth.json` file, the project's `composer.json` or by setting them in your deployment configuration using the following two settings:
|
data/capistrano-magento2.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_dependency 'capistrano', '~> 3.
|
30
|
+
spec.add_dependency 'capistrano', '~> 3.14'
|
31
31
|
|
32
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
33
|
-
spec.add_development_dependency 'rake', '~>
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
33
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
34
34
|
end
|
data/lib/capistrano/magento2.rb
CHANGED
@@ -14,10 +14,6 @@ SSHKit.config.command_map[:magento] = "/usr/bin/env php -f bin/magento --"
|
|
14
14
|
module Capistrano
|
15
15
|
module Magento2
|
16
16
|
module Helpers
|
17
|
-
def magento_version
|
18
|
-
return Gem::Version::new((capture :php, "-f #{release_path}/bin/magento -- -V --no-ansi").split(' ').pop)
|
19
|
-
end
|
20
|
-
|
21
17
|
def disabled_modules
|
22
18
|
output = capture :magento, 'module:status --no-ansi'
|
23
19
|
output = output.split("disabled modules:\n", 2)[1]
|
@@ -34,24 +30,6 @@ module Capistrano
|
|
34
30
|
end
|
35
31
|
|
36
32
|
module Setup
|
37
|
-
def static_content_deploy params
|
38
|
-
if magento_version >= Gem::Version.new('2.2.0-rc')
|
39
|
-
# Using -f here just in case MAGE_MODE environment variable in shell is set to something other than production
|
40
|
-
execute :magento, "setup:static-content:deploy -f #{params}"
|
41
|
-
else
|
42
|
-
# Sets pipefail option in shell allowing command exit codes to halt execution when piping command output
|
43
|
-
if not SSHKit.config.command_map[:magento].include? 'set -o pipefail' # avoids trouble on multi-host deploys
|
44
|
-
@@pipefail_less = SSHKit.config.command_map[:magento].dup
|
45
|
-
SSHKit.config.command_map[:magento] = "set -o pipefail; #{@@pipefail_less}"
|
46
|
-
end
|
47
|
-
|
48
|
-
execute :magento, "setup:static-content:deploy #{params} | stdbuf -o0 tr -d ."
|
49
|
-
|
50
|
-
# Unsets pipefail option in shell so it won't affect future command executions
|
51
|
-
SSHKit.config.command_map[:magento] = @@pipefail_less
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
33
|
def deployed_version
|
56
34
|
# Generate a static content version string, but only if one has not already been set on a previous call
|
57
35
|
if not fetch(:magento_static_deployed_version)
|
@@ -9,14 +9,12 @@
|
|
9
9
|
|
10
10
|
set :linked_files, fetch(:linked_files, []).push(
|
11
11
|
'app/etc/env.php',
|
12
|
-
'app/etc/config.local.php',
|
13
12
|
'var/.setup_cronjob_status',
|
14
13
|
'var/.update_cronjob_status'
|
15
14
|
)
|
16
15
|
|
17
16
|
set :linked_files_touch, fetch(:linked_files_touch, []).push(
|
18
17
|
'app/etc/env.php',
|
19
|
-
'app/etc/config.local.php',
|
20
18
|
'var/.setup_cronjob_status',
|
21
19
|
'var/.update_cronjob_status'
|
22
20
|
)
|
@@ -44,16 +42,20 @@ set :magento_deploy_chmod_d, fetch(:magento_deploy_chmod_d, '2770')
|
|
44
42
|
set :magento_deploy_chmod_f, fetch(:magento_deploy_chmod_f, '0660')
|
45
43
|
set :magento_deploy_chmod_x, fetch(:magento_deploy_chmod_x, ['bin/magento'])
|
46
44
|
|
45
|
+
# deploy selinux defaults
|
46
|
+
set :magento_deploy_chcon_dirs, fetch(:magento_deploy_chcon_dirs, ['var'])
|
47
|
+
set :magento_deploy_chcon_type, fetch(:magento_deploy_chcon_type, 'httpd_sys_rw_content_t')
|
48
|
+
|
47
49
|
# deploy configuration defaults
|
48
50
|
set :magento_deploy_composer, fetch(:magento_deploy_composer, true)
|
49
51
|
set :magento_deploy_confirm, fetch(:magento_deploy_confirm, [])
|
50
|
-
set :magento_deploy_languages, fetch(:magento_deploy_languages, [
|
52
|
+
set :magento_deploy_languages, fetch(:magento_deploy_languages, [])
|
51
53
|
set :magento_deploy_maintenance, fetch(:magento_deploy_maintenance, true)
|
52
54
|
set :magento_deploy_production, fetch(:magento_deploy_production, true)
|
53
55
|
set :magento_deploy_no_dev, fetch(:magento_deploy_no_dev, true)
|
54
56
|
set :magento_deploy_themes, fetch(:magento_deploy_themes, [])
|
55
|
-
set :magento_deploy_jobs, fetch(:magento_deploy_jobs, nil)
|
56
|
-
set :magento_deploy_strategy, fetch(:magento_deploy_strategy, nil)
|
57
|
+
set :magento_deploy_jobs, fetch(:magento_deploy_jobs, nil)
|
58
|
+
set :magento_deploy_strategy, fetch(:magento_deploy_strategy, nil)
|
57
59
|
|
58
60
|
# deploy targetting defaults
|
59
61
|
set :magento_deploy_setup_role, fetch(:magento_deploy_setup_role, :all)
|
@@ -11,7 +11,6 @@ include Capistrano::Magento2::Helpers
|
|
11
11
|
|
12
12
|
namespace :deploy do
|
13
13
|
before 'deploy:check:linked_files', 'magento:deploy:check'
|
14
|
-
before 'deploy:symlink:linked_files', 'magento:deploy:local_config'
|
15
14
|
|
16
15
|
# If both 'scopes' and 'themes' are available in app/etc/config.php then the build should not require database or
|
17
16
|
# cache backend configuration to deploy. Removing the link to app/etc/env.php in this case prevents any possible
|
@@ -50,8 +49,8 @@ namespace :deploy do
|
|
50
49
|
task :updated do
|
51
50
|
invoke 'magento:deploy:verify'
|
52
51
|
invoke 'magento:composer:install' if fetch(:magento_deploy_composer)
|
53
|
-
invoke 'magento:deploy:version_check'
|
54
52
|
invoke 'magento:setup:permissions'
|
53
|
+
invoke 'magento:setup:selinux'
|
55
54
|
|
56
55
|
if fetch(:magento_deploy_production)
|
57
56
|
invoke 'magento:setup:static-content:deploy'
|
@@ -65,7 +64,7 @@ namespace :deploy do
|
|
65
64
|
invoke 'magento:deploy:mode:production'
|
66
65
|
end
|
67
66
|
|
68
|
-
invoke 'magento:setup:permissions'
|
67
|
+
invoke! 'magento:setup:permissions'
|
69
68
|
invoke 'magento:maintenance:check'
|
70
69
|
invoke 'magento:maintenance:enable' if fetch(:magento_deploy_maintenance)
|
71
70
|
|
@@ -77,20 +76,17 @@ namespace :deploy do
|
|
77
76
|
end
|
78
77
|
end
|
79
78
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
if not fetch(:magento_internal_zero_down_flag)
|
85
|
-
invoke 'magento:app:config:import'
|
86
|
-
end
|
79
|
+
if not fetch(:magento_internal_zero_down_flag)
|
80
|
+
on cache_hosts do
|
81
|
+
within release_path do
|
82
|
+
execute :magento, 'cache:flush'
|
87
83
|
end
|
88
84
|
end
|
85
|
+
invoke 'magento:app:config:import'
|
86
|
+
invoke 'magento:setup:db:schema:upgrade'
|
87
|
+
invoke 'magento:setup:db:data:upgrade'
|
89
88
|
end
|
90
89
|
|
91
|
-
invoke 'magento:setup:db:schema:upgrade' if not fetch(:magento_internal_zero_down_flag)
|
92
|
-
invoke 'magento:setup:db:data:upgrade' if not fetch(:magento_internal_zero_down_flag)
|
93
|
-
|
94
90
|
on primary fetch(:magento_deploy_setup_role) do
|
95
91
|
within release_path do
|
96
92
|
_disabled_modules = disabled_modules
|
@@ -27,7 +27,16 @@ namespace :magento do
|
|
27
27
|
task :import do
|
28
28
|
on primary fetch(:magento_deploy_setup_role) do
|
29
29
|
within release_path do
|
30
|
-
execute :magento, 'app:config:import'
|
30
|
+
execute :magento, 'app:config:import --no-interaction'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Checks if config propagation requires update'
|
36
|
+
task :status do
|
37
|
+
on primary fetch(:magento_deploy_setup_role) do
|
38
|
+
within release_path do
|
39
|
+
execute :magento, 'app:config:status'
|
31
40
|
end
|
32
41
|
end
|
33
42
|
end
|
@@ -184,19 +193,6 @@ namespace :magento do
|
|
184
193
|
end
|
185
194
|
end
|
186
195
|
|
187
|
-
task :version_check do
|
188
|
-
on release_roles(:all), in: :sequence, wait: 1 do
|
189
|
-
within release_path do
|
190
|
-
_magento_version = magento_version
|
191
|
-
unless _magento_version >= Gem::Version.new('2.1.1')
|
192
|
-
error "\e[0;31mVersion 0.7.0 and later of this gem only support deployment of Magento 2.1.1 or newer; " +
|
193
|
-
"attempted to deploy v" + _magento_version.to_s + ". Please try again using an earlier version of this gem!\e[0m"
|
194
|
-
exit 1 # only need to check a single server, exit immediately
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
196
|
task :check do
|
201
197
|
on release_roles :all do
|
202
198
|
next unless any? :linked_files_touch
|
@@ -231,17 +227,6 @@ namespace :magento do
|
|
231
227
|
end
|
232
228
|
exit 1 if is_err
|
233
229
|
end
|
234
|
-
|
235
|
-
task :local_config do
|
236
|
-
on release_roles :all do
|
237
|
-
if test "[ -f #{release_path}/app/etc/config.local.php ]"
|
238
|
-
info "The repository contains app/etc/config.local.php, removing from :linked_files list."
|
239
|
-
_linked_files = fetch(:linked_files, [])
|
240
|
-
_linked_files.delete('app/etc/config.local.php')
|
241
|
-
set :linked_files, _linked_files
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
230
|
end
|
246
231
|
|
247
232
|
namespace :setup do
|
@@ -258,7 +243,7 @@ namespace :magento do
|
|
258
243
|
end
|
259
244
|
|
260
245
|
namespace :db do
|
261
|
-
desc 'Checks if
|
246
|
+
desc 'Checks if DB schema or data requires upgrade'
|
262
247
|
task :status do
|
263
248
|
on primary fetch(:magento_deploy_setup_role) do
|
264
249
|
within release_path do
|
@@ -311,21 +296,30 @@ namespace :magento do
|
|
311
296
|
end
|
312
297
|
end
|
313
298
|
end
|
314
|
-
Rake::Task['magento:setup:permissions'].reenable ## make task perpetually callable
|
315
299
|
end
|
316
300
|
|
301
|
+
desc 'Sets proper selinux context on directories which are written to by web processes'
|
302
|
+
task :selinux do
|
303
|
+
on release_roles :all do
|
304
|
+
with path: '/usr/sbin:$PATH' do
|
305
|
+
if test "selinuxenabled"
|
306
|
+
within release_path do
|
307
|
+
fetch(:magento_deploy_chcon_dirs).each() do |dir|
|
308
|
+
execute :chcon, "-RP -t #{fetch(:magento_deploy_chcon_type)} #{release_path}/#{dir}"
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
317
316
|
namespace :di do
|
318
317
|
desc 'Runs dependency injection compilation routine'
|
319
318
|
task :compile do
|
320
319
|
on release_roles :all do
|
321
320
|
within release_path do
|
322
321
|
with mage_mode: :production do
|
323
|
-
|
324
|
-
|
325
|
-
# 2.1.x doesn't return a non-zero exit code for certain errors (see davidalger/capistrano-magento2#41)
|
326
|
-
if output.to_s.include? 'Errors during compilation'
|
327
|
-
raise Exception, 'DI compilation command execution failed'
|
328
|
-
end
|
322
|
+
execute :magento, "setup:di:compile"
|
329
323
|
end
|
330
324
|
end
|
331
325
|
end
|
@@ -337,62 +331,36 @@ namespace :magento do
|
|
337
331
|
task :deploy do
|
338
332
|
on release_roles :all do
|
339
333
|
with mage_mode: :production do
|
340
|
-
|
334
|
+
deploy_languages = fetch(:magento_deploy_languages)
|
335
|
+
if deploy_languages.count() > 0
|
336
|
+
deploy_languages = deploy_languages.join(' ').prepend(' ')
|
337
|
+
else
|
338
|
+
deploy_languages = nil
|
339
|
+
end
|
341
340
|
|
342
341
|
deploy_themes = fetch(:magento_deploy_themes)
|
343
|
-
deploy_jobs = fetch(:magento_deploy_jobs)
|
344
|
-
|
345
342
|
if deploy_themes.count() > 0
|
346
343
|
deploy_themes = deploy_themes.join(' -t ').prepend(' -t ')
|
347
344
|
else
|
348
345
|
deploy_themes = nil
|
349
346
|
end
|
350
347
|
|
348
|
+
deploy_jobs = fetch(:magento_deploy_jobs)
|
351
349
|
if deploy_jobs
|
352
|
-
deploy_jobs = "--jobs #{deploy_jobs}
|
350
|
+
deploy_jobs = " --jobs #{deploy_jobs}"
|
353
351
|
else
|
354
352
|
deploy_jobs = nil
|
355
353
|
end
|
356
354
|
|
357
|
-
#
|
358
|
-
# language must be iterated individually. See issue #72 for details.
|
359
|
-
if _magento_version >= Gem::Version.new('2.1.3')
|
360
|
-
deploy_languages = fetch(:magento_deploy_languages)
|
361
|
-
else
|
362
|
-
deploy_languages = [fetch(:magento_deploy_languages).join(' ')]
|
363
|
-
end
|
364
|
-
|
365
|
-
# Magento 2.2 introduced static content compilation strategies that can be one of the following:
|
355
|
+
# Static content compilation strategies that can be one of the following:
|
366
356
|
# quick (default), standard (like previous versions) or compact
|
367
357
|
compilation_strategy = fetch(:magento_deploy_strategy)
|
368
|
-
if compilation_strategy
|
369
|
-
compilation_strategy = "-s #{compilation_strategy}
|
370
|
-
else
|
371
|
-
compilation_strategy = nil
|
358
|
+
if compilation_strategy
|
359
|
+
compilation_strategy = " -s #{compilation_strategy}"
|
372
360
|
end
|
373
361
|
|
374
362
|
within release_path do
|
375
|
-
|
376
|
-
execute :touch, "#{release_path}/pub/static/deployed_version.txt"
|
377
|
-
|
378
|
-
# This loop exists to support deploy on versions where each language must be deployed seperately
|
379
|
-
deploy_languages.each do |lang|
|
380
|
-
static_content_deploy "#{compilation_strategy}#{deploy_jobs}#{lang}#{deploy_themes}"
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
# Run again with HTTPS env var set to 'on' to pre-generate secure versions of RequireJS configs. A
|
385
|
-
# single run on these Magento versions will fail to generate the secure requirejs-config.js file.
|
386
|
-
if _magento_version < Gem::Version.new('2.1.8')
|
387
|
-
deploy_flags = ['css', 'less', 'images', 'fonts', 'html', 'misc', 'html-minify']
|
388
|
-
.join(' --no-').prepend(' --no-');
|
389
|
-
|
390
|
-
within release_path do with(https: 'on') {
|
391
|
-
# This loop exists to support deploy on versions where each language must be deployed seperately
|
392
|
-
deploy_languages.each do |lang|
|
393
|
-
static_content_deploy "#{compilation_strategy}#{deploy_jobs}#{lang}#{deploy_themes}#{deploy_flags}"
|
394
|
-
end
|
395
|
-
} end
|
363
|
+
execute :magento, "setup:static-content:deploy#{compilation_strategy}#{deploy_jobs}#{deploy_languages}#{deploy_themes}"
|
396
364
|
end
|
397
365
|
|
398
366
|
# Set the deployed_version of static content to ensure it matches across all hosts
|
@@ -450,51 +418,43 @@ namespace :magento do
|
|
450
418
|
end
|
451
419
|
|
452
420
|
within release_path do
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
info "Checking database status..."
|
458
|
-
# Check setup:db:status output and disable maintenance mode if all modules are up-to-date
|
459
|
-
database_status = capture :magento, 'setup:db:status', raise_on_non_zero_exit: false
|
460
|
-
|
461
|
-
if database_status.to_s.include? 'All modules are up to date'
|
462
|
-
info "All modules are up to date. No database updates should occur during this release."
|
463
|
-
info ""
|
464
|
-
disable_maintenance = true
|
465
|
-
else
|
466
|
-
puts " #{database_status.gsub("\n", "\n ").sub("Run 'setup:upgrade' to update your DB schema and data.", "")}"
|
467
|
-
end
|
421
|
+
info "Checking database status..."
|
422
|
+
# Check setup:db:status output and if out-of-date do not disable maintenance mode
|
423
|
+
database_status = capture :magento, 'setup:db:status', raise_on_non_zero_exit: false
|
424
|
+
database_uptodate = false
|
468
425
|
|
469
|
-
|
470
|
-
info "
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
end
|
426
|
+
if database_status.to_s.include? 'All modules are up to date'
|
427
|
+
info "All modules are up to date."
|
428
|
+
info ""
|
429
|
+
database_uptodate = true
|
430
|
+
else
|
431
|
+
puts " #{database_status.gsub("\n", "\n ").sub(" Run 'setup:upgrade' to update your DB schema and data.", "")}"
|
432
|
+
end
|
477
433
|
|
478
|
-
|
479
|
-
|
480
|
-
|
434
|
+
# Check app:config:status output and if out-of-date do not disable maintenance mode
|
435
|
+
info "Checking config status..."
|
436
|
+
config_status = capture :magento, 'app:config:status', raise_on_non_zero_exit: false
|
437
|
+
config_uptodate = false
|
481
438
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
info ""
|
439
|
+
if config_status.to_s.include? 'Config files are up to date'
|
440
|
+
info "Config files are up to date."
|
441
|
+
config_uptodate = true
|
442
|
+
else
|
443
|
+
puts " #{config_status.gsub("\n", "\n ").sub(" Run app:config:import or setup:upgrade command to synchronize configuration.", "")}"
|
488
444
|
end
|
445
|
+
info ""
|
489
446
|
|
490
|
-
|
491
|
-
|
447
|
+
# If both checks above reported up-to-date status checks disable maintenance mode
|
448
|
+
if database_uptodate and config_uptodate
|
449
|
+
disable_maintenance = true
|
492
450
|
end
|
493
451
|
|
494
452
|
if maintenance_enabled
|
453
|
+
info "Disabling maintenance mode management..."
|
495
454
|
info "Maintenance mode was already active prior to deploy."
|
496
455
|
set :magento_deploy_maintenance, false
|
497
456
|
elsif disable_maintenance
|
457
|
+
info "Disabling maintenance mode management..."
|
498
458
|
info "There are no database updates or config changes. This is a zero-down deployment."
|
499
459
|
set :magento_internal_zero_down_flag, true # Set internal flag to stop db schema/data upgrades from running
|
500
460
|
set :magento_deploy_maintenance, false # Disable maintenance mode management since it is not neccessary
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-magento2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Alger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.14'
|
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: '3.
|
26
|
+
version: '3.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :development
|
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: '2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
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: '13.0'
|
55
55
|
description: A Capistrano extension for Magento 2 deployments. Takes care of specific
|
56
56
|
Magento 2 requirements and adds tasks specific to the Magento 2 application.
|
57
57
|
email:
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.1.2
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: A Capistrano extension for Magento 2 deployments.
|