fitter-happier 0.0.1

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 is a Rails plug-in that provides actions for monitoring site and/or 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
+
21
+ % cd vendor/plugins
22
+ % git clone git://github.com/atmos/fitter_happier.git
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,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fitter-happier
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jon Moses
9
+ - Corey Donohoe
10
+ - Zachary Spencer
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2011-09-16 00:00:00.000000000Z
15
+ dependencies: []
16
+ description: FitterHappier is a Rails plug-in that provides actions for monitoring
17
+ site and/or database availability.
18
+ email:
19
+ - zspencer@zacharyspencer.com
20
+ executables: []
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - lib/fitter_happier.rb
25
+ - app/controllers/fitter_happier_controller.rb
26
+ - config/routes.rb
27
+ - rails/init.rb
28
+ - CHANGELOG
29
+ - MIT-LICENSE
30
+ - README.mdown
31
+ homepage: https://github.com/jmoses/fitter-happier
32
+ licenses: []
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 1.8.6
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: FitterHappier is a Rails plug-in that provides actions for monitoring site
55
+ and/or database availability.
56
+ test_files: []