kontena-plugin-aws 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +9 -0
- data/.gitmodules +0 -0
- data/.rspec +2 -0
- data/.travis.yml +16 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +191 -0
- data/README.md +16 -0
- data/kontena-plugin-aws.gemspec +24 -0
- data/lib/kontena/machine/aws.rb +13 -0
- data/lib/kontena/machine/aws/cloudinit.yml +73 -0
- data/lib/kontena/machine/aws/cloudinit_master.yml +120 -0
- data/lib/kontena/machine/aws/common.rb +54 -0
- data/lib/kontena/machine/aws/master_provisioner.rb +183 -0
- data/lib/kontena/machine/aws/node_destroyer.rb +51 -0
- data/lib/kontena/machine/aws/node_provisioner.rb +200 -0
- data/lib/kontena/machine/aws/node_restarter.rb +37 -0
- data/lib/kontena/plugin/aws.rb +7 -0
- data/lib/kontena/plugin/aws/master/create_command.rb +52 -0
- data/lib/kontena/plugin/aws/master_command.rb +9 -0
- data/lib/kontena/plugin/aws/node_command.rb +13 -0
- data/lib/kontena/plugin/aws/nodes/create_command.rb +59 -0
- data/lib/kontena/plugin/aws/nodes/restart_command.rb +25 -0
- data/lib/kontena/plugin/aws/nodes/terminate_command.rb +25 -0
- data/lib/kontena/plugin/aws_command.rb +11 -0
- data/lib/kontena_cli_plugin.rb +5 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzEzZWQwNDVlMDA5ODZmMmU4NzBkM2FjMDhjYWZmYjk0ZWRlNjZjZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2UzYWZmMmU2YzcwN2RlZmZjYzBmOTkxYWMwZTgzMDNhNDUxMDU2NA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmFmMTA5NDFjN2U4NjFjMjU5MDQxNDFmN2MwNzY3M2Q3MWRmY2Y5MjdhZWEy
|
10
|
+
MzMwZTg2ZTM4YjljNTAzNjBkMWIxY2NkYzk1NWRmMzZmYzYxZmRmMzc1YTQ0
|
11
|
+
ZmZmNjI2ZTFiYmU3ZjhkYjU2MzBkZTlhMTc2MGMxZjMzZjZkOGU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmM5NzMyZjBhNmQ4NWM5M2Q2MWYzM2Y3NjVjNDIyZGVmNGNlNDkzY2ZiYTM4
|
14
|
+
NzNjYmFkYmQ3NmY4Njc5YmIyY2I5NzBkZjNkOTMzOGQ2ZTU3ZGFhM2IyNDE5
|
15
|
+
N2M5MDRlNzNmNWViMzg0NDBhNGUzNjc2ZDM5ZDQ2YjJmMmEzMGQ=
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
File without changes
|
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.0.0-p648
|
4
|
+
- 2.1.8
|
5
|
+
- 2.2.3
|
6
|
+
- 2.3.1
|
7
|
+
env:
|
8
|
+
- secure: "JgI//AQcXde0SoT07sOCeQEuIR1jSz1mDa0O6riCcHSDWnPKo1KN91oJl9W4nY44sXOKhpc09HmQLOYP0QpK4GspD5zIAO5txeLpbOz0KDPkp15/oC3w6w1Q2A++V3Q+/6XnNIHaR/0/o2o0SAZgAFzHdOjwW9lAZoM1aydLX11TSGpTj88bqfz/gf0WfV+bOhSxtxgiH2h+I66RA2lc+MnWITfEhsXkc+blbHArXJc6gLXVO1/ks5WE4eEzTB7n7XM1WGvLm3sYmOZ+onphO8YESoYqkGmNR/5nSrMlHwHbn70HqR3IDUUe4G+tpYOVTX2odgeJTZMuH/V9Dy9LpyNqiOgX8cYbE9/GhnVlSjbMBK99m8m8trT49E9zEKIcmhUMQsI4YCfTdP+hfALcGRMB93XGrQNirvEjORw5kxNYg9Um3UPBeNYSKEbNE58zASF/d9/08tT9cQIOEo2OQCs6zkiuGUrnCTZYdnNWh2xY+sPpoDcnvGMb3h2lzvM4hkbf6HfMIEBLbi8m/zgYjaXoDxpxXyDH9TKkq8zO6/1koGaQQGhLW9ojtYGbpH6BOdWysxJVUk1rRUs3Q39kqRW+diS04cb/ipywfHzw/SbmqdaVkCL/e7MFjDlqiqRdNVUYGnZ65ZUTkgJo/2kuTuKXutar8qaBBvILfVZ4Hno="
|
9
|
+
cache: bundler
|
10
|
+
script: bundle install && bundle exec rspec spec/
|
11
|
+
deploy:
|
12
|
+
provider: rubygems
|
13
|
+
api_key: $GEM_TOKEN
|
14
|
+
gem: kontena-plugin-aws
|
15
|
+
on:
|
16
|
+
tags: true
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
Copyright 2015 Kontena, Inc.
|
180
|
+
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
182
|
+
you may not use this file except in compliance with the License.
|
183
|
+
You may obtain a copy of the License at
|
184
|
+
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
186
|
+
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
190
|
+
See the License for the specific language governing permissions and
|
191
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Kontena AWS Plugin
|
2
|
+
|
3
|
+
This plugin provides support for AWS EC2 provisioning to Kontena CLI.
|
4
|
+
|
5
|
+
|
6
|
+
## Contributing
|
7
|
+
|
8
|
+
1. Fork it ( https://github.com/kontena/kontena-plugin-aws )
|
9
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
10
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
11
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
12
|
+
5. Create a new Pull Request
|
13
|
+
|
14
|
+
## License
|
15
|
+
|
16
|
+
Kontena is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE.txt) for full license text.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kontena/plugin/aws'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kontena-plugin-aws"
|
8
|
+
spec.version = Kontena::Plugin::Aws::VERSION
|
9
|
+
spec.authors = ["Kontena, Inc."]
|
10
|
+
spec.email = ["info@kontena.io"]
|
11
|
+
|
12
|
+
spec.summary = "Kontena AWS plugin"
|
13
|
+
spec.description = "Kontena Amazon Web Services plugin"
|
14
|
+
spec.homepage = "https://github.com/kontena/kontena-plugin-aws"
|
15
|
+
spec.license = "Apache-2.0"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency 'kontena-cli', '>= 0.15.0.rc1'
|
21
|
+
spec.add_runtime_dependency 'aws-sdk', '~> 2.3', '>= 2.3.11'
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Kontena
|
2
|
+
module Machine
|
3
|
+
module Aws
|
4
|
+
end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
require 'aws-sdk'
|
8
|
+
require 'kontena/machine/random_name'
|
9
|
+
require 'kontena/machine/cert_helper'
|
10
|
+
require_relative 'aws/master_provisioner'
|
11
|
+
require_relative 'aws/node_provisioner'
|
12
|
+
require_relative 'aws/node_restarter'
|
13
|
+
require_relative 'aws/node_destroyer'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#cloud-config
|
2
|
+
hostname: <%= name %>
|
3
|
+
write_files:
|
4
|
+
- path: /etc/kontena-agent.env
|
5
|
+
permissions: 0600
|
6
|
+
owner: root
|
7
|
+
content: |
|
8
|
+
KONTENA_URI="<%= master_uri %>"
|
9
|
+
KONTENA_TOKEN="<%= grid_token %>"
|
10
|
+
KONTENA_PEER_INTERFACE=eth1
|
11
|
+
KONTENA_VERSION=<%= version %>
|
12
|
+
- path: /etc/systemd/system/docker.service.d/50-kontena.conf
|
13
|
+
content: |
|
14
|
+
[Service]
|
15
|
+
Environment='DOCKER_OPTS=--insecure-registry="10.81.0.0/19" --bip="172.17.43.1/16"'
|
16
|
+
Environment='DOCKER_CGROUPS=--exec-opt native.cgroupdriver=cgroupfs'
|
17
|
+
- path: /etc/sysctl.d/99-inotify.conf
|
18
|
+
owner: root
|
19
|
+
permissions: 0644
|
20
|
+
content: |
|
21
|
+
fs.inotify.max_user_instances = 8192
|
22
|
+
coreos:
|
23
|
+
units:
|
24
|
+
- name: 00-eth.network
|
25
|
+
runtime: true
|
26
|
+
content: |
|
27
|
+
[Match]
|
28
|
+
Name=eth*
|
29
|
+
[Network]
|
30
|
+
DHCP=yes
|
31
|
+
DNS=172.17.43.1
|
32
|
+
DNS=<%= dns_server %>
|
33
|
+
DOMAINS=kontena.local
|
34
|
+
[DHCP]
|
35
|
+
UseDNS=false
|
36
|
+
|
37
|
+
- name: 10-weave.network
|
38
|
+
runtime: false
|
39
|
+
content: |
|
40
|
+
[Match]
|
41
|
+
Type=bridge
|
42
|
+
Name=weave*
|
43
|
+
|
44
|
+
[Network]
|
45
|
+
- name: kontena-agent.service
|
46
|
+
command: start
|
47
|
+
enable: true
|
48
|
+
content: |
|
49
|
+
[Unit]
|
50
|
+
Description=kontena-agent
|
51
|
+
After=network-online.target
|
52
|
+
After=docker.service
|
53
|
+
Description=Kontena Agent
|
54
|
+
Documentation=http://www.kontena.io/
|
55
|
+
Requires=network-online.target
|
56
|
+
Requires=docker.service
|
57
|
+
|
58
|
+
[Service]
|
59
|
+
Restart=always
|
60
|
+
RestartSec=5
|
61
|
+
EnvironmentFile=/etc/kontena-agent.env
|
62
|
+
EnvironmentFile=-/etc/kontena-agent.custom.env
|
63
|
+
ExecStartPre=-/usr/bin/docker stop kontena-agent
|
64
|
+
ExecStartPre=-/usr/bin/docker rm kontena-agent
|
65
|
+
ExecStartPre=-/usr/bin/docker pull kontena/agent:${KONTENA_VERSION}
|
66
|
+
ExecStart=/usr/bin/docker run --name kontena-agent \
|
67
|
+
-e KONTENA_URI=${KONTENA_URI} \
|
68
|
+
-e KONTENA_TOKEN=${KONTENA_TOKEN} \
|
69
|
+
-e KONTENA_PEER_INTERFACE=${KONTENA_PEER_INTERFACE} \
|
70
|
+
-v=/var/run/docker.sock:/var/run/docker.sock \
|
71
|
+
-v=/etc/kontena-agent.env:/etc/kontena.env \
|
72
|
+
--net=host \
|
73
|
+
kontena/agent:${KONTENA_VERSION}
|
@@ -0,0 +1,120 @@
|
|
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
|
+
<% unless mongodb_uri -%>
|
34
|
+
- name: kontena-server-mongo.service
|
35
|
+
command: start
|
36
|
+
enable: true
|
37
|
+
content: |
|
38
|
+
[Unit]
|
39
|
+
Description=kontena-server-mongo
|
40
|
+
After=network-online.target
|
41
|
+
After=docker.service
|
42
|
+
Description=Kontena Server MongoDB
|
43
|
+
Documentation=http://www.mongodb.org/
|
44
|
+
Requires=network-online.target
|
45
|
+
Requires=docker.service
|
46
|
+
|
47
|
+
[Service]
|
48
|
+
Restart=always
|
49
|
+
RestartSec=5
|
50
|
+
ExecStartPre=/usr/bin/docker pull mongo:3.0
|
51
|
+
ExecStartPre=-/usr/bin/docker create --name=kontena-server-mongo-data mongo:3.0
|
52
|
+
ExecStartPre=-/usr/bin/docker stop kontena-server-mongo
|
53
|
+
ExecStartPre=-/usr/bin/docker rm kontena-server-mongo
|
54
|
+
ExecStart=/usr/bin/docker run --name=kontena-server-mongo \
|
55
|
+
--volumes-from=kontena-server-mongo-data \
|
56
|
+
mongo:3.0 mongod --smallfiles
|
57
|
+
<% end -%>
|
58
|
+
- name: kontena-server-api.service
|
59
|
+
command: start
|
60
|
+
enable: true
|
61
|
+
content: |
|
62
|
+
[Unit]
|
63
|
+
Description=kontena-server-api
|
64
|
+
After=network-online.target
|
65
|
+
After=docker.service
|
66
|
+
After=kontena-server-mongo.service
|
67
|
+
Description=Kontena Master
|
68
|
+
Documentation=http://www.kontena.io/
|
69
|
+
Before=kontena-server-haproxy.service
|
70
|
+
Wants=kontena-server-haproxy.service
|
71
|
+
Requires=network-online.target
|
72
|
+
Requires=docker.service
|
73
|
+
<% unless mongodb_uri -%>
|
74
|
+
Requires=kontena-server-mongo.service
|
75
|
+
<% end %>
|
76
|
+
|
77
|
+
[Service]
|
78
|
+
Restart=always
|
79
|
+
RestartSec=5
|
80
|
+
EnvironmentFile=/etc/kontena-server.env
|
81
|
+
EnvironmentFile=-/etc/kontena-server.custom.env
|
82
|
+
ExecStartPre=-/usr/bin/docker stop kontena-server-api
|
83
|
+
ExecStartPre=-/usr/bin/docker rm kontena-server-api
|
84
|
+
ExecStartPre=-/usr/bin/docker pull kontena/server:${KONTENA_VERSION}
|
85
|
+
ExecStart=/usr/bin/docker run --name kontena-server-api \
|
86
|
+
<% if mongodb_uri -%>
|
87
|
+
-e MONGODB_URI=<%= mongodb_uri %> \
|
88
|
+
<% else -%>
|
89
|
+
--link kontena-server-mongo:mongodb \
|
90
|
+
-e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
|
91
|
+
<% end -%>
|
92
|
+
<% if auth_server %>
|
93
|
+
-e AUTH_API_URL=<%= auth_server %> \
|
94
|
+
<% end -%>
|
95
|
+
-e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
|
96
|
+
kontena/server:${KONTENA_VERSION}
|
97
|
+
|
98
|
+
- name: kontena-server-haproxy.service
|
99
|
+
command: start
|
100
|
+
enable: true
|
101
|
+
content: |
|
102
|
+
[Unit]
|
103
|
+
Description=kontena-server-haproxy
|
104
|
+
After=network-online.target
|
105
|
+
After=docker.service
|
106
|
+
Description=Kontena Server HAProxy
|
107
|
+
Documentation=http://www.kontena.io/
|
108
|
+
Requires=network-online.target
|
109
|
+
Requires=docker.service
|
110
|
+
Requires=kontena-server-api.service
|
111
|
+
|
112
|
+
[Service]
|
113
|
+
Restart=always
|
114
|
+
RestartSec=5
|
115
|
+
EnvironmentFile=/etc/kontena-server.env
|
116
|
+
EnvironmentFile=-/etc/kontena-server.custom.env
|
117
|
+
ExecStartPre=-/usr/bin/docker stop kontena-server-haproxy
|
118
|
+
ExecStartPre=-/usr/bin/docker rm kontena-server-haproxy
|
119
|
+
ExecStartPre=-/usr/bin/docker pull kontena/haproxy:latest
|
120
|
+
ExecStart=/opt/bin/kontena-haproxy.sh
|