poise-monit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.kitchen.yml +8 -0
  4. data/.travis.yml +20 -0
  5. data/.yardopts +7 -0
  6. data/Berksfile +29 -0
  7. data/CHANGELOG.md +5 -0
  8. data/Gemfile +35 -0
  9. data/LICENSE +201 -0
  10. data/README.md +242 -0
  11. data/Rakefile +17 -0
  12. data/chef/attributes/default.rb +37 -0
  13. data/chef/recipes/default.rb +22 -0
  14. data/chef/templates/monit.conf.erb +27 -0
  15. data/chef/templates/monit_service.conf.erb +6 -0
  16. data/lib/poise_monit.rb +24 -0
  17. data/lib/poise_monit/cheftie.rb +19 -0
  18. data/lib/poise_monit/error.rb +21 -0
  19. data/lib/poise_monit/monit_providers.rb +36 -0
  20. data/lib/poise_monit/monit_providers/base.rb +173 -0
  21. data/lib/poise_monit/monit_providers/binaries.rb +108 -0
  22. data/lib/poise_monit/monit_providers/dummy.rb +57 -0
  23. data/lib/poise_monit/monit_providers/system.rb +86 -0
  24. data/lib/poise_monit/resources.rb +28 -0
  25. data/lib/poise_monit/resources/monit.rb +238 -0
  26. data/lib/poise_monit/resources/monit_config.rb +111 -0
  27. data/lib/poise_monit/resources/monit_service.rb +194 -0
  28. data/lib/poise_monit/resources/monit_test.rb +127 -0
  29. data/lib/poise_monit/service_providers.rb +26 -0
  30. data/lib/poise_monit/service_providers/monit.rb +124 -0
  31. data/lib/poise_monit/version.rb +20 -0
  32. data/poise-monit.gemspec +46 -0
  33. data/test/cookbooks/poise-monit_test/attributes/default.rb +17 -0
  34. data/test/cookbooks/poise-monit_test/metadata.rb +19 -0
  35. data/test/cookbooks/poise-monit_test/recipes/default.rb +31 -0
  36. data/test/docker/docker.ca +29 -0
  37. data/test/docker/docker.pem +83 -0
  38. data/test/gemfiles/chef-12.gemfile +19 -0
  39. data/test/gemfiles/master.gemfile +24 -0
  40. data/test/integration/default/serverspec/Gemfile +19 -0
  41. data/test/integration/default/serverspec/default_spec.rb +67 -0
  42. data/test/spec/monit_providers/binaries_spec.rb +95 -0
  43. data/test/spec/monit_providers/dummy_spec.rb +52 -0
  44. data/test/spec/monit_providers/system_spec.rb +74 -0
  45. data/test/spec/recipe_spec.rb +40 -0
  46. data/test/spec/resources/monit_config_spec.rb +43 -0
  47. data/test/spec/resources/monit_service_spec.rb +297 -0
  48. data/test/spec/resources/monit_spec.rb +101 -0
  49. data/test/spec/service_providers/monit_spec.rb +58 -0
  50. data/test/spec/spec_helper.rb +19 -0
  51. metadata +182 -0
