prima-twig 0.24.0 → 0.25.0

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-feature +440 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cdb68fcab4e2545accf55a97e9727cc9afb43b5
4
- data.tar.gz: a3ac16212ed2ea647d1fa56e33dc66ef89ccb616
3
+ metadata.gz: 863d28a845f060eec0dd9d5e4c0f608f8fe78dd0
4
+ data.tar.gz: 4c5cca0db0d3db76ef53e7df459c25a7cedc3829
5
5
  SHA512:
6
- metadata.gz: 16b7da2afb3f16a1c6b934dcb76c64a61ff545b5ebac08695bbc3648fb715d615a7c3757c2e4e2cfd54e00d2fea8d012f379283e56021d6768f9a3dacff3cdba
7
- data.tar.gz: 395805863bb009fbd464f032eb17b96728a5082aff89b80d48e0582ce95932290bcc8290f3e45819d960afb0ab87f047a79e7be28df874d09232e17dc97b0f82
6
+ metadata.gz: c26714a1264be5a94ba6dd46b6d11f1c35ff0bd778e27dd013a44f1384d1ed2fb1bf7e2498d42acc6d2cb1170310fe26ca2596449a849c3cccff030cebb98a5d
7
+ data.tar.gz: 8d05e5e0bdaf357ed249aae190489c4e0e58b4608d5a4d9889f8472511228277eb3d8c387fdc200cc6e3541df1f3364d9abea6797fa67000628e95fabdfe8065
data/bin/twig-feature CHANGED
@@ -22,7 +22,7 @@ class Release
22
22
  @asg = Aws::AutoScaling::Client.new
23
23
  @s3_bucket = 'prima-artifacts'
24
24
  @artifact_path = '/tmp/prima-artifact.zip'
25
- @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-504JWCS499LN:1'
25
+ @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore-TaskDefinitionDbRestore-19XD5OHZGOTI3:1'
26
26
  @prima_built = false
27
27
  @urania_built = false
28
28
  @ermes_built = false
@@ -30,10 +30,27 @@ class Release
30
30
  @hal9000_built = false
31
31
  @fidaty_built = false
32
32
  @backoffice_built = false
33
+ @peano_built = false
34
+ @rogoreport_built = false
35
+ @assange_built = false
36
+ @borat_built = false
33
37
  @dns_record_identifier = nil
34
38
  @ecs_cluster_name = nil
35
- @projects = {"prima" => {}, "backoffice" => {}, "urania" => {}, "ermes" => {}, "bburago" => {}, "hal9000" => {}, "fidaty" => {}}
39
+ @projects = {
40
+ "prima" => {},
41
+ "backoffice" => {},
42
+ "urania" => {},
43
+ "ermes" => {},
44
+ "bburago" => {},
45
+ "hal9000" => {},
46
+ "fidaty" => {},
47
+ "peano" => {},
48
+ "rogoreport" => {},
49
+ "assange" => {},
50
+ "borat" => {}
51
+ }
36
52
  @stack_name_alb = "ecs-alb-http-public-qa"
53
+ @stack_name_alb_ws = "ecs-alb-ws-public-qa"
37
54
  end
38
55
 
39
56
  def execute! args
@@ -306,6 +323,7 @@ class Release
306
323
  sleep 60
307
324
  delete_stack(cluster_stack_name)
308
325
  delete_stack(@stack_name_alb) if envs.length < 2
326
+ delete_stack(@stack_name_alb_ws) if envs.length < 2
309
327
  output "Finito!".green
310
328
  end
311
329
 
@@ -351,7 +369,19 @@ class Release
351
369
  `sudo true` # cosi' non chiede la password dopo
352
370
  `git pull && git submodule init && git submodule update`
353
371
 
354
- deploy_id = Digest::MD5.hexdigest(@projects["prima"][:name] + @projects["backoffice"][:name] + @projects["urania"][:name] + @projects["ermes"][:name] + @projects["bburago"][:name] + @projects["hal9000"][:name] + @projects["fidaty"][:name])
372
+ deploy_id = Digest::MD5.hexdigest(
373
+ @projects["prima"][:name] +
374
+ @projects["backoffice"][:name] +
375
+ @projects["urania"][:name] +
376
+ @projects["ermes"][:name] +
377
+ @projects["bburago"][:name] +
378
+ @projects["hal9000"][:name] +
379
+ @projects["fidaty"][:name] +
380
+ @projects["peano"][:name] +
381
+ @projects["rogoreport"][:name] +
382
+ @projects["assange"][:name] +
383
+ @projects["borat"][:name]
384
+ )
355
385
  @dns_record_identifier = deploy_id
