OSDN Git Service

dcos-grid-0.3.5
[metasearch/grid-chef-repo.git] / cookbooks / dcos-grid / README.md
1 dcos-grid Cookbook
2 ==================
3
4 This cookbook sets up your customized DC/OS cluster on bare metal, virtual machines and every cloud. This install method is based on [_Advanced DC/OS Installation Guide_](https://dcos.io/docs/1.8/administration/installing/custom/advanced/).
5
6 ## Contents
7
8 - [Requirements](#requirements)
9   - [platforms](#platforms)
10   - [packages](#packages)
11 - [Attributes](#attributes)
12 - [Usage](#usage)
13   - [Recipes](#recipes)
14     - [dcos-grid::default](#dcos-griddefault)
15     - [dcos-grid::agent](#dcos-gridagent)
16     - [dcos-grid::bootstrap](#dcos-gridbootstrap)
17     - [dcos-grid::cli (ver. 0.3.0 or later)](#dcos-gridcli-ver-030-or-later)
18     - [dcos-grid::cloud-config (for CoreOS only)](#dcos-gridcloud-config-for-coreos-only)
19     - [dcos-grid::master](#dcos-gridmaster)
20     - [dcos-grid::node](#dcos-gridnode)
21     - [dcos-grid::node-commons](#dcos-gridnode-commons)
22     - [dcos-grid::public-agent](#dcos-gridpublic-agent)
23   - [Role Examples](#role-examples)
24   - [Uninstall DC/OS](#uninstall-dcos)
25 - [License and Authors](#license-and-authors)
26
27 ## Requirements
28
29 ### platforms
30 - CentOS, Red Hat Enterprise Linux >= 7.2
31 - CoreOS Latest version.
32 - Ubuntu 16.04 (Experimental). DC/OS does not officially support Ubuntu yet. See [_Ubuntu 16.04 Enablement_](https://dcosjira.atlassian.net/browse/DCOS-25).
33   - DC/OS requires systemd, which is only fully supported in Ubuntu 15.04 and later releases. See [_SystemdForUpstartUsers_](https://wiki.ubuntu.com/SystemdForUpstartUsers)
34
35 ### packages
36 - none.
37
38 ## Attributes
39
40 |Key|Type|Description, example|Default|
41 |:--|:--|:--|:--|
42 |`['dcos-grid']['dcos_release_url']`|String|DC/OS download URL.|`'https://downloads.dcos.io/dcos/stable/dcos_generate_config.sh'`|
43 |`['dcos-grid']['dcos_cli_release_url']`|String|DC/OS CLI download URL (ver. 0.3.0 or later).|`'https://downloads.dcos.io/binaries/cli/linux/x86-64/0.4.10/dcos'`|
44 |`['dcos-grid']['docker']['apt_repo']['url']`|String| (ver. 0.3.1 or later)|`'https://apt.dockerproject.org/repo'`|
45 |`['dcos-grid']['docker']['apt_repo']['keyserver']`|String| (ver. 0.3.1 or later)|`'hkp://p80.pool.sks-keyservers.net:80'`|
46 |`['dcos-grid']['docker']['apt_repo']['recv-keys']`|String| (ver. 0.3.1 or later)|`'58118E89F3A912897C070ADBF76221572C52609D'`|
47 |`['dcos-grid']['docker']['yum_repo']['baseurl']`|String| (ver. 0.3.1 or later)|`'https://yum.dockerproject.org/repo/main/centos/$releasever/'`|
48 |`['dcos-grid']['docker']['yum_repo']['gpgcheck']`|String|`'0'`: disabled, `'1'`: enabled (ver. 0.3.1 or later).|`'1'`|
49 |`['dcos-grid']['docker']['yum_repo']['gpgkey']`|String| (ver. 0.3.1 or later)|`'https://yum.dockerproject.org/gpg'`|
50 |`['dcos-grid']['docker-engine']['setup']`|Boolean|Docker setup by this cookbook. If you will set up Docker by another cookbook, verify that this attribute is false. (ver. 0.3.0 or later)|`true`|
51 |`['dcos-grid']['docker-engine']['version_on_centos']`|String|Docker version for CentOS (ver. 0.3.0 or later).|`'1.11.2-1'`|
52 |`['dcos-grid']['docker-engine']['version_on_ubuntu']`|String|Docker version for Ubuntu (ver. 0.3.0 or later).|`'1.11.2-0'`|
53 |`['dcos-grid']['docker-engine']['version']`|String|Docker 1.9.x - 1.11.x is recommended for stability reasons. Note: this **default** value is overwritten by the `version_on_{centos or ubuntu}` (ver. 0.3.0 or later).|See default.rb|
54 |`['dcos-grid']['docker-engine']['storage-driver_on_centos']`|String|Docker storage driver (overlay, devicemapper, ...) for CentOS (ver. 0.3.4 or later).|`'overlay'`|
55 |`['dcos-grid']['docker-engine']['storage-driver_on_ubuntu']`|String|Docker storage driver (aufs, overlay, ...) for Ubuntu (ver. 0.3.4 or later).|`'aufs'`|
56 |`['dcos-grid']['docker-engine']['storage-driver']`|String|(ver. 0.3.4 or later).|See default.rb|
57 |`['dcos-grid']['docker-engine']['daemon_extra_options']`|String|ref. `docker daemon --help` (ver. 0.3.4 or later).|`'-H fd://'`|
58 |`['dcos-grid']['bootstrap']['ip']`|String|Bootstrap node IP address.|`'127.0.0.1'`|
59 |`['dcos-grid']['bootstrap']['port']`|String|Bootstrap node port number.|`'8080'`|
60 |`['dcos-grid']['bootstrap']['genconf_dir']`|String|genconf directory path. Note: This is overridden by the value `"#{node['dcos-grid']['cloud-config']['target_dir']}/genconf"` in the `cloud-config` recipe (ver. 0.3.5 or later).|`'/opt/dcos-grid/genconf'`|
61 |`['dcos-grid']['bootstrap']['config']`|Hash|Install configurations.|see [_Install Configuration Parameters_](https://dcos.io/docs/1.8/administration/installing/custom/configuration-parameters/)|
62 |`['dcos-grid']['bootstrap']['config']['bootstrap_url']`|String||`"http://#{node['dcos-grid']['bootstrap']['ip']}:#{node['dcos-grid']['bootstrap']['port']}"`|
63 |`['dcos-grid']['bootstrap']['config']['cluster_name']`|String||`'dcos0'`|
64 |`['dcos-grid']['bootstrap']['config']['exhibitor_storage_backend']`|String||`'static'`|
65 |`['dcos-grid']['bootstrap']['config']['ip_detect_filename']`|String||`'/genconf/ip-detect'`|
66 |`['dcos-grid']['bootstrap']['config']['master_discovery']`|String|(ver. 0.3.2 or later)|`'static'`|
67 |`['dcos-grid']['bootstrap']['config']['master_list']`|Array|e.g. `['192.168.1.101','192.168.1.102','192.168.1.103']`|`nil`|
68 |`['dcos-grid']['bootstrap']['config']['oauth_auth_host']`|String|(ver. 0.3.2 or later)|`'https://dcos.auth0.com'`|
69 |`['dcos-grid']['bootstrap']['config']['oauth_auth_redirector']`|String|(ver. 0.3.2 or later)|`'https://auth.dcos.io'`|
70 |`['dcos-grid']['bootstrap']['config']['oauth_available']`|String|(ver. 0.3.2 or later)|`'true'`|
71 |`['dcos-grid']['bootstrap']['config']['oauth_enabled']`|String|(ver. 0.3.2 or later)|`'true'`|
72 |`['dcos-grid']['bootstrap']['config']['oauth_issuer_url']`|String|(ver. 0.3.2 or later)|`'https://dcos.auth0.com/'`|
73 |`['dcos-grid']['bootstrap']['config']['resolvers']`|Array|e.g. `['8.8.8.8','8.8.4.4']` (Google DNS)|`nil`|
74 |`['dcos-grid']['bootstrap']['bootstrap']['ip-detect']['interface']`|String|Network interface on each node for the `ip-detect` script. Note: If you set comma-delimited interface list (e.g. `'eth0,enp0s3'`), the first detected interface's ip is adopted (ver. 0.3.0 or later). |`'eth0'`|
75 |`['dcos-grid']['node']['auto_setup']`|Boolean|execute the node setup script automatically or not.|`false`|
76 |`['dcos-grid']['cloud-config']['target_platform']`|String|CoreOS only now.|`'coreos'`|
77 |`['dcos-grid']['cloud-config']['target_dir']`|String||`'/home/core'`|
78 |`['dcos-grid']['cloud-config']['target_owner']`|String||`'core:core'`|
79 |`['dcos-grid']['cloud-config']['hostname']`|String||`'<fqdn>'`|
80 |`['dcos-grid']['cloud-config']['ssh_authorized_keys']`|Array||`['<your_ssh_pub_key>',]`|
81
82 ## Usage
83
84 ### Recipes
85
86 #### dcos-grid::default
87
88 This recipe does nothing.
89
90 #### dcos-grid::agent
91
92 This recipe sets up a private agent node. Note: If `node['dcos-grid']['node']['auto_setup']` is `false`, you must execute the following manually.
93
94 ```
95 $ /opt/dcos-grid/node_setup.sh slave
96 ```
97
98 #### dcos-grid::bootstrap
99
100 This recipe sets up a bootstrap node. Note: Please execute the following manually.
101
102 ```
103 $ /opt/dcos-grid/bootstrap_setup.sh
104 ```
105
106 #### dcos-grid::cli (ver. 0.3.0 or later)
107
108 This recipe installs DC/OS CLI.
109
110 #### dcos-grid::cloud-config (for CoreOS only)
111
112 This recipe generates a `/home/core/cloud-config.yaml` template file on local machine by the following `chef-solo` command.
113
114 ```
115 $ sudo chef-solo -c solo.rb -j nodes/local-dcos0-cloud-config.json
116 ```
117
118 - `nodes/local-dcos0-cloud-config.json`
119
120 ```json
121 {
122   "run_list": [
123     "role[dcos0-cloud-config]"
124   ]
125 }
126 ```
127
128 - `roles/dcos0-cloud-config.rb`
129
130 ```ruby
131 cluster_name = 'dcos0'
132
133 name "#{cluster_name}-cloud-config"
134 description "#{cluster_name} cloud-config.yaml file."
135
136 run_list(
137   "role[#{cluster_name}]",  # includes common attributes.
138   'recipe[dcos-grid::cloud-config]',
139 )
140 ```
141
142 Then edit this yaml template (hostname, ssh_authorized_keys, IP address and so on) and install CoreOS by the `cloud-config.yaml`.
143
144 ```
145 $ coreos-cloudinit -from-file ~/cloud-config.yaml -validate
146 ...
147 $ sudo coreos-install -d /dev/sda -C stable -c ~/cloud-config.yaml
148 ```
149
150 #### dcos-grid::master
151
152 This recipe sets up a master node. Note: If `node['dcos-grid']['node']['auto_setup']` is `false`, you must execute the following manually.
153
154 ```
155 $ /opt/dcos-grid/node_setup.sh master
156 ```
157
158 #### dcos-grid::node
159
160 This recipe sets up a base node (particular role is not assigned yet). Note: Please execute the following manually.
161
162 ```
163 $ /opt/dcos-grid/node_setup.sh {master|slave|slave_public}
164 ```
165
166 #### dcos-grid::node-commons
167
168 This recipe sets up common environment for DC/OS node.
169
170 #### dcos-grid::public-agent
171
172 This recipe sets up a public node. Note: If `node['dcos-grid']['node']['auto_setup']` is `false`, you must execute the following manually.
173
174 ```
175 $ /opt/dcos-grid/node_setup.sh slave_public
176 ```
177
178 ### Role Examples
179
180 - `roles/dcos0.rb`: Common attributes.
181
182 ```ruby
183 cluster_name = 'dcos0'
184
185 name cluster_name
186 description "#{cluster_name} cluster"
187
188 run_list(
189 )
190
191 override_attributes(
192   'dcos-grid' => {
193     'dcos_release_url' => 'https://downloads.dcos.io/dcos/stable/dcos_generate_config.sh',
194     #'dcos_release_url' => 'https://downloads.dcos.io/dcos/EarlyAccess/dcos_generate_config.sh',
195     'docker-engine' => {
196       'version_on_centos' => '1.11.2-1',
197       'version_on_ubuntu' => '1.11.2-0',
198       #'version' => '1.11.2-1.el7.centos',
199     },
200     'bootstrap' => {
201       'ip' => '192.168.56.100',
202       'port' => '8080',
203       'config' => {
204         'cluster_name' => cluster_name,
205         'master_list' => [
206           '192.168.56.101',
207           '192.168.56.102',
208           '192.168.56.103',
209         ],
210         'resolvers' => [
211           '8.8.8.8',
212           '8.8.4.4',
213         ],
214       },
215       'ip-detect' => {
216         'interface' => 'eth1,enp0s8',
217       },
218     },
219     'node' => {
220       'auto_setup' => false,
221     },
222   },
223 )
224 ```
225
226 - `roles/dcos0-boot.rb`
227
228 ```ruby
229 cluster_name = 'dcos0'
230
231 name "#{cluster_name}-boot"
232 description "#{cluster_name} cluster bootstrap node"
233
234 run_list(
235   "role[#{cluster_name}]",
236   'recipe[dcos-grid::bootstrap]',
237 )
238 ```
239
240 - `roles/dcos-master.rb`
241
242 ```ruby
243 cluster_name = 'dcos0'
244
245 name "#{cluster_name}-master"
246 description "#{cluster_name} cluster master node"
247
248 run_list(
249   "role[#{cluster_name}]",
250   'recipe[dcos-grid::master]',
251 )
252
253 override_attributes(
254   'dcos-grid' => {
255     'node' => {
256       'auto_setup' => false,
257     },
258   },
259 )
260 ```
261
262 - `roles/dcos0-agent.rb`
263
264 ```ruby
265 cluster_name = 'dcos0'
266
267 name "#{cluster_name}-agent"
268 description "#{cluster_name} cluster private agent node"
269
270 run_list(
271   "role[#{cluster_name}]",
272   'recipe[dcos-grid::agent]',
273 )
274
275 override_attributes(
276   'dcos-grid' => {
277     'node' => {
278       'auto_setup' => true,
279     },
280   },
281 )
282 ```
283
284 ### Uninstall DC/OS
285
286 Please log in each node and execute the following.
287
288 ```
289 $ /opt/dcos-grid/uninstall.sh
290 ```
291
292 ## License and Authors
293
294 - Author:: whitestar at osdn.jp
295
296 ```text
297 Copyright 2016, whitestar
298
299 Licensed under the Apache License, Version 2.0 (the "License");
300 you may not use this file except in compliance with the License.
301 You may obtain a copy of the License at
302
303     http://www.apache.org/licenses/LICENSE-2.0
304
305 Unless required by applicable law or agreed to in writing, software
306 distributed under the License is distributed on an "AS IS" BASIS,
307 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
308 See the License for the specific language governing permissions and
309 limitations under the License.
310 ```