@@ -0,0 +1,20 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+
18
+ module PoiseMonit
19
+ VERSION = '1.0.0'
20
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ lib = File.expand_path('../lib', __FILE__)
18
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19
+ require 'poise_monit/version'
20
+
21
+ Gem::Specification.new do |spec|
22
+ spec.name = 'poise-monit'
23
+ spec.version = PoiseMonit::VERSION
24
+ spec.authors = ['Noah Kantrowitz']
25
+ spec.email = %w{noah@coderanger.net}
26
+ spec.description = 'A Chef cookbook for managing the Monit process manager.'
27
+ spec.summary = spec.description
28
+ spec.homepage = 'https://github.com/poise/poise-monit'
29
+ spec.license = 'Apache 2.0'
30
+
31
+ spec.files = `git ls-files`.split($/)
32
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
33
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
34
+ spec.require_paths = %w{lib}
35
+
36
+ spec.add_dependency 'halite', '~> 1.1'
37
+ spec.add_dependency 'poise', '~> 2.5'
38
+ spec.add_dependency 'poise-languages', '~> 1.3'
39
+ spec.add_dependency 'poise-service', '~> 1.1'
40
+
41
+ spec.add_development_dependency 'poise-boiler', '~> 1.0'
42
+
43
+ # Leaving this hear but commented so it is clear this dependency has been
44
+ # removed on purpose. It's going to be a rare thing, so don't pull it in.
45
+ # spec.metadata['halite_dependencies'] = 'yum-epel'
46
+ end
@@ -0,0 +1,17 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ override['poise-service']['provider'] = 'dummy'
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ name 'poise-monit_test'
18
+ depends 'poise-monit'
19
+ depends 'yum-epel'
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'poise_monit/resources/monit_test'
18
+
19
+ monit_test 'monit' do
20
+ base_port 5000
21
+ end
22
+
23
+ monit_test 'system' do
24
+ base_port 6000
25
+ monit_provider :system
26
+ end
27
+
28
+ monit_test 'binaries' do
29
+ base_port 7000
30
+ monit_provider :binaries
31
+ end
@@ -0,0 +1,29 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFCzCCAvOgAwIBAgIJAJTJgn9tSdKmMA0GCSqGSIb3DQEBBQUAMA0xCzAJBgNV
3
+ BAMTAkNBMB4XDTE1MDExMjIwMjk0M1oXDTI1MDEwOTIwMjk0M1owDTELMAkGA1UE
4
+ AxMCQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDDPFn79sz1kQLk
5
+ rAS5z/zfCMXuE+V9IEmGXJeSprsXrv+AdjFpVDr52lpvZ36i2gixk8grcWtFqQMC
6
+ jB1c2HUe69ebC89rHSPmGCx5eRcWQPQG29fdH/nC+I34EbYadJB7Pdzk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Vdo3z/52XGlNo/wml80w3/NQ3HVKg
76
+ 8fHaqXCNUm2uSs15hh6aEdM3Sur+heZhZdmhnTt5hEa+xR4bzkz9nSxjUfppSEhj
77
+ Vwtr9Q2VVkD8ynC27pAd9p75lfvCsdvGRqRa50Xgl4UaPj7OfSBr+0lT7f2DlZ5h
78
+ YbrqGN8dAAOj6kXLqLjClPqy6dyUOp2htKllr3+ktzpk6xFgyKOJmMNeKhqAOsBd
79
+ kSvhgDRtmIG9qHBuCmalcsm4xXgSzhRQVceJ7Gly8v10mZwzBd2sDLsKLdMj4q4Y
80
+ Gn1aJ1M2c+HoBnZMOeA3iHtmcYv7VTt9EWkKyF9dXPX77j09vVrWuTSQIys0pPd2
81
+ uk+4YTSCej14wu+xgogClTxOW9jTN4qLdRuQnIrizTEyuqTWgxcnetowRrB/Nk1O
82
+ VXMAm0EaPTSJ8zVSNIzQAWHe01Q6VHFASINAlFUppkOmqJ8HXe1rzTg4BxPiIbR4
83
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
18
+
19
+ gem 'chef', '~> 12.0'
@@ -0,0 +1,24 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
18
+
19
+ gem 'chef', github: 'chef/chef'
20
+ gem 'halite', github: 'poise/halite'
21
+ gem 'poise', github: 'poise/poise'
22
+ gem 'poise-boiler', github: 'poise/poise-boiler'
23
+ gem 'poise-languages', github: 'poise/poise-languages'
24
+ gem 'poise-service', github: 'poise/poise-service'
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ source 'https://rubygems.org/'
18
+
19
+ gem 'poise-service-spechelper'
@@ -0,0 +1,67 @@
1
+ # #
2
+ # # Copyright 2015, Noah Kantrowitz
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # # you may not use this file except in compliance with the License.
6
+ # # You may obtain a copy of the License at
7
+ # #
8
+ # # http://www.apache.org/licenses/LICENSE-2.0
9
+ # #
10
+ # # Unless required by applicable law or agreed to in writing, software
11
+ # # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # # See the License for the specific language governing permissions and
14
+ # # limitations under the License.
15
+ # #
16
+
17
+ require 'serverspec'
18
+ set :backend, :exec
19
+
20
+ require 'poise_service/spec_helper'
21
+
22
+ # Set up the shared example for monit_test.
23
+ RSpec.shared_examples 'a monit_test' do |monit_name, base_port|
24
+ let(:monit_name) { monit_name }
25
+ let(:monit_path) { File.join('', 'root', "monit_test_#{monit_name}") }
26
+ # Helper for all the file checks.
27
+ def self.assert_file(rel_path, should_exist=true, &block)
28
+ describe rel_path do
29
+ subject { file(File.join(monit_path, rel_path)) }
30
+ # Do nothing for nil.
31
+ if should_exist == true
32
+ it { is_expected.to be_a_file }
33
+ elsif should_exist == false
34
+ it { is_expected.to_not exist }
35
+ end
36
+ instance_eval(&block) if block
37
+ end
38
+ end
39
+
40
+ # Tests for direct monit commands.
41
+ assert_file('version')
42
+ assert_file('status') do
43
+ its(:content) { is_expected.to include 'file_test' }
44
+ its(:content) { is_expected.to include 'process_test' }
45
+ end
46
+
47
+ # Tests for monit_config and monit_service.
48
+ assert_file('check')
49
+ assert_file('pid')
50
+
51
+ it_should_behave_like 'a poise_service_test', 'monit_'+monit_name, base_port, false
52
+ end
53
+
54
+ describe 'default' do
55
+ it_should_behave_like 'a monit_test', 'monit', 5000
56
+ end
57
+
58
+ # Wait at least the default daemon interval.
59
+ Kernel.sleep 120
60
+
61
+ describe 'system provider', unless: File.exist?('/no_system') do
62
+ it_should_behave_like 'a monit_test', 'system', 6000
63
+ end
64
+
65
+ describe 'binaries provider', unless: File.exist?('/no_binaries') do
66
+ it_should_behave_like 'a monit_test', 'binaries', 7000
67
+ end
@@ -0,0 +1,95 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe PoiseMonit::MonitProviders::Binaries do
20
+ let(:monit_version) { nil }
21
+ let(:chefspec_options) { {platform: 'ubuntu', version: '14.04'} }
22
+ let(:default_attributes) { {poise_monit_version: monit_version} }
23
+ let(:monit_resource) { chef_run.monit('monit') }
24
+ step_into(:monit)
25
+ recipe do
26
+ monit 'monit' do
27
+ httpd_port false
28
+ provider :binaries
29
+ version node['poise_monit_version']
30
+ end
31
+ end
32
+
33
+ shared_examples_for 'binaries provider' do |base, url|
34
+ it { expect(monit_resource.provider_for_action(:enable)).to be_a described_class }
35
+ it { is_expected.to install_poise_languages_static(File.join('', 'opt', base)).with(source: url) }
36
+ it { expect(monit_resource.monit_binary).to eq File.join('', 'opt', base, 'bin', 'monit') }
37
+ end
38
+
39
+ context 'with no version' do
40
+ it_behaves_like 'binaries provider', 'monit-5.15', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.15-linux-x64.tar.gz'
41
+ end # /context with no version
42
+
43
+ context 'with version 5.14' do
44
+ let(:monit_version) { '5.14' }
45
+ it_behaves_like 'binaries provider', 'monit-5.14', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.14-linux-x64.tar.gz'
46
+ end # /context with version 5.14
47
+
48
+ context 'with version 5.9 and no forced provider' do
49
+ recipe do
50
+ monit 'monit' do
51
+ httpd_port false
52
+ version '5.9'
53
+ end
54
+ end
55
+
56
+ it_behaves_like 'binaries provider', 'monit-5.9', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.9-linux-x64.tar.gz'
57
+ end # /context with version 5.9 and no forced provider
58
+
59
+ context 'on CentOS 7' do
60
+ let(:chefspec_options) { {platform: 'centos', version: '7.0'} }
61
+ it_behaves_like 'binaries provider', 'monit-5.15', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.15-linux-x64.tar.gz'
62
+ end # /context on CentOS 7
63
+
64
+ context 'on Fedora 18 (x86)' do
65
+ let(:chefspec_options) { {platform: 'fedora', version: '18'} }
66
+ it_behaves_like 'binaries provider', 'monit-5.15', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.15-linux-x86.tar.gz'
67
+ end # /context on Fedora 18 (x86)
68
+
69
+ context 'on AIX 6' do
70
+ let(:chefspec_options) { {platform: 'aix', version: '6.1'} }
71
+ it_behaves_like 'binaries provider', 'monit-5.15', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.15-aix6.1-ppc.tar.gz'
72
+ end # /context on AIX 6
73
+
74
+ context 'on Solaris 5.11' do
75
+ let(:chefspec_options) { {platform: 'solaris2', version: '5.11'} }
76
+ it_behaves_like 'binaries provider', 'monit-5.15', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.15-solaris-x64.tar.gz'
77
+ end # /context on Solaris 5.11
78
+
79
+ context 'on OS X 10.11.1' do
80
+ let(:chefspec_options) { {platform: 'mac_os_x', version: '10.11.1'} }
81
+ it_behaves_like 'binaries provider', 'monit-5.15', 'https://bitbucket.org/tildeslash/monit/downloads/monit-5.15-macosx-universal.tar.gz'
82
+ end # /context on OS X 10.11.1
83
+
84
+ context 'action :disable' do
85
+ recipe do
86
+ monit 'monit' do
87
+ action :disable
88
+ httpd_port false
89
+ provider :binaries
90
+ end
91
+ end
92
+
93
+ it { is_expected.to uninstall_poise_languages_static('/opt/monit-5.15') }
94
+ end # /context action :disable
95
+ end