356
386
  hostname_pattern_priority = hostname_pattern_priority()
357
387
  tags = [
@@ -386,6 +416,22 @@ class Release
386
416
  {
387
417
  key: "hostname_pattern_priority",
388
418
  value: hostname_pattern_priority
419
+ },
420
+ {
421
+ key: "peano",
422
+ value: @projects["peano"][:name]
423
+ },
424
+ {
425
+ key: "rogoreport",
426
+ value: @projects["rogoreport"][:name]
427
+ },
428
+ {
429
+ key: "assange",
430
+ value: @projects["assange"][:name]
431
+ },
432
+ {
433
+ key: "borat",
434
+ value: @projects["borat"][:name]
389
435
  }
390
436
  ]
391
437
 
@@ -401,7 +447,8 @@ class Release
401
447
  create_cluster_stack(cluster_stack_name, tags) unless stack_exists?(cluster_stack_name)
402
448
  wait_for_stack_ready(cluster_stack_name) unless stack_ready?(cluster_stack_name)
403
449
 
404
- create_alb_stack(@stack_name_alb) unless stack_exists?(@stack_name_alb)
450
+ create_alb_stack(@stack_name_alb, "http") unless stack_exists?(@stack_name_alb)
451
+ create_alb_stack(@stack_name_alb_ws, "websocket") unless stack_exists?(@stack_name_alb_ws)
405
452
 
406
453
  resp = @cf.describe_stack_resource({stack_name: cluster_stack_name, logical_resource_id: 'ECSCluster'})
407
454
  @ecs_cluster_name = resp.stack_resource_detail.physical_resource_id
@@ -430,11 +477,16 @@ class Release
430
477
  create_hal9000_artifact(@projects["hal9000"][:revision]) unless artifact_exists?('prima-artifacts', "microservices/hal9000/#{@projects["hal9000"][:revision]}-qa.tar.gz")
431
478
  create_fidaty_artifact(@projects["fidaty"][:revision], deploy_id) unless artifact_exists?('prima-artifacts', "microservices/fidaty/#{@projects["fidaty"][:revision]}-#{deploy_id}-qa.tar.gz")
432
479
  create_backoffice_artifact(@projects["backoffice"][:revision], deploy_id) unless artifact_exists?('prima-artifacts', "backoffice/#{@projects["backoffice"][:revision]}-#{deploy_id}.zip")
480
+ create_peano_artifact(@projects["peano"][:revision]) unless artifact_exists?('prima-artifacts', "microservices/peano/#{@projects["peano"][:revision]}-qa.tar.gz")
481
+ create_rogoreport_artifact(@projects["rogoreport"][:revision], deploy_id) unless artifact_exists?('prima-artifacts', "microservices/rogoreport/#{@projects["rogoreport"][:revision]}-#{deploy_id}-qa.tar.gz")
482
+ create_assange_artifact(@projects["assange"][:revision]) unless artifact_exists?('prima-artifacts', "microservices/assange/#{@projects["assange"][:revision]}-qa.tar.gz")
483
+ create_borat_artifact(@projects["borat"][:revision], deploy_id) unless artifact_exists?('prima-artifacts', "microservices/borat/#{@projects["borat"][:revision]}-#{deploy_id}-qa.tar.gz")
433
484
 
434
485
  wait_for_stack_ready(stack_name_db) unless stack_ready?(stack_name_db)
435
486
  import_dbs(ec2_ip_address(asg_stack_name)) unless stack_exists?("ecs-task-web-qa-#{deploy_id}")
436
487
 
437
488
  wait_for_stack_ready(@stack_name_alb) unless stack_ready?(@stack_name_alb)
489
+ wait_for_stack_ready(@stack_name_alb_ws) unless stack_ready?(@stack_name_alb_ws)
438
490
 
439
491
  stack_name_web = "ecs-task-web-qa-#{deploy_id}"
440
492
  git_checkout_version('prima', @projects["prima"][:revision])
@@ -693,6 +745,148 @@ class Release
693
745
  create_stack(stack_name_fidaty, stack_body, parameters, tags)
694
746
  end
695
747
 
