rubber 2.8.1 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG +19 -0
- data/Gemfile +6 -0
- data/lib/rubber/cloud/digital_ocean.rb +10 -2
- data/lib/rubber/environment.rb +14 -1
- data/lib/rubber/recipes/rubber/deploy.rb +46 -31
- data/lib/rubber/recipes/rubber/instances.rb +8 -1
- data/lib/rubber/recipes/rubber/setup.rb +52 -17
- data/lib/rubber/version.rb +1 -1
- data/templates/base/config/rubber/rubber.yml +11 -2
- data/templates/delayed_job/config/rubber/deploy-delayed_job.rb +10 -3
- data/templates/graphite/config/rubber/role/graphite_server/graphite_server-upstart.conf +14 -7
- data/templates/local_windows/config/rubber/deploy-local_windows.rb +78 -0
- data/templates/local_windows/config/rubber/rubber-local_windows.yml +4 -0
- data/templates/local_windows/templates.yml +1 -0
- data/test/cloud/digital_ocean_test.rb +38 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab6253fd1d0b38c978eda0a0dc6ca62262284cb6
|
4
|
+
data.tar.gz: d64c12b608be9a43292bace407970d31a2d7f0cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0037e0e29c1b5a408971a1ba2b2095135e34881fcac4d26e6ed100b27211ec1e3db324f52526e29b1aa2a4b14ff0a31c3f381897340b6cf41414eaa92eb4c6d0
|
7
|
+
data.tar.gz: 3c60ffe2b978abda2f0626770776a68e412fe695eee2b5221d0585131998a74e6973a1a35061654a599c44389d272b11dab769de128906d30623ca3fc85da0cd
|
data/.travis.yml
CHANGED
@@ -9,7 +9,7 @@ rvm:
|
|
9
9
|
- 1.9.2
|
10
10
|
- 1.9.3
|
11
11
|
- 2.0.0
|
12
|
-
- 2.1
|
12
|
+
- 2.1
|
13
13
|
- ruby-head
|
14
14
|
- jruby-18mode
|
15
15
|
- jruby-19mode
|
@@ -26,7 +26,7 @@ matrix:
|
|
26
26
|
gemfile: Gemfile.1.8.7
|
27
27
|
- rvm: 2.0.0
|
28
28
|
gemfile: Gemfile.1.8.7
|
29
|
-
- rvm: 2.1
|
29
|
+
- rvm: 2.1
|
30
30
|
gemfile: Gemfile.1.8.7
|
31
31
|
- rvm: ruby-head
|
32
32
|
gemfile: Gemfile.1.8.7
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
2.9.0 (06/02/2014)
|
2
|
+
|
3
|
+
New Features:
|
4
|
+
============
|
5
|
+
|
6
|
+
[core] Added support for private networking in Digital Ocean. <aee6114, c2c2059, 83fa02e, dbced9d, b1c9564, 54d6405, 55f7e13, bc1a05a>
|
7
|
+
[core, local_windows] Support for using rubber on Windows. <738cd3f, dd049bf, bd82f2a, 6bd51e7, f199cad, cfa3012, 329acad, 0b0afa3, 86bf2d0>
|
8
|
+
|
9
|
+
Improvements:
|
10
|
+
============
|
11
|
+
|
12
|
+
[delayed_job] Added Rails 4 compatibility. <c374142, 982f08b, 2f49cf7>
|
13
|
+
|
14
|
+
Bug Fixes:
|
15
|
+
=========
|
16
|
+
|
17
|
+
[base] Updated the Digital Ocean image to one that works. <48f7984>
|
18
|
+
|
19
|
+
|
1
20
|
2.8.1 (05/01/2014)
|
2
21
|
|
3
22
|
Bug Fixes:
|
data/Gemfile
CHANGED
@@ -3,5 +3,11 @@ source "https://rubygems.org"
|
|
3
3
|
gem 'jruby-openssl', :platform => :jruby
|
4
4
|
gem 'unlimited-strength-crypto', :platform => :jruby
|
5
5
|
|
6
|
+
group :development do
|
7
|
+
# Need to run off master for tests until updated Digital Ocean mocking
|
8
|
+
# makes it into a release
|
9
|
+
gem 'fog', :git => 'https://github.com/fog/fog.git', :branch => 'master'
|
10
|
+
end
|
11
|
+
|
6
12
|
# Specify your gem's dependencies in rubber.gemspec
|
7
13
|
gemspec
|
@@ -29,12 +29,19 @@ module Rubber
|
|
29
29
|
super(env, capistrano)
|
30
30
|
end
|
31
31
|
|
32
|
+
# Currently New York 2 (id 4) supports private networking
|
33
|
+
REGIONS_WITH_PRIVATE_NETWORKING = [4]
|
34
|
+
|
32
35
|
def create_instance(instance_alias, image_name, image_type, security_groups, availability_zone, region)
|
33
36
|
do_region = compute_provider.regions.find { |r| r.name == region }
|
34
37
|
if do_region.nil?
|
35
38
|
raise "Invalid region for DigitalOcean: #{region}"
|
36
39
|
end
|
37
40
|
|
41
|
+
if env.private_networking && ! REGIONS_WITH_PRIVATE_NETWORKING.include?(do_region.id)
|
42
|
+
raise "Private networking is enabled, but region #{region} does not support it"
|
43
|
+
end
|
44
|
+
|
38
45
|
image = compute_provider.images.find { |i| i.name == image_name }
|
39
46
|
if image.nil?
|
40
47
|
raise "Invalid image name for DigitalOcean: #{image_name}"
|
@@ -60,7 +67,8 @@ module Rubber
|
|
60
67
|
:image_id => image.id,
|
61
68
|
:flavor_id => flavor.id,
|
62
69
|
:region_id => do_region.id,
|
63
|
-
:ssh_key_ids => [ssh_key['id']]
|
70
|
+
:ssh_key_ids => [ssh_key['id']],
|
71
|
+
:private_networking => (env.private_networking.to_s.downcase == 'true'))
|
64
72
|
|
65
73
|
response.id
|
66
74
|
end
|
@@ -81,7 +89,7 @@ module Rubber
|
|
81
89
|
instance[:state] = item.state
|
82
90
|
instance[:type] = item.flavor_id
|
83
91
|
instance[:external_ip] = item.public_ip_address
|
84
|
-
instance[:internal_ip] = item.public_ip_address
|
92
|
+
instance[:internal_ip] = item.private_ip_address || item.public_ip_address
|
85
93
|
instance[:region_id] = item.region_id
|
86
94
|
instance[:provider] = 'digital_ocean'
|
87
95
|
instance[:platform] = Rubber::Platforms::LINUX
|
data/lib/rubber/environment.rb
CHANGED
@@ -2,6 +2,7 @@ require 'yaml'
|
|
2
2
|
require 'socket'
|
3
3
|
require 'delegate'
|
4
4
|
require 'monitor'
|
5
|
+
require 'rbconfig'
|
5
6
|
|
6
7
|
|
7
8
|
module Rubber
|
@@ -250,7 +251,19 @@ module Rubber
|
|
250
251
|
|
251
252
|
global
|
252
253
|
end
|
253
|
-
|
254
|
+
|
255
|
+
def local_platform
|
256
|
+
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'windows' : 'posix'
|
257
|
+
end
|
258
|
+
|
259
|
+
def local_windows?
|
260
|
+
local_platform == 'windows'
|
261
|
+
end
|
262
|
+
|
263
|
+
def local_posix?
|
264
|
+
local_platform == 'posix'
|
265
|
+
end
|
266
|
+
|
254
267
|
def method_missing(method_id)
|
255
268
|
self[method_id.id2name]
|
256
269
|
end
|
@@ -28,26 +28,36 @@ namespace :rubber do
|
|
28
28
|
after "deploy:rollback_code", "rubber:config"
|
29
29
|
before "deploy:migrate", "rubber:config"
|
30
30
|
|
31
|
-
|
31
|
+
namespace :config do
|
32
|
+
|
33
|
+
desc <<-DESC
|
34
|
+
Pushes and runs rubber configuration on the deployed rails application
|
35
|
+
DESC
|
36
|
+
task :default do
|
37
|
+
# Don't want to do rubber:config during bootstrap_db where it's triggered by
|
38
|
+
# deploy:update_code, because the user could be requiring the rails env inside
|
39
|
+
# some of their config templates (which fails because rails can't connect to
|
40
|
+
# the db)
|
41
|
+
if fetch(:rubber_updating_code_for_bootstrap_db, false)
|
42
|
+
logger.info "Updating code for bootstrap, skipping rubber:config"
|
43
|
+
else
|
44
|
+
rubber.config.push
|
45
|
+
rubber.config.configure
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
desc <<-DESC
|
50
|
+
Pushes instance config and rubber secret file to remote
|
51
|
+
DESC
|
52
|
+
task :push do
|
53
|
+
push_config
|
54
|
+
end
|
55
|
+
|
56
|
+
desc <<-DESC
|
32
57
|
Configures the deployed rails application by running the rubber configuration process
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
# deploy:update_code, because the user could be requiring the rails env inside
|
37
|
-
# some of their config templates (which fails because rails can't connect to
|
38
|
-
# the db)
|
39
|
-
if fetch(:rubber_updating_code_for_bootstrap_db, false)
|
40
|
-
logger.info "Updating code for bootstrap, skipping rubber:config"
|
41
|
-
else
|
42
|
-
opts = {}
|
43
|
-
opts[:no_post] = true if ENV['NO_POST']
|
44
|
-
opts[:force] = true if ENV['FORCE']
|
45
|
-
opts[:file] = ENV['FILE'] if ENV['FILE']
|
46
|
-
|
47
|
-
# when running deploy:migrations, we need to run config against release_path
|
48
|
-
opts[:deploy_path] = current_release if fetch(:migrate_target, :current).to_sym == :latest
|
49
|
-
|
50
|
-
run_config(opts)
|
58
|
+
DESC
|
59
|
+
task :configure do
|
60
|
+
run_config
|
51
61
|
end
|
52
62
|
end
|
53
63
|
|
@@ -63,13 +73,7 @@ namespace :rubber do
|
|
63
73
|
rsudo "chown -R #{rubber_env.app_user}:#{rubber_env.app_user} #{current_path}/tmp"
|
64
74
|
end
|
65
75
|
|
66
|
-
def
|
67
|
-
path = options.delete(:deploy_path) || current_path
|
68
|
-
opts = ""
|
69
|
-
opts += " --no_post" if options[:no_post]
|
70
|
-
opts += " --force" if options[:force]
|
71
|
-
opts += " --file=\"#{options[:file]}\"" if options[:file]
|
72
|
-
|
76
|
+
def push_config
|
73
77
|
unless fetch(:rubber_config_files_pushed, false)
|
74
78
|
# Need to do this so we can work with staging instances without having to
|
75
79
|
# checkin instance file between create and bootstrap, as well as during a deploy
|
@@ -89,7 +93,7 @@ namespace :rubber do
|
|
89
93
|
|
90
94
|
push_files.each do |file|
|
91
95
|
dest_file = file.sub(/^#{Rubber.root}\/?/, '')
|
92
|
-
put(File.read(file), File.join(
|
96
|
+
put(File.read(file), File.join(config_path, dest_file), :mode => "+r")
|
93
97
|
end
|
94
98
|
end
|
95
99
|
|
@@ -97,13 +101,24 @@ namespace :rubber do
|
|
97
101
|
secret = rubber_cfg.environment.config_secret
|
98
102
|
if secret && File.exist?(secret)
|
99
103
|
base = rubber_cfg.environment.config_root.sub(/^#{Rubber.root}\/?/, '')
|
100
|
-
put(File.read(secret), File.join(
|
104
|
+
put(File.read(secret), File.join(config_path, base, File.basename(secret)), :mode => "+r")
|
101
105
|
end
|
102
106
|
|
103
107
|
set :rubber_config_files_pushed, true
|
104
108
|
end
|
105
|
-
|
106
|
-
rsudo "cd #{path} && RUBBER_ENV=#{Rubber.env} RAILS_ENV=#{Rubber.env} ./script/rubber config #{opts}"
|
107
109
|
end
|
108
110
|
|
109
|
-
|
111
|
+
def run_config
|
112
|
+
opts = ""
|
113
|
+
opts += " --no_post" if ENV['NO_POST']
|
114
|
+
opts += " --force" if ENV['FORCE']
|
115
|
+
opts += " --file=\"#{ENV['FILE']}\"" if ENV['FILE']
|
116
|
+
rsudo "cd #{config_path} && RUBBER_ENV=#{Rubber.env} RAILS_ENV=#{Rubber.env} ./script/rubber config #{opts}"
|
117
|
+
end
|
118
|
+
|
119
|
+
def config_path
|
120
|
+
# when running deploy:migrations, we need to run config against release_path
|
121
|
+
fetch(:migrate_target, :current).to_sym == :latest ? current_release : current_path
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
@@ -613,7 +613,9 @@ namespace :rubber do
|
|
613
613
|
# delete from ~/.ssh/known_hosts all lines that begin with ec2- or instance_alias
|
614
614
|
def cleanup_known_hosts(instance_item)
|
615
615
|
logger.info "Cleaning ~/.ssh/known_hosts"
|
616
|
-
|
616
|
+
|
617
|
+
begin
|
618
|
+
File.open(File.expand_path('~/.ssh/known_hosts'), 'r+') do |f|
|
617
619
|
out = ""
|
618
620
|
f.each do |line|
|
619
621
|
line = case line
|
@@ -628,6 +630,11 @@ namespace :rubber do
|
|
628
630
|
f.pos = 0
|
629
631
|
f.print out
|
630
632
|
f.truncate(f.pos)
|
633
|
+
end
|
634
|
+
rescue
|
635
|
+
error_msg = "Failed to modify #{filepath} on local machine."
|
636
|
+
error_msg += " Please ensure you are running command as Administrator." if rubber_env.local_windows?
|
637
|
+
abort error_msg
|
631
638
|
end
|
632
639
|
end
|
633
640
|
|
@@ -145,28 +145,48 @@ namespace :rubber do
|
|
145
145
|
Generates/etc/hosts for local machine
|
146
146
|
DESC
|
147
147
|
required_task :setup_local_aliases do
|
148
|
-
hosts_file =
|
148
|
+
hosts_file = rubber_env.local_windows? ?
|
149
|
+
"#{ENV['windir']}\\System32\\drivers\\etc\\hosts" :
|
150
|
+
'/etc/hosts'
|
149
151
|
|
150
152
|
# Generate /etc/hosts contents for the local machine from instance config
|
151
153
|
delim = "## rubber config #{rubber_env.domain} #{Rubber.env}"
|
152
154
|
local_hosts = delim + "\n"
|
153
155
|
rubber_instances.each do |ic|
|
154
|
-
# don't add unqualified hostname in local hosts file since user may be
|
155
|
-
# managing multiple domains with same aliases
|
156
|
-
hosts_data = [ic.full_name, ic.external_host, ic.internal_host]
|
157
156
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
157
|
+
if rubber_env.local_windows?
|
158
|
+
|
159
|
+
hosts_data = [ic.full_name, ic.internal_host]
|
160
|
+
|
161
|
+
if ic.role_names.include?('web_tools')
|
162
|
+
Array(rubber_env.web_tools_proxies).each do |name, settings|
|
163
|
+
hosts_data << "#{name}-#{ic.full_name}"
|
164
|
+
end
|
165
165
|
end
|
166
|
-
end
|
167
166
|
|
168
|
-
|
167
|
+
hosts_data.compact.each do |host_name|
|
168
|
+
local_hosts << ic.external_ip.ljust(18) << host_name << "\n"
|
169
|
+
end
|
170
|
+
|
171
|
+
else # non-Windows OS
|
172
|
+
# don't add unqualified hostname in local hosts file since user may be
|
173
|
+
# managing multiple domains with same aliases
|
174
|
+
hosts_data = [ic.full_name, ic.external_host, ic.internal_host]
|
175
|
+
|
176
|
+
# add the ip aliases for web tools hosts so we can map internal tools
|
177
|
+
# to their own vhost to make proxying easier (rewriting url paths for
|
178
|
+
# proxy is a real pain, e.g. '/graphite/' externally to '/' on the
|
179
|
+
# graphite web app)
|
180
|
+
if ic.role_names.include?('web_tools')
|
181
|
+
Array(rubber_env.web_tools_proxies).each do |name, settings|
|
182
|
+
hosts_data << "#{name}-#{ic.full_name}"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
local_hosts << ic.external_ip << ' ' << hosts_data.compact.join(' ') << "\n"
|
187
|
+
end
|
169
188
|
end
|
189
|
+
|
170
190
|
local_hosts << delim << "\n"
|
171
191
|
|
172
192
|
# Write out the hosts file for this machine, use sudo
|
@@ -175,10 +195,25 @@ namespace :rubber do
|
|
175
195
|
|
176
196
|
# only write out if it has changed
|
177
197
|
if existing != (filtered + local_hosts)
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
198
|
+
if rubber_env.local_windows?
|
199
|
+
logger.info "Writing out aliases into local machines #{hosts_file}"
|
200
|
+
|
201
|
+
begin
|
202
|
+
File.open(hosts_file, 'w') do |f|
|
203
|
+
f.write(filtered)
|
204
|
+
f.write(local_hosts)
|
205
|
+
end
|
206
|
+
rescue
|
207
|
+
error_msg = "Could not modify #{hosts_file} on local machine."
|
208
|
+
error_msg += ' Please ensure you are running command as Administrator.'
|
209
|
+
abort error_msg
|
210
|
+
end
|
211
|
+
else # non-Windows OS
|
212
|
+
logger.info "Writing out aliases into local machines #{hosts_file}, sudo access needed"
|
213
|
+
Rubber::Util::sudo_open(hosts_file, 'w') do |f|
|
214
|
+
f.write(filtered)
|
215
|
+
f.write(local_hosts)
|
216
|
+
end
|
182
217
|
end
|
183
218
|
end
|
184
219
|
end
|
data/lib/rubber/version.rb
CHANGED
@@ -107,15 +107,24 @@ cloud_providers:
|
|
107
107
|
#
|
108
108
|
# Options include
|
109
109
|
# New York 1
|
110
|
+
# Amsterdam 1
|
110
111
|
# San Francisco 1
|
112
|
+
# New York 2
|
113
|
+
# Amsterdam 2
|
114
|
+
# Singapore 1
|
111
115
|
#
|
112
116
|
# These change often. Check https://www.digitalocean.com/droplets/new for the most up to date options.
|
113
|
-
|
117
|
+
# Default to New York 2 since this is the only region that currently supports private networking
|
118
|
+
region: New York 2
|
114
119
|
|
115
120
|
# REQUIRED: The image name and type for creating instances.
|
116
|
-
image_id: Ubuntu 12.04.
|
121
|
+
image_id: Ubuntu 12.04.4 x64
|
117
122
|
image_type: 512MB
|
118
123
|
|
124
|
+
# Optionally enable private networking for your instances.
|
125
|
+
# This is currently only supported in New York 2.
|
126
|
+
private_networking: true
|
127
|
+
|
119
128
|
# Use an alternate cloud provider supported by fog. This doesn't fully work
|
120
129
|
# yet due to differences in providers within fog, but gives you a starting
|
121
130
|
# point for contributing a new provider to rubber. See rubber/lib/rubber/cloud(.rb)
|
@@ -11,20 +11,27 @@ namespace :rubber do
|
|
11
11
|
def args
|
12
12
|
rubber_env.delayed_job_args || "-n #{rubber_env.num_delayed_job_workers}"
|
13
13
|
end
|
14
|
+
|
15
|
+
def script_location
|
16
|
+
bin_location = "bin/delayed_job"
|
17
|
+
script_location = "script/delayed_job"
|
18
|
+
|
19
|
+
File.exists?(bin_location) ? bin_location : script_location
|
20
|
+
end
|
14
21
|
|
15
22
|
desc "Stop the delayed_job process"
|
16
23
|
task :stop, :roles => :delayed_job do
|
17
|
-
rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env}
|
24
|
+
rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} #{self.script_location} stop #{self.args}", :as => rubber_env.app_user
|
18
25
|
end
|
19
26
|
|
20
27
|
desc "Start the delayed_job process"
|
21
28
|
task :start, :roles => :delayed_job do
|
22
|
-
rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env}
|
29
|
+
rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} #{self.script_location} start #{self.args}", :as => rubber_env.app_user
|
23
30
|
end
|
24
31
|
|
25
32
|
desc "Restart the delayed_job process"
|
26
33
|
task :restart, :roles => :delayed_job do
|
27
|
-
rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env}
|
34
|
+
rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} #{self.script_location} restart #{self.args}", :as => rubber_env.app_user
|
28
35
|
end
|
29
36
|
|
30
37
|
desc "Live tail of delayed_job log files for all machines"
|
@@ -4,13 +4,20 @@
|
|
4
4
|
%>
|
5
5
|
description "graphite server"
|
6
6
|
|
7
|
-
start on [2345]
|
8
|
-
stop on runlevel [
|
7
|
+
start on runlevel [2345]
|
8
|
+
stop on runlevel [!2345]
|
9
9
|
|
10
|
-
|
10
|
+
env CARBON_CACHE=<%= rubber_env.graphite_dir %>/bin/carbon-cache.py
|
11
|
+
env PIDFILE=/var/run/graphite-server.pid
|
12
|
+
env LOGDIR=<%= rubber_env.graphite_storage_dir %>/log/carbon-cache
|
13
|
+
|
14
|
+
kill timeout 5
|
15
|
+
|
16
|
+
post-stop exec $CARBON_CACHE --pidfile=$PIDFILE --debug stop
|
11
17
|
|
12
18
|
script
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
19
|
+
ulimit -n 65000
|
20
|
+
|
21
|
+
mkdir -p $LOGDIR
|
22
|
+
exec $CARBON_CACHE --pidfile=$PIDFILE --debug start >> $LOGDIR/console.log 2>&1
|
23
|
+
end script
|
@@ -0,0 +1,78 @@
|
|
1
|
+
|
2
|
+
on :load do
|
3
|
+
|
4
|
+
if rubber_env.local_windows? && rubber_instances.reject{|i| i.windows?}.any?
|
5
|
+
|
6
|
+
# The Bundler 'platforms' block in your Gemfile currently causes cross-platform
|
7
|
+
# deploys to fail. See: https://github.com/carlhuda/bundler/issues/646
|
8
|
+
# As a workaround we deploy to remote Linux without the Gemfile.lock from Windows.
|
9
|
+
# If you are not using 'platforms' in your Gemfile, you do not need this hack.
|
10
|
+
set :copy_exclude, strategy.copy_exclude + ['Gemfile.lock']
|
11
|
+
set :bundle_flags, "--quiet"
|
12
|
+
|
13
|
+
# An alternative option:
|
14
|
+
# set :bundle_flags, "--no_deployment --quiet"
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
namespace :rubber do
|
21
|
+
|
22
|
+
namespace :local_windows do
|
23
|
+
|
24
|
+
# Run dos2unix on code only if it has been deployed via copy
|
25
|
+
if ENV.has_key?('FIX_LINE_ENDINGS') || (Rubber.config.local_windows? && (fetch(:deploy_via, nil) == :copy))
|
26
|
+
after "deploy:update_code", "rubber:local_windows:dos2unix_code"
|
27
|
+
end
|
28
|
+
|
29
|
+
# Always run dos2unix each time config is pushed, as the Rubber secret file is always pushed via copy
|
30
|
+
if ENV.has_key?('FIX_LINE_ENDINGS') || Rubber.config.local_windows?
|
31
|
+
after "rubber:config:push", "rubber:local_windows:dos2unix_config"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc <<-DESC
|
35
|
+
Converts remote code files to Windows-style line endings (CR+LF) to Unix-style (LF)
|
36
|
+
DESC
|
37
|
+
task :dos2unix_code, :except => { :platform => 'windows' } do
|
38
|
+
run_dos2unix release_path
|
39
|
+
end
|
40
|
+
|
41
|
+
desc <<-DESC
|
42
|
+
Converts remote config files to Windows-style line endings (CR+LF) to Unix-style (LF)
|
43
|
+
DESC
|
44
|
+
task :dos2unix_config, :except => { :platform => 'windows' } do
|
45
|
+
run_dos2unix config_path
|
46
|
+
end
|
47
|
+
|
48
|
+
def run_dos2unix(path)
|
49
|
+
rsudo "find #{path} -type f -exec dos2unix -q {} \\;"
|
50
|
+
end
|
51
|
+
|
52
|
+
def config_path
|
53
|
+
File.join(release_path, rubber_cfg.environment.config_root.sub(/^#{Rubber.root}\/?/, ''))
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
namespace :rubber do
|
61
|
+
|
62
|
+
namespace :putty do
|
63
|
+
|
64
|
+
desc <<-DESC
|
65
|
+
Opens Putty sessions with your servers. Open multiple sessions at once
|
66
|
+
with FILTER variable. Requires Putty in your system path and a key
|
67
|
+
named *.ppk in your keys directory.
|
68
|
+
DESC
|
69
|
+
task :default do
|
70
|
+
rubber_env.rubber_instances.filtered.each do |inst|
|
71
|
+
# can use rubber_env.cloud_providers.aws.key_file as well
|
72
|
+
spawn("putty -ssh ubuntu@#{inst.external_host} -i #{Rubber.cloud.env.key_file}.ppk")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
description: Enables Rubber to deploy to a remote Linux machine from a local Windows machine
|
@@ -7,7 +7,12 @@ class DigitalOceanTest < Test::Unit::TestCase
|
|
7
7
|
context 'digital_ocean' do
|
8
8
|
|
9
9
|
setup do
|
10
|
-
env = {
|
10
|
+
env = {
|
11
|
+
'client_key' => "XXX",
|
12
|
+
'api_key' => "YYY",
|
13
|
+
'region' => 'New York 1',
|
14
|
+
'key_file' => "#{File.dirname(__FILE__)}/../fixtures/basic/test.pem"
|
15
|
+
}
|
11
16
|
env = Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil, nil)
|
12
17
|
@cloud = Rubber::Cloud::DigitalOcean.new(env, nil)
|
13
18
|
end
|
@@ -22,6 +27,38 @@ class DigitalOceanTest < Test::Unit::TestCase
|
|
22
27
|
assert @cloud.create_instance('my-instance', 'Ubuntu 12.04 x64', '512MB', [], '', 'New York 1')
|
23
28
|
end
|
24
29
|
|
30
|
+
should 'create instance with private networking enabled' do
|
31
|
+
env = {
|
32
|
+
'client_key' => "XXX",
|
33
|
+
'api_key' => "YYY",
|
34
|
+
'key_file' => "#{File.dirname(__FILE__)}/../fixtures/basic/test.pem",
|
35
|
+
'private_networking' => true
|
36
|
+
}
|
37
|
+
|
38
|
+
env = Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil, nil)
|
39
|
+
|
40
|
+
assert Rubber::Cloud::DigitalOcean.new(env, nil).create_instance('my-instance', 'Ubuntu 12.04 x64', '512MB', [], '', 'New York 2')
|
41
|
+
end
|
42
|
+
|
43
|
+
should 'raise error if region does not support private networking but private networking is enabled' do
|
44
|
+
env = {
|
45
|
+
'client_key' => "XXX",
|
46
|
+
'api_key' => "YYY",
|
47
|
+
'key_file' => "#{File.dirname(__FILE__)}/../fixtures/basic/test.pem",
|
48
|
+
'private_networking' => true
|
49
|
+
}
|
50
|
+
|
51
|
+
env = Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil, nil)
|
52
|
+
|
53
|
+
begin
|
54
|
+
Rubber::Cloud::DigitalOcean.new(env, nil).create_instance('my-instance', 'Ubuntu 12.04 x64', '512MB', [], '', 'New York 1')
|
55
|
+
rescue => e
|
56
|
+
assert_equal 'Private networking is enabled, but region New York 1 does not support it', e.message
|
57
|
+
else
|
58
|
+
fail 'Did not raise exception for region that does not support private networking'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
25
62
|
should 'raise error if invalid region' do
|
26
63
|
begin
|
27
64
|
@cloud.create_instance('my-instance', 'Ubuntu 12.04 x64', '512MB', [], '', 'Mars 1')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Conway
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -427,6 +427,9 @@ files:
|
|
427
427
|
- templates/jetty/config/rubber/role/jetty/jetty.xml
|
428
428
|
- templates/jetty/config/rubber/rubber-jetty.yml
|
429
429
|
- templates/jetty/templates.yml
|
430
|
+
- templates/local_windows/config/rubber/deploy-local_windows.rb
|
431
|
+
- templates/local_windows/config/rubber/rubber-local_windows.yml
|
432
|
+
- templates/local_windows/templates.yml
|
430
433
|
- templates/memcached/config/rubber/deploy-memcached.rb
|
431
434
|
- templates/memcached/config/rubber/role/memcached/crontab
|
432
435
|
- templates/memcached/config/rubber/role/memcached/dalli.rb
|