capistrano-sozo_magento2 1.6.0 → 1.8.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +5 -1
- data/lib/capistrano/sozo_magento2/defaults.rb +1 -0
- data/lib/capistrano/sozo_magento2/info.rb +1 -0
- data/lib/capistrano/sozo_magento2/version.rb +1 -1
- data/lib/capistrano/sozo_magento2.rb +2 -0
- data/lib/capistrano/tasks/cron.rake +27 -0
- data/lib/capistrano/tasks/deploy.rake +1 -1
- data/lib/capistrano/tasks/magento2.rake +1 -0
- data/lib/capistrano/tasks/server.rake +7 -2
- data/lib/capistrano/tasks/sozo.rake +13 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30ddb4232948b060b40cd21385c277fa47f3f047838b461320638b8a46a7fa72
|
4
|
+
data.tar.gz: 483615f92d6c6f94088702fad14bed24ed4048cd583a0bde96b2182dea144954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c9408af646a0cebe70f06de570403d5ffb40be9fb292c957d638abdc26619454c7c1192c2ec01f44fcde9c563b1e3f682bb6c4fedf5668286aebb40b6cca159
|
7
|
+
data.tar.gz: 28af1de39d23d75249378353572187456f9f5902a073ee1252fa947684da126a050080a5ffae30458f7edf44b421e67b330b3d09de775d37cd766f3a595bb0f8
|
data/CHANGELOG.md
CHANGED
@@ -21,6 +21,20 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
21
21
|
|
22
22
|
## [Unreleased]
|
23
23
|
|
24
|
+
## [v1.8.0] - 2022-10-14
|
25
|
+
### Added
|
26
|
+
- varnish role added to restart varnish service
|
27
|
+
- Ability to completely clear long running cron tasks to stop multiple crons running simultaneously
|
28
|
+
|
29
|
+
|
30
|
+
## [v1.7.0] - 2022-09-22
|
31
|
+
### Changed
|
32
|
+
- Fixed checks for branch existence to include tags.
|
33
|
+
|
34
|
+
### Fixed
|
35
|
+
- When deployment fails due to cleanup task failing.
|
36
|
+
|
37
|
+
|
24
38
|
## [v1.6.0] - 2022-06-18
|
25
39
|
### Added
|
26
40
|
- Ability to copy over multiple themes and specify their name.
|
data/README.md
CHANGED
@@ -7,13 +7,16 @@ It is advised to use bundler.
|
|
7
7
|
|
8
8
|
1. Add the following to your projects `Gemfile`
|
9
9
|
```
|
10
|
-
gem "capistrano-sozo_magento2", "~> 1.
|
10
|
+
gem "capistrano-sozo_magento2", "~> 1.8"
|
11
11
|
```
|
12
12
|
2. Install
|
13
13
|
```
|
14
14
|
bundle install
|
15
15
|
```
|
16
16
|
|
17
|
+
## Updating
|
18
|
+
Update the gem to the latest version with `bundle update capistrano-sozo_magento2 --conservative`
|
19
|
+
|
17
20
|
## Usage
|
18
21
|
Make sure the following lines are added to your project's `Capfile`:
|
19
22
|
```
|
@@ -74,6 +77,7 @@ SSHKit.config.command_map[:php] = '/usr/bin/env php74 -dmemory_limit=-1'
|
|
74
77
|
SSHKit.config.command_map[:composer] = SSHKit.config.command_map[:php], '-f /usr/local/bin/composer'
|
75
78
|
SSHKit.config.command_map[:n98magerun] = SSHKit.config.command_map[:php], '-f /usr/local/bin/n98-magerun'
|
76
79
|
SSHKit.config.command_map[:magento] = SSHKit.config.command_map[:php], '-f bin/magento --'
|
80
|
+
SSHKit.config.command_map[:app_controller] = 'sudo /usr/bin/systemctl'
|
77
81
|
```
|
78
82
|
|
79
83
|
## Versioning
|
@@ -45,6 +45,7 @@ set :magento_deploy_confirm_roles, fetch(:magento_deploy_confirm_roles, [])
|
|
45
45
|
|
46
46
|
# Handle removing and installing of cron tasks?
|
47
47
|
set :handle_cron, fetch(:handle_cron, false)
|
48
|
+
set :clear_cron, fetch(:clear_cron, false)
|
48
49
|
|
49
50
|
# Other defaults (for future use)
|
50
51
|
# Clear or leave the failed deployment dirs
|
@@ -4,6 +4,7 @@ SSHKit.config.command_map[:php] = '/usr/bin/env php -dmemory_limit=-1'
|
|
4
4
|
SSHKit.config.command_map[:composer] = SSHKit.config.command_map[:php], '-f /usr/local/bin/composer'
|
5
5
|
SSHKit.config.command_map[:n98magerun] = SSHKit.config.command_map[:php], '-f /usr/local/bin/n98-magerun'
|
6
6
|
SSHKit.config.command_map[:magento] = SSHKit.config.command_map[:php], '-f bin/magento --'
|
7
|
+
SSHKit.config.command_map[:app_controller] = 'sudo /usr/bin/systemctl'
|
7
8
|
|
8
9
|
load File.expand_path('../tasks/sozo_magento2.rake', __FILE__)
|
9
10
|
load File.expand_path('../tasks/deploy.rake', __FILE__)
|
@@ -15,6 +16,7 @@ load File.expand_path('../tasks/magento2.rake', __FILE__)
|
|
15
16
|
load File.expand_path('../tasks/provision.rake', __FILE__)
|
16
17
|
load File.expand_path('../tasks/server.rake', __FILE__)
|
17
18
|
load File.expand_path('../tasks/wordpress.rake', __FILE__)
|
19
|
+
load File.expand_path('../tasks/cron.rake', __FILE__)
|
18
20
|
|
19
21
|
after 'deploy:check', 'sozo:git:check'
|
20
22
|
after 'deploy:check', 'sozo:info'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
namespace :cron do
|
2
|
+
desc 'Cleanup cron tasks that shouldn\'t be running'
|
3
|
+
task :cleanup do
|
4
|
+
on release_roles :all do
|
5
|
+
if (fetch(:clear_cron).to_s == "true")
|
6
|
+
info "Stopping cron daemon"
|
7
|
+
execute :app_controller, "stop", "crond"
|
8
|
+
|
9
|
+
info "Killing current cron tasks"
|
10
|
+
execute :sudo, "pkill", "-u", "#{fetch(:username)}", "-f", "'cron|consumer'", "||", "true"
|
11
|
+
|
12
|
+
within fetch(:deploy_root) + '/magento2/' do
|
13
|
+
info "Removing Magento cron tasks"
|
14
|
+
execute :rm, "-rf", "var/cron/*"
|
15
|
+
|
16
|
+
info "Truncating cron_schedule table"
|
17
|
+
execute :n98magerun, "db:query", '"truncate cron_schedule;"'
|
18
|
+
end
|
19
|
+
|
20
|
+
info "Starting cron daemon"
|
21
|
+
execute :app_controller, "start", "crond"
|
22
|
+
else
|
23
|
+
info "Cron Clear not controlled by capistrano"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -34,7 +34,7 @@ namespace :deploy do
|
|
34
34
|
directories_str = directories.map do |release|
|
35
35
|
releases_path.join(release)
|
36
36
|
end.join(" ")
|
37
|
-
execute :sudo, 'rm', "-rf", directories_str
|
37
|
+
execute :sudo, 'rm', "-rf", directories_str, "||", "true"
|
38
38
|
# TODO re-symlink the old directory
|
39
39
|
else
|
40
40
|
info t(:no_old_releases, host: host.to_s, keep_releases: keep)
|
@@ -2,10 +2,15 @@ namespace :server do
|
|
2
2
|
namespace :service do
|
3
3
|
desc "Restart the server services"
|
4
4
|
task :restart do
|
5
|
+
on roles(:varnish) do
|
6
|
+
within release_path do
|
7
|
+
execute :app_controller, "restart", "varnish"
|
8
|
+
end
|
9
|
+
end
|
5
10
|
on roles(:gcloud, :aws, :cloud, :dedicated) do
|
6
11
|
within release_path do
|
7
|
-
execute :
|
8
|
-
execute :
|
12
|
+
execute :app_controller, "restart", "php-fpm"
|
13
|
+
execute :app_controller, "restart", "nginx"
|
9
14
|
end
|
10
15
|
end
|
11
16
|
on roles(:cluster) do
|
@@ -15,11 +15,23 @@ namespace :sozo do
|
|
15
15
|
desc "Git branch Check"
|
16
16
|
task :check do
|
17
17
|
on roles(:all) do
|
18
|
+
found = false
|
19
|
+
# Check if branch exists on remote
|
18
20
|
check = capture(:git, 'ls-remote', '--heads', fetch(:repo_url), fetch(:branch), '|', 'wc', '-l')
|
19
21
|
|
20
22
|
if check.to_i == 1
|
21
23
|
info "Branch is available for deployment."
|
22
|
-
|
24
|
+
found = true
|
25
|
+
else
|
26
|
+
# Check if a tag exists on remote
|
27
|
+
check = capture(:git, 'ls-remote', '--tags', fetch(:repo_url), fetch(:branch), '|', 'wc', '-l')
|
28
|
+
if check.to_i == 1
|
29
|
+
info "Tag is available for deployment."
|
30
|
+
found = true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if found == false
|
23
35
|
error "Branch does not exist in git repository, have you pushed your changes?"
|
24
36
|
exit 1
|
25
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-sozo_magento2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clive Walkden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/capistrano/sozo_magento2/slack.rb
|
46
46
|
- lib/capistrano/sozo_magento2/version.rb
|
47
47
|
- lib/capistrano/tasks/composer.rake
|
48
|
+
- lib/capistrano/tasks/cron.rake
|
48
49
|
- lib/capistrano/tasks/db.rake
|
49
50
|
- lib/capistrano/tasks/deploy.rake
|
50
51
|
- lib/capistrano/tasks/magento2.rake
|