inf 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/inf +0 -1
  3. data/lib/aws.rb +26 -20
  4. data/lib/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7765d51747258b9cb335204780d44762c00efdb7
4
- data.tar.gz: dcf23bacd65b44f06f182947a3f13115c27b631c
3
+ metadata.gz: c0590efc3175a008573b3d56833eea841415dc46
4
+ data.tar.gz: 34fd31eb23ba83cd6c35310ec192e52cda63fd12
5
5
  SHA512:
6
- metadata.gz: 947bfbab39a2e34e3e850f1c1f432f24047bdc6a7028fefc037e5509cc6552f3a009bc9ca89d6cb47b9f6d7bec3abeda650391349f728725542187cc0f37230b
7
- data.tar.gz: 85b89d216c0d4539705ac993aa56c888b3f1f0adb898a6c1be6552b7e5b70b6f96e4096948436a189f4268019ed0dae8a43741d5de22e6ab541cda217444c058
6
+ metadata.gz: c0562297b95f3734508a6c32c6bf950be22db7981c1d932509dfc7842287f9371d107d5ee5edb56768fe80f34e48793339fd9dbae56354203e1bab9f4bd67c5d
7
+ data.tar.gz: 2b297e1ed43d694b6399c5c5cfdc548b6df7df4467f28cc7982c39d3a70fe8226aee7d9257b2dae480cddb7c34ce861a8067a2139c7c0e02a4e9d56c1085cdbe
data/bin/inf CHANGED
@@ -31,7 +31,6 @@ require_env_vars %w(
31
31
  ELB_SG
32
32
  SUBNET_IDS
33
33
  KEY_NAME
34
- CERT_ARN
35
34
  )
36
35
 
37
36
  ENV['TERMINATE_INSTANCES'] ||= "true"
data/lib/aws.rb CHANGED
@@ -30,7 +30,7 @@ export APP_NAME=#{app_name}
30
30
  export STATE_BUCKET=#{state_bucket}
31
31
  export FLEET_NAME=#{fleet_name}
32
32
  export AWS_REGION=#{ENV['AWS_REGION']}
33
- export JENKINS_PUBLIC_KEY="#{ENV['JENKINS_PUBLIC_KEY']}"
33
+ export JENKINS_PUBLIC_KEY='#{ENV['JENKINS_PUBLIC_KEY']}'
34
34
  EOF
35
35
 
36
36
  . ./bootstrap-env
@@ -45,23 +45,29 @@ BOOTSTRAP_SCRIPT
45
45
 
46
46
  def self.launch_load_balancer
47
47
  lb_name = "app-lb-#{app_name}"
48
+ cert = ENV['CERT_ARN']
49
+
50
+ listeners = [{
51
+ instance_port: 5000,
52
+ instance_protocol: 'HTTP',
53
+ load_balancer_port: 80,
54
+ protocol: 'HTTP'
55
+ }]
56
+
57
+ cert.present? && listeners.push(
58
+ instance_port: 5000,
59
+ instance_protocol: 'HTTP',
60
+ load_balancer_port: 443,
61
+ protocol: 'HTTPS',
62
+ ssl_certificate_id: cert
63
+ )
64
+
48
65
  lb_dns = elb.create_load_balancer(
49
66
  load_balancer_name: lb_name,
50
67
  subnets: ENV['SUBNET_IDS'].split(','),
51
68
  security_groups: [ENV['ELB_SG']],
52
- scheme: "internet-facing",
53
- listeners: [{
54
- instance_port: 5000,
55
- instance_protocol: 'HTTP',
56
- load_balancer_port: 80,
57
- protocol: 'HTTP'
58
- }, {
59
- instance_port: 5000,
60
- instance_protocol: "HTTP",
61
- load_balancer_port: 443,
62
- protocol: "HTTPS",
63
- ssl_certificate_id: ENV['CERT_ARN'],
64
- }]
69
+ scheme: 'internet-facing',
70
+ listeners: listeners
65
71
  ).dns_name
66
72
 
67
73
  elb.configure_health_check(
@@ -78,7 +84,7 @@ BOOTSTRAP_SCRIPT
78
84
  put_state("apps/#{app_name}/lb-name", lb_name)
79
85
  put_state("apps/#{app_name}/lb-dns", lb_dns)
80
86
 
81
- puts "Launched load balancer (or it was running)".blue
87
+ puts 'Launched load balancer (or it was running)'.blue
82
88
  end
83
89
 
84
90
  def self.request_spot_fleet(fleet_name='default')
@@ -109,10 +115,10 @@ BOOTSTRAP_SCRIPT
109
115
 
110
116
  tag_specifications = [{
111
117
  tags: [{
112
- key: "app_name",
118
+ key: 'app_name',
113
119
  value: app_name
114
120
  }, {
115
- key: "fleet_name",
121
+ key: 'fleet_name',
116
122
  value: fleet_name
117
123
  }]
118
124
  }]
@@ -127,9 +133,9 @@ BOOTSTRAP_SCRIPT
127
133
  iam_fleet_role: ENV['FLEET_ROLE'],
128
134
  launch_specifications: launch_specifications,
129
135
  # tag_specifications: tag_specifications,
130
- excess_capacity_termination_policy: "default", # accepts noTermination, default
131
- allocation_strategy: "diversified", # accepts lowestPrice, diversified
132
- type: "maintain", # accepts request, maintain
136
+ excess_capacity_termination_policy: 'default', # accepts noTermination, default
137
+ allocation_strategy: 'diversified', # accepts lowestPrice, diversified
138
+ type: 'maintain', # accepts request, maintain
133
139
  replace_unhealthy_instances: true,
134
140
  },
135
141
  )
@@ -1,3 +1,3 @@
1
1
  module Inf
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.15'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Brett <kyle@kylebrett.com>