kontena-cli 0.14.7 → 0.15.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/VERSION +1 -1
  4. data/bin/kontena +3 -50
  5. data/examples/kontena-plugin-hello/.gitignore +9 -0
  6. data/examples/kontena-plugin-hello/Gemfile +4 -0
  7. data/examples/kontena-plugin-hello/README.md +3 -0
  8. data/examples/kontena-plugin-hello/bin/console +14 -0
  9. data/examples/kontena-plugin-hello/bin/setup +8 -0
  10. data/examples/kontena-plugin-hello/kontena-plugin-hello.gemspec +22 -0
  11. data/examples/kontena-plugin-hello/lib/kontena/plugin/hello.rb +7 -0
  12. data/examples/kontena-plugin-hello/lib/kontena/plugin/hello/world_command.rb +6 -0
  13. data/examples/kontena-plugin-hello/lib/kontena/plugin/hello_command.rb +9 -0
  14. data/examples/kontena-plugin-hello/lib/kontena_cli_plugin.rb +5 -0
  15. data/kontena-cli.gemspec +1 -3
  16. data/lib/kontena/cli/apps/build_command.rb +3 -0
  17. data/lib/kontena/cli/apps/common.rb +6 -1
  18. data/lib/kontena/cli/apps/deploy_command.rb +1 -1
  19. data/lib/kontena/cli/apps/docker_helper.rb +13 -14
  20. data/lib/kontena/cli/apps/service_generator.rb +19 -11
  21. data/lib/kontena/cli/apps/service_generator_v2.rb +1 -0
  22. data/lib/kontena/cli/apps/yaml/reader.rb +15 -0
  23. data/lib/kontena/cli/apps/yaml/service_extender.rb +28 -0
  24. data/lib/kontena/cli/apps/yaml/validations.rb +38 -24
  25. data/lib/kontena/cli/apps/yaml/validator.rb +7 -7
  26. data/lib/kontena/cli/apps/yaml/validator_v2.rb +7 -6
  27. data/lib/kontena/cli/certificate/authorize_command.rb +23 -0
  28. data/lib/kontena/cli/certificate/get_command.rb +25 -0
  29. data/lib/kontena/cli/certificate/register_command.rb +19 -0
  30. data/lib/kontena/cli/certificate_command.rb +14 -0
  31. data/lib/kontena/cli/containers/containers_helper.rb +22 -0
  32. data/lib/kontena/cli/containers/exec_command.rb +9 -2
  33. data/lib/kontena/cli/grids/logs_command.rb +14 -3
  34. data/lib/kontena/cli/master_command.rb +1 -12
  35. data/lib/kontena/cli/node_command.rb +0 -16
  36. data/lib/kontena/cli/plugin_command.rb +15 -0
  37. data/lib/kontena/cli/plugins/install_command.rb +28 -0
  38. data/lib/kontena/cli/plugins/list_command.rb +13 -0
  39. data/lib/kontena/cli/plugins/search_command.rb +29 -0
  40. data/lib/kontena/cli/plugins/uninstall_command.rb +30 -0
  41. data/lib/kontena/cli/registry/create_command.rb +1 -1
  42. data/lib/kontena/cli/services/create_command.rb +16 -0
  43. data/lib/kontena/cli/services/list_command.rb +17 -3
  44. data/lib/kontena/cli/services/logs_command.rb +63 -18
  45. data/lib/kontena/cli/services/services_helper.rb +47 -4
  46. data/lib/kontena/cli/services/update_command.rb +16 -0
  47. data/lib/kontena/cli/stack_command.rb +20 -0
  48. data/lib/kontena/cli/stacks/common.rb +39 -0
  49. data/lib/kontena/cli/stacks/create_command.rb +27 -0
  50. data/lib/kontena/cli/stacks/deploy_command.rb +26 -0
  51. data/lib/kontena/cli/stacks/list_command.rb +38 -0
  52. data/lib/kontena/cli/stacks/remove_command.rb +26 -0
  53. data/lib/kontena/cli/stacks/show_command.rb +38 -0
  54. data/lib/kontena/cli/stacks/update_command.rb +27 -0
  55. data/lib/kontena/client.rb +11 -4
  56. data/lib/kontena/command.rb +4 -0
  57. data/lib/kontena/main_command.rb +61 -0
  58. data/lib/kontena/plugin_manager.rb +38 -0
  59. data/lib/kontena/util.rb +17 -0
  60. data/lib/kontena_cli.rb +6 -0
  61. data/spec/fixtures/health.yml +26 -0
  62. data/spec/fixtures/kontena-build.yml +16 -0
  63. data/spec/fixtures/kontena_build_v2.yaml +26 -0
  64. data/spec/kontena/cli/app/build_command_spec.rb +13 -1
  65. data/spec/kontena/cli/app/common_spec.rb +11 -0
  66. data/spec/kontena/cli/app/deploy_command_spec.rb +1 -1
  67. data/spec/kontena/cli/app/docker_helper_spec.rb +45 -0
  68. data/spec/kontena/cli/app/service_generator_spec.rb +52 -1
  69. data/spec/kontena/cli/app/yaml/service_extender_spec.rb +24 -0
  70. data/spec/kontena/cli/app/yaml/validator_spec.rb +97 -14
  71. data/spec/kontena/cli/common_spec.rb +0 -5
  72. data/spec/kontena/cli/containers/containers_helper_spec.rb +16 -0
  73. data/spec/kontena/cli/services/services_helper_spec.rb +50 -1
  74. data/spec/kontena/cli/version_command_spec.rb +1 -1
  75. data/spec/kontena/client_spec.rb +156 -0
  76. data/spec/kontena/plugin_manager_spec.rb +22 -0
  77. data/spec/spec_helper.rb +1 -0
  78. metadata +54 -125
  79. data/lib/kontena/cli/master/aws/create_command.rb +0 -48
  80. data/lib/kontena/cli/master/aws_command.rb +0 -8
  81. data/lib/kontena/cli/master/azure/create_command.rb +0 -37
  82. data/lib/kontena/cli/master/azure_command.rb +0 -13
  83. data/lib/kontena/cli/master/digital_ocean/create_command.rb +0 -38
  84. data/lib/kontena/cli/master/digital_ocean_command.rb +0 -13
  85. data/lib/kontena/cli/master/packet/create_command.rb +0 -42
  86. data/lib/kontena/cli/master/packet_command.rb +0 -14
  87. data/lib/kontena/cli/master/upcloud/create_command.rb +0 -39
  88. data/lib/kontena/cli/master/upcloud_command.rb +0 -13
  89. data/lib/kontena/cli/master/vagrant/create_command.rb +0 -25
  90. data/lib/kontena/cli/master/vagrant/restart_command.rb +0 -20
  91. data/lib/kontena/cli/master/vagrant/ssh_command.rb +0 -15
  92. data/lib/kontena/cli/master/vagrant/start_command.rb +0 -20
  93. data/lib/kontena/cli/master/vagrant/stop_command.rb +0 -20
  94. data/lib/kontena/cli/master/vagrant/terminate_command.rb +0 -13
  95. data/lib/kontena/cli/master/vagrant_command.rb +0 -23
  96. data/lib/kontena/cli/nodes/aws/create_command.rb +0 -44
  97. data/lib/kontena/cli/nodes/aws/restart_command.rb +0 -29
  98. data/lib/kontena/cli/nodes/aws/terminate_command.rb +0 -21
  99. data/lib/kontena/cli/nodes/aws_command.rb +0 -15
  100. data/lib/kontena/cli/nodes/azure/create_command.rb +0 -38
  101. data/lib/kontena/cli/nodes/azure/restart_command.rb +0 -32
  102. data/lib/kontena/cli/nodes/azure/terminate_command.rb +0 -21
  103. data/lib/kontena/cli/nodes/azure_command.rb +0 -15
  104. data/lib/kontena/cli/nodes/digital_ocean/create_command.rb +0 -32
  105. data/lib/kontena/cli/nodes/digital_ocean/restart_command.rb +0 -27
  106. data/lib/kontena/cli/nodes/digital_ocean/terminate_command.rb +0 -19
  107. data/lib/kontena/cli/nodes/digital_ocean_command.rb +0 -15
  108. data/lib/kontena/cli/nodes/packet/create_command.rb +0 -35
  109. data/lib/kontena/cli/nodes/packet/restart_command.rb +0 -17
  110. data/lib/kontena/cli/nodes/packet/terminate_command.rb +0 -20
  111. data/lib/kontena/cli/nodes/packet_command.rb +0 -15
  112. data/lib/kontena/cli/nodes/upcloud/create_command.rb +0 -33
  113. data/lib/kontena/cli/nodes/upcloud/restart_command.rb +0 -20
  114. data/lib/kontena/cli/nodes/upcloud/terminate_command.rb +0 -20
  115. data/lib/kontena/cli/nodes/upcloud_command.rb +0 -15
  116. data/lib/kontena/cli/nodes/vagrant/create_command.rb +0 -27
  117. data/lib/kontena/cli/nodes/vagrant/restart_command.rb +0 -26
  118. data/lib/kontena/cli/nodes/vagrant/ssh_command.rb +0 -21
  119. data/lib/kontena/cli/nodes/vagrant/start_command.rb +0 -26
  120. data/lib/kontena/cli/nodes/vagrant/stop_command.rb +0 -26
  121. data/lib/kontena/cli/nodes/vagrant/terminate_command.rb +0 -17
  122. data/lib/kontena/cli/nodes/vagrant_command.rb +0 -21
  123. data/lib/kontena/machine/aws.rb +0 -13
  124. data/lib/kontena/machine/aws/cloudinit.yml +0 -71
  125. data/lib/kontena/machine/aws/cloudinit_master.yml +0 -118
  126. data/lib/kontena/machine/aws/common.rb +0 -58
  127. data/lib/kontena/machine/aws/master_provisioner.rb +0 -187
  128. data/lib/kontena/machine/aws/node_destroyer.rb +0 -51
  129. data/lib/kontena/machine/aws/node_provisioner.rb +0 -204
  130. data/lib/kontena/machine/azure.rb +0 -13
  131. data/lib/kontena/machine/azure/cloudinit.yml +0 -64
  132. data/lib/kontena/machine/azure/cloudinit_master.yml +0 -106
  133. data/lib/kontena/machine/azure/logger.rb +0 -27
  134. data/lib/kontena/machine/azure/master_provisioner.rb +0 -128
  135. data/lib/kontena/machine/azure/node_destroyer.rb +0 -53
  136. data/lib/kontena/machine/azure/node_provisioner.rb +0 -132
  137. data/lib/kontena/machine/digital_ocean.rb +0 -13
  138. data/lib/kontena/machine/digital_ocean/cloudinit.yml +0 -64
  139. data/lib/kontena/machine/digital_ocean/cloudinit_master.yml +0 -118
  140. data/lib/kontena/machine/digital_ocean/master_provisioner.rb +0 -99
  141. data/lib/kontena/machine/digital_ocean/node_destroyer.rb +0 -40
  142. data/lib/kontena/machine/digital_ocean/node_provisioner.rb +0 -88
  143. data/lib/kontena/machine/packet.rb +0 -17
  144. data/lib/kontena/machine/packet/cloudinit.yml +0 -66
  145. data/lib/kontena/machine/packet/cloudinit_master.yml +0 -118
  146. data/lib/kontena/machine/packet/master_provisioner.rb +0 -93
  147. data/lib/kontena/machine/packet/node_destroyer.rb +0 -42
  148. data/lib/kontena/machine/packet/node_provisioner.rb +0 -77
  149. data/lib/kontena/machine/packet/node_restarter.rb +0 -41
  150. data/lib/kontena/machine/packet/packet_common.rb +0 -89
  151. data/lib/kontena/machine/upcloud.rb +0 -9
  152. data/lib/kontena/machine/upcloud/cloudinit.yml +0 -64
  153. data/lib/kontena/machine/upcloud/cloudinit_master.yml +0 -118
  154. data/lib/kontena/machine/upcloud/master_provisioner.rb +0 -138
  155. data/lib/kontena/machine/upcloud/node_destroyer.rb +0 -85
  156. data/lib/kontena/machine/upcloud/node_provisioner.rb +0 -121
  157. data/lib/kontena/machine/upcloud/node_restarter.rb +0 -49
  158. data/lib/kontena/machine/upcloud/upcloud_common.rb +0 -74
  159. data/lib/kontena/machine/vagrant.rb +0 -12
  160. data/lib/kontena/machine/vagrant/Vagrantfile.master.rb.erb +0 -104
  161. data/lib/kontena/machine/vagrant/Vagrantfile.node.rb.erb +0 -32
  162. data/lib/kontena/machine/vagrant/cloudinit.yml +0 -73
  163. data/lib/kontena/machine/vagrant/master_destroyer.rb +0 -37
  164. data/lib/kontena/machine/vagrant/master_provisioner.rb +0 -79
  165. data/lib/kontena/machine/vagrant/node_destroyer.rb +0 -40
  166. data/lib/kontena/machine/vagrant/node_provisioner.rb +0 -68