748
+ stack_name_peano = "ecs-task-peano-qa-#{deploy_id}"
749
+ git_checkout_version('peano', @projects["peano"][:revision])
750
+ stack_body = YAML.load_file('projects/peano/deploy/task.yml')
751
+ stack_body['Resources']['ECSServicePeano']['Properties'].reject!{ |k| ['LoadBalancers', 'Role'].include?(k) }
752
+ stack_body = stack_body.to_yaml
753
+ parameters = [
754
+ {
755
+ parameter_key: "Environment",
756
+ parameter_value: "qa"
757
+ },
758
+ {
759
+ parameter_key: "ReleaseVersion",
760
+ parameter_value: @projects["peano"][:revision]
761
+ },
762
+ {
763
+ parameter_key: "ECSClusterName",
764
+ parameter_value: @ecs_cluster_name
765
+ },
766
+ {
767
+ parameter_key: "TaskDesiredCount",
768
+ parameter_value: "1"
769
+ },
770
+ {
771
+ parameter_key: "ALBShortName",
772
+ parameter_value: "peano-qa-#{deploy_id}"[0..31]
773
+ },
774
+ {
775
+ parameter_key: "HostnamePattern",
776
+ parameter_value: "peano-#{@dns_record_identifier}.qa.colaster.com"
777
+ },
778
+ {
779
+ parameter_key: "HostnamePatternPriority",
780
+ parameter_value: hostname_pattern_priority
781
+ }
782
+ ]
783
+ if stack_exists?(stack_name_peano)
784
+ update_stack(stack_name_peano, stack_body, parameters) if @peano_built
785
+ else
786
+ create_stack(stack_name_peano, stack_body, parameters, tags)
787
+ end
788
+
789
+ stack_name_rogoreport = "ecs-task-rogoreport-qa-#{deploy_id}"
790
+ git_checkout_version('rogoreport', @projects["rogoreport"][:revision])
791
+ stack_body = IO.read('projects/rogoreport/deploy/task.yml')
792
+ parameters = [
793
+ {
794
+ parameter_key: "Environment",
795
+ parameter_value: "qa"
796
+ },
797
+ {
798
+ parameter_key: "ReleaseVersion",
799
+ parameter_value: "#{@projects["rogoreport"][:revision]}-#{deploy_id}"
800
+ },
801
+ {
802
+ parameter_key: "ECSClusterName",
803
+ parameter_value: @ecs_cluster_name
804
+ }
805
+ ]
806
+ if stack_exists?(stack_name_rogoreport)
807
+ update_stack(stack_name_rogoreport, stack_body, parameters) if @rogoreport_built
808
+ else
809
+ create_stack(stack_name_rogoreport, stack_body, parameters, tags)
810
+ end
811
+
812
+ stack_name_assange = "ecs-task-assange-qa-#{deploy_id}"
813
+ git_checkout_version('assange', @projects["assange"][:revision])
814
+ stack_body = IO.read('projects/assange/deploy/task.yml')
815
+ parameters = [
816
+ {
817
+ parameter_key: "Environment",
818
+ parameter_value: "qa"
819
+ },
820
+ {
821
+ parameter_key: "ReleaseVersion",
822
+ parameter_value: @projects["assange"][:revision]
823
+ },
824
+ {
825
+ parameter_key: "ECSClusterName",
826
+ parameter_value: @ecs_cluster_name
827
+ },
828
+ {
829
+ parameter_key: "TaskDesiredCount",
830
+ parameter_value: "1"
831
+ },
832
+ {
833
+ parameter_key: "ALBShortName",
834
+ parameter_value: "assange-qa-#{deploy_id}"[0..31]
835
+ },
836
+ {
837
+ parameter_key: "HostnamePattern",
838
+ parameter_value: "assange-#{@dns_record_identifier}.qa.colaster.com"
839
+ },
840
+ {
841
+ parameter_key: "HostnamePatternPriority",
842
+ parameter_value: (hostname_pattern_priority.to_i + 20).to_s
843
+ }
844
+ ]
845
+ if stack_exists?(stack_name_assange)
846
+ update_stack(stack_name_assange, stack_body, parameters) if @assange_built
847
+ else
848
+ create_stack(stack_name_assange, stack_body, parameters, tags)
849
+ end
850
+
851
+ stack_name_borat = "ecs-task-borat-qa-#{deploy_id}"
852
+ git_checkout_version('borat', @projects["borat"][:revision])
853
+ stack_body = IO.read('projects/borat/deploy/task.yml')
854
+ parameters = [
855
+ {
856
+ parameter_key: "Environment",
857
+ parameter_value: "qa"
858
+ },
859
+ {
860
+ parameter_key: "ReleaseVersion",
861
+ parameter_value: "#{@projects["borat"][:revision]}-#{deploy_id}"
862
+ },
863
+ {
864
+ parameter_key: "ECSClusterName",
865
+ parameter_value: @ecs_cluster_name
866
+ },
867
+ {
868
+ parameter_key: "TaskDesiredCount",
869
+ parameter_value: "1"
870
+ },
871
+ {
872
+ parameter_key: "ALBShortName",
873
+ parameter_value: "borat-qa-#{deploy_id}"[0..31]
874
+ },
875
+ {
876
+ parameter_key: "HostnamePattern",
877
+ parameter_value: "backoffice-#{@dns_record_identifier}.qa.colaster.com"
878
+ },
879
+ {
880
+ parameter_key: "HostnamePatternPriority",
881
+ parameter_value: (hostname_pattern_priority.to_i + 30).to_s
882
+ }
883
+ ]
884
+ if stack_exists?(stack_name_borat)
885
+ update_stack(stack_name_borat, stack_body, parameters) if @borat_built
886
+ else
887
+ create_stack(stack_name_borat, stack_body, parameters, tags)
888
+ end
889
+
696
890
  git_checkout_version('backoffice', @projects["backoffice"][:revision])
