hako 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23c0c6350f347bcf8bc3a4462c6284e2d3135f22
4
- data.tar.gz: 9ddd98e7ce10875ac654fcc2c425de3264d392e4
3
+ metadata.gz: ef29ede6ffaf4f044b5b8af2d45e0d737faacd9b
4
+ data.tar.gz: ac44a0612a7188db235ea9dffd9c8e54f93616f2
5
5
  SHA512:
6
- metadata.gz: 1597dd9361d1ec0fbee733dc89f18a1856a0c49527a0b5b55a5982c31520c9d9483ba42fcbb36df9dbf3a81789d32c2336cf3e0f38dd7bf4c670b39dc7582821
7
- data.tar.gz: a0dba22ad43958e5092b3a130fcb5a53d01328418feec37d57edbeef41b95f2350fe8577e1789d30c6a58dcfda8bdedc0a23de0ea66b0525a5f898763c22becc
6
+ metadata.gz: e4ddcc37c95d87a0620240b00ebb90822c1f2115233aaf24b3afc929fb07f0e3e9868b64f8e5f241e44ba888ef6954e52fef20ba0f15ce4daa18ee47f1b28234
7
+ data.tar.gz: 5f11ebc2a746ea818cdb5fb8899ecd53ffaef6913b8acf3e95e2b215b96e841425a66fc7638ac8e3651b1f149000dd6540bf5f28e168c590ac5322df9c47939d
data/.travis.yml CHANGED
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.3.1
4
+ - 2.3.3
5
+ - 2.4.0
5
6
  - ruby-head
6
7
  before_install:
8
+ - gem update --system # https://github.com/rubygems/rubygems/pull/1819
7
9
  - gem install bundler
8
10
  matrix:
9
11
  allow_failures:
data/README.md CHANGED
@@ -47,7 +47,7 @@ Events:
47
47
  2015-10-05 13:35:53 +0900: (service hello) has reached a steady state.
48
48
  2015-10-05 13:35:14 +0900: (service hello) stopped 1 running tasks.
49
49
 
50
- % hako rollback examples/hello.yml # [EXPERIMENTAL]
50
+ % hako rollback examples/hello.yml
51
51
  I, [2016-05-02T13:07:12.679926 #10961] INFO -- : Current task defintion is hello:29. Rolling back to arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:task-definition/hello:28
52
52
  I, [2016-05-02T13:07:12.959116 #10961] INFO -- : Updated service: arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:service/hello
53
53
  I, [2016-05-02T13:08:27.280686 #10961] INFO -- : Deployment completed
@@ -58,7 +58,7 @@ module Hako
58
58
 
59
59
  if @dry_run
60
60
  definitions.each do |d|
61
- Hako.logger.info "Add container #{d}"
61
+ print_definition_in_cli_format(d)
62
62
  end
63
63
  if @autoscaling
64
64
  @autoscaling.apply(Aws::ECS::Types::Service.new(cluster_arn: @cluster, service_name: @app_id))
@@ -617,6 +617,7 @@ module Hako
617
617
  deployment_configuration: @deployment_configuration,
618
618
  }
619
619
  if ecs_elb_client.find_or_create_load_balancer(front_port)
620
+ ecs_elb_client.modify_attributes
620
621
  params[:load_balancers] = [
621
622
  @ecs_elb_client.load_balancer_params_for_service.merge(container_name: 'front', container_port: 80),
622
623
  ]
@@ -762,6 +763,58 @@ module Hako
762
763
  required_cpu < cpu && required_memory < memory
763
764
  end
764
765
  end
766
+
767
+ # @param [Hash] definition
768
+ # @return [nil]
769
+ def print_definition_in_cli_format(definition)
770
+ cmd = %w[docker run]
771
+ cmd << '--name' << definition.fetch(:name)
772
+ cmd << '--cpu-shares' << definition.fetch(:cpu)
773
+ cmd << '--memory' << definition.fetch(:memory)
774
+ definition.fetch(:links).each do |link|
775
+ cmd << '--link' << link
776
+ end
777
+ definition.fetch(:port_mappings).each do |port_mapping|
778
+ cmd << '--publish' << "#{port_mapping.fetch(:host_port)}:#{port_mapping.fetch(:container_port)}"
779
+ end
780
+ definition.fetch(:docker_labels).each do |key, val|
781
+ if key != 'cc.wanko.hako.version'
782
+ cmd << '--label' << "#{key}=#{val}"
783
+ end
784
+ end
785
+ definition.fetch(:mount_points).each do |mount_point|
786
+ source_volume = mount_point.fetch(:source_volume)
787
+ v = @volumes[source_volume]
788
+ if v
789
+ cmd << '--volume' << "#{v.fetch('source_path')}:#{mount_point.fetch(:container_path)}#{mount_point[:read_only] ? ':ro' : ''}"
790
+ else
791
+ raise "Could not find volume #{source_volume}"
792
+ end
793
+ end
794
+ if definition[:privileged]
795
+ cmd << '--privileged'
796
+ end
797
+ definition.fetch(:volumes_from).each do |volumes_from|
798
+ p volumes_from
799
+ end
800
+ if definition[:user]
801
+ cmd << '--user' << definition[:user]
802
+ end
803
+
804
+ cmd << "\\\n "
805
+ definition.fetch(:environment).each do |env|
806
+ cmd << '--env' << "#{env.fetch(:name)}=#{env.fetch(:value)}"
807
+ cmd << "\\\n "
808
+ end
809
+
810
+ cmd << definition.fetch(:image)
811
+ if definition[:command]
812
+ cmd << "\\\n "
813
+ cmd += definition[:command]
814
+ end
815
+ puts cmd.join(' ')
816
+ nil
817
+ end
765
818
  end
766
819
  end
767
820
  end
@@ -61,6 +61,20 @@ module Hako
61
61
  true
62
62
  end
63
63
 
64
+ # @return [Types::ModifyLoadBalancerAttributesOutput, nil]
65
+ def modify_attributes
66
+ if @elb_config.key?('cross_zone_load_balancing')
67
+ @elb.modify_load_balancer_attributes(
68
+ load_balancer_name: name,
69
+ load_balancer_attributes: {
70
+ cross_zone_load_balancing: {
71
+ enabled: @elb_config['cross_zone_load_balancing'],
72
+ }
73
+ }
74
+ )
75
+ end
76
+ end
77
+
64
78
  # @return [nil]
65
79
  def destroy
66
80
  if exist?
@@ -95,6 +95,11 @@ module Hako
95
95
  true
96
96
  end
97
97
 
98
+ # @return [nil]
99
+ def modify_attributes
100
+ # Nothing implemented for now
101
+ end
102
+
98
103
  # @return [nil]
99
104
  def destroy
100
105
  unless @elb_v2_config
@@ -77,7 +77,7 @@ module Hako
77
77
  # @return [Hash]
78
78
  def upload_config(front_conf)
79
79
  if @dry_run
80
- Hako.logger.info "Generated configuration:\n#{front_conf}"
80
+ puts "#{self.class} will upload this configuration:\n#{front_conf}"
81
81
  else
82
82
  s3_client.put_object(
83
83
  body: front_conf,
data/lib/hako/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hako
3
- VERSION = '0.23.0'
3
+ VERSION = '0.24.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hako
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-26 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.5.1
187
+ rubygems_version: 2.6.10
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Deploy Docker container