--- /dev/null
+~FC001
+~FC019
--- /dev/null
+AllCops:
+ Exclude:
+ - vendor/**/*
+
+AlignParameters:
+ Enabled: false
+LineLength:
+ Enabled: false
+Lint/UnusedBlockArgument:
+ Enabled: false
+Metrics/AbcSize:
+ Enabled: false
+Style/BlockComments:
+ Enabled: false
+Style/BlockDelimiters:
+ Enabled: false
+Style/ExtraSpacing:
+ Enabled: false
+Style/FileName:
+ Enabled: false
+Style/LeadingCommentSpace:
+ Enabled: false
+Style/RescueModifier:
+ Enabled: false
+Style/SpaceAroundOperators:
+ Enabled: false
+Style/SpaceBeforeFirstArg:
+ Enabled: false
+Style/SpaceInsideBlockBraces:
+ Enabled: false
+Style/SpaceInsidePercentLiteralDelimiters:
+ Enabled: false
+Style/TrailingCommaInLiteral:
+ EnforcedStyleForMultiline: consistent_comma
+Style/WordArray:
+ Enabled: false
+
+#Lint/ShadowingOuterLocalVariable:
+# Enabled: false
+#Metrics/MethodLength:
+# Max: 10
+#Metrics/ModuleLength:
+# Max: 100
+#Metrics/CyclomaticComplexity:
+# Max: 6
+#Metrics/PerceivedComplexity:
+# Max: 7
+#Style/AccessorMethodName:
+# Enabled: false
+#Style/MultilineOperationIndentation:
+# Enabled: false
+#Style/PerlBackrefs:
+# Enabled: false
--- /dev/null
+#
+# Copyright 2018 whitestar
+#
+# 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.
+#
+
+source 'https://supermarket.chef.io'
+
+metadata
--- /dev/null
+# minio-grid CHANGELOG
+
+0.1.0
+-----
+- Initial release of minio-grid
--- /dev/null
+source 'https://rubygems.org'
+
+# with Chef DK
+gem 'stove'
--- /dev/null
+minio-grid Cookbook
+===================
+
+This cookbook sets up a Minio service.
+
+## Contents
+
+- [Requirements](#requirements)
+ - [platforms](#platforms)
+ - [packages](#packages)
+- [Attributes](#attributes)
+- [Usage](#usage)
+ - [Recipes](#recipes)
+ - [minio-grid::default](#minio-griddefault)
+ - [minio-grid::docker-compose](#minio-griddocker-compose)
+ - [Role Examples](#role-examples)
+ - [SSL server keys and certificates management by `ssl_cert` cookbook](#ssl-server-keys-and-certificates-management-by-ssl_cert-cookbook)
+ - [Server access key management by Chef Vault](#server-access-key-management-by-chef-vault)
+- [License and Authors](#license-and-authors)
+
+## Requirements
+
+### platforms
+
+- Debian >= 9.0
+- Ubuntu >= 14.04
+- CentOS,RHEL >= 7.3
+
+### packages
+- none.
+
+## Attributes
+
+|Key|Type|Description, example|Default|
+|:--|:--|:--|:--|
+|`['minio-grid']['with_ssl_cert_cookbook']`|Boolean|If this attribute is true, `node['minio-grid']['docker-compose']['config']` are are overridden by the following `common_name` attributes.|`false`|
+|`['minio-grid']['ssl_cert']['common_name']`|String|Minio server common name for TLS|`node['fqdn']`|
+|`['minio-grid']['docker-compose']['app_dir']`|String||`"#{node['docker-grid']['compose']['app_dir']}/minio"`|
+|`['minio-grid']['docker-compose']['config_dir']`|String||`"#{node['minio-grid']['docker-compose']['app_dir']}/config"`|
+|`['minio-grid']['docker-compose']['data_dir']`|String||`"#{node['docker-grid']['compose']['app_dir']}/data"`|
+|`['minio-grid']['docker-compose']['config']`|Hash|`docker-compose.yml` configurations.|See `attributes/default.rb`|
+
+## Usage
+
+### Recipes
+
+#### minio-grid::default
+
+This recipe does nothing.
+
+#### minio-grid::docker-compose
+
+This recipe generates a `docker-compose.yml` for the Minio service.
+
+### Role Examples
+
+- `roles/minio-on-docker.rb`
+
+```ruby
+name 'minio-on-docker'
+description 'Minio on Docker'
+
+minio_port = '9000'
+
+run_list(
+ 'role[docker]',
+ 'recipe[minio-grid::docker-compose]',
+)
+
+#env_run_lists
+
+#default_attributes
+
+override_attributes(
+ 'minio-grid' => {
+ 'docker-compose' => {
+ 'config' => {
+ 'services' => {
+ 'minio' => {
+ 'restart' => 'always',
+ 'image' => 'minio/minio',
+ 'ports' => [
+ "#{minio_port}:9000",
+ ],
+ 'environment' => {
+ # See https://docs.minio.io/
+ #'MINIO_REGION' => 'us-east-1',
+ #'MINIO_BROWSER' => 'on',
+ #'MINIO_DOMAIN' => 'minio.example.com', # for virtual-host-style requests
+ # These variables will be set by the minio-grid::docker-compose recipe automatically.
+ #'MINIO_ACCESS_KEY' => '${MINIO_ACCESS_KEY}',
+ #'MINIO_SECRET_KEY' => '${MINIO_SECRET_KEY}',
+ },
+ #'volumes' => [
+ # These volumes will be set by the minio-grid::docker-compose recipe automatically.
+ #"#{node['minio-grid']['docker-compose']['config_dir']}:/root/.minio:rw",
+ #"#{node['minio-grid']['docker-compose']['data_dir']}:/data:rw",
+ #"#{server_cert_path(node['minio-grid']['ssl_cert']['common_name'])}:/root/.minio/certs/public.crt:ro",
+ #"#{server_key_path(node['minio-grid']['ssl_cert']['common_name'])}:/root/.minio/certs/private.key:ro",
+ #],
+ },
+ },
+ },
+ },
+ },
+)
+```
+
+- `roles/minio-with-ssl-on-docker.rb`
+
+```ruby
+name 'minio-with-ssl-on-docker'
+description 'Minio setup with ssl_cert cookbook'
+
+minio_port = '9000'
+minio_cn = 'minio.io.example.com'
+
+run_list(
+ 'role[docker]',
+ 'recipe[minio-grid::docker-compose]',
+)
+
+#env_run_lists
+
+#default_attributes
+
+override_attributes(
+ 'minio-grid' => {
+ 'with_ssl_cert_cookbook' => true,
+ 'ssl_cert' => {
+ 'common_name' => minio_cn,
+ },
+ 'docker-compose' => {
+ 'config' => {
+ 'services' => {
+ 'minio' => {
+ 'restart' => 'always',
+ 'image' => 'minio/minio',
+ 'ports' => [
+ "#{minio_port}:9000",
+ ],
+ 'environment' => {
+ # See https://docs.minio.io/
+ #'MINIO_REGION' => 'us-east-1',
+ #'MINIO_BROWSER' => 'on',
+ #'MINIO_DOMAIN' => 'minio.example.com', # for virtual-host-style requests
+ # These variables will be set by the minio-grid::docker-compose recipe automatically.
+ #'MINIO_ACCESS_KEY' => '${MINIO_ACCESS_KEY}',
+ #'MINIO_SECRET_KEY' => '${MINIO_SECRET_KEY}',
+ },
+ #'volumes' => [
+ # These volumes will be set by the minio-grid::docker-compose recipe automatically.
+ #"#{node['minio-grid']['docker-compose']['config_dir']}:/root/.minio:rw",
+ #"#{node['minio-grid']['docker-compose']['data_dir']}:/data:rw",
+ #"#{server_cert_path(node['minio-grid']['ssl_cert']['common_name'])}:/root/.minio/certs/public.crt:ro",
+ #"#{server_key_path(node['minio-grid']['ssl_cert']['common_name'])}:/root/.minio/certs/private.key:ro",
+ #],
+ },
+ },
+ },
+ },
+ },
+)
+```
+
+### SSL server keys and certificates management by `ssl_cert` cookbook
+
+- create chef-vault items.
+
+```text
+$ ruby -rjson -e 'puts JSON.generate({"private" => File.read("minio.io.example.com.prod.key")})' \
+> > ~/sec/tmp/minio.io.example.com.prod.key.json
+
+$ ruby -rjson -e 'puts JSON.generate({"public" => File.read("minio.io.example.com.prod.crt")})' \
+> > ~/sec/tmp/minio.io.example.com.prod.crt.json
+
+$ cd $CHEF_REPO
+
+$ knife vault create ssl_server_keys minio.io.example.com.prod \
+> --json ~/sec/tmp/minio.io.example.com.prod.key.json
+
+$ knife vault create ssl_server_certs minio.io.example.com.prod \
+> --json ~/sec/tmp/minio.io.example.com.prod.crt.json
+```
+
+- grant reference permission to the Minio host
+
+```text
+$ knife vault update ssl_server_keys minio.io.example.com.prod -S 'name:minio-host.example.com'
+$ knife vault update ssl_server_certs minio.io.example.com.prod -S 'name:minio-host.example.com'
+```
+
+- modify run_list and attributes
+
+```ruby
+run_list(
+ 'recipe[minio-grid::docker-compose]',
+)
+
+override_attributes(
+ 'minio-grid' => {
+ 'with_ssl_cert_cookbook' => true,
+ 'ssl_cert' => {
+ 'common_name' => 'minio.io.example.com',
+ },
+ # ...
+ },
+)
+```
+
+### Server access key management by Chef Vault
+
+- create vault items.
+
+```text
+$ cat ~/sec/tmp/minio_access_key.json
+{
+ "keyid":"********************",
+ "secret":"****************************************"
+}
+
+$ cd $CHEF_REPO_PATH
+$ knife vault create minio access_key --json ~/sec/tmp/minio_access_key.json
+```
+
+- grant reference permission to the minio host
+
+```text
+$ knife vault update minio access_key -S 'name:minio-host.example.com'
+```
+
+- modify attributes
+
+```ruby
+override_attributes(
+ 'minio-grid' => {
+ # ...
+ 'access_key_vault_item' => {
+ 'vault' => 'minio',
+ 'name' => 'access_key',
+ 'env_context' => false,
+ 'key' => 'keyid',
+ },
+ 'secret_key_vault_item' => {
+ 'vault' => 'minio',
+ 'name' => 'access_key',
+ 'env_context' => false,
+ 'key' => 'secret',
+ },
+ # ...
+ },
+)
+```
+
+## License and Authors
+
+- Author:: whitestar at osdn.jp
+
+```text
+Copyright 2018, whitestar
+
+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.
+```
--- /dev/null
+require 'rspec/core/rake_task'
+require 'rubocop/rake_task'
+require 'foodcritic'
+require 'stove/rake_task'
+
+namespace :style do
+ desc 'Run Ruby style checks'
+ RuboCop::RakeTask.new(:ruby) do |t|
+ t.options = [
+ '--auto-gen-config', # creates .rubocop_todo.yml
+ ]
+ end
+
+ desc 'Run Chef style checks'
+ FoodCritic::Rake::LintTask.new(:chef) do |t|
+ t.options = {
+ fail_tags: ['any'],
+ }
+ end
+end
+
+desc 'Run all style checks'
+task style: ['style:chef', 'style:ruby']
+
+desc 'Run ChefSpec examples'
+RSpec::Core::RakeTask.new(:spec)
+
+desc 'Publish cookbook'
+Stove::RakeTask.new(:publish) do |t|
+ t.stove_opts = [
+ # `--username` and `--key` are set in ~/.stove typically.
+ #'--username', 'somebody',
+ #'--key', '~/chef/chef.io.example.com/somebody.pem',
+ #'--endpoint', 'https://supermarket.io.example.com/api/v1', # default: supermarket.chef.io
+ #'--no-ssl-verify',
+ '--no-git',
+ '--log-level', 'info',
+ ]
+end
+
+task default: ['style', 'spec']
--- /dev/null
+#
+# Cookbook Name:: minio-grid
+# Attributes:: default
+#
+# Copyright 2018, whitestar
+#
+# 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['minio-grid']['with_ssl_cert_cookbook'] = false
+# If ['minio-grid']['with_ssl_cert_cookbook'] is true,
+# node['minio-grid']['docker-compose']['config']
+# are overridden by the following 'common_name' attributes.
+default['minio-grid']['ssl_cert']['common_name'] = node['fqdn']
+
+default['minio-grid']['access_key_vault_item'] = {
+=begin
+ 'vault' => 'minio',
+ 'name' => 'access_key',
+ # single key id or nested hash key id path delimited by slash
+ 'env_context' => false,
+ 'key' => 'kid', # real hash path: "/kid"
+ # or nested hash key id path delimited by slash
+ #'env_context' => true,
+ #'key' => 'hash/path/to/kid', # real hash path: "/#{node.chef_environment}/hash/path/to/kid"
+=end
+}
+default['minio-grid']['secret_key_vault_item'] = {
+=begin
+ 'vault' => 'minio',
+ 'name' => 'access_key',
+ # single key secret or nested hash key secret path delimited by slash
+ 'env_context' => false,
+ 'key' => 'secret', # real hash path: "/secret"
+ # or nested hash key secret path delimited by slash
+ #'env_context' => true,
+ #'key' => 'hash/path/to/secret', # real hash path: "/#{node.chef_environment}/hash/path/to/secret"
+=end
+}
+
+default['minio-grid']['docker-compose']['app_dir'] = "#{node['docker-grid']['compose']['app_dir']}/minio"
+default['minio-grid']['docker-compose']['config_dir'] = "#{node['minio-grid']['docker-compose']['app_dir']}/config"
+default['minio-grid']['docker-compose']['data_dir'] = "#{node['minio-grid']['docker-compose']['app_dir']}/data"
+
+force_override['minio-grid']['docker-compose']['config_format_version'] = '2'
+version_2_config = {
+ # Version 2 docker-compose format
+ 'version' => '2',
+ 'services' => {
+ 'minio' => {
+ 'restart' => 'always',
+ 'image' => 'minio/minio',
+ 'command' => 'server /data',
+ 'ports' => [
+ #'9000:9000', # default
+ ],
+ 'volumes' => [
+ # These volumes will be set by the minio-grid::docker-compose recipe automatically.
+ #"#{node['minio-grid']['docker-compose']['config_dir']}:/root/.minio:rw",
+ #"#{node['minio-grid']['docker-compose']['data_dir']}:/data:rw",
+ #"#{server_cert_path(node['minio-grid']['ssl_cert']['common_name'])}:/root/.minio/certs/public.crt:ro",
+ #"#{server_key_path(node['minio-grid']['ssl_cert']['common_name'])}:/root/.minio/certs/private.key:ro",
+ ],
+ 'environment' => {
+ # See https://docs.minio.io/
+ #'MINIO_REGION' => 'us-east-1',
+ #'MINIO_BROWSER' => 'on',
+ #'MINIO_DOMAIN' => 'minio.example.com', # for virtual-host-style requests
+ # These variables will be set by the minio-grid::docker-compose recipe automatically.
+ #'MINIO_ACCESS_KEY' => '${MINIO_ACCESS_KEY}',
+ #'MINIO_SECRET_KEY' => '${MINIO_SECRET_KEY}',
+ },
+ },
+ },
+}
+
+default['minio-grid']['docker-compose']['config'] = version_2_config
--- /dev/null
+---
+# $ fly -t target sp -p minio-grid-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
+resources:
+- name: src-git
+ type: git
+ source:
+ uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
+ branch: master
+ paths:
+ - cookbooks/((cookbook-name))
+ private_key: ((git-private-key))
+ git_user: ((git-user-osdn))
+ #check_every: 1h # default: 1m
+- name: chefdk-cache
+ type: docker-image
+ source:
+ repository: chef/chefdk
+ tag: ((chefdk-version))
+ # ((param)) style: fly >= 3.2.0
+ registry_mirror: https://((registry-mirror-domain)) # e.g. https://registry.docker.example.com:5000
+ ca_certs:
+ - domain: ((registry-mirror-domain)) # e.g. registry.docker.example.com:5000
+ cert: ((docker-reg-ca-cert))
+ check_every: 12h # default: 1m
+
+jobs:
+- name: test-cookbook
+ plan:
+ - aggregate:
+ - get: src-git
+ params:
+ depth: 5
+ trigger: true
+ - get: chefdk-cache
+ - task: ci-build
+ image: chefdk-cache
+ params:
+ http_proxy: ((http-proxy)) # e.g. http://proxy.example.com:3128
+ #HTTP_PROXY: ((http-proxy))
+ config:
+ platform: linux
+ #image_resource:
+ # type: docker-image
+ # source:
+ # repository: chef/chefdk
+ # tag: ((chefdk-version))
+ # NG, setting disable
+ #registry_mirror: https://((registry-mirror-domain))
+ #ca_certs:
+ #- domain: ((registry-mirror-domain))
+ # cert: ((docker-reg-ca-cert))
+ inputs:
+ - name: src-git
+ run:
+ #dir: ./src-git/cookbooks/((cookbook-name))
+ #path: rake
+ path: /bin/bash
+ args:
+ - -c
+ - |
+ cd ./src-git/cookbooks/((cookbook-name))
+ bundle install
+ rake
+- name: publish-cookbook
+ plan:
+ - aggregate:
+ - get: src-git
+ params:
+ depth: 5
+ trigger: false
+ passed: [test-cookbook]
+ - get: chefdk-cache
+ passed: [test-cookbook]
+ - task: publish
+ image: chefdk-cache
+ params:
+ http_proxy: ((http-proxy))
+ chef_username: ((chef-username))
+ chef_client_key: ((chef-client-key))
+ config:
+ platform: linux
+ inputs:
+ - name: src-git
+ run:
+ path: /bin/bash
+ args:
+ - -c
+ - |
+ echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
+ echo "$chef_client_key" > /root/chef-client-key.pem
+ cd ./src-git/cookbooks/((cookbook-name))
+ bundle install
+ rake publish
+ - put: src-git
+ params:
+ repository: src-git
+ tag_prefix: ((cookbook-name))-
+ tag: src-git/cookbooks/((cookbook-name))/version
+ only_tag: true
+ annotate: ../src-git/cookbooks/((cookbook-name))/version
--- /dev/null
+---
+cookbook-name: minio-grid
+chefdk-version: 2.4.17
--- /dev/null
+name 'minio-grid'
+maintainer 'whitestar'
+maintainer_email ''
+license 'Apache 2.0'
+description 'Installs/Configures Minio server'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version IO.read(File.join(File.dirname(__FILE__), 'version')).chomp
+source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
+issues_url 'https://osdn.jp/projects/metasearch/ticket'
+
+chef_version '>= 12'
+%w( centos redhat ).each do |os|
+ supports os, '>= 7.0'
+end
+supports 'debian', '>= 8.0'
+supports 'ubuntu', '>= 14.04'
+
+depends 'docker-grid', '>= 0.4.0'
+depends 'platform_utils', '>= 0.4.4'
+depends 'ssl_cert', '>= 0.3.9'
--- /dev/null
+#
+# Cookbook Name:: minio-grid
+# Recipe:: default
+#
+# Copyright 2018, whitestar
+#
+# 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.
+#
--- /dev/null
+#
+# Cookbook Name:: minio-grid
+# Recipe:: docker-compose
+#
+# Copyright 2018, whitestar
+#
+# 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.
+#
+
+doc_url = 'https://hub.docker.com/r/minio/minio/'
+
+include_recipe 'platform_utils::kernel_user_namespace'
+include_recipe 'docker-grid::compose'
+
+app_dir = node['minio-grid']['docker-compose']['app_dir']
+config_dir = node['minio-grid']['docker-compose']['config_dir']
+certs_dir = "#{config_dir}/certs"
+data_dir = node['minio-grid']['docker-compose']['data_dir']
+
+[
+ app_dir,
+ config_dir,
+ certs_dir,
+ data_dir,
+].each {|dir|
+ resources(directory: dir) rescue directory dir do
+ owner 'root'
+ group 'root'
+ mode '0755'
+ recursive true
+ end
+}
+
+#override_minio_config = node.override['minio-grid']['config']
+config_srvs = node['minio-grid']['docker-compose']['config']['services']
+override_config_srvs = node.override['minio-grid']['docker-compose']['config']['services']
+force_override_config_srvs = node.force_override['minio-grid']['docker-compose']['config']['services']
+#minio_envs_org = config_srvs['minio']['environment']
+minio_envs = {}
+minio_vols = config_srvs['minio']['volumes'].to_a
+
+ports = config_srvs['minio']['ports']
+override_config_srvs['minio']['ports'] = ['9000:9000'] if ports.empty?
+
+minio_vols.push("#{config_dir}:/root/.minio:rw")
+minio_vols.push("#{data_dir}:/data:rw")
+
+access_key = nil
+access_key_vault_item = node['minio-grid']['access_key_vault_item']
+unless access_key_vault_item.empty?
+ access_key = get_vault_item_value(access_key_vault_item)
+ minio_envs['MINIO_ACCESS_KEY'] = '${MINIO_ACCESS_KEY}'
+end
+
+secret_key = nil
+secret_key_vault_item = node['minio-grid']['secret_key_vault_item']
+unless secret_key_vault_item.empty?
+ secret_key = get_vault_item_value(secret_key_vault_item)
+ minio_envs['MINIO_SECRET_KEY'] = '${MINIO_SECRET_KEY}'
+end
+
+if node['minio-grid']['with_ssl_cert_cookbook']
+ ::Chef::Recipe.send(:include, SSLCert::Helper)
+ cn = node['minio-grid']['ssl_cert']['common_name']
+ append_server_ssl_cn(cn)
+ include_recipe 'ssl_cert::server_key_pairs'
+
+ minio_vols.push("#{server_cert_path(cn)}:/root/.minio/certs/public.crt:ro")
+ minio_vols.push("#{server_key_path(cn)}:/root/.minio/certs/private.key:ro")
+end
+
+# merge environment hash
+force_override_config_srvs['minio']['environment'] = minio_envs unless minio_envs.empty?
+# reset vlumes array.
+override_config_srvs['minio']['volumes'] = minio_vols unless minio_vols.empty?
+
+config_file = "#{app_dir}/docker-compose.yml"
+template config_file do
+ source 'opt/docker-compose/app/minio/docker-compose.yml'
+ owner 'root'
+ group 'root'
+ mode '0644'
+end
+
+env_file = "#{app_dir}/.env"
+template env_file do
+ source 'opt/docker-compose/app/minio/.env'
+ owner 'root'
+ group 'root'
+ mode '0600'
+ sensitive true
+ # prevent Chef from logging password attribute value.
+ variables(
+ # secrets
+ access_key: access_key,
+ secret_key: secret_key
+ )
+end
+
+log 'minio docker-compose post install message' do
+ message <<-"EOM"
+Note: You must execute the following command manually.
+ See #{doc_url}
+ * Start:
+ $ cd #{app_dir}
+ $ docker-compose up -d
+ * Stop
+ $ docker-compose down
+EOM
+end
--- /dev/null
+require_relative '../spec_helper'
+
+describe 'minio-grid::default' do
+ let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
+
+ #it 'does something' do
+ # expect(chef_run).to do_something('...')
+ #end
+end
--- /dev/null
+# Added by ChefSpec
+require 'chefspec'
+
+# Uncomment to use ChefSpec's Berkshelf extension
+# require 'chefspec/berkshelf'
+
+RSpec.configure do |config|
+ # Specify the path for Chef Solo to find cookbooks
+ # config.cookbook_path = '/var/cookbooks'
+
+ # Specify the path for Chef Solo to find roles
+ # config.role_path = '/var/roles'
+
+ # Specify the Chef log_level (default: :warn)
+ # config.log_level = :debug
+
+ # Specify the path to a local JSON file with Ohai data
+ # config.path = 'ohai.json'
+
+ # Specify the operating platform to mock Ohai data from
+ # config.platform = 'ubuntu'
+
+ # Specify the operating version to mock Ohai data from
+ # config.version = '12.04'
+end
--- /dev/null
+<%
+# Note in this file:
+# - Do not use quotation marks (' or ").
+# - Do not use variable reference.
+-%>
+<% unless @access_key.nil? %>
+MINIO_ACCESS_KEY=<%= @access_key %>
+<% end %>
+<% unless @secret_key.nil? %>
+MINIO_SECRET_KEY=<%= @secret_key %>
+<% end %>
--- /dev/null
+<%
+require 'yaml'
+yaml_str = node['minio-grid']['docker-compose']['config'].to_hash.to_yaml
+-%>
+<%= yaml_str %>