conan_deploy 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/conan/manifest_builder.rb +40 -33
- data/lib/conan/output.rb +3 -3
- data/lib/conan/stackato.rb +7 -7
- data/lib/conan/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmVlYmE0YzJmYjFhZjUyNWIxNDM0MWM5MWJhMzgzMWZiNGUzNDQzZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmFmNWIzNDA0NDM5NTQ3NDE3OWM1ZmQ3MWZkOWQzZjA5Yzk5MDg3Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGU2OWU4OWI0MDIxOGUwZTdhY2U3YzE1MGUyZTNjM2EyZjAwMWNiNjc5ODY3
|
10
|
+
ZGFiYzA2MjAwZTE5YTFlYTIxODFhMmU3YjA3MGVjNzE1ZmY3NWUwNTkwYzY2
|
11
|
+
ZGNlYTlhZmYzM2Y5MTdmMGRiMTRmNGU0YTc3ZmM1NWViY2RhMTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjBiMDBkZWYwMDc1NDJlMTI1YTI0ZTM1Y2UzNmE0YjliN2UzOThjNWVlMGE2
|
14
|
+
MTQ4YjcxYTNlNzRlY2RhNTliZDgxMjgwNWY2ZjZhODQ0YTcyZWI1YTcyOWI2
|
15
|
+
YjA3OTUxMzk4NzgwNDQ5ZWFiOWE5MmFjODY1MzExNGYwNzA0ZGM=
|
@@ -159,14 +159,14 @@ class Pipeline
|
|
159
159
|
@options = options
|
160
160
|
end
|
161
161
|
|
162
|
-
def app(app_id, project_name, platform_type)
|
162
|
+
def app(app_id, project_name, platform_type, url_segment=nil)
|
163
163
|
if (@options[:'deploy-app-name'].nil?) || (@options[:'deploy-app-name'] == app_id.to_s)
|
164
164
|
puts "No app specified, or we matched the specified app: #{@options[:'deploy-app-name']}"
|
165
165
|
@apps[app_id] = case platform_type
|
166
166
|
when :jvm
|
167
|
-
JvmApp.new(app_id, project_name, @artifact_repo)
|
167
|
+
JvmApp.new(app_id, project_name, @artifact_repo, url_segment)
|
168
168
|
when :rails_zip
|
169
|
-
RailsZipApp.new(app_id, project_name, @artifact_repo)
|
169
|
+
RailsZipApp.new(app_id, project_name, @artifact_repo, url_segment)
|
170
170
|
else
|
171
171
|
raise "unknown platform type: #{platform_type}"
|
172
172
|
end
|
@@ -223,14 +223,14 @@ class Pipeline
|
|
223
223
|
if (force)
|
224
224
|
paas.deploy(work_dir, app, deploy, true)
|
225
225
|
else
|
226
|
-
paas.deploy(work_dir, app, deploy) unless app.isDeployedAt(deploy.manifest_url(app
|
226
|
+
paas.deploy(work_dir, app, deploy) unless app.isDeployedAt(deploy.manifest_url(app))
|
227
227
|
end
|
228
228
|
}
|
229
229
|
end
|
230
230
|
|
231
231
|
def bg_deploy(environment, paas, force=false)
|
232
232
|
eachAppDeployment(environment) { |app, deploy|
|
233
|
-
if (force or !app.isDeployedAt(deploy.manifest_url(app
|
233
|
+
if (force or !app.isDeployedAt(deploy.manifest_url(app)))
|
234
234
|
paas.bg_deploy(@output.workingDir(app), app, deploy)
|
235
235
|
end
|
236
236
|
}
|
@@ -238,7 +238,7 @@ class Pipeline
|
|
238
238
|
|
239
239
|
def is_inactive_node_healthy?(environment, paas)
|
240
240
|
eachAppDeployment(environment) { |app, deploy|
|
241
|
-
response = ApiHelper.healthcheck(deploy.inactive_healthcheck_url(app
|
241
|
+
response = ApiHelper.healthcheck(deploy.inactive_healthcheck_url(app), 60)
|
242
242
|
|
243
243
|
if(response.code != 200)
|
244
244
|
puts "Healthcheck failed for inactive (Blue) node. Here is the entire response: #{response.inspect}"
|
@@ -271,11 +271,12 @@ end
|
|
271
271
|
|
272
272
|
class Application
|
273
273
|
|
274
|
-
attr_accessor :id, :platform_type, :group_id, :artifact_id, :version, :extension, :sha1, :artifact_meta_data
|
274
|
+
attr_accessor :id, :platform_type, :group_id, :artifact_id, :version, :extension, :sha1, :artifact_meta_data, :url_segment
|
275
275
|
|
276
|
-
def initialize(id, project_name, platform_type)
|
276
|
+
def initialize(id, project_name, platform_type, url_segment=nil)
|
277
277
|
@id = id
|
278
|
-
@platform_type = platform_type
|
278
|
+
@platform_type = platform_type
|
279
|
+
@url_segment = url_segment || id
|
279
280
|
mvn_id = project_name.split(':')
|
280
281
|
@group_id = mvn_id[0]
|
281
282
|
@artifact_id = mvn_id[1]
|
@@ -380,8 +381,8 @@ end
|
|
380
381
|
class JvmApp < Application
|
381
382
|
attr_accessor :sha1, :artifact_repo
|
382
383
|
|
383
|
-
def initialize(id, project_name, artifact_repo)
|
384
|
-
super(id, project_name, :jvm)
|
384
|
+
def initialize(id, project_name, artifact_repo, url_segment=nil)
|
385
|
+
super(id, project_name, :jvm, url_segment)
|
385
386
|
@sha1 = nil
|
386
387
|
@artifact_repo = artifact_repo
|
387
388
|
end
|
@@ -396,8 +397,8 @@ end
|
|
396
397
|
class RailsZipApp < Application
|
397
398
|
attr_accessor :sha1, :artifact_repo
|
398
399
|
|
399
|
-
def initialize(id, project_name, artifact_repo)
|
400
|
-
super(id, project_name, :rails_zip)
|
400
|
+
def initialize(id, project_name, artifact_repo, url_segment=nil)
|
401
|
+
super(id, project_name, :rails_zip, url_segment)
|
401
402
|
@sha1 = nil
|
402
403
|
@artifact_repo = artifact_repo
|
403
404
|
end
|
@@ -449,7 +450,7 @@ class Deployment < HasOptions
|
|
449
450
|
|
450
451
|
@@paas_domain = 'mtnsatcloud.com'
|
451
452
|
|
452
|
-
attr_accessor :environment, :org, :ship, :shipcloud, :app_ids, :facility_id
|
453
|
+
attr_accessor :environment, :org, :ship, :shipcloud, :app_ids, :facility_id, :additional_mappings
|
453
454
|
|
454
455
|
def initialize(environment, org, ship)
|
455
456
|
# inherit options from the environment
|
@@ -460,6 +461,7 @@ class Deployment < HasOptions
|
|
460
461
|
@ship = ship
|
461
462
|
@shipcloud = "#{org}-#{ship}"
|
462
463
|
@app_ids = []
|
464
|
+
@additional_mappings = []
|
463
465
|
@facility_id = nil
|
464
466
|
@enabled = true
|
465
467
|
@randomid = SecureRandom.hex(3)
|
@@ -472,6 +474,12 @@ class Deployment < HasOptions
|
|
472
474
|
def facility(facility_id)
|
473
475
|
@facility_id = facility_id
|
474
476
|
end
|
477
|
+
|
478
|
+
def hostnames(*hostnames)
|
479
|
+
hostnames.each do |hostname|
|
480
|
+
@additional_mappings.push(hostname) unless hostname.empty?
|
481
|
+
end
|
482
|
+
end
|
475
483
|
|
476
484
|
def enabled(b)
|
477
485
|
@enabled = b
|
@@ -481,41 +489,40 @@ class Deployment < HasOptions
|
|
481
489
|
@enabled
|
482
490
|
end
|
483
491
|
|
484
|
-
def name(
|
485
|
-
"#{
|
492
|
+
def name(app)
|
493
|
+
"#{app.id}-#{@environment.id}-#{@ship}"
|
486
494
|
end
|
487
495
|
|
488
|
-
def unique_name(
|
489
|
-
"#{name(
|
496
|
+
def unique_name(app)
|
497
|
+
"#{name(app)}-#{@randomid}"
|
490
498
|
end
|
491
499
|
|
492
|
-
def dns_name(
|
493
|
-
"#{@environment.id}.#{
|
500
|
+
def dns_name(app)
|
501
|
+
"#{@environment.id}.#{app.url_segment}.#{@ship}.#{@org}.#{@@paas_domain}"
|
494
502
|
end
|
495
503
|
|
496
|
-
def agnostic_dns_name(
|
497
|
-
"#{@environment.id}.#{
|
504
|
+
def agnostic_dns_name(app)
|
505
|
+
"#{@environment.id}.#{app.url_segment}.#{@@paas_domain}"
|
498
506
|
end
|
499
507
|
|
500
|
-
|
501
|
-
|
502
|
-
[ dns_name(app_id), agnostic_dns_name(app_id) ]
|
508
|
+
def active_urls(app)
|
509
|
+
[ dns_name(app), agnostic_dns_name(app) ] + @additional_mappings
|
503
510
|
end
|
504
511
|
|
505
|
-
def inactive_urls(
|
506
|
-
|
512
|
+
def inactive_urls(app)
|
513
|
+
active_urls(app).map{ |url| "inactive.#{url}" }
|
507
514
|
end
|
508
515
|
|
509
|
-
def manifest_url(
|
510
|
-
"http://#{dns_name(
|
516
|
+
def manifest_url(app)
|
517
|
+
"http://#{dns_name(app)}/status/manifest"
|
511
518
|
end
|
512
519
|
|
513
|
-
def active_healthcheck_url(
|
514
|
-
"http://#{dns_name(
|
520
|
+
def active_healthcheck_url(app)
|
521
|
+
"http://#{dns_name(app)}/status/healthcheck"
|
515
522
|
end
|
516
523
|
|
517
|
-
def inactive_healthcheck_url(
|
518
|
-
"http://inactive.#{dns_name(
|
524
|
+
def inactive_healthcheck_url(app)
|
525
|
+
"http://inactive.#{dns_name(app)}/status/healthcheck"
|
519
526
|
end
|
520
527
|
|
521
528
|
def paas_target
|
data/lib/conan/output.rb
CHANGED
@@ -97,9 +97,9 @@ class StackatoOutThingy < OutThingy
|
|
97
97
|
|
98
98
|
# short-cuts
|
99
99
|
:app_id => app.id,
|
100
|
-
:deploy_base_name => deploy.name(app
|
101
|
-
:deploy_name => bg ? deploy.unique_name(app
|
102
|
-
:deploy_urls => bg ? deploy.inactive_urls(app
|
100
|
+
:deploy_base_name => deploy.name(app),
|
101
|
+
:deploy_name => bg ? deploy.unique_name(app) : deploy.name(app),
|
102
|
+
:deploy_urls => bg ? deploy.inactive_urls(app) : deploy.active_urls(app),
|
103
103
|
:env => deploy.environment.id,
|
104
104
|
:org => deploy.org,
|
105
105
|
:ship => deploy.ship,
|
data/lib/conan/stackato.rb
CHANGED
@@ -29,7 +29,7 @@ class Stackato
|
|
29
29
|
Dir.chdir(work_dir){
|
30
30
|
login(deployment.paas_target)
|
31
31
|
|
32
|
-
paas_app_name = deployment.name(app
|
32
|
+
paas_app_name = deployment.name(app)
|
33
33
|
appCreate = ->(cmd) {
|
34
34
|
c = "#{@doit} #{@paas_cmd} --manifest #{@paas_manifest} --no-prompt #{cmd} --no-start"
|
35
35
|
system(c) or raise "Stackato #{cmd} failed: #{c}"
|
@@ -84,7 +84,7 @@ class Stackato
|
|
84
84
|
app_info = application_info(app, deployment)
|
85
85
|
raise "Please remove inactive app '#{app_info.inactive_app_name}' before proceeding." unless app_info.inactive_app_name.nil?
|
86
86
|
|
87
|
-
puts "Deploying inactive app #{deployment.name(app
|
87
|
+
puts "Deploying inactive app #{deployment.name(app)}"
|
88
88
|
c = "#{@doit} #{@paas_cmd} --manifest #{@paas_manifest} --no-prompt push"
|
89
89
|
system(c) or raise "Stackato push failed: #{c}"
|
90
90
|
}
|
@@ -100,8 +100,8 @@ class Stackato
|
|
100
100
|
return
|
101
101
|
end
|
102
102
|
|
103
|
-
active_urls = deployment.active_urls(app
|
104
|
-
inactive_urls = deployment.inactive_urls(app
|
103
|
+
active_urls = deployment.active_urls(app)
|
104
|
+
inactive_urls = deployment.inactive_urls(app)
|
105
105
|
|
106
106
|
appUrlOp = ->(cmd, paas_app_name, url) {
|
107
107
|
c = "#{@doit} #{@paas_cmd} #{cmd} #{paas_app_name} #{url}"
|
@@ -140,9 +140,9 @@ class Stackato
|
|
140
140
|
list_json = `#{@paas_cmd} list --json`
|
141
141
|
raise "Stackato list failed" if !$?.success?
|
142
142
|
|
143
|
-
base_name = deployment.name(app
|
144
|
-
active_urls = deployment.active_urls(app
|
145
|
-
inactive_urls = deployment.inactive_urls(app
|
143
|
+
base_name = deployment.name(app)
|
144
|
+
active_urls = deployment.active_urls(app)
|
145
|
+
inactive_urls = deployment.inactive_urls(app)
|
146
146
|
|
147
147
|
StackatoApplicationInfo.new(list_json, base_name, active_urls, inactive_urls)
|
148
148
|
end
|
data/lib/conan/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conan_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Reardon
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daphne_util
|