hako 0.17.2 → 0.18.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daada56b5f8aa658441ff166bc8edd230092b102
4
- data.tar.gz: 68a71148392934f2dcf224bdf0dc6fbc509cc0b9
3
+ metadata.gz: a30c23443a235e245cf7581ac2e8370958e52431
4
+ data.tar.gz: ec03c2205e76f980d0067273ffc7b7cd7a8889d3
5
5
  SHA512:
6
- metadata.gz: 3477cb28ef35a80024402bb8c2da2b9d1b07adc5548c34682719334a6164f338373a18a2c29c727fcbf701708bd27590a23f851f5a49b224e67dade7cedf5041
7
- data.tar.gz: 7dafec4447c9f78de768895ff42eabba9ebbc30ede6b6bb157f335e7b94c0b2d25e72cae91a0391c545d0de367f481e56ae8e13a7b7463d332dacaa4e45e33ee
6
+ metadata.gz: ceaa7c3d218036910d962f867a6a1236ea821db4dca6a732504188638165394891e56b9098fec28cbe93d5a9c368f97d7244011004912d6919aa06dd49347c0f
7
+ data.tar.gz: ed0e28623c75f4bc09a9bb99c70faf52e1d63f6ed10c9cd8a9ee1ce7303955db329dbb3230ae35bff3d3ef2549e688637c5bb30ad771502e6aa64128eda0f54b
@@ -36,7 +36,6 @@ app:
36
36
  image: ryotarai/hello-sinatra
37
37
  memory: 128
38
38
  cpu: 256
39
- port: 3000
40
39
  env:
41
40
  $providers:
42
41
  - type: file
@@ -50,6 +49,7 @@ additional_containers:
50
49
  cpu: 32
51
50
  scripts:
52
51
  - <<: !include front.yml
52
+ backend_port: 3000
53
53
  locations:
54
54
  /:
55
55
  allow_only_from:
@@ -17,7 +17,6 @@ app:
17
17
  image: ryotarai/hello-sinatra
18
18
  memory: 128
19
19
  cpu: 256
20
- port: 3000
21
20
  env:
22
21
  $providers:
23
22
  - type: file
@@ -31,6 +30,7 @@ additional_containers:
31
30
  cpu: 32
32
31
  scripts:
33
32
  - <<: !include front.yml
33
+ backend_port: 3000
34
34
  locations:
35
35
  /:
36
36
  allow_only_from:
@@ -8,7 +8,6 @@ app:
8
8
  image: ryotarai/hello-sinatra
9
9
  memory: 128
10
10
  cpu: 256
11
- port: 3000
12
11
  links:
13
12
  - redis:redis
14
13
  env:
@@ -27,4 +26,5 @@ additional_containers:
27
26
  cpu: 64
28
27
  memory: 512
29
28
  scripts:
30
- - !include front.yml
29
+ - <<: !include front.yml
30
+ backend_port: 3000
@@ -7,10 +7,5 @@ module Hako
7
7
  def image_tag
8
8
  "#{@definition['image']}:#{@definition['tag']}"
9
9
  end
10
-
11
- # @return [Fixnum]
12
- def port
13
- @definition['port']
14
- end
15
10
  end
16
11
  end
@@ -40,11 +40,10 @@ module Hako
40
40
  # @param [Fixnum] front_port
41
41
  # @return [nil]
42
42
  def deploy_started(containers, front_port)
43
- app = containers.fetch('app')
44
43
  front = containers.fetch('front')
45
44
  front.definition['port_mappings'] << port_mapping(front_port)
46
- upload_config(generate_config(app.port))
47
- Hako.logger.debug "Uploaded front configuration to s3://#{@s3.bucket}/#{@s3.key(@app.id)}"
45
+ upload_config(generate_config)
46
+ Hako.logger.info "Uploaded front configuration to s3://#{@s3.bucket}/#{@s3.key(@app.id)}"
48
47
  end
49
48
 
50
49
  private
@@ -55,12 +54,13 @@ module Hako
55
54
  super
56
55
  @options = options
57
56
  @options['locations'] ||= { '/' => {} }
58
- @s3 = S3Config.new(@options.fetch('s3'))
57
+ @backend = options.fetch('backend', 'app')
58
+ @s3 = S3Config.new(options.fetch('s3'))
59
59
  end
60
60
 
61
61
  # @return [String]
62
62
  def link_app
63
- 'app:app'
63
+ "#{@backend}:backend"
64
64
  end
65
65
 
66
66
  # @param [Fixnum] front_port
@@ -69,10 +69,9 @@ module Hako
69
69
  { container_port: 80, host_port: front_port, protocol: 'tcp' }
70
70
  end
71
71
 
72
- # @param [Fixnum] app_port
73
72
  # @return [String]
74
- def generate_config(app_port)
75
- Generator.new(@options, app_port).render
73
+ def generate_config
74
+ Generator.new(@options).render
76
75
  end
77
76
 
78
77
  # @return [Hash]
@@ -95,10 +94,9 @@ module Hako
95
94
 
96
95
  class Generator
97
96
  # @param [Hash] options
98
- # @param [Fixnum] app_port
99
- def initialize(options, app_port)
97
+ def initialize(options)
100
98
  @options = options
101
- @app_port = app_port
99
+ @backend_port = options.fetch('backend_port')
102
100
  end
103
101
 
104
102
  # @return [String]
@@ -110,7 +108,7 @@ module Hako
110
108
 
111
109
  # @return [String]
112
110
  def listen_spec
113
- "app:#{@app_port}"
111
+ "backend:#{@backend_port}"
114
112
  end
115
113
 
116
114
  # @return [String]
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hako
3
- VERSION = '0.17.2'
3
+ VERSION = '0.18.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.17.2
4
+ version: 0.18.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-07-28 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -170,4 +170,3 @@ signing_key:
170
170
  specification_version: 4
171
171
  summary: Deploy Docker container
172
172
  test_files: []
173
- has_rdoc: