rails3_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 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 |map|
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,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :fitter_happier do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1 @@
1
+ require 'fitter_happier'
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails3_fitter_happier
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.2
6
+ platform: ruby
7
+ authors:
8
+ - Jon Moses
9
+ - Corey Donohoe
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2011-03-05 00:00:00 -05:00
15
+ default_executable:
16
+ dependencies: []
17
+
18
+ description: FitterHappier is a Rails plug-in that provides actions for monitoring site and/or database availability.
19
+ email:
20
+ - jon@burningbush.us
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files: []
26
+
27
+ files:
28
+ - lib/fitter_happier.rb
29
+ - lib/tasks/fitter_happier_tasks.rake
30
+ - app/controllers/fitter_happier_controller.rb
31
+ - config/routes.rb
32
+ - rails/init.rb
33
+ - CHANGELOG
34
+ - MIT-LICENSE
35
+ - README.mdown
36
+ has_rdoc: true
37
+ homepage: https://github.com/jmoses/fitter_happier
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.5.2
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: FitterHappier is a Rails plug-in that provides actions for monitoring site and/or database availability.
64
+ test_files: []
65
+