OSDN Git Service

fix service control.
[metasearch/grid-chef-repo.git] / cookbooks / etcd-grid / README.md
1 etcd-grid Cookbook
2 ==================
3
4 This cookbook sets up a etcd cluster.
5
6 ## Contents
7
8 - [Requirements](#requirements)
9     - [platforms](#platforms)
10     - [packages](#packages)
11 - [Attributes](#attributes)
12 - [Usage](#usage)
13     - [Recipes](#recipes)
14         - [etcd-grid::default](#etcd-griddefault)
15         - [etcd-grid::docker-compose (for TESTING)](#etcd-griddocker-compose-for-testing)
16     - [Role Examples](#role-examples)
17 - [License and Authors](#license-and-authors)
18
19 ## Requirements
20
21 ### platforms
22
23 - Debian >= 9.0
24 - Ubuntu >= 14.04
25 - CentOS,RHEL >= 7.3
26
27 ### packages
28 - none.
29
30 ## Attributes
31
32 |Key|Type|Description, example|Default|
33 |:--|:--|:--|:--|
34 |`['etcd-grid']['image']['url']`|String|etcd container image URL.|`'quay.io/coreos/etcd'`|
35 |`['etcd-grid']['image']['version']`|String|Container image version.|`'v3.1'`|
36 |`['etcd-grid']['cluster']['size']`|Integer|recommended: 3, 5, 7|`3`|
37 |`['etcd-grid']['node']['port4client']`|String|Port number for client requests.|`'2379'`|
38 |`['etcd-grid']['node']['port4peer']`|String|Port number for peer communication.|`'2380'`|
39 |`['etcd-grid']['docker-compose']['app_dir']`|String||`"#{node['docker-grid']['compose']['app_dir']}/etcd"`|
40 |`['etcd-grid']['docker-compose']['data_dir']`|String||`"#{node['etcd-grid']['docker-compose']['app_dir']}/data"`|
41 |`['etcd-grid']['docker-compose']['config']`|Hash|`docker-compose.yml` configurations.|See `attributes/default.rb`|
42
43 ## Usage
44
45 ### Recipes
46
47 #### etcd-grid::default
48
49 This recipe does nothing.
50
51 #### etcd-grid::docker-compose (for TESTING)
52
53 This recipe generates a `docker-compose.yml` for the etcd cluster.
54
55 ### Role Examples
56
57 - `roles/etcd-on-docker.rb`
58
59 ```ruby
60 name 'etcd-on-docker'
61 description 'etcd on Docker'
62
63 run_list(
64   'role[docker]',
65   'recipe[etcd-grid::docker-compose]',
66 )
67
68 host_ip = '192.168.1.123'
69
70 #env_run_lists()
71
72 #default_attributes()
73
74 override_attributes(
75   'docker-grid' => {
76     'engine' => {
77       'skip_setup' => false,
78     },
79     'compose' => {
80       'skip_setup' => false,
81     },
82   },
83   'etcd-grid' => {
84     'image' => {
85       'url' => 'quay.io/coreos/etcd',
86       'version' => 'v3.1',
87     },
88     'cluster' => {
89       'size' => 3,  # recommended: 3, 5, 7
90     },
91     'docker-compose' => {
92       'config' => {
93         'services' => {
94           'etcd1' => {
95             'ports' => [
96               "#{host_ip}:23791:2379",
97               "#{host_ip}:23801:2380",
98             ],
99           },
100           'etcd2' => {
101             'ports' => [
102               "#{host_ip}:23792:2379",
103               "#{host_ip}:23802:2380",
104             ],
105           },
106           'etcd3' => {
107             'ports' => [
108               "#{host_ip}:23793:2379",
109               "#{host_ip}:23803:2380",
110             ],
111           },
112           # for TEST
113           'client' => {
114             'image' => 'quay.io/coreos/etcd:v3.1',
115             'restart' => 'none',
116             'entrypoint' => '/bin/sh -c "while true; echo dummy; do sleep 600; done"',
117             'environment' => {
118               'ETCDCTL_API' => '3',
119               'ETCDCTL_ENDPOINTS' => 'http://etcd1:2379,http://etcd2:2379,http://etcd3:2379',
120             },
121           },
122         },
123       },
124     },
125   },
126 )
127 ```
128
129 ## License and Authors
130
131 - Author:: whitestar at osdn.jp
132
133 ```text
134 Copyright 2017, whitestar
135
136 Licensed under the Apache License, Version 2.0 (the "License");
137 you may not use this file except in compliance with the License.
138 You may obtain a copy of the License at
139
140     http://www.apache.org/licenses/LICENSE-2.0
141
142 Unless required by applicable law or agreed to in writing, software
143 distributed under the License is distributed on an "AS IS" BASIS,
144 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145 See the License for the specific language governing permissions and
146 limitations under the License.
147 ```