nulogy-fitter-happier 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ CHANGELOG
2
+ =========
3
+
4
+ Version 1.1
5
+ ===========
6
+ * Added 2 additional URIs
7
+ * /fitter_happier/site_check => Timestamped site check
8
+ * /fitter_happier/site_and_database_check => Timestamped site and database check
9
+ * Updated the response message for /fitter_happier
10
+
11
+ Version 1.0
12
+ ===========
13
+ * atmos release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,79 @@
1
+ FitterHappier
2
+ =============
3
+
4
+ FitterHappier provides actions for monitoring a rails site and database availability. FitterHappier's monitoring controller disables unnecessary Rails features, like sessions, layouts, and logging, for lightning-fast monitoring URIs.
5
+
6
+ FitterHappier provides three monitoring URIs
7
+
8
+ % curl localhost:3000/fitter_happier
9
+ FitterHappier Site Check Passed
10
+
11
+ % curl localhost:3000/fitter_happier/site_check
12
+ FitterHappier Site Check Passed @ Wed, 17 Dec 2008 14:27:47 -0800
13
+
14
+ % curl localhost:3000/fitter_happier/site_and_database_check
15
+ FitterHappier Site and Database Check Passed @ Wed, 17 Dec 2008 14:27:57 -0800
16
+ Schema Version: 20081217141904
17
+
18
+ Installation
19
+ ============
20
+ Add the following to your gemfile
21
+
22
+ gem 'fitter-happier'
23
+
24
+ Uptime Monitoring
25
+ =================
26
+
27
+ See EngineYard's support guide on [uptime monitoring for your rails application](http://www.engineyard.com/support/guides/uptime_monitoring_for_your_rails_application)
28
+
29
+ Monit
30
+ =====
31
+
32
+ You can do simple checks with monit like this:
33
+
34
+ if failed host 127.0.0.1 port 5000
35
+ protocol HTTP request /fitter_happier with checksum 15b8a1ee66d740fbfc00297684bb5430 then restart
36
+
37
+ Keepalived/LVS
38
+ ==============
39
+
40
+ You can also do this in a keepalived/LVS setup:
41
+
42
+ virtual_server 169.254.y.z 80 {
43
+ delay_loop 15
44
+ lb_algo lc
45
+ lb_kind NAT
46
+ nat_mask 255.255.255.0
47
+ persistence_timeout 0
48
+ protocol TCP
49
+ sorry_server 127.0.0.1 80
50
+ virtualhost www.myfacetube.com
51
+ real_server 10.0.1.34 80 {
52
+ weight 1
53
+ HTTP_GET {
54
+ url {
55
+ path /fitter_happier
56
+ status_code 200
57
+ }
58
+ connect_port 80
59
+ connect_timeout 5
60
+ nb_get_retry 20
61
+ delay_before_retry 2
62
+ }
63
+ }
64
+ real_server 10.0.1.35 80 {
65
+ weight 1
66
+ HTTP_GET {
67
+ url {
68
+ path /fitter_happier
69
+ status_code 200
70
+ }
71
+ connect_port 80
72
+ connect_timeout 5
73
+ nb_get_retry 20
74
+ delay_before_retry 2
75
+ }
76
+ }
77
+ }
78
+
79
+ Copyright (c) 2008 atmos, released under the MIT license
@@ -0,0 +1,30 @@
1
+ class FitterHappierController < ActionController::Base
2
+ layout nil
3
+
4
+ def index
5
+ render(:text => "FitterHappier Site Check Passed\n")
6
+ end
7
+
8
+ def site_check
9
+ time = Time.now.to_formatted_s(:rfc822)
10
+ render(:text => "FitterHappier Site Check Passed @ #{time}\n")
11
+ end
12
+
13
+ def site_and_database_check
14
+ table_name = (Rails::VERSION::STRING >= '2.1.0' ? 'schema_migrations' : 'schema_info')
15
+ query = "SELECT max(lpad(version, 20, '0')) FROM #{table_name}"
16
+ version = ActiveRecord::Base.connection.select_value(query).to_i
17
+ time = Time.now.to_formatted_s(:rfc822)
18
+ render(:text => "FitterHappier Site and Database Check Passed @ #{time}\nSchema Version: #{version}\n")
19
+ end
20
+
21
+ private
22
+
23
+ def process_with_silence(*args)
24
+ logger.silence do
25
+ process_without_silence(*args)
26
+ end
27
+ end
28
+
29
+ alias_method_chain :process, :silence
30
+ end
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ match '/fitter_happier' => 'fitter_happier#index'
3
+ match '/fitter_happier/site_check' => 'fitter_happier#site_check'
4
+ match '/fitter_happier/site_and_database_check' => 'fitter_happier#site_and_database_check'
5
+ end
@@ -0,0 +1,5 @@
1
+ module FitterHappier
2
+ class Engine < Rails::Engine
3
+ engine_name :fitter_happier
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'fitter_happier'
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nulogy-fitter-happier
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Jon Moses
14
+ - Corey Donohoe
15
+ - Zachary Spencer
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-11-07 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies: []
23
+
24
+ description: send bug reports to http://github.com/nulogy/fitter-happier/
25
+ email:
26
+ - zspencer@zacharyspencer.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - lib/fitter-happier.rb
35
+ - app/controllers/fitter_happier_controller.rb
36
+ - config/routes.rb
37
+ - rails/init.rb
38
+ - CHANGELOG
39
+ - MIT-LICENSE
40
+ - README.mdown
41
+ has_rdoc: true
42
+ homepage: https://github.com/nulogy/fitter-happier
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.3.7
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: FitterHappier is a plug-in that provides actions for monitoring site and/or database availability for rails apps.
75
+ test_files: []
76
+