deploy_mate 0.20 → 0.25
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/.travis.yml +3 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -2
- data/LICENSE.txt +21 -0
- data/README.md +1 -1
- data/Rakefile +5 -1
- data/deploy-mate.gemspec +8 -6
- data/lib/capistrano/deploy_mate_defaults.rb +5 -5
- data/lib/capistrano/helpers.rb +2 -2
- data/lib/capistrano/modules/aptitude.rb +2 -4
- data/lib/capistrano/modules/bluepill.rb +0 -2
- data/lib/capistrano/modules/shell.rb +0 -2
- data/lib/capistrano/modules/upstart.rb +0 -2
- data/lib/capistrano/modules/user_management.rb +0 -2
- data/lib/capistrano/tasks/elasticsearch.rake +2 -2
- data/lib/capistrano/tasks/logrotate.rake +0 -1
- data/lib/capistrano/tasks/machine.rake +16 -17
- data/lib/capistrano/tasks/nginx.rake +0 -1
- data/lib/capistrano/tasks/puma.rake +0 -1
- data/lib/capistrano/tasks/rvm.rake +16 -16
- data/lib/capistrano/tasks/seeds.rake +0 -3
- data/lib/capistrano/tasks/unicorn.rake +0 -1
- data/lib/capistrano/tasks/upstart.rake +0 -1
- data/lib/deploy_mate/tasks.rake +11 -8
- data/lib/deploy_mate/templates/deploy/stage.rb.erb +4 -4
- data/lib/deploy_mate/templates/deploy.rb.erb +1 -2
- data/lib/deploy_mate/templates/deploy_mate.yml.erb +32 -28
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4688cb4bbaaac7d4f9ca94f23ceae0c00444bbee
|
|
4
|
+
data.tar.gz: d4f5f27b8e5934f6762feb513538147663e40e0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6efc0d11872ede6f98f931fc4c719794fb173f9ae4ef79986c8998d8318aabbe24fff6e9e091be334b2c8a7c3db6b53c91ec8083ae06124514a89a251a5e5352
|
|
7
|
+
data.tar.gz: 0afcd367fd83b0ac36871375038d3d72d97b347b9123f17b83aa7c2f603dbf5025993a092c0499ead7d7770e72ec68d8e29d3295ff85db8df221a00259c3451f
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
* **0.25 (2016-05-23)**: Support multiple stages in YAML-file.
|
|
1
2
|
* **0.2 (2016-05-18)**: Configuration moved to YAML-file. SSH-Keys optional. Config-templates overwritable locally.
|
|
2
3
|
* **0.18.4 (2016-03-22)**: Added mandatory task to install `ssh_key`s
|
|
3
4
|
* **0.18.2 (2016-03-08)**: Added basic DDoS and flooding-proof via nginx `req_limit` and `fail2ban`
|
data/Gemfile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
|
-
gemspec
|
|
2
|
+
gemspec
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
deploy_mate (0.
|
|
4
|
+
deploy_mate (0.20)
|
|
5
5
|
capistrano (~> 3.0)
|
|
6
6
|
capistrano-bundler
|
|
7
7
|
capistrano-rails
|
|
@@ -10,6 +10,7 @@ PATH
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
+
ast (2.2.0)
|
|
13
14
|
capistrano (3.4.0)
|
|
14
15
|
i18n
|
|
15
16
|
rake (>= 10.0.0)
|
|
@@ -24,16 +25,29 @@ GEM
|
|
|
24
25
|
net-scp (1.2.1)
|
|
25
26
|
net-ssh (>= 2.6.5)
|
|
26
27
|
net-ssh (3.0.2)
|
|
28
|
+
parser (2.3.0.4)
|
|
29
|
+
ast (~> 2.2)
|
|
30
|
+
powerpack (0.1.1)
|
|
31
|
+
rainbow (2.1.0)
|
|
27
32
|
rake (10.5.0)
|
|
33
|
+
rubocop (0.37.1)
|
|
34
|
+
parser (>= 2.3.0.4, < 3.0)
|
|
35
|
+
powerpack (~> 0.1)
|
|
36
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
37
|
+
ruby-progressbar (~> 1.7)
|
|
38
|
+
unicode-display_width (~> 0.3)
|
|
39
|
+
ruby-progressbar (1.7.5)
|
|
28
40
|
sshkit (1.8.1)
|
|
29
41
|
net-scp (>= 1.1.2)
|
|
30
42
|
net-ssh (>= 2.8.0)
|
|
43
|
+
unicode-display_width (0.3.1)
|
|
31
44
|
|
|
32
45
|
PLATFORMS
|
|
33
46
|
ruby
|
|
34
47
|
|
|
35
48
|
DEPENDENCIES
|
|
36
49
|
deploy_mate!
|
|
50
|
+
rubocop
|
|
37
51
|
|
|
38
52
|
BUNDLED WITH
|
|
39
|
-
1.
|
|
53
|
+
1.12.4
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Hanse Ventures BSJ GmbH
|
|
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.
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# The sturdy d'ploy-mate
|
|
1
|
+
# The sturdy d'ploy-mate [](https://travis-ci.org/johanness/deploy-mate) [](https://codeclimate.com/github/johanness/deploy-mate)
|
|
2
2
|
<img src="http://hanseventures.s3.amazonaws.com/github/pirate-redbeard_1024.png" width="300" />
|
|
3
3
|
> T'arrust me, bucko. I can do it.
|
|
4
4
|
|
data/Rakefile
CHANGED
data/deploy-mate.gemspec
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "deploy_mate"
|
|
3
|
-
s.version = "0.
|
|
3
|
+
s.version = "0.25"
|
|
4
4
|
|
|
5
5
|
s.authors = ["Tim Adler", "Marcus Geißler", "Johannes Strampe"]
|
|
6
|
-
s.date =
|
|
7
|
-
s.description =
|
|
6
|
+
s.date = '2016-05-23'
|
|
7
|
+
s.description = 'This is how we deploy around here.'
|
|
8
8
|
s.summary = s.description
|
|
9
|
-
s.email =
|
|
9
|
+
s.email = 'development (at) hanseventures (dot) com'
|
|
10
10
|
s.license = "MIT"
|
|
11
11
|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
|
13
13
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
14
|
-
s.homepage =
|
|
14
|
+
s.homepage = 'https://github.com/hanseventures/deploy-mate'
|
|
15
15
|
s.require_paths = ["lib"]
|
|
16
|
-
s.rubygems_version =
|
|
16
|
+
s.rubygems_version = '1.6.2'
|
|
17
17
|
|
|
18
18
|
s.add_dependency 'capistrano', '~> 3.0'
|
|
19
19
|
s.add_dependency 'capistrano-bundler'
|
|
20
20
|
s.add_dependency 'capistrano-rails'
|
|
21
21
|
s.add_dependency 'rake'
|
|
22
|
+
|
|
23
|
+
s.add_development_dependency 'rubocop'
|
|
22
24
|
end
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
# This file contains default values for all projects
|
|
2
|
-
set :log_level, :info
|
|
2
|
+
set :log_level, fetch(:log_level, :info)
|
|
3
3
|
|
|
4
4
|
set :user, "ubuntu"
|
|
5
5
|
set :group, "www-data"
|
|
6
6
|
|
|
7
7
|
set :pty, true
|
|
8
8
|
set :rvm_ruby_version, "ruby-2.2.0"
|
|
9
|
-
set :rvm_map_bins, %w
|
|
9
|
+
set :rvm_map_bins, %w(gem rake ruby rvmsudo bundle)
|
|
10
10
|
|
|
11
11
|
set :deploy_to, "/srv/#{fetch(:application)}"
|
|
12
|
-
set :linked_dirs, fetch(:linked_dirs, []).push(*%w
|
|
12
|
+
set :linked_dirs, fetch(:linked_dirs, []).push(*%w(log vendor/bundle system/pids system/sockets public/assets))
|
|
13
13
|
|
|
14
14
|
set :keep_releases, 3
|
|
15
|
-
set :ssh_options,
|
|
15
|
+
set :ssh_options, forward_agent: true
|
|
16
16
|
|
|
17
17
|
# bundler config
|
|
18
18
|
set :bundle_flags, "--deployment"
|
|
19
|
-
set :bundle_without, %w
|
|
19
|
+
set :bundle_without, %w(development test).join(' ')
|
|
20
20
|
set :bundle_exec, "bundle exec"
|
|
21
21
|
|
|
22
22
|
# app server
|
data/lib/capistrano/helpers.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
def template(from, to)
|
|
5
5
|
path = File.expand_path("lib/capistrano/configs/#{from}", ENV['PWD'])
|
|
6
|
-
path = File.expand_path("../configs/#{from}", __FILE__) unless File.
|
|
6
|
+
path = File.expand_path("../configs/#{from}", __FILE__) unless File.exist?(path)
|
|
7
7
|
erb = File.read(path)
|
|
8
8
|
compiled = ERB.new(erb).result(binding)
|
|
9
9
|
io = StringIO.new(compiled)
|
|
@@ -15,7 +15,7 @@ def set_default(name, *args, &block)
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def execute_script(name, params = "")
|
|
18
|
-
upload! File.expand_path("../scripts/#{name}", __FILE__),
|
|
18
|
+
upload! File.expand_path("../scripts/#{name}", __FILE__), name.to_s
|
|
19
19
|
execute "chmod 755 #{name}"
|
|
20
20
|
execute "./#{name} #{params}"
|
|
21
21
|
execute "rm #{name}"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
module Aptitude
|
|
2
|
-
|
|
3
2
|
def apt_get_update
|
|
4
3
|
sudo "apt-get -y update"
|
|
5
4
|
end
|
|
@@ -12,8 +11,7 @@ module Aptitude
|
|
|
12
11
|
sudo "sudo apt-get -y autoremove #{package_name}"
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
def
|
|
16
|
-
|
|
14
|
+
def package_installed?(package_name)
|
|
15
|
+
!/(Installed: \(none\)|Unable to locate package)/.match(capture("apt-cache policy #{package_name}"))
|
|
17
16
|
end
|
|
18
|
-
|
|
19
17
|
end
|
|
@@ -4,8 +4,8 @@ namespace :elasticsearch do
|
|
|
4
4
|
include Aptitude
|
|
5
5
|
task :install do
|
|
6
6
|
on roles(:search) do
|
|
7
|
-
unless
|
|
8
|
-
apt_get_install("openjdk-7-jre-headless") unless
|
|
7
|
+
unless package_installed?("elasticsearch")
|
|
8
|
+
apt_get_install("openjdk-7-jre-headless") unless package_installed?("openjdk-7-jre-headless")
|
|
9
9
|
execute "wget -qO - https://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -"
|
|
10
10
|
sudo "add-apt-repository 'deb http://packages.elasticsearch.org/elasticsearch/#{fetch(:elasticsearch_version)}/debian stable main'"
|
|
11
11
|
apt_get_update
|
|
@@ -36,7 +36,7 @@ namespace :machine do
|
|
|
36
36
|
unless am_i?("ubuntu")
|
|
37
37
|
execute_script("create_ubuntu_user.sh") # Creates an Amazon AWS-style 'ubuntu'-user on machines with only 'root'
|
|
38
38
|
error "Please use a use a user named 'ubuntu' to login to the machine."
|
|
39
|
-
|
|
39
|
+
raise
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -70,7 +70,7 @@ namespace :machine do
|
|
|
70
70
|
|
|
71
71
|
task :language_pack_de do
|
|
72
72
|
on roles(:app) do
|
|
73
|
-
apt_get_install("language-pack-de") unless
|
|
73
|
+
apt_get_install("language-pack-de") unless package_installed?("language-pack-de")
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -104,44 +104,44 @@ namespace :machine do
|
|
|
104
104
|
|
|
105
105
|
task :imagemagick do
|
|
106
106
|
on roles(:app) do
|
|
107
|
-
apt_get_install("imagemagick") unless
|
|
107
|
+
apt_get_install("imagemagick") unless package_installed?("imagemagick")
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
task :memcached do
|
|
112
112
|
on roles(:app) do
|
|
113
|
-
apt_get_install("memcached") unless
|
|
113
|
+
apt_get_install("memcached") unless package_installed?("memcached")
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
task :mysql_dev do
|
|
118
118
|
on roles(:app) do
|
|
119
|
-
apt_get_install("libmysqlclient-dev") unless
|
|
119
|
+
apt_get_install("libmysqlclient-dev") unless package_installed?("libmysqlclient-dev")
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
task :postgres_dev do
|
|
124
124
|
on roles(:app) do
|
|
125
|
-
apt_get_install("libpq-dev") unless
|
|
126
|
-
apt_get_install("postgresql-client") unless
|
|
125
|
+
apt_get_install("libpq-dev") unless package_installed?("libpq-dev")
|
|
126
|
+
apt_get_install("postgresql-client") unless package_installed?("postgresql-client")
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
task :htop do
|
|
131
131
|
on roles(:app) do
|
|
132
|
-
apt_get_install("htop") unless
|
|
132
|
+
apt_get_install("htop") unless package_installed?("htop")
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
task :nodejs do
|
|
137
137
|
on roles(:app) do
|
|
138
|
-
apt_get_install("nodejs") unless
|
|
138
|
+
apt_get_install("nodejs") unless package_installed?("nodejs")
|
|
139
139
|
end
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
task :ntp do
|
|
143
143
|
on roles(:app) do
|
|
144
|
-
apt_get_install("ntp") unless
|
|
144
|
+
apt_get_install("ntp") unless package_installed?("ntp")
|
|
145
145
|
sudo "chmod 666 /etc/timezone"
|
|
146
146
|
execute 'echo "Europe/Berlin" > /etc/timezone'
|
|
147
147
|
sudo "chmod 644 /etc/timezone"
|
|
@@ -151,25 +151,25 @@ namespace :machine do
|
|
|
151
151
|
|
|
152
152
|
task :git do
|
|
153
153
|
on roles(:app) do
|
|
154
|
-
apt_get_install("git") unless
|
|
154
|
+
apt_get_install("git") unless package_installed?("git")
|
|
155
155
|
end
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
task :nginx do
|
|
159
159
|
on roles(:app) do
|
|
160
|
-
apt_get_install("nginx") unless
|
|
160
|
+
apt_get_install("nginx") unless package_installed?("nginx")
|
|
161
161
|
end
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
task :fail2ban do
|
|
165
165
|
on roles(:app) do
|
|
166
|
-
apt_get_install("fail2ban") unless
|
|
166
|
+
apt_get_install("fail2ban") unless package_installed?("fail2ban")
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
task :imagemagick do
|
|
171
171
|
on roles(:app) do
|
|
172
|
-
unless
|
|
172
|
+
unless package_installed?("imagemagick")
|
|
173
173
|
apt_get_install("imagemagick")
|
|
174
174
|
apt_get_install("libmagickcore-dev")
|
|
175
175
|
apt_get_install("libmagickwand-dev")
|
|
@@ -179,7 +179,7 @@ namespace :machine do
|
|
|
179
179
|
|
|
180
180
|
task :unattended_upgrades do
|
|
181
181
|
on roles(:app) do
|
|
182
|
-
unless
|
|
182
|
+
unless package_installed?("unattended-upgrades")
|
|
183
183
|
apt_get_install("unattended-upgrades")
|
|
184
184
|
end
|
|
185
185
|
end
|
|
@@ -209,7 +209,7 @@ namespace :machine do
|
|
|
209
209
|
end
|
|
210
210
|
end
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
raise "No ssh-keys found in #{file_patterns.join(',')}." unless keys.any?
|
|
213
213
|
|
|
214
214
|
upload!(StringIO.new(keys.join("")), 'new_keys')
|
|
215
215
|
sudo "rm ~/.ssh/authorized_keys"
|
|
@@ -224,5 +224,4 @@ namespace :machine do
|
|
|
224
224
|
end
|
|
225
225
|
before "machine:install:rvm", "machine:install:update_rvm_key"
|
|
226
226
|
end
|
|
227
|
-
|
|
228
227
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
RVM_SYSTEM_PATH = "/usr/local/rvm"
|
|
2
|
-
RVM_USER_PATH = "~/.rvm"
|
|
1
|
+
RVM_SYSTEM_PATH = "/usr/local/rvm".freeze
|
|
2
|
+
RVM_USER_PATH = "~/.rvm".freeze
|
|
3
3
|
|
|
4
4
|
namespace :rvm do
|
|
5
5
|
desc "Prints the RVM and Ruby version on the target host"
|
|
@@ -19,19 +19,19 @@ namespace :rvm do
|
|
|
19
19
|
on roles(fetch(:rvm_roles, :all)) do
|
|
20
20
|
rvm_path = fetch(:rvm_custom_path)
|
|
21
21
|
rvm_path ||= case fetch(:rvm_type)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
when :auto
|
|
23
|
+
if test("[ -d #{RVM_USER_PATH} ]")
|
|
24
|
+
RVM_USER_PATH
|
|
25
|
+
elsif test("[ -d #{RVM_SYSTEM_PATH} ]")
|
|
26
|
+
RVM_SYSTEM_PATH
|
|
27
|
+
else
|
|
28
|
+
RVM_USER_PATH
|
|
29
|
+
end
|
|
30
|
+
when :system, :mixed
|
|
31
|
+
RVM_SYSTEM_PATH
|
|
32
|
+
else # :user
|
|
33
|
+
RVM_USER_PATH
|
|
34
|
+
end
|
|
35
35
|
|
|
36
36
|
set :rvm_path, rvm_path
|
|
37
37
|
end
|
|
@@ -49,7 +49,7 @@ before :deploy, 'rvm:hook'
|
|
|
49
49
|
|
|
50
50
|
namespace :load do
|
|
51
51
|
task :defaults do
|
|
52
|
-
set :rvm_map_bins, %w
|
|
52
|
+
set :rvm_map_bins, %w(gem rake ruby bundle)
|
|
53
53
|
set :rvm_type, :auto
|
|
54
54
|
set :rvm_ruby_version, "default"
|
|
55
55
|
end
|
data/lib/deploy_mate/tasks.rake
CHANGED
|
@@ -7,6 +7,7 @@ namespace :deploy_mate do
|
|
|
7
7
|
@imagemagick = to_h(imagemagick?)
|
|
8
8
|
@sidekiq = to_h(sidekiq?)
|
|
9
9
|
@memcached = to_h(memcached?)
|
|
10
|
+
@stages = %w(prestage production)
|
|
10
11
|
|
|
11
12
|
puts "Creating default template:\n\n"
|
|
12
13
|
puts "\t" + config_template('deploy_mate.yml.erb', 'config/deploy_mate.yml')
|
|
@@ -15,11 +16,16 @@ namespace :deploy_mate do
|
|
|
15
16
|
|
|
16
17
|
task :install do
|
|
17
18
|
@config = YAML.load_file(File.expand_path('config/deploy_mate.yml', ENV['PWD']))
|
|
19
|
+
|
|
18
20
|
puts "Creating capistrano deployment files:\n"
|
|
19
|
-
FileUtils.mkdir_p("config/deploy") unless File.
|
|
21
|
+
FileUtils.mkdir_p("config/deploy") unless File.exist?("config/deploy")
|
|
20
22
|
puts config_template("Capfile.erb", "Capfile")
|
|
21
23
|
puts config_template("deploy.rb.erb", "config/deploy.rb")
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
@config['stages'].each do |stage_config|
|
|
26
|
+
@stage_config = stage_config
|
|
27
|
+
puts config_template("deploy/stage.rb.erb", "config/deploy/#{@stage_config['stage_name']}.rb")
|
|
28
|
+
end
|
|
23
29
|
end
|
|
24
30
|
end
|
|
25
31
|
|
|
@@ -51,16 +57,13 @@ def guess_app_name
|
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
def guess_ruby_version
|
|
54
|
-
ruby_version = nil
|
|
55
60
|
ruby_version = cat_file(".ruby-version")
|
|
56
61
|
ruby_version.strip! if ruby_version
|
|
57
62
|
unless ruby_version
|
|
58
63
|
gem_file_content = cat_file("Gemfile")
|
|
59
64
|
if gem_file_content
|
|
60
|
-
match =
|
|
61
|
-
if match
|
|
62
|
-
ruby_version = "ruby-" + match["version"]
|
|
63
|
-
end
|
|
65
|
+
match = gem_file_content.match("^ruby '(?<version>[0-9.]*)'")
|
|
66
|
+
ruby_version = "ruby-" + match["version"] if match
|
|
64
67
|
end
|
|
65
68
|
end
|
|
66
69
|
ruby_version
|
|
@@ -71,5 +74,5 @@ def to_h(value)
|
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
def cat_file(filename)
|
|
74
|
-
File.open(filename, "rb"
|
|
77
|
+
File.open(filename, "rb", &:read) if File.exist?(filename)
|
|
75
78
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
server "<%= @
|
|
1
|
+
server "<%= @stage_config['ssh_name'] %>", roles: [:app, :db, :web<% if @config['elasticsearch'] %>, :search<% end %>], :primary => true
|
|
2
2
|
|
|
3
3
|
set :unicorn_workers, "2"
|
|
4
|
-
set :nginx_server_name, "<%= @
|
|
4
|
+
set :nginx_server_name, "<%= @stage_config['host_name'] %>"
|
|
5
5
|
|
|
6
|
-
set :environment, "<%= @
|
|
7
|
-
set :branch, ENV.fetch("branch", "<%= @
|
|
6
|
+
set :environment, "<%= @stage_config['environment'] %>"
|
|
7
|
+
set :branch, ENV.fetch("branch", "<%= @stage_config['branch_name'] %>")
|
|
@@ -6,8 +6,7 @@ require "capistrano/deploy_mate_defaults"
|
|
|
6
6
|
set :rvm_ruby_version, '<%= @config['ruby_version'] %>'
|
|
7
7
|
|
|
8
8
|
# Set app specific vars
|
|
9
|
-
set :
|
|
10
|
-
set :default_stage, '<%= @config['stage_name'] %>'
|
|
9
|
+
set :default_stage, '<%= @config['stages'][0]['stage_name'] %>'
|
|
11
10
|
set :repo_url, '<%= @config['repo_url'] %>'
|
|
12
11
|
set :db_engine, '<%= @config['db_engine'] %>'
|
|
13
12
|
set :app_server, '<%= @config['app_server'] %>'
|
|
@@ -13,40 +13,44 @@
|
|
|
13
13
|
# The url of your GIT repository.
|
|
14
14
|
repo_url: "git@github.com:your-github-name/<%= @app_name %>.git"
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
|
|
17
|
+
# The following lists the configs for every stage that a deployment will
|
|
18
|
+
# be generated for
|
|
19
|
+
stages:
|
|
20
|
+
<% @stages.each do |stage| %>
|
|
21
|
+
# Name of the stage
|
|
22
|
+
- stage_name: <%= stage %>
|
|
23
|
+
|
|
24
|
+
# Under which rails environment will the application run on <%= stage %>.
|
|
25
|
+
environment: <%= stage %>
|
|
26
|
+
|
|
27
|
+
# Which GIT branch should be deployed to <%= stage %> by default?
|
|
28
|
+
# You can overrule this value by providing a branch on the deployment command:
|
|
29
|
+
#
|
|
30
|
+
# bundle exec cap <%= stage %> deploy branch=feature/xyz
|
|
31
|
+
branch_name: <%= (stage == 'production' ? 'master' : 'dev') %>
|
|
32
|
+
|
|
33
|
+
# Which is the ssh shortcut to connect to the <%= stage %>-server. It should be configured
|
|
34
|
+
# in your ~/.ssh/config. You should be able to connect to the server using:
|
|
35
|
+
#
|
|
36
|
+
# ssh specified_ssh_name
|
|
37
|
+
#
|
|
38
|
+
ssh_name: <%= stage %>-server
|
|
39
|
+
|
|
40
|
+
# Under which URL should your server be available? An IP address does the job
|
|
41
|
+
# too
|
|
42
|
+
host_name: example.com
|
|
43
|
+
<% end %>
|
|
44
|
+
|
|
45
|
+
# Since you are able to connect to your with the specified ssh shortcurt,
|
|
46
|
+
# usually more persons should be able to access them. You can specify a list of
|
|
39
47
|
# public ssh keys which will be copied to the ~/.ssh/authorized_keys file on the
|
|
40
48
|
# server. If the list is empty, the current key setting will be left untouched on
|
|
41
49
|
# the server.
|
|
42
50
|
ssh_file_names:
|
|
43
51
|
- "~/.ssh/*.pub"
|
|
44
52
|
|
|
45
|
-
#
|
|
46
|
-
# too
|
|
47
|
-
host_name: example.com
|
|
48
|
-
|
|
49
|
-
# The ruby version, that will be installed and used on the server. It is used
|
|
53
|
+
# The ruby version, that will be installed and used on the servers. It is used
|
|
50
54
|
# by RVM and must have a compatible syntax like '2.3.0' or 'ruby-2.3.0'.
|
|
51
55
|
ruby_version: <%= @ruby_version %>
|
|
52
56
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: deploy_mate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.25'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Adler
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2016-05-
|
|
13
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: capistrano
|
|
@@ -68,6 +68,20 @@ dependencies:
|
|
|
68
68
|
- - ">="
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
70
|
version: '0'
|
|
71
|
+
- !ruby/object:Gem::Dependency
|
|
72
|
+
name: rubocop
|
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
type: :development
|
|
79
|
+
prerelease: false
|
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
81
|
+
requirements:
|
|
82
|
+
- - ">="
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '0'
|
|
71
85
|
description: This is how we deploy around here.
|
|
72
86
|
email: development (at) hanseventures (dot) com
|
|
73
87
|
executables: []
|
|
@@ -78,9 +92,11 @@ files:
|
|
|
78
92
|
- ".rubocop.yml"
|
|
79
93
|
- ".ruby-gemset"
|
|
80
94
|
- ".ruby-version"
|
|
95
|
+
- ".travis.yml"
|
|
81
96
|
- CHANGELOG.md
|
|
82
97
|
- Gemfile
|
|
83
98
|
- Gemfile.lock
|
|
99
|
+
- LICENSE.txt
|
|
84
100
|
- README.md
|
|
85
101
|
- Rakefile
|
|
86
102
|
- deploy-mate.gemspec
|