prima-twig 0.2.14 → 0.2.16

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-deploy +5 -5
  3. data/bin/twig-feature +44 -7
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a10a63db774a0ba868946173fda9b6e65ba93402
4
- data.tar.gz: 4bb6c872e5b9342367cc05c745b79ece43bbc024
3
+ metadata.gz: 7e461bd2975f9c5c3ebe5ac22894efcf993aef12
4
+ data.tar.gz: ea2a3b971ef09a6d4f73c90121360f1f03fa4200
5
5
  SHA512:
6
- metadata.gz: c7429b2ffd7656c4908255b1fa5e06dbf81ce8e01b7ad89e6b019d9e3603e2f363dff326cb0a064c85a828b8f8b1cd40575cd44ffd7ae2d6a437bfdc5f6e4cca
7
- data.tar.gz: 49fb9e5381ad2485a8cbe5134d4510f6f5de821931d3820e63bd06d561804d4feeb68673bafb1e1dd0625c8ced5c19fed76374517a67eac14a0076bddcd94ec2
6
+ metadata.gz: 370d6fb95c1723b2cd2a30c16b564f35a28cccecf5ff3ffa825179e18ab20731830d274d66dfde78466f2a0fc72bff46243634efa87b98a24fbd31ec3ff29d63
7
+ data.tar.gz: e56af2ff3aebb0314955ddb63c5cb58146dd4aeebf9027ece63792dc7331cfe6446a45c599969664a4d16cc7d4ab0a445e35b87c3a00a2ec4cb386e73238a66e
data/bin/twig-deploy CHANGED
@@ -78,11 +78,11 @@ class Review
78
78
  subject "#{user} ha effettuato il deploy della revision #{artifact[:rev]}"
79
79
  end
80
80
 
81
- body = "# Deploy in produzione avvenuto con successo!\n\n"
82
- body << "### Data: #{Time.now.strftime('%d/%m/%Y %H:%M:%S')}\n"
83
- body << "### Utente: #{user}\n"
84
- body << "### Revision: [#{artifact[:rev]}](https://github.com/primait/prima/commit/#{artifact[:rev]}) del #{artifact[:created_at].strftime('%d/%m/%Y %H:%M:%S')}\n"
85
- body << "### Branch: [#{artifact[:branch]}](https://github.com/primait/prima/tree/#{artifact[:branch]})\n"
81
+ body = "## Deploy in produzione iniziato\n\n"
82
+ body << "Data: #{Time.now.strftime('%d/%m/%Y %H:%M:%S')}\n\n"
83
+ body << "Utente: #{user}\n\n"
84
+ body << "Revision: [#{artifact[:rev]}](https://github.com/primait/prima/commit/#{artifact[:rev]}) del #{artifact[:created_at].strftime('%d/%m/%Y %H:%M:%S')}\n\n"
85
+ body << "Branch: [#{artifact[:branch]}](https://github.com/primait/prima/tree/#{artifact[:branch]})\n"
86
86
 
87
87
  htmlBody = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new).render body
88
88
 
data/bin/twig-feature CHANGED
@@ -90,10 +90,21 @@ class Release
90
90
  if environment_exists?(@application_name, @environment_name)
91
91
  is_eb_ready = is_eb_ready?(@application_name, @environment_name)
92
92
  wait_for_eb_ready(@application_name, @environment_name) unless is_eb_ready
93
- @eb.update_application_version({
94
- application_name: @application_name,
93
+ @eb.update_environment({
94
+ environment_name: @environment_name,
95
95
  version_label: @version_label
96
96
  })
97
+ wait_for_eb_ready(@application_name, @environment_name)
98
+ output "Attendo che i container vengano riavviati...\n".yellow
99
+ # Non e' veramente ready, deve restartare i container
100
+ sleep_seconds = 180
101
+ seconds_elapsed = 0
102
+ while true
103
+ break if seconds_elapsed >= sleep_seconds
104
+ print '.'.yellow; STDOUT.flush
105
+ sleep 1
106
+ seconds_elapsed += 1
107
+ end
97
108
  run_commands(@environment_name, ssh_key_path)
98
109
  else
99
110
  output "Environment #{@environment_name} non presente, inizio la creazione...\n".yellow
@@ -184,6 +195,26 @@ class Release
184
195
  version_label: version_label,
185
196
  solution_stack_name: "64bit Amazon Linux 2015.09 v2.0.4 running Multi-container Docker 1.7.1 (Generic)",
186
197
  option_settings: [
198
+ {
199
+ namespace: "aws:ec2:vpc",
200
+ option_name: "VPCId",
201
+ value: "vpc-72e52b17",
202
+ },
203
+ {
204
+ namespace: "aws:ec2:vpc",
205
+ option_name: "Subnets",
206
+ value: "subnet-90dc64f5,subnet-df13e986,subnet-78db7a0f",
207
+ },
208
+ {
209
+ namespace: "aws:ec2:vpc",
210
+ option_name: "ELBSubnets",
211
+ value: "subnet-90dc64f5,subnet-df13e986,subnet-78db7a0f",
212
+ },
213
+ {
214
+ namespace: "aws:ec2:vpc",
215
+ option_name: "AssociatePublicIpAddress",
216
+ value: "true",
217
+ },
187
218
  {
188
219
  namespace: "aws:autoscaling:launchconfiguration",
189
220
  option_name: "IamInstanceProfile",
@@ -272,10 +303,9 @@ class Release
272
303
  def wait_for_eb_ready(application_name, environment_name)
273
304
  ready = false
274
305
  start_time = Time.now - 60
306
+ sleep_seconds = 30
275
307
  output "Attendo che l'environment finisca di essere inizializzato...\n".yellow
276
308
  while !ready
277
- print '...'.yellow; STDOUT.flush
278
-
279
309
  events = get_eb_events(application_name, environment_name, start_time)
280
310
  start_time = Time.now
281
311
 
@@ -292,7 +322,14 @@ class Release
292
322
  end
293
323
 
294
324
  ready = true if is_eb_ready?(application_name, environment_name)
295
- sleep 10 unless ready
325
+
326
+ seconds_elapsed = 0
327
+ while true
328
+ break if seconds_elapsed >= sleep_seconds
329
+ print '.'.yellow; STDOUT.flush
330
+ sleep 1
331
+ seconds_elapsed += 1
332
+ end
296
333
  end
297
334
 
298
335
  output "Environment inizializzato!\n".green
@@ -310,8 +347,8 @@ class Release
310
347
  output "L'IP pubblico della macchina e': #{public_ip_address}\n".cyan
311
348
 
312
349
  base_cmd = "ssh -q -tt -o StrictHostKeyChecking=no -i #{ssh_key_path} ec2-user@#{public_ip_address}"
313
- cmd = "#{base_cmd} sudo -i docker ps -a --filter='name=php' | awk '{print $1 }' | grep -v CONTAINER"
314
- container_id = %x[ #{cmd} | grep -v 'Warning:' ].chomp
350
+ cmd = "#{base_cmd} sudo -i docker ps --filter='name=-php-' | awk '{print $1 }' | grep -v CONTAINER"
351
+ container_id = %x[ #{cmd} | grep -v 'Warning:' ].strip
315
352
 
316
353
  base_docker_cmd = "sudo -i docker exec #{container_id}"
317
354
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prima-twig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-12-02 00:00:00.000000000 Z
14
+ date: 2015-12-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: twig