alpha_omega 0.0.171 → 0.0.172
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.
- data/VERSION +1 -1
- data/lib/alpha_omega/deploy.rb +16 -17
- data/lib/alpha_omega/utils.rb +23 -22
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.172
|
data/lib/alpha_omega/deploy.rb
CHANGED
|
@@ -268,13 +268,13 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
268
268
|
|
|
269
269
|
task :bootstrap_code do
|
|
270
270
|
if releases.length < 2 # without services and run as root
|
|
271
|
-
run "[[ -d #{deploy_to} ]] || #{try_sudo} install -
|
|
272
|
-
run "#{try_sudo} install -
|
|
271
|
+
run "[[ -d #{deploy_to} ]] || #{try_sudo} install -d -m #{dir_perms} #{try_sudo.empty? ? '' : "-o #{root_user} -g #{root_group}"} #{deploy_to}"
|
|
272
|
+
run "#{try_sudo} install -d -m #{dir_perms} #{try_sudo.empty? ? '' : "-o #{user} -g #{group}"} #{releases_path} #{deploy_to}/log"
|
|
273
273
|
else
|
|
274
274
|
dirs = [ releases_path, service_path, service_drop, log_path ]
|
|
275
275
|
dir_args = dirs.map {|d| d.sub("#{deploy_to}/", "") }.join(' ')
|
|
276
|
-
run "#{try_sudo} install -
|
|
277
|
-
run "cd #{deploy_to} && install -
|
|
276
|
+
run "#{try_sudo} install -d -m #{dir_perms} #{try_sudo.empty? ? '' : "-o #{user} -g #{group}"} #{deploy_to}"
|
|
277
|
+
run "cd #{deploy_to} && install -d -m #{dir_perms} #{dir_args}"
|
|
278
278
|
end
|
|
279
279
|
end
|
|
280
280
|
|
|
@@ -294,7 +294,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
294
294
|
|
|
295
295
|
task :symlink_next do
|
|
296
296
|
if releases.length >= 2
|
|
297
|
-
run "ln -
|
|
297
|
+
run "ln -nfs #{current_release} #{next_path}.new"
|
|
298
298
|
run "mv -T #{next_path}.new #{next_path}"
|
|
299
299
|
end
|
|
300
300
|
end
|
|
@@ -312,8 +312,8 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
312
312
|
if releases.length > 0
|
|
313
313
|
on_rollback do
|
|
314
314
|
if rollback_release
|
|
315
|
-
run "rm -
|
|
316
|
-
run "ln -
|
|
315
|
+
run "rm -f #{previous_path} #{next_path}"
|
|
316
|
+
run "ln -nfs #{rollback_release} #{current_path}.new"
|
|
317
317
|
run "mv -T #{current_path}.new #{current_path}"
|
|
318
318
|
else
|
|
319
319
|
logger.important "no previous release to rollback to, rollback of symlink skipped"
|
|
@@ -321,17 +321,17 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
321
321
|
end
|
|
322
322
|
|
|
323
323
|
if releases.length == 1
|
|
324
|
-
run "ln -
|
|
324
|
+
run "ln -nfs #{current_release} #{current_path}.new"
|
|
325
325
|
run "mv -T #{current_path}.new #{current_path}"
|
|
326
326
|
else
|
|
327
|
-
run "rm -
|
|
328
|
-
run "ln -
|
|
327
|
+
run "rm -f #{previous_path} #{next_path}"
|
|
328
|
+
run "ln -nfs #{current_release} #{current_path}.new"
|
|
329
329
|
run "mv -T #{current_path}.new #{current_path}"
|
|
330
330
|
if current_path != external_path
|
|
331
|
-
run "#{File.dirname(external_path).index(deploy_to) == 0 ? "" : try_sudo} ln -
|
|
331
|
+
run "#{File.dirname(external_path).index(deploy_to) == 0 ? "" : try_sudo} ln -nfs #{current_path} #{external_path}.new"
|
|
332
332
|
run "#{File.dirname(external_path).index(deploy_to) == 0 ? "" : try_sudo} mv -T #{external_path}.new #{external_path}"
|
|
333
333
|
end
|
|
334
|
-
run "ln -
|
|
334
|
+
run "ln -nfs #{rollback_release} #{previous_path}.new"
|
|
335
335
|
run "mv -T #{previous_path}.new #{previous_path}"
|
|
336
336
|
end
|
|
337
337
|
|
|
@@ -402,7 +402,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
402
402
|
set :deploy_path_name, "compare"
|
|
403
403
|
set :deploy_release_name, "compare"
|
|
404
404
|
update_code
|
|
405
|
-
run "ln -
|
|
405
|
+
run "ln -nfs #{deploy_release} #{deploy_path}.new"
|
|
406
406
|
run "mv -T #{deploy_path}.new #{deploy_path}"
|
|
407
407
|
end
|
|
408
408
|
|
|
@@ -415,9 +415,8 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
415
415
|
task :revision do
|
|
416
416
|
if previous_release
|
|
417
417
|
system "#{figlet} -w 200 on #{previous_release_name}"
|
|
418
|
-
run "rm -
|
|
419
|
-
|
|
420
|
-
run "ln -vnfs #{previous_release} #{current_path}.new"
|
|
418
|
+
run "rm -f #{previous_path} #{next_path}"
|
|
419
|
+
run "ln -nfs #{previous_release} #{current_path}.new"
|
|
421
420
|
run "mv -T #{current_path}.new #{current_path}"
|
|
422
421
|
else
|
|
423
422
|
abort "could not rollback the code because there is no prior release"
|
|
@@ -462,7 +461,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
|
462
461
|
set :deploy_path_name, "migrate"
|
|
463
462
|
set :deploy_release_name, "migrate"
|
|
464
463
|
update_code
|
|
465
|
-
run "ln -
|
|
464
|
+
run "ln -nfs #{deploy_release} #{deploy_path}.new"
|
|
466
465
|
run "mv -T #{deploy_path}.new #{deploy_path}"
|
|
467
466
|
end
|
|
468
467
|
|
data/lib/alpha_omega/utils.rb
CHANGED
|
@@ -72,7 +72,7 @@ module AlphaOmega
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# each pod task sets the pod context for host/group tasks
|
|
75
|
-
config.task "#{pod_name}.#{tsuffix}" do # task
|
|
75
|
+
config.task "#{pod_name}.#{tsuffix}" do # task pod1
|
|
76
76
|
set :current_pod, pod_name
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -84,30 +84,31 @@ module AlphaOmega
|
|
|
84
84
|
node_dna[remote_name] = {}
|
|
85
85
|
node_dna[remote_name].deep_merge!(n)
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
config.task "#{task_name}.#{pod_name}.echo" do # task host.default.echo, host.pod1.echo
|
|
94
|
-
puts "#{AlphaOmega.magic_prefix} #{remote_name}"
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
config.task "#{task_name}.#{pod_name}.yaml" do # task host.default.yaml, host.pod1..yaml
|
|
98
|
-
StringIO.new({ remote_name => n }.to_yaml).lines.to_a[1..-1].each {|l| puts "#{AlphaOmega.magic_prefix} #{l}" }
|
|
87
|
+
cap_roles = node_filter.call(this_node, n)
|
|
88
|
+
return nil unless cap_roles
|
|
89
|
+
|
|
90
|
+
config.task "#{task_name}.#{pod_name}.app" do # task host.pod1.app
|
|
91
|
+
cap_roles.each do |cap_role, cap_preds|
|
|
92
|
+
role cap_role, remote_name, cap_preds
|
|
99
93
|
end
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
set :dna, node_dna[remote_name]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
config.task "#{task_name}.#{pod_name}.echo" do # task host.pod1.echo
|
|
98
|
+
puts "#{AlphaOmega.magic_prefix} #{remote_name}"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
config.task "#{task_name}.#{pod_name}.yaml" do # task host.pod1.yaml
|
|
102
|
+
StringIO.new({ remote_name => n }.to_yaml).lines.to_a[1..-1].each {|l| puts "#{AlphaOmega.magic_prefix} #{l}" }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
%w(app echo yaml).each do |tsuffix|
|
|
106
|
+
config.task "#{task_name}.#{tsuffix}" do # task host -> host.current_pod
|
|
107
|
+
config.after "#{task_name}.#{tsuffix}", "#{task_name}.#{current_pod}.#{tsuffix}"
|
|
105
108
|
end
|
|
106
|
-
|
|
107
|
-
n
|
|
108
|
-
else
|
|
109
|
-
nil
|
|
110
109
|
end
|
|
110
|
+
|
|
111
|
+
n
|
|
111
112
|
end
|
|
112
113
|
|
|
113
114
|
AlphaOmega.what_groups hosts do |task_name, nodes|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alpha_omega
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 327
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 172
|
|
10
|
+
version: 0.0.172
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- David Nghiem
|