@@ -1,51 +0,0 @@
1
- require 'shell-spinner'
2
-
3
- module Kontena
4
- module Machine
5
- module Aws
6
- class NodeDestroyer
7
-
8
- attr_reader :ec2, :api_client
9
-
10
- # @param [Kontena::Client] api_client Kontena api client
11
- # @param [String] access_key_id aws_access_key_id
12
- # @param [String] secret_key aws_secret_access_key
13
- # @param [String] region
14
- def initialize(api_client, access_key_id, secret_key, region = 'eu-west-1')
15
- @api_client = api_client
16
- @ec2 = ::Aws::EC2::Resource.new(
17
- region: region,
18
- credentials: ::Aws::Credentials.new(access_key_id, secret_key)
19
- )
20
- end
21
-
22
- def run!(grid, name)
23
- instances = ec2.instances({
24
- filters: [
25
- {name: 'tag:Name', values: [name]}
26
- ]
27
- })
28
- abort("Cannot find AWS instance #{name}") if instances.to_a.size == 0
29
- abort("There are multiple instances with name #{name}") if instances.to_a.size > 1
30
- instance = instances.first
31
- if instance
32
- ShellSpinner "Terminating AWS instance #{name.colorize(:cyan)} " do
33
- instance.terminate
34
- until instance.reload.state.name.to_s == 'terminated'
35
- sleep 2
36
- end
37
- end
38
- else
39
- abort "Cannot find instance #{name.colorize(:cyan)} in AWS"
40
- end
41
- node = api_client.get("grids/#{grid['id']}/nodes")['nodes'].find{|n| n['name'] == name}
42
- if node
43
- ShellSpinner "Removing node #{name.colorize(:cyan)} from grid #{grid['name'].colorize(:cyan)} " do
44
- api_client.delete("grids/#{grid['id']}/nodes/#{name}")
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,204 +0,0 @@
1
- require 'fileutils'
2
- require 'erb'
3
- require 'open3'
4
- require 'shell-spinner'
5
- require_relative 'common'
6
-
7
- module Kontena
8
- module Machine
9
- module Aws
10
- class NodeProvisioner
11
- include RandomName
12
- include Common
13
-
14
- attr_reader :ec2, :api_client
15
-
16
- # @param [Kontena::Client] api_client Kontena api client
17
- # @param [String] access_key_id aws_access_key_id
18
- # @param [String] secret_key aws_secret_access_key
19
- # @param [String] region
20
- def initialize(api_client, access_key_id, secret_key, region)
21
- @api_client = api_client
22
- @ec2 = ::Aws::EC2::Resource.new(
23
- region: region, credentials: ::Aws::Credentials.new(access_key_id, secret_key)
24
- )
25
- end
26
-
27
- # @param [Hash] opts
28
- def run!(opts)
29
- ami = resolve_ami(region)
30
- abort('No valid AMI found for region') unless ami
31
-
32
- opts[:vpc] = default_vpc.vpc_id unless opts[:vpc]
33
-
34
- security_groups = opts[:security_groups] ?
35
- resolve_security_groups_to_ids(opts[:security_groups], opts[:vpc]) :
36
- ensure_security_group(opts[:grid], opts[:vpc])
37
-
38
- name = opts[:name ] || generate_name
39
-
40
- if opts[:subnet].nil?
41
- subnet = default_subnet(opts[:vpc], region+opts[:zone])
42
- else
43
- subnet = ec2.subnet(opts[:subnet])
44
- end
45
- dns_server = aws_dns_supported?(opts[:vpc]) ? '169.254.169.253' : '8.8.8.8'
46
- userdata_vars = {
47
- name: name,
48
- version: opts[:version],
49
- master_uri: opts[:master_uri],
50
- grid_token: opts[:grid_token],
51
- dns_server: dns_server
52
- }
53
-
54
- ec2_instance = ec2.create_instances({
55
- image_id: ami,
56
- min_count: 1,
57
- max_count: 1,
58
- instance_type: opts[:type],
59
- key_name: opts[:key_pair],
60
- user_data: Base64.encode64(user_data(userdata_vars)),
61
- block_device_mappings: [
62
- {
63
- device_name: '/dev/xvda',
64
- virtual_name: 'Root',
65
- ebs: {
66
- volume_size: opts[:storage],
67
- volume_type: 'gp2'
68
- }
69
- }
70
- ],
71
- network_interfaces: [
72
- {
73
- device_index: 0,
74
- subnet_id: subnet.subnet_id,
75
- groups: security_groups,
76
- associate_public_ip_address: opts[:associate_public_ip],
77
- delete_on_termination: true
78
- }
79
- ]
80
- }).first
81
- ec2_instance.create_tags({
82
- tags: [
83
- {key: 'Name', value: name},
84
- {key: 'kontena_grid', value: opts[:grid]}
85
- ]
86
- })
87
-
88
- ShellSpinner "Creating AWS instance #{name.colorize(:cyan)} " do
89
- sleep 5 until ec2_instance.reload.state.name == 'running'
90
- end
91
- node = nil
92
- ShellSpinner "Waiting for node #{name.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
93
- sleep 2 until node = instance_exists_in_grid?(opts[:grid], name)
94
- end
95
- labels = [
96
- "region=#{region}",
97
- "az=#{opts[:zone]}",
98
- "provider=aws"
99
- ]
100
- set_labels(node, labels)
101
- end
102
-
103
- ##
104
- # @param [String] grid
105
- # @return [Array] Security group id in array
106
- def ensure_security_group(grid, vpc_id)
107
- group_name = "kontena_grid_#{grid}"
108
- group_id = resolve_security_groups_to_ids(group_name, vpc_id)
109
-
110
- if group_id.empty?
111
- ShellSpinner "Creating AWS security group" do
112
- sg = create_security_group(group_name, vpc_id)
113
- group_id = [sg.group_id]
114
- end
115
- end
116
- group_id
117
- end
118
-
119
- ##
120
- # creates security_group and authorizes default port ranges
121
- #
122
- # @param [String] name
123
- # @param [String] vpc_id
124
- # @return [Aws::EC2::SecurityGroup]
125
- def create_security_group(name, vpc_id)
126
- sg = ec2.create_security_group({
127
- group_name: name,
128
- description: "Kontena Grid",
129
- vpc_id: vpc_id
130
- })
131
-
132
- sg.authorize_ingress({ # SSH
133
- ip_protocol: 'tcp', from_port: 22, to_port: 22, cidr_ip: '0.0.0.0/0'
134
- })
135
- sg.authorize_ingress({ # HTTP
136
- ip_protocol: 'tcp', from_port: 80, to_port: 80, cidr_ip: '0.0.0.0/0'
137
- })
138
- sg.authorize_ingress({ # HTTPS
139
- ip_protocol: 'tcp', from_port: 443, to_port: 443, cidr_ip: '0.0.0.0/0'
140
- })
141
- sg.authorize_ingress({ # OpenVPN
142
- ip_protocol: 'udp', from_port: 1194, to_port: 1194, cidr_ip: '0.0.0.0/0'
143
- })
144
- sg.authorize_ingress({ # Overlay / Weave network
145
- ip_permissions: [
146
- {
147
- from_port: 6783, to_port: 6783, ip_protocol: 'tcp',
148
- user_id_group_pairs: [
149
- { group_id: sg.group_id, vpc_id: vpc_id }
150
- ]
151
- },
152
- {
153
- from_port: 6783, to_port: 6784, ip_protocol: 'udp',
154
- user_id_group_pairs: [
155
- { group_id: sg.group_id, vpc_id: vpc_id }
156
- ]
157
- }
158
- ]
159
- })
160
-
161
- sg
162
- end
163
-
164
- # @return [String]
165
- def region
166
- ec2.client.config.region
167
- end
168
-
169
- def user_data(vars)
170
- cloudinit_template = File.join(__dir__ , '/cloudinit.yml')
171
- erb(File.read(cloudinit_template), vars)
172
- end
173
-
174
- def generate_name
175
- "#{super}-#{rand(1..99)}"
176
- end
177
-
178
- def instance_exists_in_grid?(grid, name)
179
- api_client.get("grids/#{grid}/nodes")['nodes'].find{|n| n['name'] == name}
180
- end
181
-
182
- def erb(template, vars)
183
- ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding })
184
- end
185
-
186
- # @param [Hash] node
187
- # @param [Array<String>] labels
188
- def set_labels(node, labels)
189
- data = {}
190
- data[:labels] = labels
191
- api_client.put("nodes/#{node['id']}", data, {}, {'Kontena-Grid-Token' => node['grid']['token']})
192
- end
193
-
194
- # @param [String] vpc_id
195
- # @return [Boolean]
196
- def aws_dns_supported?(vpc_id)
197
- vpc = ec2.vpc(vpc_id)
198
- response = vpc.describe_attribute({attribute: 'enableDnsSupport'})
199
- response.enable_dns_support
200
- end
201
- end
202
- end
203
- end
204
- end
@@ -1,13 +0,0 @@
1
- begin
2
- require "azure"
3
- rescue LoadError
4
- puts "It seems that you don't have Azure SDK installed."
5
- puts "Install it using: gem install azure:0.7.0"
6
- exit 1
7
- end
8
-
9
- require_relative 'random_name'
10
- require_relative 'azure/logger'
11
- require_relative 'azure/node_provisioner'
12
- require_relative 'azure/node_destroyer'
13
- require_relative 'azure/master_provisioner'
@@ -1,64 +0,0 @@
1
- #cloud-config
2
- write_files:
3
- - path: /etc/kontena-agent.env
4
- permissions: 0600
5
- owner: root
6
- content: |
7
- KONTENA_URI="<%= master_uri %>"
8
- KONTENA_TOKEN="<%= grid_token %>"
9
- KONTENA_PEER_INTERFACE=eth1
10
- KONTENA_VERSION=<%= version %>
11
- - path: /etc/systemd/system/docker.service.d/50-kontena.conf
12
- content: |
13
- [Service]
14
- Environment='DOCKER_OPTS=--insecure-registry="10.81.0.0/19" --bip="172.17.43.1/16"'
15
- - path: /etc/sysctl.d/99-inotify.conf
16
- owner: root
17
- permissions: 0644
18
- content: |
19
- fs.inotify.max_user_instances = 8192
20
- - path: /etc/resolv.conf
21
- permissions: 0644
22
- owner: root
23
- content: |
24
- nameserver 172.17.43.1
25
- nameserver 8.8.8.8
26
- nameserver 8.8.4.4
27
- coreos:
28
- units:
29
- - name: 10-weave.network
30
- runtime: false
31
- content: |
32
- [Match]
33
- Type=bridge
34
- Name=weave*
35
-
36
- [Network]
37
- - name: kontena-agent.service
38
- command: start
39
- enable: true
40
- content: |
41
- [Unit]
42
- Description=kontena-agent
43
- After=network-online.target
44
- After=docker.service
45
- Description=Kontena Agent
46
- Documentation=http://www.kontena.io/
47
- Requires=network-online.target
48
- Requires=docker.service
49
-
50
- [Service]
51
- Restart=always
52
- RestartSec=5
53
- EnvironmentFile=/etc/kontena-agent.env
54
- ExecStartPre=-/usr/bin/docker stop kontena-agent
55
- ExecStartPre=-/usr/bin/docker rm kontena-agent
56
- ExecStartPre=/usr/bin/docker pull kontena/agent:${KONTENA_VERSION}
57
- ExecStart=/usr/bin/docker run --name kontena-agent \
58
- -e KONTENA_URI=${KONTENA_URI} \
59
- -e KONTENA_TOKEN=${KONTENA_TOKEN} \
60
- -e KONTENA_PEER_INTERFACE=${KONTENA_PEER_INTERFACE} \
61
- -v=/var/run/docker.sock:/var/run/docker.sock \
62
- -v=/etc/kontena-agent.env:/etc/kontena.env \
63
- --net=host \
64
- kontena/agent:${KONTENA_VERSION}
@@ -1,106 +0,0 @@
1
- #cloud-config
2
- write_files:
3
- - path: /etc/kontena-server.env
4
- permissions: 0600
5
- owner: root
6
- content: |
7
- KONTENA_VERSION=<%= version %>
8
- KONTENA_VAULT_KEY=<%= vault_secret %>
9
- KONTENA_VAULT_IV=<%= vault_iv %>
10
- <% if ssl_cert %>SSL_CERT="/etc/kontena-server.pem"
11
-
12
- - path: /etc/kontena-server.pem
13
- permissions: 0600
14
- owner: root
15
- content: | <% ssl_cert.split(/\n/).each do |row| %>
16
- <%= row %><% end %><% end %>
17
- - path: /opt/bin/kontena-haproxy.sh
18
- permissions: 0755
19
- owner: root
20
- content: |
21
- #!/bin/sh
22
- if [ -n "$SSL_CERT" ]; then
23
- SSL_CERT=$(awk 1 ORS='\\n' $SSL_CERT)
24
- else
25
- SSL_CERT="**None**"
26
- fi
27
- /usr/bin/docker run --name=kontena-server-haproxy \
28
- --link kontena-server-api:kontena-server-api \
29
- -e SSL_CERT="$SSL_CERT" \
30
- -p 80:80 -p 443:443 kontena/haproxy:latest
31
- coreos:
32
- units:
33
- - name: kontena-server-mongo.service
34
- command: start
35
- enable: true
36
- content: |
37
- [Unit]
38
- Description=kontena-server-mongo
39
- After=network-online.target
40
- After=docker.service
41
- Description=Kontena Server MongoDB
42
- Documentation=http://www.mongodb.org/
43
- Requires=network-online.target
44
- Requires=docker.service
45
-
46
- [Service]
47
- Restart=always
48
- RestartSec=5
49
- ExecStartPre=/usr/bin/docker pull mongo:3.0
50
- ExecStartPre=-/usr/bin/docker create --name=kontena-server-mongo-data mongo:3.0
51
- ExecStartPre=-/usr/bin/docker stop kontena-server-mongo
52
- ExecStartPre=-/usr/bin/docker rm kontena-server-mongo
53
- ExecStart=/usr/bin/docker run --name=kontena-server-mongo \
54
- --volumes-from=kontena-server-mongo-data \
55
- mongo:3.0 mongod --smallfiles
56
-
57
- - name: kontena-server-api.service
58
- command: start
59
- enable: true
60
- content: |
61
- [Unit]
62
- Description=kontena-server-api
63
- After=network-online.target
64
- After=docker.service
65
- After=kontena-server-mongo.service
66
- Description=Kontena Master
67
- Documentation=http://www.kontena.io/
68
- Requires=network-online.target
69
- Requires=docker.service
70
- Requires=kontena-server-mongo.service
71
-
72
- [Service]
73
- Restart=always
74
- RestartSec=5
75
- EnvironmentFile=/etc/kontena-server.env
76
- ExecStartPre=-/usr/bin/docker stop kontena-server-api
77
- ExecStartPre=-/usr/bin/docker rm kontena-server-api
78
- ExecStartPre=/usr/bin/docker pull kontena/server:${KONTENA_VERSION}
79
- ExecStart=/usr/bin/docker run --name kontena-server-api \
80
- --link kontena-server-mongo:mongodb \
81
- -e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
82
- -e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
83
- <% if auth_server %>-e AUTH_API_URL=<%= auth_server %><% end %> \
84
- kontena/server:${KONTENA_VERSION}
85
-
86
- - name: kontena-server-haproxy.service
87
- command: start
88
- enable: true
89
- content: |
90
- [Unit]
91
- Description=kontena-server-haproxy
92
- After=network-online.target
93
- After=docker.service
94
- Description=Kontena Server HAProxy
95
- Documentation=http://www.kontena.io/
96
- Requires=network-online.target
97
- Requires=docker.service
98
-
99
- [Service]
100
- Restart=always
101
- RestartSec=5
102
- EnvironmentFile=/etc/kontena-server.env
103
- ExecStartPre=-/usr/bin/docker stop kontena-server-haproxy
104
- ExecStartPre=-/usr/bin/docker rm kontena-server-haproxy
105
- ExecStartPre=/usr/bin/docker pull kontena/haproxy:latest
106
- ExecStart=/opt/bin/kontena-haproxy.sh
@@ -1,27 +0,0 @@
1
- module Kontena
2
- module Machine
3
- module Azure
4
- class Logger
5
- def info(msg)
6
-
7
- end
8
-
9
- def error_with_exit(msg)
10
- puts msg.colorize(:red)
11
- end
12
-
13
- def warn(msg)
14
- puts msg.colorize(:yellow)
15
- end
16
-
17
- def error(msg)
18
- puts msg.colorize(:red)
19
- end
20
-
21
- def exception_message(msg)
22
- puts msg.colorize(:red)
23
- end
24
- end
25
- end
26
- end
27
- end