Grid環境構築用のChefリポジトリです。
Revision | 318873347ac2001922f3ab9e1e69420c16333928 (tree) |
---|---|
Zeit | 2016-12-17 22:43:56 |
Autor | whitestar <whitestar@gaea...> |
Commiter | whitestar |
adds sha256 checksum verification of the downloaded DC/OS artifacts.
@@ -1,6 +1,11 @@ | ||
1 | 1 | dcos-grid CHANGELOG |
2 | 2 | =================== |
3 | 3 | |
4 | +0.5.0 | |
5 | +----- | |
6 | +- improves CLI installation. | |
7 | +- adds sha256 checksum verification of the downloaded DC/OS artifacts. | |
8 | + | |
4 | 9 | 0.4.9 |
5 | 10 | ----- |
6 | 11 | - adds `dcos-grid::universe-server` recipe. |
@@ -47,9 +47,15 @@ This cookbook sets up your customized DC/OS cluster on bare metal, virtual machi | ||
47 | 47 | |Key|Type|Description, example|Default| |
48 | 48 | |:--|:--|:--|:--| |
49 | 49 | |`['dcos-grid']['dcos_release_url']`|String|DC/OS download URL.|`'https://downloads.dcos.io/dcos/stable/dcos_generate_config.sh'`| |
50 | +|`['dcos-grid']['dcos_release_checksum']`|String|sha256 checksum of the DC/OS release. (ver. 0.5.0 or later)|`nil` (no check)| | |
50 | 51 | |`['dcos-grid']['dcos_release_script_name']`|String|OSS edition: `'dcos_generate_config.sh'`, Enterprise edition: `'dcos_generate_config.ee.sh'` (ver. 0.4.8 or later).|`Pathname(URI(node['dcos-grid']['dcos_release_url']).path).basename`| |
51 | -|`['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/dcos-1.8/dcos'`| | |
52 | -|`['dcos-grid']['dcos_cli_upgrade']`|Boolean|Whether upgrade DC/OS CLI or not (ver. 0.4.3 or later).|`false`| | |
52 | +|`['dcos-grid']['dcos_cli_release_url']`|String|DEPRECATED: DC/OS CLI download URL (ver. 0.3.0 or later).|`"https://downloads.dcos.io/binaries/cli/linux/x86-64/#{node['dcos-grid']['cli']['version']}/dcos"`| | |
53 | +|`['dcos-grid']['dcos_cli_upgrade']`|Boolean|DEPRECATED: Whether upgrade DC/OS CLI or not (ver. 0.4.3 or later).|`false`| | |
54 | +|`['dcos-grid']['cli']['version']`|String|DC/OS CLI version (ver. 0.5.0 or later)|`'0.4.14'`| | |
55 | +|`['dcos-grid']['cli']['release_url']`|String| (ver. 0.5.0 or later)|`node['dcos-grid']['dcos_cli_release_url']`| | |
56 | +|`['dcos-grid']['cli']['release_checksum']`|String|sha256 checksum of the DC/OS CLI release. (ver. 0.5.0 or later)|`nil` (no check)| | |
57 | +|`['dcos-grid']['cli']['auto_upgrade']`|Boolean| (ver. 0.5.0 or later)|`node['dcos-grid']['dcos_cli_upgrade']`| | |
58 | +|`['dcos-grid']['cli']['install_path']`|String| (ver. 0.5.0 or later)|`'/usr/local/bin/dcos'`| | |
53 | 59 | |`['dcos-grid']['docker']['apt_repo']['url']`|String|DEPRECATED: use `['docker-grid']['apt_repo']['url']` (ver. 0.4.0 or later)|`nil`| |
54 | 60 | |`['dcos-grid']['docker']['apt_repo']['keyserver']`|String|DEPRECATED: use `['docker-grid']['apt_repo']['keyserver']` (ver. 0.4.0 or later)|`nil`| |
55 | 61 | |`['dcos-grid']['docker']['apt_repo']['recv-keys']`|String|DEPRECATED: use `['docker-grid']['apt_repo']['recv-keys']` (ver. 0.4.0 or later)|`nil`| |
@@ -21,9 +21,19 @@ require 'uri' | ||
21 | 21 | require 'pathname' |
22 | 22 | |
23 | 23 | default['dcos-grid']['dcos_release_url'] = 'https://downloads.dcos.io/dcos/stable/dcos_generate_config.sh' |
24 | +default['dcos-grid']['dcos_release_checksum'] = nil | |
25 | +# DC/OS 1.8.7 | |
26 | +#default['dcos-grid']['dcos_release_checksum'] = 'ddd9a86e4fc6ab149fb6c2ce38fc7d7c2f5891e62fb5ed41b91c3e99e02ed536' | |
24 | 27 | default['dcos-grid']['dcos_release_script_name'] = Pathname(URI(node['dcos-grid']['dcos_release_url']).path).basename |
25 | -default['dcos-grid']['dcos_cli_release_url'] = 'https://downloads.dcos.io/binaries/cli/linux/x86-64/dcos-1.8/dcos' | |
28 | +default['dcos-grid']['cli']['version'] = '0.4.14' # or dcos-1.8 | |
29 | +default['dcos-grid']['dcos_cli_release_url'] = "https://downloads.dcos.io/binaries/cli/linux/x86-64/#{node['dcos-grid']['cli']['version']}/dcos" | |
26 | 30 | default['dcos-grid']['dcos_cli_upgrade'] = false |
31 | +default['dcos-grid']['cli']['release_url'] = node['dcos-grid']['dcos_cli_release_url'] | |
32 | +default['dcos-grid']['cli']['release_checksum'] = nil | |
33 | +# DC/OS CLI 0.4.14 | |
34 | +#default['dcos-grid']['cli']['release_checksum'] = '070587062c7c0b926e2438a383b05c942e99ccf909421feed4941d06e3846fa7' | |
35 | +default['dcos-grid']['cli']['auto_upgrade'] = node['dcos-grid']['dcos_cli_upgrade'] | |
36 | +default['dcos-grid']['cli']['install_path'] = '/usr/local/bin/dcos' | |
27 | 37 | # DEPRECATED: ['dcos-grid']['docker'][*] attributes. Use ['docker-grid'][*] |
28 | 38 | default['dcos-grid']['docker']['apt_repo'] = { |
29 | 39 | 'url' => nil, |
@@ -5,7 +5,7 @@ maintainer_email '' | ||
5 | 5 | license 'Apache 2.0' |
6 | 6 | description 'Installs/Configures DC/OS Cluster Node.' |
7 | 7 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
8 | -version '0.4.9' | |
8 | +version '0.5.0' | |
9 | 9 | source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git' |
10 | 10 | issues_url 'https://osdn.jp/projects/metasearch/ticket' |
11 | 11 |
@@ -18,6 +18,7 @@ | ||
18 | 18 | # |
19 | 19 | |
20 | 20 | genconf_dir = node['dcos-grid']['bootstrap']['genconf_dir'] |
21 | +cli_ver = node['dcos-grid']['cli']['version'] | |
21 | 22 | |
22 | 23 | resources(directory: genconf_dir) rescue directory genconf_dir do |
23 | 24 | owner 'root' |
@@ -46,6 +47,14 @@ when 'debian' | ||
46 | 47 | end |
47 | 48 | =end |
48 | 49 | |
50 | +[ | |
51 | + 'curl', | |
52 | +].each {|pkg| | |
53 | + resources(package: pkg) rescue package pkg do | |
54 | + action :install | |
55 | + end | |
56 | +} | |
57 | + | |
49 | 58 | template "#{File.dirname(genconf_dir)}/cli_setup.sh" do |
50 | 59 | source 'opt/dcos-grid/cli_setup.sh' |
51 | 60 | owner 'root' |
@@ -57,5 +66,6 @@ bash 'install_dcos_cli' do | ||
57 | 66 | code <<-"EOH" |
58 | 67 | #{File.dirname(genconf_dir)}/cli_setup.sh -y |
59 | 68 | EOH |
60 | - not_if { ::File.exist?('/usr/local/bin/dcos') } unless node['dcos-grid']['dcos_cli_upgrade'] | |
69 | + not_if "[ \"$(dcos --version | grep dcoscli.version | awk -F '=' '{print $2}')\" = #{cli_ver} ]" | |
70 | + not_if { ::File.exist?(node['dcos-grid']['cli']['install_path']) } unless node['dcos-grid']['cli']['auto_upgrade'] | |
61 | 71 | end |
@@ -57,7 +57,7 @@ when 'rhel' | ||
57 | 57 | 'curl', |
58 | 58 | 'ipset', |
59 | 59 | ].each {|pkg| |
60 | - package pkg do | |
60 | + resources(package: pkg) rescue package pkg do | |
61 | 61 | action :install |
62 | 62 | end |
63 | 63 | } |
@@ -82,7 +82,7 @@ when 'debian' | ||
82 | 82 | 'curl', |
83 | 83 | 'ipset', |
84 | 84 | ].each {|pkg| |
85 | - package pkg do | |
85 | + resources(package: pkg) rescue package pkg do | |
86 | 86 | action :install |
87 | 87 | end |
88 | 88 | } |
@@ -28,7 +28,7 @@ when 'rhel' | ||
28 | 28 | 'python34-setuptools', |
29 | 29 | 'jq', |
30 | 30 | ].each {|pkg| |
31 | - package pkg do | |
31 | + resources(package: pkg) rescue package pkg do | |
32 | 32 | action :install |
33 | 33 | end |
34 | 34 | } |
@@ -42,7 +42,7 @@ when 'debian' | ||
42 | 42 | 'python3-pip', |
43 | 43 | 'jq', |
44 | 44 | ].each {|pkg| |
45 | - package pkg do | |
45 | + resources(package: pkg) rescue package pkg do | |
46 | 46 | action :install |
47 | 47 | end |
48 | 48 | } |
@@ -7,6 +7,7 @@ PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:`dirname $0` | ||
7 | 7 | |
8 | 8 | install_dir=<%= File.dirname(node['dcos-grid']['bootstrap']['genconf_dir']) %> |
9 | 9 | release_script_name=<%= node['dcos-grid']['dcos_release_script_name'] %> |
10 | +rel_checksum='<%= node['dcos-grid']['dcos_release_checksum'] %>' | |
10 | 11 | port=<%= node['dcos-grid']['bootstrap']['port'] %> |
11 | 12 | |
12 | 13 | usage() { |
@@ -99,6 +100,13 @@ else | ||
99 | 100 | |
100 | 101 | echo 'Downloading DC/OS release ...' |
101 | 102 | execute "$sudo curl -O <%= node['dcos-grid']['dcos_release_url'] %>" |
103 | + if [ "$rel_checksum" != '' ]; then | |
104 | + if [ "$(sha256sum $release_script_name | awk '{print $1}')" != $rel_checksum ]; then | |
105 | + echo '[ERROR] dcos binary file checksum mismatch.' | |
106 | + execute "$sudo rm $release_script_name" | |
107 | + exit 1 | |
108 | + fi | |
109 | + fi | |
102 | 110 | |
103 | 111 | echo 'Generating DC/OS configurations ...' |
104 | 112 | execute "$sudo bash $release_script_name" |
@@ -7,6 +7,7 @@ PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:`dirname $0` | ||
7 | 7 | |
8 | 8 | install_dir=<%= File.dirname(node['dcos-grid']['bootstrap']['genconf_dir']) %> |
9 | 9 | release_script_name=<%= node['dcos-grid']['dcos_release_script_name'] %> |
10 | +rel_checksum='<%= node['dcos-grid']['dcos_release_checksum'] %>' | |
10 | 11 | port=<%= node['dcos-grid']['bootstrap']['port'] %> |
11 | 12 | |
12 | 13 | usage() { |
@@ -110,6 +111,13 @@ upgrade() { | ||
110 | 111 | else |
111 | 112 | echo 'Downloading new DC/OS release ...' |
112 | 113 | execute "$sudo curl -O <%= node['dcos-grid']['dcos_release_url'] %>" |
114 | + if [ "$rel_checksum" != '' ]; then | |
115 | + if [ "$(sha256sum $release_script_name | awk '{print $1}')" != $rel_checksum ]; then | |
116 | + echo '[ERROR] dcos binary file checksum mismatch.' | |
117 | + execute "$sudo rm $release_script_name" | |
118 | + exit 1 | |
119 | + fi | |
120 | + fi | |
113 | 121 | fi |
114 | 122 | |
115 | 123 | echo 'Generating new DC/OS configurations ...' |
@@ -2,6 +2,9 @@ | ||
2 | 2 | |
3 | 3 | PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:`dirname $0` |
4 | 4 | |
5 | +install_path=<%= node['dcos-grid']['cli']['install_path'] %> | |
6 | +cli_checksum='<%= node['dcos-grid']['cli']['release_checksum'] %>' | |
7 | + | |
5 | 8 | usage() { |
6 | 9 | echo 'Usage: cli_setup.sh [-y] [-h]' |
7 | 10 | echo 'This script sets up DC/OS client.' |
@@ -60,9 +63,16 @@ done | ||
60 | 63 | sudo='sudo' |
61 | 64 | [ `whoami` = 'root' ] && sudo='' |
62 | 65 | |
63 | -execute "$sudo curl <%= node['dcos-grid']['dcos_cli_release_url'] %> -o /usr/local/bin/dcos && | |
64 | -$sudo chmod +x /usr/local/bin/dcos && | |
65 | -$sudo /usr/local/bin/dcos config set core.dcos_url https://<%= node['dcos-grid']['bootstrap']['config']['master_list'][0] %>" | |
66 | +execute "$sudo curl <%= node['dcos-grid']['cli']['release_url'] %> -o $install_path" | |
67 | +if [ "$cli_checksum" != '' ]; then | |
68 | + if [ "$(sha256sum $install_path | awk '{print $1}')" != $cli_checksum ]; then | |
69 | + echo '[ERROR] dcos binary file checksum mismatch.' | |
70 | + execute "$sudo rm $install_path" | |
71 | + exit 1 | |
72 | + fi | |
73 | +fi | |
74 | +execute "$sudo chmod +x $install_path && | |
75 | +$sudo $install_path config set core.dcos_url https://<%= node['dcos-grid']['bootstrap']['config']['master_list'][0] %>" | |
66 | 76 | |
67 | 77 | # old way |
68 | 78 | #mkdir -p dcos && cd dcos && |
@@ -15,6 +15,11 @@ default_attributes( | ||
15 | 15 | |
16 | 16 | override_attributes( |
17 | 17 | 'dcos-grid' => { |
18 | - 'dcos_cli_upgrade' => true, | |
18 | + 'cli' => { | |
19 | + 'version' => '0.4.14', | |
20 | + 'release_checksum' => '070587062c7c0b926e2438a383b05c942e99ccf909421feed4941d06e3846fa7', | |
21 | + 'auto_upgrade' => true, | |
22 | + 'install_path' => '/usr/local/bin/dcos', | |
23 | + }, | |
19 | 24 | }, |
20 | 25 | ) |