hako 0.3.1 → 0.4.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 +4 -4
- data/lib/hako/commander.rb +4 -3
- data/lib/hako/container.rb +5 -1
- data/lib/hako/front_config.rb +5 -2
- data/lib/hako/scheduler.rb +1 -1
- data/lib/hako/schedulers/echo.rb +2 -2
- data/lib/hako/schedulers/ecs.rb +5 -2
- data/lib/hako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7051366d540062e8a8d89a5e4a29d4fd439e53f9
|
4
|
+
data.tar.gz: de094d094bcc3773b789b3f4fbe12a24a9f64752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d1331497077ed082ef86164f37b255a9a644444242ef208fb12e4a0301e3934ba63f2d7ec4e90587d286e2c600c46fc13c76b5665260aed3fc77cf367b6b2c
|
7
|
+
data.tar.gz: 812835ac65a95d396687eb2a8314d736e5351099669374f5765ecd9b1688451b9325cf4dc99f0308d4a8062271bbaa9749dc3080e39c27b2641667918d16c5f5
|
data/lib/hako/commander.rb
CHANGED
@@ -26,9 +26,10 @@ module Hako
|
|
26
26
|
)
|
27
27
|
scripts = @app.yaml.fetch('scripts', []).map { |config| load_script(config) }
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
containers = { 'app' => app, 'front' => front }
|
30
|
+
scripts.each { |script| script.before_deploy(containers) }
|
31
|
+
scheduler.deploy(containers, env, app_port, force: force)
|
32
|
+
scripts.each { |script| script.after_deploy(containers) }
|
32
33
|
end
|
33
34
|
|
34
35
|
def oneshot(commands, tag: 'latest')
|
data/lib/hako/container.rb
CHANGED
data/lib/hako/front_config.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'erb'
|
2
|
+
require 'hako/container'
|
2
3
|
|
3
4
|
module Hako
|
4
|
-
FrontConfig = Struct.new(:type, :
|
5
|
+
FrontConfig = Struct.new(:type, :container, :s3, :extra)
|
5
6
|
class FrontConfig
|
6
7
|
S3Config = Struct.new(:region, :bucket, :prefix) do
|
7
8
|
def initialize(options)
|
@@ -21,7 +22,9 @@ module Hako
|
|
21
22
|
|
22
23
|
def initialize(options)
|
23
24
|
self.type = options.fetch('type')
|
24
|
-
self.
|
25
|
+
self.container = Container.new(
|
26
|
+
'image_tag' => options.fetch('image_tag'),
|
27
|
+
)
|
25
28
|
self.s3 = S3Config.new(options.fetch('s3'))
|
26
29
|
self.extra = options.fetch('extra', {})
|
27
30
|
end
|
data/lib/hako/scheduler.rb
CHANGED
data/lib/hako/schedulers/echo.rb
CHANGED
@@ -7,8 +7,8 @@ module Hako
|
|
7
7
|
@app_id = app_id
|
8
8
|
end
|
9
9
|
|
10
|
-
def deploy(
|
11
|
-
puts "Deploy #{app.image_tag} with app_port=#{app_port}, force=#{force}"
|
10
|
+
def deploy(containers, env, app_port, force: false)
|
11
|
+
puts "Deploy #{containers.fetch('app').image_tag} with app_port=#{app_port}, force=#{force}"
|
12
12
|
puts 'Environment variables:'
|
13
13
|
env.each do |key, val|
|
14
14
|
puts " #{key}=#{val.inspect}"
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -23,8 +23,10 @@ module Hako
|
|
23
23
|
@ec2 = Aws::EC2::Client.new(region: region)
|
24
24
|
end
|
25
25
|
|
26
|
-
def deploy(
|
26
|
+
def deploy(containers, env, app_port, force: false)
|
27
27
|
@force_mode = force
|
28
|
+
app = containers.fetch('app')
|
29
|
+
front = containers.fetch('front')
|
28
30
|
front_env = {
|
29
31
|
'AWS_DEFAULT_REGION' => front.config.s3.region,
|
30
32
|
'S3_CONFIG_BUCKET' => front.config.s3.bucket,
|
@@ -229,13 +231,14 @@ module Hako
|
|
229
231
|
environment = env.map { |k, v| { name: k, value: v } }
|
230
232
|
{
|
231
233
|
name: 'front',
|
232
|
-
image: front_config.image_tag,
|
234
|
+
image: front_config.container.image_tag,
|
233
235
|
cpu: 100,
|
234
236
|
memory: 100,
|
235
237
|
links: ['app:app'],
|
236
238
|
port_mappings: [{ container_port: 80, host_port: front_port, protocol: 'tcp' }],
|
237
239
|
essential: true,
|
238
240
|
environment: environment,
|
241
|
+
docker_labels: front_config.container.docker_labels,
|
239
242
|
}
|
240
243
|
end
|
241
244
|
|
data/lib/hako/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.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-02-
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|