697
891
  stack_name_backoffice = "ecs-task-backoffice-qa-#{deploy_id}"
698
892
  stack_body = IO.read('projects/backoffice/deploy/task.yml')
@@ -719,7 +913,7 @@ class Release
719
913
  },
720
914
  {
721
915
  parameter_key: "HostnamePattern",
722
- parameter_value: "backoffice-#{@dns_record_identifier}.qa.colaster.com"
916
+ parameter_value: "backoffice-legacy-#{@dns_record_identifier}.qa.colaster.com"
723
917
  },
724
918
  {
725
919
  parameter_key: "HostnamePatternPriority",
@@ -740,6 +934,10 @@ class Release
740
934
  wait_for_stack_ready(stack_name_bburago) unless stack_ready?(stack_name_bburago)
741
935
  wait_for_stack_ready(stack_name_hal9000) unless stack_ready?(stack_name_hal9000)
742
936
  wait_for_stack_ready(stack_name_fidaty) unless stack_ready?(stack_name_fidaty)
937
+ wait_for_stack_ready(stack_name_peano) unless stack_ready?(stack_name_peano)
938
+ wait_for_stack_ready(stack_name_rogoreport) unless stack_ready?(stack_name_rogoreport)
939
+ wait_for_stack_ready(stack_name_assange) unless stack_ready?(stack_name_assange)
940
+ wait_for_stack_ready(stack_name_borat) unless stack_ready?(stack_name_borat)
743
941
 
744
942
  update_service_defaults(stack_name_web)
745
943
  update_service_defaults(stack_name_consumer)
@@ -749,6 +947,10 @@ class Release
749
947
  update_service_defaults(stack_name_bburago)
750
948
  update_service_defaults(stack_name_hal9000)
751
949
  update_service_defaults(stack_name_fidaty)
950
+ update_service_defaults(stack_name_peano)
951
+ update_service_defaults(stack_name_rogoreport)
952
+ update_service_defaults(stack_name_assange)
953
+ update_service_defaults(stack_name_borat)
752
954
 
753
955
  stack_name_route53 = "ecs-route53-qa-#{deploy_id}"
754
956
  stack_body = IO.read('cloudformation/stacks/route53/qa.yml')
@@ -780,6 +982,18 @@ class Release
780
982
  {
781
983
  parameter_key: "FidatyIp",
782
984
  parameter_value: ec2_ip_address(asg_stack_name)
985
+ },
986
+ {
987
+ parameter_key: "PeanoIp",
988
+ parameter_value: ec2_ip_address(asg_stack_name)
989
+ },
990
+ {
991
+ parameter_key: "AssangeElbHostname",
992
+ parameter_value: get_alb_host(@stack_name_alb)
993
+ },
994
+ {
995
+ parameter_key: "BoratElbHostname",
996
+ parameter_value: get_alb_host(@stack_name_alb_ws)
783
997
  }
784
998
  ]
785
999
  create_stack(stack_name_route53, stack_body, parameters, tags) unless stack_exists?(stack_name_route53)
@@ -789,17 +1003,23 @@ class Release
789
1003
  bburago_hostname = get_route53_hostname(stack_name_bburago)
790
1004
  hal9000_hostname = get_route53_hostname(stack_name_hal9000)
791
1005
  fidaty_hostname = get_route53_hostname(stack_name_fidaty)
1006
+ peano_hostname = get_route53_hostname(stack_name_peano)
792
1007
  backoffice_hostname = get_route53_hostname(stack_name_backoffice)
