health_check 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +17 -17
- data/Gemfile +9 -2
- data/Gemfile.lock +74 -4
- data/README.rdoc +42 -1
- data/VERSION +1 -1
- data/health_check.gemspec +17 -17
- data/lib/health_check/health_check_controller.rb +3 -1
- data/lib/health_check/utils.rb +4 -0
- data/{gemfiles/rails1_2.gemfile → rails1_2.gemfile} +2 -3
- data/{gemfiles/rails2_3.gemfile → rails2_3.gemfile} +7 -8
- data/{gemfiles/rails3_0.gemfile → rails3_0.gemfile} +7 -8
- data/{gemfiles/rails3_1.gemfile → rails3_1.gemfile} +7 -8
- data/{gemfiles/rails3_2.gemfile → rails3_2.gemfile} +7 -8
- data/{gemfiles/rails_edge.gemfile → rails_edge.gemfile} +7 -9
- data/test/test_with_railsapp +38 -7
- data/test/testurl +3 -3
- metadata +45 -43
data/.travis.yml
CHANGED
@@ -21,11 +21,11 @@ before_install:
|
|
21
21
|
- mkdir -p tmp/bundle
|
22
22
|
|
23
23
|
gemfile:
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
#-
|
24
|
+
- rails2_3.gemfile
|
25
|
+
- rails3_0.gemfile
|
26
|
+
- rails3_1.gemfile
|
27
|
+
- rails3_2.gemfile
|
28
|
+
#- rails_edge.gemfile
|
29
29
|
|
30
30
|
bundler_args: "--binstubs"
|
31
31
|
|
@@ -34,29 +34,29 @@ script: ./test/test_with_railsapp
|
|
34
34
|
matrix:
|
35
35
|
exclude:
|
36
36
|
- rvm: rbx-18mode
|
37
|
-
gemfile:
|
37
|
+
gemfile: rails2_3.gemfile
|
38
38
|
- rvm: rbx-19mode
|
39
|
-
gemfile:
|
39
|
+
gemfile: rails2_3.gemfile
|
40
40
|
- rvm: jruby-18mode
|
41
|
-
gemfile:
|
41
|
+
gemfile: rails2_3.gemfile
|
42
42
|
- rvm: jruby-19mode
|
43
|
-
gemfile:
|
43
|
+
gemfile: rails2_3.gemfile
|
44
44
|
- rvm: jruby-head
|
45
|
-
gemfile:
|
45
|
+
gemfile: rails2_3.gemfile
|
46
46
|
- rvm: ruby-head
|
47
|
-
gemfile:
|
47
|
+
gemfile: rails2_3.gemfile
|
48
48
|
- rvm: 1.9.3
|
49
|
-
gemfile:
|
49
|
+
gemfile: rails2_3.gemfile
|
50
50
|
|
51
51
|
- rvm: 1.8.7
|
52
|
-
gemfile:
|
52
|
+
gemfile: rails_edge.gemfile
|
53
53
|
- rvm: rbx-18mode
|
54
|
-
gemfile:
|
54
|
+
gemfile: rails_edge.gemfile
|
55
55
|
- rvm: jruby-18mode
|
56
|
-
gemfile:
|
56
|
+
gemfile: rails_edge.gemfile
|
57
57
|
- rvm: ree
|
58
|
-
gemfile:
|
58
|
+
gemfile: rails_edge.gemfile
|
59
59
|
allow_failures:
|
60
|
-
- gemfile:
|
60
|
+
- gemfile: rails_edge.gemfile
|
61
61
|
- rvm: jruby-head
|
62
62
|
- rvm: ruby-head
|
data/Gemfile
CHANGED
@@ -2,12 +2,18 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
+
gem 'rails', ">= 2.3.0"
|
6
|
+
|
5
7
|
group :development, :test do
|
6
8
|
gem 'rake', '>= 0.8.3'
|
7
9
|
gem 'jeweler', '~> 1.8.4'
|
8
10
|
gem 'shoulda', "~> 2.11.0"
|
9
|
-
|
10
|
-
|
11
|
+
if defined?(JRUBY_VERSION)
|
12
|
+
gem 'jruby-openssl'
|
13
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
14
|
+
else
|
15
|
+
gem 'sqlite3', "~> 1.3.7"
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
19
|
group :misc do
|
@@ -16,3 +22,4 @@ group :misc do
|
|
16
22
|
# required to run rake test:plugins
|
17
23
|
gem 'ruby-prof', '>= 0.6.1'
|
18
24
|
end
|
25
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,102 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
actionmailer (3.2.12)
|
5
|
+
actionpack (= 3.2.12)
|
6
|
+
mail (~> 2.4.4)
|
7
|
+
actionpack (3.2.12)
|
8
|
+
activemodel (= 3.2.12)
|
9
|
+
activesupport (= 3.2.12)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.5)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.2.1)
|
17
|
+
activemodel (3.2.12)
|
18
|
+
activesupport (= 3.2.12)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.12)
|
21
|
+
activemodel (= 3.2.12)
|
22
|
+
activesupport (= 3.2.12)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.12)
|
26
|
+
activemodel (= 3.2.12)
|
27
|
+
activesupport (= 3.2.12)
|
28
|
+
activesupport (3.2.12)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
arel (3.0.2)
|
32
|
+
builder (3.0.4)
|
33
|
+
erubis (2.7.0)
|
7
34
|
git (1.2.5)
|
8
35
|
hashr (0.0.22)
|
36
|
+
hike (1.2.1)
|
37
|
+
i18n (0.6.1)
|
9
38
|
jeweler (1.8.4)
|
10
39
|
bundler (~> 1.0)
|
11
40
|
git (>= 1.2.5)
|
12
41
|
rake
|
13
42
|
rdoc
|
43
|
+
journey (1.0.4)
|
14
44
|
json (1.7.6)
|
45
|
+
mail (2.4.4)
|
46
|
+
i18n (>= 0.4.0)
|
47
|
+
mime-types (~> 1.16)
|
48
|
+
treetop (~> 1.4.8)
|
49
|
+
mime-types (1.21)
|
50
|
+
multi_json (1.6.1)
|
51
|
+
polyglot (0.3.3)
|
52
|
+
rack (1.4.5)
|
53
|
+
rack-cache (1.2)
|
54
|
+
rack (>= 0.4)
|
55
|
+
rack-ssl (1.3.3)
|
56
|
+
rack
|
57
|
+
rack-test (0.6.2)
|
58
|
+
rack (>= 1.0)
|
59
|
+
rails (3.2.12)
|
60
|
+
actionmailer (= 3.2.12)
|
61
|
+
actionpack (= 3.2.12)
|
62
|
+
activerecord (= 3.2.12)
|
63
|
+
activeresource (= 3.2.12)
|
64
|
+
activesupport (= 3.2.12)
|
65
|
+
bundler (~> 1.0)
|
66
|
+
railties (= 3.2.12)
|
67
|
+
railties (3.2.12)
|
68
|
+
actionpack (= 3.2.12)
|
69
|
+
activesupport (= 3.2.12)
|
70
|
+
rack-ssl (~> 1.3.2)
|
71
|
+
rake (>= 0.8.7)
|
72
|
+
rdoc (~> 3.4)
|
73
|
+
thor (>= 0.14.6, < 2.0)
|
15
74
|
rake (10.0.3)
|
16
75
|
rdoc (3.12)
|
17
76
|
json (~> 1.4)
|
18
77
|
ruby-prof (0.12.1)
|
19
78
|
shoulda (2.11.3)
|
79
|
+
sprockets (2.2.2)
|
80
|
+
hike (~> 1.2)
|
81
|
+
multi_json (~> 1.0)
|
82
|
+
rack (~> 1.0)
|
83
|
+
tilt (~> 1.1, != 1.3.0)
|
20
84
|
sqlite3 (1.3.7)
|
85
|
+
thor (0.17.0)
|
86
|
+
tilt (1.3.3)
|
21
87
|
travis-lint (1.5.0)
|
22
88
|
hashr (~> 0.0.22)
|
89
|
+
treetop (1.4.12)
|
90
|
+
polyglot
|
91
|
+
polyglot (>= 0.3.1)
|
92
|
+
tzinfo (0.3.35)
|
23
93
|
|
24
94
|
PLATFORMS
|
25
95
|
ruby
|
26
96
|
|
27
97
|
DEPENDENCIES
|
28
|
-
activerecord (>= 2.3.0)
|
29
98
|
jeweler (~> 1.8.4)
|
99
|
+
rails (>= 2.3.0)
|
30
100
|
rake (>= 0.8.3)
|
31
101
|
ruby-prof (>= 0.6.1)
|
32
102
|
shoulda (~> 2.11.0)
|
data/README.rdoc
CHANGED
@@ -53,6 +53,45 @@ Run the following commands from the root of your rails application
|
|
53
53
|
% cd vendor/plugins
|
54
54
|
% git clone git://github.com/ianheggie/health_check.git
|
55
55
|
|
56
|
+
=== Standalone for testing the gem
|
57
|
+
|
58
|
+
Using rbenv or rvm, install and set the version of ruby you wish to test against.
|
59
|
+
You will need to install the bundler gem if using rbenv.
|
60
|
+
See the .travis.yml file for a list of supported ruby versions.
|
61
|
+
|
62
|
+
rbenv shell 1.8.7-p371
|
63
|
+
# or
|
64
|
+
rvm use 1.9.3
|
65
|
+
|
66
|
+
Create a temp directory for throw away testing, and clone the health_check gem into it
|
67
|
+
|
68
|
+
mkdir -p ~/tmp
|
69
|
+
cd ~/tmp
|
70
|
+
git clone https://github.com/ianheggie/health_check.git
|
71
|
+
|
72
|
+
Configure which rails version you want to test against, and load the gems appropriate for the ruby version
|
73
|
+
|
74
|
+
cd ~/tmp/health_check
|
75
|
+
|
76
|
+
export BUNDLE_GEMFILE=rails2_3.gemfile
|
77
|
+
# or
|
78
|
+
export BUNDLE_GEMFILE=rails3_0.gemfile
|
79
|
+
# or
|
80
|
+
export BUNDLE_GEMFILE=rails3_1.gemfile
|
81
|
+
# or
|
82
|
+
export BUNDLE_GEMFILE=rails3_2.gemfile
|
83
|
+
|
84
|
+
# Install required gems
|
85
|
+
bundle install --binstubs
|
86
|
+
rbenv rehash # if using rbenv
|
87
|
+
|
88
|
+
Run the tests
|
89
|
+
|
90
|
+
cd ~/tmp/health_check
|
91
|
+
|
92
|
+
# Run tests
|
93
|
+
bin/rake test
|
94
|
+
|
56
95
|
== Uptime Monitoring
|
57
96
|
|
58
97
|
Use a website monitoring service to check the url regularly for the word "success" rather than just a 200 return code.
|
@@ -71,7 +110,8 @@ See
|
|
71
110
|
* database - checks that the current migration level can be read from the database
|
72
111
|
* email - basic check of email - :test returns true, :sendmail checks file is present and executable, :smtp sends HELO command to server and checks response
|
73
112
|
* migration - checks that the database migration level matches that in db/migrations
|
74
|
-
*
|
113
|
+
* cache - checks that a value can be written to the cache
|
114
|
+
* site - checks rails is running sufficiently to render text
|
75
115
|
|
76
116
|
== Note on Patches/Pull Requests
|
77
117
|
|
@@ -106,3 +146,4 @@ See Travis CI testing result: {<img src="https://travis-ci.org/ianheggie/health_
|
|
106
146
|
* 0.x - Rails 2.3
|
107
147
|
* 1.x - Includes Rails 3.x suppprt as an Engine
|
108
148
|
* 1.0.2 - Included travis config and gemfiles used in travis tests in gem and changes to test setup so that gem test
|
149
|
+
* 1.1.0 - Include cache check (Thanks to https://github.com/mgomes1 ) and some changes to test setup to workaround and diagnose test failures under rvm
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/health_check.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.0
|
7
|
+
s.name = %q{health_check}
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ian Heggie"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = %q{2013-02-19}
|
13
|
+
s.description = %q{Simple health check of Rails app for use with Pingdom, NewRelic, EngineYard or uptime.openacs.org etc.}
|
14
|
+
s.email = %q{ian@heggie.biz}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
@@ -25,18 +25,18 @@ Gem::Specification.new do |s|
|
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"config/routes.rb",
|
28
|
-
"gemfiles/rails1_2.gemfile",
|
29
|
-
"gemfiles/rails2_3.gemfile",
|
30
|
-
"gemfiles/rails3_0.gemfile",
|
31
|
-
"gemfiles/rails3_1.gemfile",
|
32
|
-
"gemfiles/rails3_2.gemfile",
|
33
|
-
"gemfiles/rails_edge.gemfile",
|
34
28
|
"health_check.gemspec",
|
35
29
|
"init.rb",
|
36
30
|
"lib/health_check.rb",
|
37
31
|
"lib/health_check/add_23_routes.rb",
|
38
32
|
"lib/health_check/health_check_controller.rb",
|
39
33
|
"lib/health_check/utils.rb",
|
34
|
+
"rails1_2.gemfile",
|
35
|
+
"rails2_3.gemfile",
|
36
|
+
"rails3_0.gemfile",
|
37
|
+
"rails3_1.gemfile",
|
38
|
+
"rails3_2.gemfile",
|
39
|
+
"rails_edge.gemfile",
|
40
40
|
"test/fake_smtp_server",
|
41
41
|
"test/migrate/empty/do_not_remove.txt",
|
42
42
|
"test/migrate/nine/9_create_countries.rb",
|
@@ -48,35 +48,35 @@ Gem::Specification.new do |s|
|
|
48
48
|
"test/unit/health_check_controller_test.rb",
|
49
49
|
"test/unit/routes_test.rb"
|
50
50
|
]
|
51
|
-
s.homepage =
|
51
|
+
s.homepage = %q{http://github.com/ianheggie/health_check}
|
52
52
|
s.require_paths = ["lib"]
|
53
|
-
s.rubygems_version =
|
54
|
-
s.summary =
|
53
|
+
s.rubygems_version = %q{1.6.2}
|
54
|
+
s.summary = %q{Simple health check of Rails app for uptime monitoring}
|
55
55
|
|
56
56
|
if s.respond_to? :specification_version then
|
57
57
|
s.specification_version = 3
|
58
58
|
|
59
59
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<rails>, [">= 2.3.0"])
|
60
61
|
s.add_development_dependency(%q<rake>, [">= 0.8.3"])
|
61
62
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
62
63
|
s.add_development_dependency(%q<shoulda>, ["~> 2.11.0"])
|
63
64
|
s.add_development_dependency(%q<sqlite3>, ["~> 1.3.7"])
|
64
|
-
s.add_development_dependency(%q<activerecord>, [">= 2.3.0"])
|
65
65
|
s.add_development_dependency(%q<bundler>, ["~> 1.2.0"])
|
66
66
|
else
|
67
|
+
s.add_dependency(%q<rails>, [">= 2.3.0"])
|
67
68
|
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
68
69
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
69
70
|
s.add_dependency(%q<shoulda>, ["~> 2.11.0"])
|
70
71
|
s.add_dependency(%q<sqlite3>, ["~> 1.3.7"])
|
71
|
-
s.add_dependency(%q<activerecord>, [">= 2.3.0"])
|
72
72
|
s.add_dependency(%q<bundler>, ["~> 1.2.0"])
|
73
73
|
end
|
74
74
|
else
|
75
|
+
s.add_dependency(%q<rails>, [">= 2.3.0"])
|
75
76
|
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
76
77
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
77
78
|
s.add_dependency(%q<shoulda>, ["~> 2.11.0"])
|
78
79
|
s.add_dependency(%q<sqlite3>, ["~> 1.3.7"])
|
79
|
-
s.add_dependency(%q<activerecord>, [">= 2.3.0"])
|
80
80
|
s.add_dependency(%q<bundler>, ["~> 1.2.0"])
|
81
81
|
end
|
82
82
|
end
|
@@ -54,11 +54,13 @@ module HealthCheck
|
|
54
54
|
if database_version.to_i != migration_version.to_i
|
55
55
|
errors << "Current database version (#{database_version}) does not match latest migration (#{migration_version}). "
|
56
56
|
end
|
57
|
+
when 'cache'
|
58
|
+
errors << HealthCheck::Utils.check_cache
|
57
59
|
when "standard"
|
58
60
|
errors << process_checks("database_migrations")
|
59
61
|
errors << process_checks("email") unless HealthCheck::Utils.default_action_mailer_configuration?
|
60
62
|
when "all", "full"
|
61
|
-
errors << process_checks("
|
63
|
+
errors << process_checks("database_migrations_email_cache")
|
62
64
|
else
|
63
65
|
return "invalid argument to health_test. "
|
64
66
|
end
|
data/lib/health_check/utils.rb
CHANGED
@@ -99,5 +99,9 @@ module HealthCheck
|
|
99
99
|
(status =~ /^221/) ? '' : "SMTP: #{status || 'unexpected EOF on socket'}. "
|
100
100
|
end
|
101
101
|
|
102
|
+
def self.check_cache
|
103
|
+
Rails.cache.write('__health_check_cache_test__', 'ok', :expires_in => 1.second) ? '' : 'Unable to write to cache. '
|
104
|
+
end
|
105
|
+
|
102
106
|
end
|
103
107
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# Gemfile for health_test testing
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'rails', "~> 1.2.6"
|
6
|
-
gem 'sqlite3', "~> 1.3.7"
|
7
6
|
|
8
7
|
group :development, :test do
|
8
|
+
gem 'sqlite3', "~> 1.3.7"
|
9
9
|
# rails requires rake >= 0.8.3
|
10
10
|
gem 'jeweler', '~> 1.8.4'
|
11
11
|
gem 'shoulda', "~> 2.11.0"
|
12
12
|
end
|
13
|
-
|
@@ -1,18 +1,17 @@
|
|
1
1
|
# Gemfile for health_test testing
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'rails', "~> 2.3.15"
|
6
6
|
# rails requires rake >= 0.8.3
|
7
|
-
if defined?(JRUBY_VERSION)
|
8
|
-
gem 'jruby-openssl'
|
9
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
10
|
-
else
|
11
|
-
gem 'sqlite3', "~> 1.3.7"
|
12
|
-
end
|
13
7
|
|
14
8
|
group :development, :test do
|
9
|
+
if defined?(JRUBY_VERSION)
|
10
|
+
gem 'jruby-openssl'
|
11
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', "~> 1.3.7"
|
14
|
+
end
|
15
15
|
gem 'jeweler', '~> 1.8.4'
|
16
16
|
gem 'shoulda', "~> 2.11.0"
|
17
17
|
end
|
18
|
-
|
@@ -1,18 +1,17 @@
|
|
1
1
|
# Gemfile for health_test testing
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'rails', "~> 3.0.19"
|
6
6
|
gem 'rake', '>= 0.8.3'
|
7
|
-
if defined?(JRUBY_VERSION)
|
8
|
-
gem 'jruby-openssl'
|
9
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
10
|
-
else
|
11
|
-
gem 'sqlite3', "~> 1.3.7"
|
12
|
-
end
|
13
7
|
|
14
8
|
group :development, :test do
|
9
|
+
if defined?(JRUBY_VERSION)
|
10
|
+
gem 'jruby-openssl'
|
11
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', "~> 1.3.7"
|
14
|
+
end
|
15
15
|
gem 'jeweler', '~> 1.8.4'
|
16
16
|
gem 'shoulda', "~> 2.11.0"
|
17
17
|
end
|
18
|
-
|
@@ -1,18 +1,17 @@
|
|
1
1
|
# Gemfile for health_test testing
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'rails', "~> 3.1.0"
|
6
6
|
gem 'rake', '>= 0.8.3'
|
7
|
-
if defined?(JRUBY_VERSION)
|
8
|
-
gem 'jruby-openssl'
|
9
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
10
|
-
else
|
11
|
-
gem 'sqlite3', "~> 1.3.7"
|
12
|
-
end
|
13
7
|
|
14
8
|
group :development, :test do
|
9
|
+
if defined?(JRUBY_VERSION)
|
10
|
+
gem 'jruby-openssl'
|
11
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', "~> 1.3.7"
|
14
|
+
end
|
15
15
|
gem 'jeweler', '~> 1.8.4'
|
16
16
|
gem 'shoulda', "~> 2.11.0"
|
17
17
|
end
|
18
|
-
|
@@ -1,18 +1,17 @@
|
|
1
1
|
# Gemfile for health_test testing
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'rails', "~> 3.2.0"
|
6
6
|
gem 'rake', '>= 0.8.3'
|
7
|
-
if defined?(JRUBY_VERSION)
|
8
|
-
gem 'jruby-openssl'
|
9
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
10
|
-
else
|
11
|
-
gem 'sqlite3', "~> 1.3.7"
|
12
|
-
end
|
13
7
|
|
14
8
|
group :development, :test do
|
9
|
+
if defined?(JRUBY_VERSION)
|
10
|
+
gem 'jruby-openssl'
|
11
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', "~> 1.3.7"
|
14
|
+
end
|
15
15
|
gem 'jeweler', '~> 1.8.4'
|
16
16
|
gem 'shoulda', "~> 2.11.0"
|
17
17
|
end
|
18
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Gemfile for health_test testing
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Bundle edge Rails instead:
|
6
6
|
|
@@ -10,15 +10,13 @@ gem 'arel', :git => 'git://github.com/rails/arel.git'
|
|
10
10
|
|
11
11
|
gem "rack", '~> 1.4.3'
|
12
12
|
|
13
|
-
if defined?(JRUBY_VERSION)
|
14
|
-
gem 'jruby-openssl'
|
15
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
-
else
|
17
|
-
gem 'sqlite3', "~> 1.3.7"
|
18
|
-
end
|
19
|
-
|
20
13
|
group :development, :test do
|
14
|
+
if defined?(JRUBY_VERSION)
|
15
|
+
gem 'jruby-openssl'
|
16
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
17
|
+
else
|
18
|
+
gem 'sqlite3', "~> 1.3.7"
|
19
|
+
end
|
21
20
|
gem 'jeweler'
|
22
21
|
gem 'shoulda'
|
23
22
|
end
|
24
|
-
|
data/test/test_with_railsapp
CHANGED
@@ -3,6 +3,23 @@
|
|
3
3
|
# Any failure causes exit
|
4
4
|
set -e
|
5
5
|
|
6
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
7
|
+
echo "Detected user installed rvm"
|
8
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
9
|
+
echo "Detected root installed rvm"
|
10
|
+
elif [[ -d "$HOME/.rbenv" ]] ; then
|
11
|
+
echo "Detected rbenv ..."
|
12
|
+
else
|
13
|
+
printf "Note: Neither rvm nor rbenv was not found.\n"
|
14
|
+
fi
|
15
|
+
|
16
|
+
echo "Checking required commands exist:"
|
17
|
+
for cmd in bash gem egrep ls tail kill find cpio ruby gem rake bundle
|
18
|
+
do
|
19
|
+
echo -n " "
|
20
|
+
which $cmd || ( echo "Aborting test: Missing $cmd command!" && exit 2 )
|
21
|
+
done
|
22
|
+
|
6
23
|
base_dir=`pwd`
|
7
24
|
|
8
25
|
testurl="$base_dir/test/testurl"
|
@@ -12,6 +29,8 @@ test_dir=`pwd`/tmp
|
|
12
29
|
rm -rf tmp/Gemfile* tmp/railsapp tmp/bin tmp/gems
|
13
30
|
mkdir -p tmp/gems
|
14
31
|
|
32
|
+
[ -d lib/health_check ] || exec echo test MUST be executed in the base of the health_check gem/clone of git repository
|
33
|
+
|
15
34
|
echo Installing health_check as a gem into tmp/gems
|
16
35
|
env GEM_HOME=$test_dir/gems rake install
|
17
36
|
|
@@ -32,26 +51,31 @@ server_pid=''
|
|
32
51
|
finish()
|
33
52
|
{
|
34
53
|
set +e
|
35
|
-
set +x
|
36
54
|
echo ========================================================
|
37
55
|
echo TEST ${1:-FAILED}
|
38
56
|
echo ========================================================
|
57
|
+
echo Result of: ls -lR $test_dir/railsapp/log $test_dir/railsapp/db
|
39
58
|
ls -lR $test_dir/railsapp/log $test_dir/railsapp/db
|
40
59
|
|
41
60
|
if [ -s $test_dir/railsapp/log/test.log ]
|
42
61
|
then
|
62
|
+
echo ========================================================
|
43
63
|
echo Last 300 lines of test log
|
44
64
|
tail -300 $test_dir/railsapp/log/test.log
|
45
65
|
fi
|
46
66
|
|
47
67
|
case "$server_pid" in
|
48
68
|
[0-9]*)
|
69
|
+
echo ========================================================
|
49
70
|
echo "Killing rails server [pid: $server_pid]"
|
50
71
|
kill -9 $server_pid
|
51
72
|
wait
|
52
73
|
;;
|
53
74
|
esac
|
54
75
|
trap "" 0
|
76
|
+
echo ========================================================
|
77
|
+
echo TEST ${1:-FAILED}
|
78
|
+
echo ========================================================
|
55
79
|
exit ${2:-2}
|
56
80
|
}
|
57
81
|
|
@@ -98,6 +122,7 @@ case "$actual_rails_version" in
|
|
98
122
|
esac
|
99
123
|
|
100
124
|
cd railsapp
|
125
|
+
|
101
126
|
echo "Changed current directory to railsapp root: `pwd`"
|
102
127
|
|
103
128
|
echo "Fixing rdoc require in Rakefile if needed"
|
@@ -117,12 +142,12 @@ echo
|
|
117
142
|
|
118
143
|
if [ -s Gemfile ]
|
119
144
|
then
|
120
|
-
echo
|
145
|
+
echo Adding health_check as gem to Gemfile...
|
121
146
|
echo "gem 'health_check', :path => '$base_dir'" >> Gemfile
|
122
147
|
|
123
148
|
case "$BUNDLE_GEMFILE" in
|
124
149
|
?*)
|
125
|
-
echo Unsetting BUNDLE_GEMFILE '(so Gemfile will be used)'
|
150
|
+
echo Unsetting BUNDLE_GEMFILE '(so Gemfile for rails application will be used)'
|
126
151
|
unset BUNDLE_GEMFILE
|
127
152
|
;;
|
128
153
|
esac
|
@@ -130,25 +155,31 @@ then
|
|
130
155
|
echo Gemfile contents:
|
131
156
|
cat Gemfile
|
132
157
|
echo
|
133
|
-
echo running bundle --binstubs
|
134
|
-
bundle --binstubs
|
158
|
+
echo running bundle install --binstubs
|
159
|
+
bundle install --binstubs
|
135
160
|
echo "Using binstubs in `pwd`/bin for rails and rake commands"
|
136
161
|
rails="`pwd`/bin/rails"
|
137
162
|
rake="`pwd`/bin/rake"
|
163
|
+
# Fix for rvm, otherwise bundle run from rails create fails
|
164
|
+
export PATH="`pwd`/bin:$PATH"
|
138
165
|
else
|
139
166
|
dest=`pwd`/vendor/plugins/health_check
|
140
167
|
echo Installing health_check as plugin in $dest ...
|
141
168
|
mkdir -p $dest
|
142
169
|
(
|
143
|
-
|
170
|
+
cd $base_dir
|
171
|
+
|
144
172
|
find . | egrep -v '/tmp|/\.git|\.gem$' | cpio -pdl $dest
|
145
|
-
|
173
|
+
|
174
|
+
cd $dest
|
175
|
+
|
146
176
|
echo Files installed as plugin:
|
147
177
|
find . -type f
|
148
178
|
echo
|
149
179
|
)
|
150
180
|
fi
|
151
181
|
|
182
|
+
echo Setting RAILS_ENV=test RACK_ENV=test
|
152
183
|
export RAILS_ENV=test RACK_ENV=test
|
153
184
|
|
154
185
|
case $db in
|
data/test/testurl
CHANGED
@@ -8,16 +8,16 @@ end
|
|
8
8
|
|
9
9
|
page_content = open(ARGV[0]) rescue nil
|
10
10
|
unless page_content
|
11
|
-
i=
|
11
|
+
i=0
|
12
12
|
print "waiting.."
|
13
|
-
while i <
|
13
|
+
while i < 120 and not page_content
|
14
14
|
print "."
|
15
15
|
STDOUT.flush
|
16
16
|
i += 1
|
17
17
|
sleep(1)
|
18
18
|
page_content = open(ARGV[0]) rescue nil
|
19
19
|
end
|
20
|
-
puts "
|
20
|
+
puts "\n #{page_content ? 'got url content' : 'timed out'} after waiting #{i} seconds"
|
21
21
|
end
|
22
22
|
|
23
23
|
puts page_content
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.2
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ian Heggie
|
@@ -15,10 +15,27 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-02-19 00:00:00 +11:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 3
|
31
|
+
- 0
|
32
|
+
version: 2.3.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
name: rails
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
22
39
|
none: false
|
23
40
|
requirements:
|
24
41
|
- - ">="
|
@@ -29,12 +46,12 @@ dependencies:
|
|
29
46
|
- 8
|
30
47
|
- 3
|
31
48
|
version: 0.8.3
|
32
|
-
version_requirements: *id001
|
33
|
-
name: rake
|
34
|
-
prerelease: false
|
35
49
|
type: :development
|
50
|
+
prerelease: false
|
51
|
+
name: rake
|
52
|
+
version_requirements: *id002
|
36
53
|
- !ruby/object:Gem::Dependency
|
37
|
-
requirement: &
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
38
55
|
none: false
|
39
56
|
requirements:
|
40
57
|
- - ~>
|
@@ -45,12 +62,12 @@ dependencies:
|
|
45
62
|
- 8
|
46
63
|
- 4
|
47
64
|
version: 1.8.4
|
48
|
-
version_requirements: *id002
|
49
|
-
name: jeweler
|
50
|
-
prerelease: false
|
51
65
|
type: :development
|
66
|
+
prerelease: false
|
67
|
+
name: jeweler
|
68
|
+
version_requirements: *id003
|
52
69
|
- !ruby/object:Gem::Dependency
|
53
|
-
requirement: &
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
54
71
|
none: false
|
55
72
|
requirements:
|
56
73
|
- - ~>
|
@@ -61,12 +78,12 @@ dependencies:
|
|
61
78
|
- 11
|
62
79
|
- 0
|
63
80
|
version: 2.11.0
|
64
|
-
version_requirements: *id003
|
65
|
-
name: shoulda
|
66
|
-
prerelease: false
|
67
81
|
type: :development
|
82
|
+
prerelease: false
|
83
|
+
name: shoulda
|
84
|
+
version_requirements: *id004
|
68
85
|
- !ruby/object:Gem::Dependency
|
69
|
-
requirement: &
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
70
87
|
none: false
|
71
88
|
requirements:
|
72
89
|
- - ~>
|
@@ -77,26 +94,10 @@ dependencies:
|
|
77
94
|
- 3
|
78
95
|
- 7
|
79
96
|
version: 1.3.7
|
80
|
-
version_requirements: *id004
|
81
|
-
name: sqlite3
|
82
|
-
prerelease: false
|
83
97
|
type: :development
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 2
|
93
|
-
- 3
|
94
|
-
- 0
|
95
|
-
version: 2.3.0
|
96
|
-
version_requirements: *id005
|
97
|
-
name: activerecord
|
98
98
|
prerelease: false
|
99
|
-
|
99
|
+
name: sqlite3
|
100
|
+
version_requirements: *id005
|
100
101
|
- !ruby/object:Gem::Dependency
|
101
102
|
requirement: &id006 !ruby/object:Gem::Requirement
|
102
103
|
none: false
|
@@ -109,10 +110,10 @@ dependencies:
|
|
109
110
|
- 2
|
110
111
|
- 0
|
111
112
|
version: 1.2.0
|
112
|
-
version_requirements: *id006
|
113
|
-
name: bundler
|
114
|
-
prerelease: false
|
115
113
|
type: :development
|
114
|
+
prerelease: false
|
115
|
+
name: bundler
|
116
|
+
version_requirements: *id006
|
116
117
|
description: Simple health check of Rails app for use with Pingdom, NewRelic, EngineYard or uptime.openacs.org etc.
|
117
118
|
email: ian@heggie.biz
|
118
119
|
executables: []
|
@@ -131,18 +132,18 @@ files:
|
|
131
132
|
- Rakefile
|
132
133
|
- VERSION
|
133
134
|
- config/routes.rb
|
134
|
-
- gemfiles/rails1_2.gemfile
|
135
|
-
- gemfiles/rails2_3.gemfile
|
136
|
-
- gemfiles/rails3_0.gemfile
|
137
|
-
- gemfiles/rails3_1.gemfile
|
138
|
-
- gemfiles/rails3_2.gemfile
|
139
|
-
- gemfiles/rails_edge.gemfile
|
140
135
|
- health_check.gemspec
|
141
136
|
- init.rb
|
142
137
|
- lib/health_check.rb
|
143
138
|
- lib/health_check/add_23_routes.rb
|
144
139
|
- lib/health_check/health_check_controller.rb
|
145
140
|
- lib/health_check/utils.rb
|
141
|
+
- rails1_2.gemfile
|
142
|
+
- rails2_3.gemfile
|
143
|
+
- rails3_0.gemfile
|
144
|
+
- rails3_1.gemfile
|
145
|
+
- rails3_2.gemfile
|
146
|
+
- rails_edge.gemfile
|
146
147
|
- test/fake_smtp_server
|
147
148
|
- test/migrate/empty/do_not_remove.txt
|
148
149
|
- test/migrate/nine/9_create_countries.rb
|
@@ -153,6 +154,7 @@ files:
|
|
153
154
|
- test/testurl
|
154
155
|
- test/unit/health_check_controller_test.rb
|
155
156
|
- test/unit/routes_test.rb
|
157
|
+
has_rdoc: true
|
156
158
|
homepage: http://github.com/ianheggie/health_check
|
157
159
|
licenses: []
|
158
160
|
|
@@ -182,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
184
|
requirements: []
|
183
185
|
|
184
186
|
rubyforge_project:
|
185
|
-
rubygems_version: 1.
|
187
|
+
rubygems_version: 1.6.2
|
186
188
|
signing_key:
|
187
189
|
specification_version: 3
|
188
190
|
summary: Simple health check of Rails app for uptime monitoring
|