capistrano-sumo 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/README.md +121 -4
- data/Rakefile +1 -1
- data/capistrano-sumo.gemspec +14 -14
- data/lib/capistrano/sumo/defaults.rb +2 -2
- data/lib/capistrano/sumo/version.rb +1 -1
- data/lib/capistrano/tasks/db.rake +35 -16
- data/lib/capistrano/tasks/files.rake +2 -2
- data/lib/capistrano/tasks/notifications.rake +3 -3
- data/lib/capistrano/tasks/redirect.rake +7 -7
- metadata +8 -9
- data/LICENSE.txt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf87dd89c5c2962bf76386a18b2fba63043c371
|
4
|
+
data.tar.gz: 272acb6133c86bb063d5aed37e2fcf07afd13ea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75aa34cf39b0a38691215bbdabc1e0e178ae1dfc77fb41b488c11f99c1a094bed72927a0adff9b9144c9940d5505992bc655dd123dd7df2684f4095f4d4e42b
|
7
|
+
data.tar.gz: e697d889c7c83186d99a6c4ef6e950eae3f08e3f6ba95196cc93e285ded2314f25585e317e58673d8fbac2cca94d80c3a2cb5668d42d9bac26e9d1aa6f080cfe
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,13 +22,130 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
# Capistrano::Forkcms
|
26
26
|
|
27
|
-
|
27
|
+
Fork CMS specific Capistrano tasks
|
28
28
|
|
29
|
-
|
29
|
+
Capistrano ForkCMS - Easy deployment of ForkCMS 5+ apps with Ruby over SSH.
|
30
30
|
|
31
|
-
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
Add this line to your application's Gemfile:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
gem 'capistrano-forkcms'
|
38
|
+
```
|
39
|
+
|
40
|
+
And then execute:
|
41
|
+
|
42
|
+
$ bundle
|
43
|
+
|
44
|
+
|
45
|
+
## Usage
|
46
|
+
|
47
|
+
Require the module in your Capfile:
|
48
|
+
|
49
|
+
require "capistrano/sumo"
|
50
|
+
|
51
|
+
The plugin comes with some tasks:
|
52
|
+
|
53
|
+
* `sumo:db:create`, which will create the database if it doesn't exists yet, works only on staging.
|
54
|
+
* `sumo:db:get`, which will replace the local database with the remote database.
|
55
|
+
* `sumo:db:info`, which will get info about the database, works only on staging.
|
56
|
+
* `sumo:db:put`, which will replace the remote database with the local database.
|
57
|
+
* `sumo:files:get`, which will downloads the remote files to the local instance.
|
58
|
+
* `sumo:files:put`, which will upload the local files to the remote server.
|
59
|
+
* `sumo:notifications:deploy`, which will notify our webhooks on a deploy.
|
60
|
+
* `sumo:redirect:enable`, which will enable a redirect page, all traffic will be redirected to this page.
|
61
|
+
|
62
|
+
But you won't need any of them as everything is wired automagically if you follow the steps below
|
63
|
+
|
64
|
+
|
65
|
+
## Configuration
|
66
|
+
|
67
|
+
Configuration options:
|
68
|
+
|
69
|
+
...
|
70
|
+
|
71
|
+
## How to use with a fresh Fork install
|
72
|
+
|
73
|
+
1. Create a Capfile with the content below:
|
74
|
+
|
75
|
+
```
|
76
|
+
set :deploy_config_path, 'app/config/capistrano/deploy.rb'
|
77
|
+
set :stage_config_path, 'app/config/capistrano/stages'
|
78
|
+
|
79
|
+
require 'capistrano/setup'
|
80
|
+
require 'capistrano/deploy'
|
81
|
+
require 'capistrano/scm/git'
|
82
|
+
install_plugin Capistrano::SCM::Git
|
83
|
+
require 'capistrano/forkcms'
|
84
|
+
require 'capistrano/sumo'
|
85
|
+
require 'capistrano/deploytags'
|
86
|
+
|
87
|
+
set :format_options, log_file: 'app/logs/capistrano.log'
|
88
|
+
|
89
|
+
Dir.glob('app/config/capistrano/tasks/*.rake').each { |r| import r }
|
90
|
+
```
|
91
|
+
|
92
|
+
2. Create a file called `app/config/capistrano/deploy.rb`, with the content below:
|
93
|
+
|
94
|
+
```
|
95
|
+
set :client, "$the-clients-name"
|
96
|
+
set :project, "$the-project-name"
|
97
|
+
set :repo_url, "$the-repo-url"
|
98
|
+
set :production_url, "$the-production-url"
|
99
|
+
|
100
|
+
### DO NOT EDIT BELOW ###
|
101
|
+
set :application, "#{fetch :project}"
|
102
|
+
|
103
|
+
set :deploytag_utc, false
|
104
|
+
set :deploytag_time_format, "%Y%m%d-%H%M%S"
|
105
|
+
|
106
|
+
set :files_dir, %w(src/Frontend/Files)
|
107
|
+
```
|
108
|
+
|
109
|
+
3. Create a file called `app/config/capistrano/stages/production.rb`, with the content below:
|
110
|
+
|
111
|
+
```
|
112
|
+
server "php71-001.sumohosting.be", user: "$production-user", roles: %w{app db web}
|
113
|
+
|
114
|
+
set :document_root, "/home/$production-user/domains/$domain/public_html"
|
115
|
+
set :deploy_to, "/home/$production-user/apps/#{fetch :project}"
|
116
|
+
|
117
|
+
set :opcache_reset_strategy, "file"
|
118
|
+
set :opcache_reset_base_url, "#{fetch :production_url}"
|
119
|
+
|
120
|
+
### DO NOT EDIT BELOW ###
|
121
|
+
set :keep_releases, 3
|
122
|
+
set :php_bin, "php"
|
123
|
+
|
124
|
+
SSHKit.config.command_map[:composer] = "#{fetch :php_bin} #{shared_path.join("composer.phar")}"
|
125
|
+
SSHKit.config.command_map[:php] = fetch(:php_bin)
|
126
|
+
```
|
127
|
+
|
128
|
+
4. Create a file called `app/config/capistrano/stages/staging.rb`, with the content below:
|
129
|
+
|
130
|
+
```
|
131
|
+
|
132
|
+
### DO NOT EDIT BELOW ###
|
133
|
+
set :branch, "staging"
|
134
|
+
set :document_root, "/home/sites/php71/#{fetch :client}/#{fetch :project}"
|
135
|
+
set :deploy_to, "/home/sites/apps/#{fetch :client}/#{fetch :project}"
|
136
|
+
set :keep_releases, 2
|
137
|
+
set :url, "http://#{fetch :project}.#{fetch :client}.php71.sumocoders.eu"
|
138
|
+
set :fcgi_connection_string, "/var/run/php_71_fpm_sites.sock"
|
139
|
+
set :php_bin, "php7.1"
|
140
|
+
set :php_bin_custom_path, fetch(:php_bin)
|
141
|
+
set :opcache_reset_strategy, "fcgi"
|
142
|
+
set :opcache_reset_fcgi_connection_string, "/var/run/php_71_fpm_sites.sock"
|
143
|
+
|
144
|
+
server "dev02.sumocoders.eu", user: "sites", roles: %w{app db web}
|
145
|
+
|
146
|
+
SSHKit.config.command_map[:composer] = "#{fetch :php_bin} #{shared_path.join("composer.phar")}"
|
147
|
+
SSHKit.config.command_map[:php] = fetch(:php_bin)
|
148
|
+
```
|
32
149
|
|
33
150
|
## Contributing
|
34
151
|
|
data/Rakefile
CHANGED
data/capistrano-sumo.gemspec
CHANGED
@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require "capistrano/sumo/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
7
|
+
spec.name = 'capistrano-sumo'
|
8
|
+
spec.version = Capistrano::Sumo::VERSION
|
9
|
+
spec.authors = ['Tijs Verkoyen']
|
10
|
+
spec.email = ['capistrano-sumo@verkoyen.eu']
|
11
11
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
12
|
+
spec.summary = %q{SumoCoders specific task for Capistrano 3.x.}
|
13
|
+
spec.description = %q{SumoCoders specific task for Capistrano 3.x.}
|
14
|
+
spec.homepage = 'https://github.com/tijsverkoyen/capistrano-sumo'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
|
-
spec.files
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
18
|
f.match(%r{^(test|spec|features)/})
|
19
19
|
end
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
end
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
23
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.6'
|
25
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
namespace :sumo do
|
2
2
|
namespace :db do
|
3
|
-
desc
|
3
|
+
desc 'Create the database if it doesn\'t exists yet'
|
4
4
|
task :create do
|
5
|
-
if fetch(:stage).to_s !=
|
6
|
-
warn Airbrussh::Colors.red('✘') +
|
5
|
+
if fetch(:stage).to_s != 'staging'
|
6
|
+
warn Airbrussh::Colors.red('✘') + ' This task will only work on staging.'
|
7
7
|
exit 1
|
8
8
|
end
|
9
9
|
|
@@ -12,10 +12,10 @@ namespace :sumo do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
desc
|
15
|
+
desc 'Get info about the database'
|
16
16
|
task :info do
|
17
|
-
if fetch(:stage).to_s !=
|
18
|
-
warn Airbrussh::Colors.red('✘') +
|
17
|
+
if fetch(:stage).to_s != 'staging'
|
18
|
+
warn Airbrussh::Colors.red('✘') + ' This task will only work on staging.'
|
19
19
|
exit 1
|
20
20
|
end
|
21
21
|
|
@@ -24,19 +24,31 @@ namespace :sumo do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
desc
|
27
|
+
desc 'Replace the remote database with the local database'
|
28
28
|
task :put do
|
29
29
|
on roles(:db) do
|
30
|
-
execute :mysqldump,
|
30
|
+
execute :mysqldump,
|
31
|
+
'--lock-tables=false',
|
32
|
+
'--set-charset',
|
33
|
+
remote_db_options,
|
34
|
+
extract_from_remote_parameters('database.name'),
|
35
|
+
"> #{shared_path}/backup_#{Time.now.strftime('%Y%m%d%H%M')}.sql"
|
31
36
|
end
|
32
37
|
|
33
38
|
run_locally do
|
34
|
-
execute :mysqldump,
|
39
|
+
execute :mysqldump,
|
40
|
+
'--lock-tables=false',
|
41
|
+
'--set-charset',
|
42
|
+
extract_from_local_parameters('database.name'),
|
43
|
+
'> ./db_upload.tmp.sql'
|
35
44
|
end
|
36
45
|
|
37
46
|
on roles(:db) do
|
38
47
|
upload! File.open('./db_upload.tmp.sql'), "#{shared_path}/db_upload.tmp.sql"
|
39
|
-
execute :mysql,
|
48
|
+
execute :mysql,
|
49
|
+
remote_db_options,
|
50
|
+
extract_from_remote_parameters('database.name'),
|
51
|
+
"< #{shared_path}/db_upload.tmp.sql"
|
40
52
|
execute :rm, "#{shared_path}/db_upload.tmp.sql"
|
41
53
|
end
|
42
54
|
|
@@ -45,15 +57,22 @@ namespace :sumo do
|
|
45
57
|
end
|
46
58
|
end
|
47
59
|
|
48
|
-
desc
|
60
|
+
desc 'Replace the local database with the remote database'
|
49
61
|
task :get do
|
50
62
|
on roles(:db) do
|
51
|
-
execute :mysqldump,
|
63
|
+
execute :mysqldump,
|
64
|
+
'--lock-tables=false',
|
65
|
+
'--set-charset',
|
66
|
+
remote_db_options,
|
67
|
+
extract_from_remote_parameters('database.name'),
|
68
|
+
" > #{shared_path}/db_download.tmp.sql"
|
52
69
|
download! "#{shared_path}/db_download.tmp.sql", './db_download.tmp.sql'
|
53
70
|
end
|
54
71
|
|
55
72
|
run_locally do
|
56
|
-
execute :mysql,
|
73
|
+
execute :mysql,
|
74
|
+
extract_from_local_parameters('database.name'),
|
75
|
+
'< ./db_download.tmp.sql'
|
57
76
|
end
|
58
77
|
|
59
78
|
on roles(:db) do
|
@@ -69,9 +88,9 @@ namespace :sumo do
|
|
69
88
|
private
|
70
89
|
def remote_db_options
|
71
90
|
data = {
|
72
|
-
'host' => extract_from_remote_parameters(
|
73
|
-
'user' => extract_from_remote_parameters(
|
74
|
-
'password' => extract_from_remote_parameters(
|
91
|
+
'host' => extract_from_remote_parameters('database.host'),
|
92
|
+
'user' => extract_from_remote_parameters('database.user'),
|
93
|
+
'password' => extract_from_remote_parameters('database.password'),
|
75
94
|
}
|
76
95
|
options = ''
|
77
96
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
namespace :sumo do
|
2
2
|
namespace :files do
|
3
|
-
desc
|
3
|
+
desc 'Uploads the local files to the remote server'
|
4
4
|
task :put do
|
5
5
|
on roles(:web) do
|
6
6
|
fetch(:files_dir).each do |path|
|
@@ -9,7 +9,7 @@ namespace :sumo do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
desc
|
12
|
+
desc 'Downloads the remote files to the local instance'
|
13
13
|
task :get do
|
14
14
|
on roles(:web) do
|
15
15
|
fetch(:files_dir).each do |path|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
namespace :sumo do
|
2
2
|
namespace :notifications do
|
3
|
-
desc
|
3
|
+
desc 'Notify our webhooks on a deploy'
|
4
4
|
task :deploy do
|
5
5
|
on roles(:web) do
|
6
6
|
execute :curl,
|
7
|
-
|
7
|
+
'-sS',
|
8
8
|
"--data local_username=#{ENV["USER"]}",
|
9
9
|
"--data stage=#{fetch(:stage)}",
|
10
10
|
"--data repo=#{fetch(:repo_url)}",
|
11
11
|
"--data revision=#{capture("cat #{current_path}/REVISION")}",
|
12
|
-
|
12
|
+
'http://bot.sumo.sumoapp.be:3001/deploy/hook'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
namespace :sumo do
|
2
2
|
namespace :redirect do
|
3
|
-
desc
|
3
|
+
desc 'Enable a redirect page, all traffic will be redirected to this page.'
|
4
4
|
task :enable do
|
5
5
|
on roles(:web) do
|
6
|
-
execute :mkdir,
|
7
|
-
execute :wget,
|
8
|
-
execute :wget,
|
9
|
-
execute :sed,
|
10
|
-
execute :rm,
|
11
|
-
execute :ln,
|
6
|
+
execute :mkdir, '-p', "#{shared_path}/redirect"
|
7
|
+
execute :wget, '-qO', "#{shared_path}/redirect/index.php http://static.sumocoders.be/redirect/index.phps"
|
8
|
+
execute :wget, '-qO', "#{shared_path}/redirect/.htaccess http://static.sumocoders.be/redirect/htaccess"
|
9
|
+
execute :sed, '-i', "'s|<real-url>|#{fetch :production_url}|' #{shared_path}/redirect/index.php"
|
10
|
+
execute :rm, '-f', "#{fetch :deploy_to}/current"
|
11
|
+
execute :ln, '-s', "#{shared_path}/redirect #{fetch :deploy_to}/current"
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-sumo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tijs Verkoyen
|
@@ -30,31 +30,31 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
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: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.6'
|
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: '3.
|
55
|
-
description:
|
54
|
+
version: '3.6'
|
55
|
+
description: SumoCoders specific task for Capistrano 3.x.
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- capistrano-sumo@verkoyen.eu
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- ".travis.yml"
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE.md
|
67
|
-
- LICENSE.txt
|
68
67
|
- README.md
|
69
68
|
- Rakefile
|
70
69
|
- capistrano-sumo.gemspec
|
@@ -98,5 +97,5 @@ rubyforge_project:
|
|
98
97
|
rubygems_version: 2.6.11
|
99
98
|
signing_key:
|
100
99
|
specification_version: 4
|
101
|
-
summary:
|
100
|
+
summary: SumoCoders specific task for Capistrano 3.x.
|
102
101
|
test_files: []
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2017 Tijs Verkoyen
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|