1008
+ assange_hostname = get_route53_hostname(stack_name_assange)
1009
+ borat_hostname = get_route53_hostname(stack_name_borat)
793
1010
 
794
1011
  wait_for_stack_ready(stack_name_route53) unless stack_ready?(stack_name_route53)
795
1012
 
796
1013
  output "Prima url: https://#{prima_hostname}\n".cyan
797
1014
  output "Prima RI url: https://#{prima_hostname.sub("www", "wwwri")}\n".cyan
798
- output "Backoffice url: https://#{backoffice_hostname}\n".cyan
1015
+ output "Backoffice (Borat) url: https://#{borat_hostname}\n".cyan
799
1016
  output "Urania url: http://#{urania_hostname}:81\n".cyan
800
1017
  output "Bburago url: http://#{bburago_hostname}:83\n".cyan
801
1018
  output "Hal9000 url: http://#{hal9000_hostname}:10031\n".cyan
802
1019
  output "Fidaty url: http://#{fidaty_hostname}:10021\n".cyan
1020
+ output "Peano url: http://#{peano_hostname}:10039\n".cyan
1021
+ output "Assange url: https://#{assange_hostname}\n".cyan
1022
+ output "Backoffice (legacy) url: https://#{backoffice_hostname}\n".cyan
803
1023
  output "SSH connection: ssh ec2-user@#{ec2_ip_address(asg_stack_name)} -i ~/.ssh/ecs-cluster-qa.pem".cyan
804
1024
  output "Deploy effettuato, everything is awesome!\n".green
805
1025
  end
@@ -811,13 +1031,19 @@ class Release
811
1031
  when stack_name.include?('urania')
812
1032
  host = "urania-#{@dns_record_identifier}.qa.colaster.com"
813
1033
  when stack_name.include?('backoffice')
814
- host = "backoffice-#{@dns_record_identifier}.qa.colaster.com"
1034
+ host = "backoffice-legacy-#{@dns_record_identifier}.qa.colaster.com"
815
1035
  when stack_name.include?('bburago')
816
1036
  host = "bburago-#{@dns_record_identifier}.qa.colaster.com"
817
1037
  when stack_name.include?('hal9000')
818
1038
  host = "hal9000-#{@dns_record_identifier}.qa.colaster.com"
819
1039
  when stack_name.include?('fidaty')
820
1040
  host = "fidaty-#{@dns_record_identifier}.qa.colaster.com"
1041
+ when stack_name.include?('peano')
1042
+ host = "peano-#{@dns_record_identifier}.qa.colaster.com"
1043
+ when stack_name.include?('assange')
1044
+ host = "assange-#{@dns_record_identifier}.qa.colaster.com"
1045
+ when stack_name.include?('borat')
1046
+ host = "backoffice-#{@dns_record_identifier}.qa.colaster.com"
821
1047
  end
822
1048
  host
823
1049
  end
@@ -852,6 +1078,14 @@ class Release
852
1078
  logical_resource_id = 'EcsApplicationLoadBalancerInternal'
853
1079
  when stack_name.include?('alb-http-public')
854
1080
  logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1081
+ when stack_name.include?('alb-ws-public')
1082
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1083
+ when stack_name.include?('peano')
1084
+ logical_resource_id = 'EcsApplicationLoadBalancerInternal'
1085
+ when stack_name.include?('assange')
1086
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1087
+ when stack_name.include?('borat')
1088
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
855
1089
  end
