kontena-cli 0.12.3 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/kontena +6 -4
- data/lib/kontena/cli/apps/common.rb +21 -7
- data/lib/kontena/cli/apps/deploy_command.rb +11 -4
- data/lib/kontena/cli/apps/docker_helper.rb +12 -0
- data/lib/kontena/cli/apps/logs_command.rb +0 -2
- data/lib/kontena/cli/apps/remove_command.rb +23 -14
- data/lib/kontena/cli/bytes_helper.rb +40 -0
- data/lib/kontena/cli/container_command.rb +0 -1
- data/lib/kontena/cli/grid_command.rb +4 -6
- data/lib/kontena/cli/grids/logs_command.rb +0 -2
- data/lib/kontena/cli/grids/trusted_subnet_command.rb +12 -0
- data/lib/kontena/cli/grids/trusted_subnets/add_command.rb +16 -0
- data/lib/kontena/cli/grids/trusted_subnets/list_command.rb +17 -0
- data/lib/kontena/cli/grids/trusted_subnets/remove_command.rb +20 -0
- data/lib/kontena/cli/grids/user_command.rb +12 -0
- data/lib/kontena/cli/grids/{add_user_command.rb → users/add_command.rb} +4 -4
- data/lib/kontena/cli/grids/{list_users_command.rb → users/list_command.rb} +4 -4
- data/lib/kontena/cli/grids/{remove_user_command.rb → users/remove_command.rb} +4 -4
- data/lib/kontena/cli/login_command.rb +4 -3
- data/lib/kontena/cli/master/aws/create_command.rb +3 -1
- data/lib/kontena/cli/master/current_command.rb +17 -0
- data/lib/kontena/cli/master/digital_ocean/create_command.rb +5 -3
- data/lib/kontena/cli/master/users/role_command.rb +10 -0
- data/lib/kontena/cli/master/users/{add_role_command.rb → roles/add_command.rb} +4 -4
- data/lib/kontena/cli/master/users/{remove_role_command.rb → roles/remove_command.rb} +4 -4
- data/lib/kontena/cli/master/users_command.rb +2 -4
- data/lib/kontena/cli/master_command.rb +2 -0
- data/lib/kontena/cli/node_command.rb +2 -4
- data/lib/kontena/cli/nodes/label_command.rb +14 -0
- data/lib/kontena/cli/nodes/{add_label_command.rb → labels/add_command.rb} +2 -2
- data/lib/kontena/cli/nodes/{remove_label_command.rb → labels/remove_command.rb} +2 -2
- data/lib/kontena/cli/nodes/list_command.rb +2 -1
- data/lib/kontena/cli/nodes/show_command.rb +19 -2
- data/lib/kontena/cli/registry_command.rb +0 -1
- data/lib/kontena/cli/service_command.rb +4 -11
- data/lib/kontena/cli/services/create_command.rb +10 -2
- data/lib/kontena/cli/services/env_command.rb +12 -0
- data/lib/kontena/cli/services/{add_env_command.rb → envs/add_command.rb} +4 -4
- data/lib/kontena/cli/services/{envs_command.rb → envs/list_command.rb} +5 -5
- data/lib/kontena/cli/services/{remove_env_command.rb → envs/remove_command.rb} +4 -4
- data/lib/kontena/cli/services/list_command.rb +3 -2
- data/lib/kontena/cli/services/logs_command.rb +0 -2
- data/lib/kontena/cli/services/secret_command.rb +10 -0
- data/lib/kontena/cli/services/{add_secret_command.rb → secrets/link_command.rb} +4 -4
- data/lib/kontena/cli/services/{remove_secret_command.rb → secrets/unlink_command.rb} +4 -4
- data/lib/kontena/cli/services/services_helper.rb +35 -8
- data/lib/kontena/cli/services/stats_command.rb +6 -1
- data/lib/kontena/cli/services/update_command.rb +4 -0
- data/lib/kontena/cli/user/forgot_password_command.rb +16 -0
- data/lib/kontena/cli/user/reset_password_command.rb +23 -0
- data/lib/kontena/cli/user/verify_command.rb +22 -0
- data/lib/kontena/cli/user_command.rb +13 -0
- data/lib/kontena/cli/vault/list_command.rb +1 -1
- data/lib/kontena/cli/vpn_command.rb +0 -1
- data/lib/kontena/cli/whoami_command.rb +17 -3
- data/lib/kontena/machine/aws/cloudinit_master.yml +13 -4
- data/lib/kontena/machine/aws/common.rb +8 -13
- data/lib/kontena/machine/aws/master_provisioner.rb +6 -5
- data/lib/kontena/machine/azure/cloudinit_master.yml +0 -2
- data/lib/kontena/machine/digital_ocean.rb +1 -0
- data/lib/kontena/machine/digital_ocean/cloudinit.yml +0 -22
- data/lib/kontena/machine/digital_ocean/cloudinit_master.yml +14 -4
- data/lib/kontena/machine/digital_ocean/master_provisioner.rb +12 -9
- data/lib/kontena/machine/vagrant/cloudinit.yml +2 -0
- data/lib/kontena/scripts/completer +4 -4
- data/spec/kontena/cli/app/common_spec.rb +55 -7
- data/spec/kontena/cli/app/docker_helper_spec.rb +74 -0
- data/spec/kontena/cli/grids/trusted_subnets/add_command_spec.rb +38 -0
- data/spec/kontena/cli/grids/trusted_subnets/list_command_spec.rb +31 -0
- data/spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb +38 -0
- data/spec/kontena/cli/master/current_command_spec.rb +57 -0
- data/spec/kontena/cli/master/users/{add_role_command_spec.rb → roles/add_command_spec.rb} +3 -3
- data/spec/kontena/cli/master/users/{remove_role_command_spec.rb → roles/remove_command_spec.rb} +3 -3
- data/spec/kontena/cli/services/{add_secret_command_spec.rb → secrets/link_command_spec.rb} +4 -3
- data/spec/kontena/cli/services/{remove_secret_command_spec.rb → secrets/unlink_command_spec.rb} +4 -3
- data/spec/kontena/cli/services/services_helper_spec.rb +44 -0
- metadata +45 -26
- data/lib/kontena/cli/forgot_password_command.rb +0 -13
- data/lib/kontena/cli/reset_password_command.rb +0 -19
- data/lib/kontena/cli/users_command.rb +0 -15
- data/lib/kontena/cli/verify_account_command.rb +0 -13
@@ -0,0 +1,10 @@
|
|
1
|
+
module Kontena::Cli::Services
|
2
|
+
|
3
|
+
require_relative 'secrets/link_command'
|
4
|
+
require_relative 'secrets/unlink_command'
|
5
|
+
|
6
|
+
class SecretCommand < Clamp::Command
|
7
|
+
subcommand "link", "Link secret from Vault", Secrets::LinkCommand
|
8
|
+
subcommand "unlink", "Unlink secret from Vault", Secrets::UnlinkCommand
|
9
|
+
end
|
10
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require_relative 'services_helper'
|
1
|
+
require_relative '../services_helper'
|
2
2
|
|
3
|
-
module Kontena::Cli::Services
|
4
|
-
class
|
3
|
+
module Kontena::Cli::Services::Secrets
|
4
|
+
class LinkCommand < Clamp::Command
|
5
5
|
include Kontena::Cli::Common
|
6
6
|
include Kontena::Cli::GridOptions
|
7
|
-
include ServicesHelper
|
7
|
+
include Kontena::Cli::Services::ServicesHelper
|
8
8
|
|
9
9
|
parameter "NAME", "Service name"
|
10
10
|
parameter "SECRET", "Secret to be added from Vault (format: secret:name:type)"
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require_relative 'services_helper'
|
1
|
+
require_relative '../services_helper'
|
2
2
|
|
3
|
-
module Kontena::Cli::Services
|
4
|
-
class
|
3
|
+
module Kontena::Cli::Services::Secrets
|
4
|
+
class UnlinkCommand < Clamp::Command
|
5
5
|
include Kontena::Cli::Common
|
6
6
|
include Kontena::Cli::GridOptions
|
7
|
-
include ServicesHelper
|
7
|
+
include Kontena::Cli::Services::ServicesHelper
|
8
8
|
|
9
9
|
parameter "NAME", "Service name"
|
10
10
|
parameter "SECRET", "Secret to be removed (format: secret:name:type)"
|
@@ -50,8 +50,13 @@ module Kontena
|
|
50
50
|
puts " scaling: #{service['container_count'] }"
|
51
51
|
puts " strategy: #{service['strategy']}"
|
52
52
|
puts " deploy_opts:"
|
53
|
-
puts " wait_for_port: #{service['deploy_opts']['wait_for_port'] || '-'}"
|
54
53
|
puts " min_health: #{service['deploy_opts']['min_health']}"
|
54
|
+
if service['deploy_opts']['wait_for_port']
|
55
|
+
puts " wait_for_port: #{service['deploy_opts']['wait_for_port']}"
|
56
|
+
end
|
57
|
+
if service['deploy_opts']['interval']
|
58
|
+
puts " interval: #{service['deploy_opts']['interval']}"
|
59
|
+
end
|
55
60
|
puts " dns: #{service['name']}.#{grid}.kontena.local"
|
56
61
|
|
57
62
|
if service['affinity'].to_a.size > 0
|
@@ -276,14 +281,17 @@ module Kontena
|
|
276
281
|
# @param [String] memory
|
277
282
|
# @return [Integer]
|
278
283
|
def parse_memory(memory)
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
284
|
+
case memory
|
285
|
+
when /^\d+(k|K)$/
|
286
|
+
memory.to_i * 1024
|
287
|
+
when /^\d+(m|M)$/
|
288
|
+
memory.to_i * 1024 * 1024
|
289
|
+
when /^\d+(g|G)$/
|
290
|
+
memory.to_i * 1024 * 1024 * 1024
|
291
|
+
when /^\d+$/
|
286
292
|
memory.to_i
|
293
|
+
else
|
294
|
+
raise ArgumentError.new("Invalid memory value: #{memory}")
|
287
295
|
end
|
288
296
|
end
|
289
297
|
|
@@ -319,6 +327,25 @@ module Kontena
|
|
319
327
|
secrets
|
320
328
|
end
|
321
329
|
|
330
|
+
# @param [String] time
|
331
|
+
# @return [Integer, NilClass]
|
332
|
+
def parse_relative_time(time)
|
333
|
+
if time.end_with?('min')
|
334
|
+
time.to_i * 60
|
335
|
+
elsif time.end_with?('h')
|
336
|
+
time.to_i * 60 * 60
|
337
|
+
elsif time.end_with?('d')
|
338
|
+
time.to_i * 60 * 60 * 24
|
339
|
+
else
|
340
|
+
time = time.to_i
|
341
|
+
if time == 0
|
342
|
+
nil
|
343
|
+
else
|
344
|
+
time
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
322
349
|
def int_to_filesize(int)
|
323
350
|
{
|
324
351
|
'B' => 1000,
|
@@ -6,6 +6,10 @@ module Kontena::Cli::Services
|
|
6
6
|
include Kontena::Cli::GridOptions
|
7
7
|
include ServicesHelper
|
8
8
|
|
9
|
+
MEM_MAX_LIMITS = [
|
10
|
+
1.8446744073709552e+19, 9.223372036854772e+18
|
11
|
+
]
|
12
|
+
|
9
13
|
parameter "NAME", "Service name"
|
10
14
|
option ["-t", "--tail"], :flag, "Tail (follow) stats in real time", default: false
|
11
15
|
|
@@ -40,7 +44,7 @@ module Kontena::Cli::Services
|
|
40
44
|
|
41
45
|
def render_stat_row(stat)
|
42
46
|
memory = stat['memory'].nil? ? 'N/A' : filesize_to_human(stat['memory']['usage'])
|
43
|
-
if !stat['memory'].nil? && stat['memory']['limit']
|
47
|
+
if !stat['memory'].nil? && (stat['memory']['limit'] && !MEM_MAX_LIMITS.include?(stat['memory']['limit']))
|
44
48
|
memory_limit = filesize_to_human(stat['memory']['limit'])
|
45
49
|
memory_pct = "#{(stat['memory']['usage'].to_f / stat['memory']['limit'].to_f * 100).round(2)}%"
|
46
50
|
else
|
@@ -58,6 +62,7 @@ module Kontena::Cli::Services
|
|
58
62
|
# @param [Integer] size
|
59
63
|
# @return [String]
|
60
64
|
def filesize_to_human(size)
|
65
|
+
return '0B' if size.to_f == 0.0
|
61
66
|
units = %w{B K M G T}
|
62
67
|
e = (Math.log(size) / Math.log(1000)).floor
|
63
68
|
s = '%.2f' % (size.to_f / 1000**e)
|
@@ -28,6 +28,7 @@ module Kontena::Cli::Services
|
|
28
28
|
option "--deploy-strategy", "STRATEGY", "Deploy strategy to use (ha, daemon, random)"
|
29
29
|
option "--deploy-wait-for-port", "PORT", "Wait for port to respond when deploying"
|
30
30
|
option "--deploy-min-health", "FLOAT", "The minimum percentage (0.0 - 1.0) of healthy instances that do not sacrifice overall service availability while deploying"
|
31
|
+
option "--deploy-interval", "TIME", "Auto-deploy with given interval (format: <number><unit>, where unit = min, h, d)"
|
31
32
|
option "--pid", "PID", "Pid namespace to use"
|
32
33
|
option "--secret", "SECRET", "Import secret from Vault (format: <secret>:<name>:<type>)", multivalued: true
|
33
34
|
|
@@ -66,6 +67,9 @@ module Kontena::Cli::Services
|
|
66
67
|
data[:deploy_opts] = {}
|
67
68
|
data[:deploy_opts][:min_health] = deploy_min_health.to_f if deploy_min_health
|
68
69
|
data[:deploy_opts][:wait_for_port] = deploy_wait_for_port.to_i if deploy_wait_for_port
|
70
|
+
if deploy_interval
|
71
|
+
data[:deploy_opts][:interval] = parse_relative_time(deploy_interval)
|
72
|
+
end
|
69
73
|
data.delete(:deploy_opts) if data[:deploy_opts].empty?
|
70
74
|
data[:pid] = pid if pid
|
71
75
|
data
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Kontena::Cli::User
|
2
|
+
class ForgotPasswordCommand < Clamp::Command
|
3
|
+
include Kontena::Cli::Common
|
4
|
+
|
5
|
+
parameter "EMAIL", "Email address"
|
6
|
+
|
7
|
+
option "--auth-provider-url", "URL", "Auth provider URL", default: "https://auth.kontena.io/"
|
8
|
+
|
9
|
+
def execute
|
10
|
+
params = {email: email}
|
11
|
+
auth_client = Kontena::Client.new(auth_provider_url)
|
12
|
+
auth_client.post('user/password_reset', params)
|
13
|
+
puts 'Email with password reset instructions is sent to your email address. Please follow the instructions to change your password.'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Kontena::Cli::User
|
2
|
+
class ResetPasswordCommand < Clamp::Command
|
3
|
+
include Kontena::Cli::Common
|
4
|
+
|
5
|
+
parameter "TOKEN", "Password reset token"
|
6
|
+
|
7
|
+
option "--auth-provider-url", "URL", "Auth provider URL", default: "https://auth.kontena.io/"
|
8
|
+
|
9
|
+
def execute
|
10
|
+
require 'highline/import'
|
11
|
+
|
12
|
+
password = ask("Password: ") { |q| q.echo = "*" }
|
13
|
+
password2 = ask("Password again: ") { |q| q.echo = "*" }
|
14
|
+
if password != password2
|
15
|
+
abort("Passwords don't match")
|
16
|
+
end
|
17
|
+
params = {token: token, password: password}
|
18
|
+
auth_client = Kontena::Client.new(auth_provider_url)
|
19
|
+
auth_client.put('user/password_reset', params)
|
20
|
+
puts 'Password is now changed. To login with the new password, please run: kontena login'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Kontena::Cli::User
|
2
|
+
class VerifyCommand < Clamp::Command
|
3
|
+
include Kontena::Cli::Common
|
4
|
+
|
5
|
+
parameter "TOKEN", "Kontena verify token"
|
6
|
+
|
7
|
+
option "--auth-provider-url", "URL", "Auth provider URL", default: "https://auth.kontena.io/"
|
8
|
+
|
9
|
+
def execute
|
10
|
+
require_api_url
|
11
|
+
|
12
|
+
params = {token: token}
|
13
|
+
begin
|
14
|
+
auth_client = Kontena::Client.new(auth_provider_url)
|
15
|
+
auth_client.post('user/email_confirm', params)
|
16
|
+
puts 'Account verified'.colorize(:green)
|
17
|
+
rescue Kontena::Errors::StandardError
|
18
|
+
abort 'Invalid verify token'.colorize(:red)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'user/verify_command'
|
2
|
+
require_relative 'user/forgot_password_command'
|
3
|
+
require_relative 'user/reset_password_command'
|
4
|
+
|
5
|
+
class Kontena::Cli::UserCommand < Clamp::Command
|
6
|
+
|
7
|
+
subcommand "verify", "Verify user account", Kontena::Cli::User::VerifyCommand
|
8
|
+
subcommand "forgot-password", "Request password reset for Kontena account", Kontena::Cli::User::ForgotPasswordCommand
|
9
|
+
subcommand "reset-password", "Reset Kontena account password", Kontena::Cli::User::ResetPasswordCommand
|
10
|
+
|
11
|
+
def execute
|
12
|
+
end
|
13
|
+
end
|
@@ -10,7 +10,7 @@ module Kontena::Cli::Vault
|
|
10
10
|
|
11
11
|
column_width_paddings = '%-54s %-25.25s'
|
12
12
|
puts column_width_paddings % ['NAME', 'CREATED AT']
|
13
|
-
result['secrets'].each do |secret|
|
13
|
+
result['secrets'].sort_by { |s| s['name'] }.each do |secret|
|
14
14
|
puts column_width_paddings % [secret['name'], secret['created_at']]
|
15
15
|
end
|
16
16
|
end
|
@@ -8,7 +8,6 @@ class Kontena::Cli::VpnCommand < Clamp::Command
|
|
8
8
|
subcommand "create", "Create VPN service", Kontena::Cli::Vpn::CreateCommand
|
9
9
|
subcommand "config", "Show/Export VPN config", Kontena::Cli::Vpn::ConfigCommand
|
10
10
|
subcommand ["remove", "rm"], "Remove VPN service", Kontena::Cli::Vpn::RemoveCommand
|
11
|
-
subcommand "delete", "[DEPRECATED] Delete VPN service", Kontena::Cli::Vpn::DeleteCommand
|
12
11
|
|
13
12
|
def execute
|
14
13
|
end
|
@@ -13,9 +13,23 @@ class Kontena::Cli::WhoamiCommand < Clamp::Command
|
|
13
13
|
puts "Master: #{self.current_master['name']}"
|
14
14
|
puts "URL: #{api_url}"
|
15
15
|
puts "Grid: #{current_grid}"
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if current_master['email']
|
17
|
+
puts "User: #{current_master['email']}"
|
18
|
+
else # In case local storage doesn't have the user email yet
|
19
|
+
token = require_token
|
20
|
+
user = client(token).get('user')
|
21
|
+
puts "User: #{user['email']}"
|
22
|
+
master = {
|
23
|
+
'name' => current_master['name'],
|
24
|
+
'url' => current_master['url'],
|
25
|
+
'token' => current_master['token'],
|
26
|
+
'email' => user['email'],
|
27
|
+
'grid' => current_master['grid']
|
28
|
+
}
|
29
|
+
|
30
|
+
self.add_master(current_master['name'], master)
|
31
|
+
end
|
32
|
+
|
19
33
|
|
20
34
|
end
|
21
35
|
|
@@ -30,6 +30,7 @@ write_files:
|
|
30
30
|
-p 80:80 -p 443:443 kontena/haproxy:latest
|
31
31
|
coreos:
|
32
32
|
units:
|
33
|
+
<% unless mongodb_uri -%>
|
33
34
|
- name: kontena-server-mongo.service
|
34
35
|
command: start
|
35
36
|
enable: true
|
@@ -53,7 +54,7 @@ coreos:
|
|
53
54
|
ExecStart=/usr/bin/docker run --name=kontena-server-mongo \
|
54
55
|
--volumes-from=kontena-server-mongo-data \
|
55
56
|
mongo:3.0 mongod --smallfiles
|
56
|
-
|
57
|
+
<% end -%>
|
57
58
|
- name: kontena-server-api.service
|
58
59
|
command: start
|
59
60
|
enable: true
|
@@ -65,11 +66,13 @@ coreos:
|
|
65
66
|
After=kontena-server-mongo.service
|
66
67
|
Description=Kontena Master
|
67
68
|
Documentation=http://www.kontena.io/
|
69
|
+
Before=kontena-server-haproxy.service
|
70
|
+
Wants=kontena-server-haproxy.service
|
68
71
|
Requires=network-online.target
|
69
72
|
Requires=docker.service
|
73
|
+
<% unless mongodb_uri -%>
|
70
74
|
Requires=kontena-server-mongo.service
|
71
|
-
|
72
|
-
Wants=kontena-server-haproxy.service
|
75
|
+
<% end %>
|
73
76
|
|
74
77
|
[Service]
|
75
78
|
Restart=always
|
@@ -79,10 +82,16 @@ coreos:
|
|
79
82
|
ExecStartPre=-/usr/bin/docker rm kontena-server-api
|
80
83
|
ExecStartPre=/usr/bin/docker pull kontena/server:${KONTENA_VERSION}
|
81
84
|
ExecStart=/usr/bin/docker run --name kontena-server-api \
|
85
|
+
<% if mongodb_uri -%>
|
86
|
+
-e MONGODB_URI=<%= mongodb_uri %> \
|
87
|
+
<% else -%>
|
82
88
|
--link kontena-server-mongo:mongodb \
|
83
89
|
-e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
|
90
|
+
<% end -%>
|
91
|
+
<% if auth_server %>
|
92
|
+
-e AUTH_API_URL=<%= auth_server %> \
|
93
|
+
<% end -%>
|
84
94
|
-e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
|
85
|
-
<% if auth_server %>-e AUTH_API_URL=<%= auth_server %><% end %> \
|
86
95
|
kontena/server:${KONTENA_VERSION}
|
87
96
|
|
88
97
|
- name: kontena-server-haproxy.service
|
@@ -6,19 +6,14 @@ module Kontena
|
|
6
6
|
# @param [String] region
|
7
7
|
# @return String
|
8
8
|
def resolve_ami(region)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
'us-west-2' => 'ami-20927640',
|
18
|
-
'us-west-1' => 'ami-c2e490a2',
|
19
|
-
'eu-west-1' => 'ami-7e72c70d'
|
20
|
-
}
|
21
|
-
images[region]
|
9
|
+
response = Excon.get("https://coreos.com/dist/aws/aws-stable.json")
|
10
|
+
images = JSON.parse(response.body)
|
11
|
+
info = images[region]
|
12
|
+
if info
|
13
|
+
info['hvm']
|
14
|
+
else
|
15
|
+
nil
|
16
|
+
end
|
22
17
|
end
|
23
18
|
|
24
19
|
# @param [String] vpc_id
|
@@ -47,7 +47,8 @@ module Kontena
|
|
47
47
|
auth_server: opts[:auth_server],
|
48
48
|
version: opts[:version],
|
49
49
|
vault_secret: opts[:vault_secret],
|
50
|
-
vault_iv: opts[:vault_iv]
|
50
|
+
vault_iv: opts[:vault_iv],
|
51
|
+
mongodb_uri: opts[:mongodb_uri]
|
51
52
|
}
|
52
53
|
|
53
54
|
security_group = ensure_security_group(opts[:vpc])
|
@@ -83,12 +84,12 @@ module Kontena
|
|
83
84
|
master_url = "https://#{ec2_instance.public_ip_address}"
|
84
85
|
Excon.defaults[:ssl_verify_peer] = false
|
85
86
|
http_client = Excon.new(master_url, :connect_timeout => 10)
|
86
|
-
ShellSpinner "Waiting for #{name.colorize(:cyan)} to start" do
|
87
|
+
ShellSpinner "Waiting for #{name.colorize(:cyan)} to start " do
|
87
88
|
sleep 5 until master_running?(http_client)
|
88
89
|
end
|
89
90
|
|
90
91
|
puts "Kontena Master is now running at #{master_url}"
|
91
|
-
puts "Use #{"kontena login #{master_url}".colorize(:light_black)} to complete Kontena Master setup"
|
92
|
+
puts "Use #{"kontena login --name=#{name.sub('kontena-master-', '')} #{master_url}".colorize(:light_black)} to complete Kontena Master setup"
|
92
93
|
end
|
93
94
|
|
94
95
|
##
|
@@ -151,7 +152,7 @@ module Kontena
|
|
151
152
|
end
|
152
153
|
|
153
154
|
def generate_name
|
154
|
-
"kontena-master-#{super}-#{rand(1..
|
155
|
+
"kontena-master-#{super}-#{rand(1..9)}"
|
155
156
|
end
|
156
157
|
|
157
158
|
def master_running?(http_client)
|
@@ -161,7 +162,7 @@ module Kontena
|
|
161
162
|
end
|
162
163
|
|
163
164
|
def erb(template, vars)
|
164
|
-
ERB.new(template).result(
|
165
|
+
ERB.new(template, nil, '%<>-').result(
|
165
166
|
OpenStruct.new(vars).instance_eval { binding }
|
166
167
|
)
|
167
168
|
end
|
@@ -24,13 +24,6 @@ write_files:
|
|
24
24
|
nameserver 172.17.43.1
|
25
25
|
nameserver 8.8.8.8
|
26
26
|
nameserver 8.8.4.4
|
27
|
-
- path: /opt/bin/floating_ip.sh
|
28
|
-
permissions: 0755
|
29
|
-
owner: root
|
30
|
-
content: |
|
31
|
-
#!/bin/sh
|
32
|
-
IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address)
|
33
|
-
/usr/bin/ip addr add $IP/16 dev eth0
|
34
27
|
coreos:
|
35
28
|
units:
|
36
29
|
- name: 10-weave.network
|
@@ -41,21 +34,6 @@ coreos:
|
|
41
34
|
Name=weave*
|
42
35
|
|
43
36
|
[Network]
|
44
|
-
- name: floating-ip.service
|
45
|
-
command: start
|
46
|
-
enable: true
|
47
|
-
content: |
|
48
|
-
[Unit]
|
49
|
-
Description=floating-ip
|
50
|
-
After=network-online.target
|
51
|
-
Description=DigitalOcean Floating IP
|
52
|
-
Documentation=https://www.digitalocean.com/community/tutorials/how-to-enable-floating-ips-on-an-older-droplet#coreos
|
53
|
-
Requires=network-online.target
|
54
|
-
|
55
|
-
[Service]
|
56
|
-
Type=oneshot
|
57
|
-
RemainAfterExit=yes
|
58
|
-
ExecStart=/opt/bin/floating_ip.sh
|
59
37
|
- name: kontena-agent.service
|
60
38
|
command: start
|
61
39
|
enable: true
|