-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from chef-partners/mattray/alpha
Initial release
- Loading branch information
Showing
18 changed files
with
445 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
driver: | ||
name: gce | ||
project: chef-marketplace-dev | ||
zone: us-central1-a | ||
preemptible: true | ||
email: [email protected] | ||
tags: | ||
- mesosphere | ||
- test-kitchen | ||
service_account_scopes: | ||
- devstorage.read_write | ||
- userinfo.email | ||
|
||
transport: | ||
username: mray | ||
ssh_key: | ||
- ~/.ssh/google_compute_engine | ||
|
||
platforms: | ||
- name: centos-7.2 | ||
driver: | ||
image_name: centos-7 | ||
|
||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[dcos::default] | ||
attributes: | ||
dcos: | ||
master_list: ['127.0.0.1'] | ||
- name: gm1 | ||
run_list: | ||
- recipe[dcos::default] | ||
attributes: | ||
dcos: | ||
ip-detect: 'gce' | ||
dcos_role: 'master' | ||
master_list: ['10.240.0.2', '10.240.0.3', '10.240.0.4'] | ||
- name: gm2 | ||
run_list: | ||
- recipe[dcos::default] | ||
attributes: | ||
dcos: | ||
ip-detect: 'gce' | ||
dcos_role: 'master' | ||
master_list: ['10.240.0.2', '10.240.0.3', '10.240.0.4'] | ||
- name: gm3 | ||
run_list: | ||
- recipe[dcos::default] | ||
attributes: | ||
dcos: | ||
dcos_role: 'master' | ||
master_list: ['10.240.0.2', '10.240.0.3', '10.240.0.4'] | ||
- name: gs1 | ||
run_list: | ||
- recipe[dcos::default] | ||
attributes: | ||
dcos: | ||
ip-detect: 'gce' | ||
dcos_role: 'slave' | ||
master_list: ['10.240.0.2', '10.240.0.3', '10.240.0.4'] | ||
- name: gs2 | ||
run_list: | ||
- recipe[dcos::default] | ||
attributes: | ||
dcos: | ||
ip-detect: 'gce' | ||
dcos_role: 'slave' | ||
master_list: ['10.240.0.2', '10.240.0.3', '10.240.0.4'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Style/FileName: | ||
Exclude: | ||
- 'recipes/_ip-detect.rb' | ||
|
||
LineLength: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
language: ruby | ||
sudo: false | ||
|
||
addons: | ||
apt: | ||
sources: | ||
- chef-current-precise | ||
packages: | ||
- chefdk | ||
|
||
# Ensure we make ChefDK's Ruby the default | ||
before_script: | ||
- eval "$(/opt/chefdk/bin/chef shell-init bash)" | ||
script: | ||
- /opt/chefdk/embedded/bin/chef --version | ||
- /opt/chefdk/embedded/bin/rubocop --version | ||
- /opt/chefdk/embedded/bin/rubocop | ||
- /opt/chefdk/embedded/bin/foodcritic --version | ||
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec | ||
- /opt/chefdk/embedded/bin/rspec --version | ||
- /opt/chefdk/embedded/bin/rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://supermarket.chef.io' | ||
|
||
metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Author:: Matt Ray <[email protected]> | ||
# Cookbook Name:: dcos | ||
# | ||
# Copyright 2016 Chef Software, Inc | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
default['dcos']['dcos_version'] = 'stable' | ||
default['dcos']['dcos_role'] = 'master' # 'master', 'slave' or 'slave_public' | ||
|
||
default['dcos']['cluster_name'] = 'DCOS' | ||
default['dcos']['master_discovery'] = 'static' | ||
default['dcos']['exhibitor_storage_backend'] = 'static' | ||
default['dcos']['bootstrap_url'] = 'file:///root/genconf/serve' | ||
|
||
# determine how to generate the genconf/ip-detect script | ||
# 'aws' or 'gce' will use the local ipv4 address from the metadata service | ||
# otherwise use 'eth0', 'eth1', etc. and it will get the ipaddress associated | ||
# with node['network']['interface'][VALUE] | ||
default['dcos']['ip-detect'] = 'eth0' | ||
|
||
# ipv4 only, must be odd number 1-9 | ||
default['dcos']['master_list'] = [] | ||
# upstream DNS for MesosDNS | ||
default['dcos']['resolvers'] = ['8.8.8.8', '8.8.4.4'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
# Example ip-detect script using an external authority | ||
# Uses the AWS Metadata Service to get the node's internal | ||
# ipv4 address | ||
|
||
curl -fsSL http://169.254.169.254/latest/meta-data/local-ipv4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
# Example ip-detect script using an external authority | ||
# Uses the GCE metadata server to get the node's internal | ||
# ipv4 address | ||
|
||
curl -fsSl -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/ip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
name 'mesosphere' | ||
name 'dcos' | ||
maintainer 'Chef Software, Inc.' | ||
maintainer_email '[email protected]' | ||
license 'Apache 2.0' | ||
description 'Installs/Configures Mesosphere' | ||
long_description 'Installs/Configures Mesosphere' | ||
version '0.1.0' | ||
|
||
source_url 'https://github.com/chef-partners/dcos-cookbook' if | ||
respond_to?(:source_url) | ||
issues_url 'https://github.com/chef-partners/dcos-cookbook/issues' if | ||
respond_to?(:issues_url) | ||
|
||
supports 'centos' | ||
supports 'oracle' | ||
supports 'redhat' | ||
supports 'scientific' | ||
|
||
depends 'docker', '~> 2.0' | ||
depends 'selinux', '~> 0.9.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# Cookbook Name:: dcos | ||
# Recipe:: _ip-detect | ||
# | ||
# Copyright 2016, Chef Software, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# generates a genconf/ip-detect script based on the node['dcos']['ip-detect'] | ||
# https://docs.mesosphere.com/archived-dcos-enterprise-edition/installing-enterprise-edition-1-5/create-a-script-for-ip-address-discovery/ | ||
|
||
if node['dcos']['ip-detect'].eql? 'aws' | ||
cookbook_file '/root/genconf/ip-detect' do | ||
source 'aws' | ||
mode '0755' | ||
end | ||
elsif node['dcos']['ip-detect'].eql? 'gce' | ||
cookbook_file '/root/genconf/ip-detect' do | ||
source 'gce' | ||
mode '0755' | ||
end | ||
else | ||
# find the ipaddress for that interface | ||
interface = node['dcos']['ip-detect'] | ||
addresses = node['network']['interfaces'][interface]['addresses'] | ||
addresses.select do |ip, data| | ||
template '/root/genconf/ip-detect' do | ||
source 'ip-detect.erb' | ||
only_if { data['family'].eql?('inet') } | ||
mode '0755' | ||
variables(ip: ip) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# | ||
# Cookbook Name:: dcos | ||
# Recipe:: default | ||
# | ||
# Copyright 2016, Chef Software, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# Prereqs | ||
selinux_state 'SELinux Permissive' do | ||
action :permissive | ||
end | ||
|
||
service 'firewalld' do | ||
action [:stop, :disable] | ||
end | ||
|
||
package 'unzip' | ||
|
||
package 'ipset' | ||
|
||
group 'nogroup' | ||
|
||
# Install docker with overlayfs | ||
docker_service 'default' do | ||
storage_driver 'overlay' | ||
action [:create, :start] | ||
end | ||
|
||
# Note this link does not have versioning, so using it will always be the latest | ||
# DCOS from 'testing' and this URL might change in the future. | ||
# https://s3.amazonaws.com/downloads.mesosphere.io/dcos/stable/dcos_generate_config.sh | ||
remote_file '/root/dcos_generate_config.sh' do | ||
source 'https://downloads.mesosphere.io/dcos/testing/continuous/dcos_generate_config.sh' | ||
mode '0755' | ||
end | ||
|
||
directory '/root/genconf' do | ||
mode '0755' | ||
end | ||
|
||
template '/root/genconf/config.yaml' do | ||
source 'config.yaml.erb' | ||
end | ||
|
||
# generate the /root/genconf/ip-detect script | ||
include_recipe 'dcos::_ip-detect' | ||
|
||
execute 'dcos-genconf' do | ||
command '/root/dcos_generate_config.sh --genconf' | ||
user 'root' | ||
cwd '/root' | ||
not_if do | ||
File.exist?('/root/genconf/cluster_packages.json') | ||
end | ||
end | ||
|
||
file '/root/genconf/serve/dcos_install.sh' do | ||
mode '0755' | ||
subscribes :create, 'execute[dcos-genconf]', :immediately | ||
action :nothing | ||
end | ||
|
||
execute 'dcos_install' do | ||
command "/root/genconf/serve/dcos_install.sh #{node['dcos']['dcos_role']}" | ||
user 'root' | ||
cwd '/root' | ||
subscribes :run, 'file[/root/genconf/serve/dcos_install.sh]', :immediately | ||
action :nothing | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'chefspec' | ||
require 'chefspec/berkshelf' |
Oops, something went wrong.