856
1090
  resp = @cf.describe_stack_resource({
857
1091
  stack_name: stack_name,
@@ -877,6 +1111,12 @@ class Release
877
1111
  logical_resource_id = 'EcsElasticLoadBalancerInternal'
878
1112
  when stack_name.include?('fidaty')
879
1113
  logical_resource_id = 'EcsElasticLoadBalancerInternal'
1114
+ when stack_name.include?('peano')
1115
+ logical_resource_id = 'EcsElasticLoadBalancerInternal'
1116
+ when stack_name.include?('assange')
1117
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1118
+ when stack_name.include?('borat')
1119
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
880
1120
  end
881
1121
  resp = @cf.describe_stack_resource({
882
1122
  stack_name: stack_name,
@@ -907,6 +1147,14 @@ class Release
907
1147
  logical_resource_id = 'ECSServiceHal9000'
908
1148
  when stack_name.include?('fidaty')
909
1149
  logical_resource_id = 'ECSServiceFidaty'
1150
+ when stack_name.include?('peano')
1151
+ logical_resource_id = 'ECSServicePeano'
1152
+ when stack_name.include?('rogoreport')
1153
+ logical_resource_id = 'ECSServiceRogoreport'
1154
+ when stack_name.include?('assange')
1155
+ logical_resource_id = 'ECSServiceAssange'
1156
+ when stack_name.include?('borat')
1157
+ logical_resource_id = 'ECSServiceBorat'
910
1158
  else
911
1159
  raise "Service name non gestito per lo stack #{stack_name}"
912
1160
  end
@@ -1110,6 +1358,176 @@ class Release
1110
1358
  Dir.chdir '../../'
1111
1359
  end
1112
1360
 
1361
+ def create_peano_artifact(revision)
1362
+ @peano_built = true
1363
+ output "Preparo l'artifact peano .zip\n".yellow
1364
+
1365
+ git_checkout_version('peano', revision)
1366
+
1367
+ Dir.chdir 'projects/peano'
1368
+
1369
+ stop_unless is_branch_compatible_with_current_twig_version?("peano"), "Il tuo branch del progetto peano non e' compatibile con questa versione di twig, devi REBASARE DA MASTER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!".red
1370
+
1371
+ [
1372
+ "docker-compose build web",
1373
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh peano_web \
1374
+ '-c' 'mix local.hex --force && mix hex.info && \
1375
+ mix deps.get && mix compile && mix deps.compile && \
1376
+ mix release.clean --implode --no-confirm && \
1377
+ mix release --env=qa'",
1378
+ "sudo chown -R `whoami` ."
1379
+ ].each do |cmd|
1380
+ output "Eseguo #{cmd}".yellow
1381
+ res = %x[ #{cmd} ]
1382
+ if $?.exitstatus != 0
1383
+ color = 'red'
1384
+ else
1385
+ color = 'green'
1386
+ end
1387
+ output res.send color
1388
+ stop_if (color == 'red'), "Errore durante la build dell'artifact".red
1389
+ end
1390
+
1391
+ artifact_path = Dir.glob("_build/qa/rel/peano/releases/*/peano.tar.gz").first
1392
+ upload_artifact(artifact_path, "microservices/peano/#{revision}-qa.tar.gz")
1393
+
1394
+ Dir.chdir '../../'
1395
+ end
1396
+
1397
+ def create_rogoreport_artifact(revision, deploy_id)
1398
+ @rogoreport_built = true
1399
+ output "Preparo l'artifact rogoreport .zip\n".yellow
1400
+
1401
+ git_checkout_version('rogoreport', revision)
1402
+
1403
+ Dir.chdir 'projects/rogoreport'
1404
+
1405
+ stack_name_peano = "ecs-task-peano-qa-notneeded"
1406
+ peano_qa_host = "#{get_route53_hostname(stack_name_peano)}:10039"
1407
+
1408
+ [
1409
+ "docker-compose build web",
1410
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh rogoreport_web \
1411
+ '-c' 'sed -i \"s/peano-qa-host/#{peano_qa_host}/g\" apps/escile/config/qa.exs && \
1412
+ cat apps/escile/config/qa.exs && \
1413
+ mix local.hex --force && mix hex.info && \
1414
+ mix deps.get && mix compile && mix deps.compile && \
1415
+ cp -r rel/vm.args rel/config.exs rel/hooks /tmp/ && mix release.clean --implode --no-confirm && \
1416
+ mkdir -p rel && mv /tmp/vm.args /tmp/config.exs /tmp/hooks rel/ && mix release --name=rogoreport_escile --env=qa'",
1417
+ "sudo chown -R `whoami` ."
1418
+ ].each do |cmd|
1419
+ output "Eseguo #{cmd}".yellow
1420
+ res = %x[ #{cmd} ]
1421
+ if $?.exitstatus != 0
1422
+ color = 'red'
1423
+ else
1424
+ color = 'green'
1425
+ end
1426
+ output res.send color
1427
+ stop_if (color == 'red'), "Errore durante la build dell'artifact".red
1428
+ end
1429
+
1430
+ artifact_path = Dir.glob("rel/rogoreport*/releases/*/rogoreport*.tar.gz").first
1431
+ upload_artifact(artifact_path, "microservices/rogoreport/#{revision}-#{deploy_id}-qa.tar.gz")
1432
+
1433
+ Dir.chdir '../../'
1434
+ end
1435
+
1436
+ def create_assange_artifact(revision)
1437
+ @assange_built = true
1438
+ output "Preparo l'artifact assange .zip\n".yellow
1439
+
1440
+ git_checkout_version('assange', revision)
1441
+
1442
+ Dir.chdir 'projects/assange'
1443
+
1444
+ stop_unless is_branch_compatible_with_current_twig_version?("assange"), "Il tuo branch del progetto assange non e' compatibile con questa versione di twig, devi REBASARE DA MASTER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!".red
1445
+
1446
+ [
1447
+ "docker-compose build web",
1448
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh assange_web \
1449
+ '-c' 'mix local.hex --force && mix hex.info && \
1450
+ mix deps.get && mix compile && mix deps.compile && \
1451
+ mix phx.digest && \
1452
+ mix release.clean --implode --no-confirm && \
1453
+ mix release --env=qa'",
1454
+ "sudo chown -R `whoami` ."
1455
+ ].each do |cmd|
1456
+ output "Eseguo #{cmd}".yellow
1457
+ res = %x[ #{cmd} ]
1458
+ if $?.exitstatus != 0
1459
+ color = 'red'
1460
+ else
1461
+ color = 'green'
1462
+ end
1463
+ output res.send color
1464
+ stop_if (color == 'red'), "Errore durante la build dell'artifact".red
1465
+ end
1466
+
1467
+ artifact_path = Dir.glob("_build/qa/rel/assange/releases/*/assange.tar.gz").first
1468
+ upload_artifact(artifact_path, "microservices/assange/#{revision}-qa.tar.gz")
1469
+
1470
+ Dir.chdir '../../'
1471
+ end
1472
+
1473
+ def create_borat_artifact(revision, deploy_id)
1474
+ @borat_built = true
1475
+ output "Preparo l'artifact borat .zip\n".yellow
1476
+
1477
+ git_checkout_version('borat', revision)
1478
+
1479
+ Dir.chdir 'projects/borat'
1480
+
1481
+ stack_name_web = "ecs-task-web-qa-notneeded"
1482
+ web_qa_host = get_route53_hostname(stack_name_web)
1483
+ stack_name_backoffice = "ecs-task-backoffice-qa-notneeded"
1484
+ backoffice_qa_host = get_route53_hostname(stack_name_backoffice)
1485
+ stack_name_assange = "ecs-task-assange-qa-notneeded"
1486
+ assange_qa_host = get_route53_hostname(stack_name_assange)
1487
+ stack_name_borat = "ecs-task-borat-qa-notneeded"
1488
+ borat_qa_host = get_route53_hostname(stack_name_borat)
1489
+
1490
+ ws_endpoint = "wss://#{borat_qa_host}/socket/websocket?vsn=1.0.0"
1491
+ frontend_endpoint = "https://#{web_qa_host}/"
1492
+
1493
+ stop_unless is_branch_compatible_with_current_twig_version?("borat"), "Il tuo branch del progetto borat non e' compatibile con questa versione di twig, devi REBASARE DA MASTER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!".red
1494
+
1495
+ [
1496
+ "docker-compose build backend",
1497
+ "docker run -v $PWD:/code -w /code -e WS_ENDPOINT=#{ws_endpoint} -e FRONTEND=#{frontend_endpoint} -e MIX_ENV=qa --entrypoint /bin/sh borat_backend \
1498
+ '-c' 'sed -i \"s/web-qa-host/#{web_qa_host}/g\" config/qa.exs && \
1499
+ sed -i \"s/backoffice-legacy-qa-host/#{backoffice_qa_host}/g\" config/qa.exs && \
1500
+ sed -i \"s/assange-qa-host/#{assange_qa_host}/g\" config/qa.exs && \
1501
+ mix local.hex --force && mix hex.info && \
1502
+ mix deps.get && \
1503
+ cd assets && \
1504
+ yarn --cache-folder ~/.cache/yarn && \
1505
+ ./node_modules/.bin/elm-github-install && \
1506
+ sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
1507
+ cd ../ && \
1508
+ mix phx.digest && \
1509
+ mix compile && mix deps.compile && \
1510
+ cp -r rel/vm.args rel/config.exs /tmp/ && mix release.clean --implode --no-confirm && \
1511
+ mkdir -p rel && mv /tmp/vm.args /tmp/config.exs rel/ && mix release --env=qa'",
1512
+ "sudo chown -R `whoami` ."
1513
+ ].each do |cmd|
1514
+ output "Eseguo #{cmd}".yellow
1515
+ res = %x[ #{cmd} ]
1516
+ if $?.exitstatus != 0
1517
+ color = 'red'
1518
+ else
1519
+ color = 'green'
1520
+ end
1521
+ output res.send color
1522
+ stop_if (color == 'red'), "Errore durante la build dell'artifact".red
1523
+ end
1524
+
1525
+ artifact_path = Dir.glob("_build/qa/rel/backend/releases/*/backend.tar.gz").first
1526
+ upload_artifact(artifact_path, "microservices/borat/#{revision}-#{deploy_id}-qa.tar.gz")
1527
+
1528
+ Dir.chdir '../../'
1529
+ end
1530
+
1113
1531
  def create_backoffice_artifact(revision, deploy_id)
1114
1532
  @backoffice_built = true
1115
1533
  output "Preparo l'artifact backoffice .zip\n".yellow
@@ -1177,9 +1595,10 @@ class Release
1177
1595
 
1178
1596
  backoffice_qa_host = get_route53_hostname("ecs-task-backoffice-qa-notneeded")
1179
1597
  web_qa_host = get_route53_hostname("ecs-task-web-qa-notneeded")
1598
+ assange_qa_host = get_route53_hostname("ecs-task-assange-qa-notneeded")
1180
1599
 
1181
1600
  [
1182
- "bin/local_build_artifact.sh #{branch_name} #{web_qa_host} #{backoffice_qa_host} #{deploy_id}"
1601
+ "bin/local_build_artifact.sh #{branch_name} #{web_qa_host} #{backoffice_qa_host} #{assange_qa_host} #{deploy_id}"
1183
1602
  ].each do |cmd|
1184
1603
  output "Eseguo #{cmd}".yellow
1185
1604
  res = %x[ #{cmd} ]
@@ -1286,7 +1705,7 @@ class Release
1286
1705
  create_stack(stack_name, stack_body, [], tags)
1287
1706
  end
1288
1707
 
1289
- def create_alb_stack(stack_name)
1708
+ def create_alb_stack(stack_name, role)
1290
1709
  stack_body = IO.read('cloudformation/stacks/alb/ecs-alb-public.yml')
1291
1710
  parameters = [
1292
1711
  {
@@ -1295,7 +1714,7 @@ class Release
1295
1714
  },
1296
1715
  {
1297
1716
  parameter_key: "Role",
1298
- parameter_value: "http"
1717
+ parameter_value: role
1299
1718
  }
1300
1719
  ]
1301
1720
  create_stack(stack_name, stack_body, parameters)
@@ -1452,7 +1871,7 @@ class Release
1452
1871
  def is_branch_compatible_with_current_twig_version?(project)
1453
1872
  case
1454
1873
  when project == 'prima'
1455
- File.readlines("app/cloudformation/tasks/web.yml").grep(/HostnamePatternAggregatorPriority/).size > 0
1874
+ File.readlines("app/config/config_qa.yml").grep(/replaceme-assange.qa.staging.colaster.com/).size > 0
1456
1875
  when project == 'urania'
1457
1876
  File.readlines("deploy/deploy").grep(/HOSTNAME_PATTERN/).size > 0
1458
1877
  when project == 'backoffice'
@@ -1463,6 +1882,12 @@ class Release
1463
1882
  File.readlines("deploy/deploy").grep(/HOSTNAME_PATTERN/).size > 0
1464
1883
  when project == 'fidaty'
1465
1884
  File.readlines("deploy/deploy").grep(/HOSTNAME_PATTERN/).size > 0
1885
+ when project == 'peano'
1886
+ File.readlines("deploy/deploy").grep(/HOSTNAME_PATTERN/).size > 0
1887
+ when project == 'assange'
1888
+ File.readlines("deploy/deploy").grep(/HOSTNAME_PATTERN/).size > 0
1889
+ when project == 'borat'
1890
+ File.readlines("deploy/deploy").grep(/HOSTNAME_PATTERN/).size > 0
1466
1891
  end
1467
1892
  end
1468
1893
 
@@ -1491,6 +1916,10 @@ class Release
1491
1916
  @projects["bburago"] = choose_branch_to_deploy('bburago')
1492
1917
  @projects["hal9000"] = choose_branch_to_deploy('hal9000')
1493
1918
  @projects["fidaty"] = choose_branch_to_deploy('fidaty')
1919
+ @projects["peano"] = choose_branch_to_deploy('peano')
1920
+ @projects["rogoreport"] = choose_branch_to_deploy('rogoreport')
1921
+ @projects["assange"] = choose_branch_to_deploy('assange')
1922
+ @projects["borat"] = choose_branch_to_deploy('borat')
1494
1923
  else
1495
1924
  stop_unless File.directory?("./projects/#{project_name}"), "progetto #{project_name} inesistente o non supportato"
1496
1925
  @projects[project_name] = choose_branch_to_deploy(project_name)
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.24.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-06-15 00:00:00.000000000 Z
15
+ date: 2017-07-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: twig