rails-health-checker 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +37 -0
- data/COMMANDS.md +118 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +222 -0
- data/LICENSE +21 -0
- data/README.md +174 -0
- data/Rakefile +6 -0
- data/SECURITY.md +41 -0
- data/TESTING.md +64 -0
- data/TEST_RESULTS.md +51 -0
- data/example_usage.rb +23 -0
- data/lib/rails_health_checker/checker.rb +88 -0
- data/lib/rails_health_checker/dashboard_middleware.rb +503 -0
- data/lib/rails_health_checker/gem_analyzer.rb +39 -0
- data/lib/rails_health_checker/health_middleware.rb +53 -0
- data/lib/rails_health_checker/job_analyzer.rb +108 -0
- data/lib/rails_health_checker/railtie.rb +11 -0
- data/lib/rails_health_checker/report_generator.rb +499 -0
- data/lib/rails_health_checker/system_analyzer.rb +182 -0
- data/lib/rails_health_checker/tasks.rb +63 -0
- data/lib/rails_health_checker/version.rb +3 -0
- data/lib/rails_health_checker.rb +17 -0
- data/rails_health_checker.gemspec +33 -0
- data/simple_test.rb +52 -0
- data/test_gem.rb +100 -0
- metadata +117 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: be0f112b61f929e7dd3026fa40d9f63ce230641ef34ad956637e8c098e1a7058
|
|
4
|
+
data.tar.gz: 2fb188bf9508328f57ed7b11e85947f60a57e1dd8e20caf32853701ce92a80e9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b3eeacdbb52e1ce1f3741433ae0c732d19e01d9ad3d08ea27ed777387ad98c9e24dfafd41f89a62d5b1e15e1b1daf7486305d7ae59012af3f96e4ca8d9f9b123
|
|
7
|
+
data.tar.gz: aa42aba4244369ba52b22c12b16515c7a7f3955d8d67e2a53ddd5b23bc6317eea737be285a6be665f32891506f51fc9df6bf6d797e6326af663d0944b55d3c11
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-11-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of RailsHealthChecker gem
|
|
12
|
+
- Rails version compatibility checking
|
|
13
|
+
- Ruby version validation
|
|
14
|
+
- Database connectivity testing
|
|
15
|
+
- Gem dependencies analysis
|
|
16
|
+
- Security vulnerability detection
|
|
17
|
+
- HTTP health endpoint with web dashboard
|
|
18
|
+
- Rake tasks for command-line health checking
|
|
19
|
+
- Password-protected health dashboard
|
|
20
|
+
- Real-time health scoring (0-100)
|
|
21
|
+
- Auto-refresh dashboard functionality
|
|
22
|
+
- System information display
|
|
23
|
+
- Priority actions with color-coded urgency
|
|
24
|
+
- Comprehensive health reporting
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
- 🏥 Visual health overview with status indicators
|
|
28
|
+
- 📊 Real-time health score calculation
|
|
29
|
+
- 🔧 System information (Rails/Ruby versions)
|
|
30
|
+
- 💾 Database connectivity status
|
|
31
|
+
- 📦 Gem dependencies analysis
|
|
32
|
+
- 🔒 Security vulnerability overview
|
|
33
|
+
- 🎯 Priority actions with urgency levels
|
|
34
|
+
- 🔄 Auto-refresh every 30 seconds
|
|
35
|
+
- 🔐 Password-protected access
|
|
36
|
+
|
|
37
|
+
[0.1.0]: https://github.com/ArshdeepGrover/rails-health-checker/releases/tag/v0.1.0
|
data/COMMANDS.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Commands Reference
|
|
2
|
+
|
|
3
|
+
## Development Commands
|
|
4
|
+
|
|
5
|
+
### Setup
|
|
6
|
+
```bash
|
|
7
|
+
bundle install
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Testing
|
|
11
|
+
```bash
|
|
12
|
+
bundle exec rspec
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Build
|
|
16
|
+
```bash
|
|
17
|
+
bundle exec rake build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Release Process
|
|
21
|
+
|
|
22
|
+
### 1. Update Version
|
|
23
|
+
Edit `lib/rails_health_checker/version.rb`:
|
|
24
|
+
```ruby
|
|
25
|
+
VERSION = "x.x.x"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Update Changelog
|
|
29
|
+
Add changes to `CHANGELOG.md` (if exists) or document in commit message.
|
|
30
|
+
|
|
31
|
+
### 3. Commit Changes
|
|
32
|
+
```bash
|
|
33
|
+
git add .
|
|
34
|
+
git commit -m "Bump version to x.x.x"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 4. Release
|
|
38
|
+
```bash
|
|
39
|
+
bundle exec rake release
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This command will:
|
|
43
|
+
- Build the gem
|
|
44
|
+
- Create git tag
|
|
45
|
+
- Push tag to GitHub
|
|
46
|
+
- Push gem to RubyGems.org
|
|
47
|
+
|
|
48
|
+
### Manual Release (if needed)
|
|
49
|
+
```bash
|
|
50
|
+
# Build
|
|
51
|
+
gem build rails-health-checker.gemspec
|
|
52
|
+
|
|
53
|
+
# Push to RubyGems
|
|
54
|
+
gem push rails-health-checker-x.x.x.gem
|
|
55
|
+
|
|
56
|
+
# Tag and push
|
|
57
|
+
git tag vx.x.x
|
|
58
|
+
git push origin vx.x.x
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage Commands
|
|
62
|
+
|
|
63
|
+
### Rake Tasks
|
|
64
|
+
```bash
|
|
65
|
+
rake health:check # Complete health check
|
|
66
|
+
rake health:gems # Check gem dependencies
|
|
67
|
+
rake health:database # Check database connectivity
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Programmatic
|
|
71
|
+
```ruby
|
|
72
|
+
results = RailsHealthChecker.check
|
|
73
|
+
analyzer = RailsHealthChecker::GemAnalyzer.new
|
|
74
|
+
gem_health = analyzer.analyze
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### HTTP Endpoint
|
|
78
|
+
```
|
|
79
|
+
GET /health # Health dashboard
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Deployment Commands
|
|
83
|
+
|
|
84
|
+
### Deploy to RubyGems
|
|
85
|
+
```bash
|
|
86
|
+
# Login to RubyGems (first time only)
|
|
87
|
+
gem signin
|
|
88
|
+
|
|
89
|
+
# Deploy latest version
|
|
90
|
+
bundle exec rake release
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Deploy Documentation
|
|
94
|
+
```bash
|
|
95
|
+
# If using GitHub Pages
|
|
96
|
+
git push origin main
|
|
97
|
+
|
|
98
|
+
# If using Netlify (manual)
|
|
99
|
+
# Upload docs folder to Netlify dashboard
|
|
100
|
+
|
|
101
|
+
# If using custom server
|
|
102
|
+
scp -r docs/ user@server:/path/to/docs
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Verify Deployment
|
|
106
|
+
```bash
|
|
107
|
+
# Check gem is live
|
|
108
|
+
gem search rails-health-checker
|
|
109
|
+
|
|
110
|
+
# Test installation
|
|
111
|
+
gem install rails-health-checker
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Environment Variables
|
|
115
|
+
```bash
|
|
116
|
+
export HEALTH_USERNAME=your_username
|
|
117
|
+
export HEALTH_PASSWORD=your_secure_password
|
|
118
|
+
```
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
rails-health-checker (0.1.0)
|
|
5
|
+
bundler (>= 2.0)
|
|
6
|
+
rails (>= 6.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actioncable (7.1.5.2)
|
|
12
|
+
actionpack (= 7.1.5.2)
|
|
13
|
+
activesupport (= 7.1.5.2)
|
|
14
|
+
nio4r (~> 2.0)
|
|
15
|
+
websocket-driver (>= 0.6.1)
|
|
16
|
+
zeitwerk (~> 2.6)
|
|
17
|
+
actionmailbox (7.1.5.2)
|
|
18
|
+
actionpack (= 7.1.5.2)
|
|
19
|
+
activejob (= 7.1.5.2)
|
|
20
|
+
activerecord (= 7.1.5.2)
|
|
21
|
+
activestorage (= 7.1.5.2)
|
|
22
|
+
activesupport (= 7.1.5.2)
|
|
23
|
+
mail (>= 2.7.1)
|
|
24
|
+
net-imap
|
|
25
|
+
net-pop
|
|
26
|
+
net-smtp
|
|
27
|
+
actionmailer (7.1.5.2)
|
|
28
|
+
actionpack (= 7.1.5.2)
|
|
29
|
+
actionview (= 7.1.5.2)
|
|
30
|
+
activejob (= 7.1.5.2)
|
|
31
|
+
activesupport (= 7.1.5.2)
|
|
32
|
+
mail (~> 2.5, >= 2.5.4)
|
|
33
|
+
net-imap
|
|
34
|
+
net-pop
|
|
35
|
+
net-smtp
|
|
36
|
+
rails-dom-testing (~> 2.2)
|
|
37
|
+
actionpack (7.1.5.2)
|
|
38
|
+
actionview (= 7.1.5.2)
|
|
39
|
+
activesupport (= 7.1.5.2)
|
|
40
|
+
nokogiri (>= 1.8.5)
|
|
41
|
+
racc
|
|
42
|
+
rack (>= 2.2.4)
|
|
43
|
+
rack-session (>= 1.0.1)
|
|
44
|
+
rack-test (>= 0.6.3)
|
|
45
|
+
rails-dom-testing (~> 2.2)
|
|
46
|
+
rails-html-sanitizer (~> 1.6)
|
|
47
|
+
actiontext (7.1.5.2)
|
|
48
|
+
actionpack (= 7.1.5.2)
|
|
49
|
+
activerecord (= 7.1.5.2)
|
|
50
|
+
activestorage (= 7.1.5.2)
|
|
51
|
+
activesupport (= 7.1.5.2)
|
|
52
|
+
globalid (>= 0.6.0)
|
|
53
|
+
nokogiri (>= 1.8.5)
|
|
54
|
+
actionview (7.1.5.2)
|
|
55
|
+
activesupport (= 7.1.5.2)
|
|
56
|
+
builder (~> 3.1)
|
|
57
|
+
erubi (~> 1.11)
|
|
58
|
+
rails-dom-testing (~> 2.2)
|
|
59
|
+
rails-html-sanitizer (~> 1.6)
|
|
60
|
+
activejob (7.1.5.2)
|
|
61
|
+
activesupport (= 7.1.5.2)
|
|
62
|
+
globalid (>= 0.3.6)
|
|
63
|
+
activemodel (7.1.5.2)
|
|
64
|
+
activesupport (= 7.1.5.2)
|
|
65
|
+
activerecord (7.1.5.2)
|
|
66
|
+
activemodel (= 7.1.5.2)
|
|
67
|
+
activesupport (= 7.1.5.2)
|
|
68
|
+
timeout (>= 0.4.0)
|
|
69
|
+
activestorage (7.1.5.2)
|
|
70
|
+
actionpack (= 7.1.5.2)
|
|
71
|
+
activejob (= 7.1.5.2)
|
|
72
|
+
activerecord (= 7.1.5.2)
|
|
73
|
+
activesupport (= 7.1.5.2)
|
|
74
|
+
marcel (~> 1.0)
|
|
75
|
+
activesupport (7.1.5.2)
|
|
76
|
+
base64
|
|
77
|
+
benchmark (>= 0.3)
|
|
78
|
+
bigdecimal
|
|
79
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
80
|
+
connection_pool (>= 2.2.5)
|
|
81
|
+
drb
|
|
82
|
+
i18n (>= 1.6, < 2)
|
|
83
|
+
logger (>= 1.4.2)
|
|
84
|
+
minitest (>= 5.1)
|
|
85
|
+
mutex_m
|
|
86
|
+
securerandom (>= 0.3)
|
|
87
|
+
tzinfo (~> 2.0)
|
|
88
|
+
base64 (0.3.0)
|
|
89
|
+
benchmark (0.4.1)
|
|
90
|
+
bigdecimal (3.3.1)
|
|
91
|
+
builder (3.3.0)
|
|
92
|
+
cgi (0.5.0)
|
|
93
|
+
concurrent-ruby (1.3.5)
|
|
94
|
+
connection_pool (2.5.4)
|
|
95
|
+
crass (1.0.6)
|
|
96
|
+
date (3.4.1)
|
|
97
|
+
diff-lcs (1.5.1)
|
|
98
|
+
drb (2.2.3)
|
|
99
|
+
erb (4.0.4)
|
|
100
|
+
cgi (>= 0.3.3)
|
|
101
|
+
erubi (1.13.1)
|
|
102
|
+
globalid (1.3.0)
|
|
103
|
+
activesupport (>= 6.1)
|
|
104
|
+
i18n (1.14.7)
|
|
105
|
+
concurrent-ruby (~> 1.0)
|
|
106
|
+
io-console (0.8.1)
|
|
107
|
+
irb (1.15.2)
|
|
108
|
+
pp (>= 0.6.0)
|
|
109
|
+
rdoc (>= 4.0.0)
|
|
110
|
+
reline (>= 0.4.2)
|
|
111
|
+
logger (1.7.0)
|
|
112
|
+
loofah (2.24.1)
|
|
113
|
+
crass (~> 1.0.2)
|
|
114
|
+
nokogiri (>= 1.12.0)
|
|
115
|
+
mail (2.8.1)
|
|
116
|
+
mini_mime (>= 0.1.1)
|
|
117
|
+
net-imap
|
|
118
|
+
net-pop
|
|
119
|
+
net-smtp
|
|
120
|
+
marcel (1.1.0)
|
|
121
|
+
mini_mime (1.1.5)
|
|
122
|
+
minitest (5.26.0)
|
|
123
|
+
mutex_m (0.3.0)
|
|
124
|
+
net-imap (0.4.22)
|
|
125
|
+
date
|
|
126
|
+
net-protocol
|
|
127
|
+
net-pop (0.1.2)
|
|
128
|
+
net-protocol
|
|
129
|
+
net-protocol (0.2.2)
|
|
130
|
+
timeout
|
|
131
|
+
net-smtp (0.5.1)
|
|
132
|
+
net-protocol
|
|
133
|
+
nio4r (2.7.4)
|
|
134
|
+
nokogiri (1.17.2-arm64-darwin)
|
|
135
|
+
racc (~> 1.4)
|
|
136
|
+
pp (0.6.3)
|
|
137
|
+
prettyprint
|
|
138
|
+
prettyprint (0.2.0)
|
|
139
|
+
psych (5.2.6)
|
|
140
|
+
date
|
|
141
|
+
stringio
|
|
142
|
+
racc (1.8.1)
|
|
143
|
+
rack (3.2.3)
|
|
144
|
+
rack-session (2.1.1)
|
|
145
|
+
base64 (>= 0.1.0)
|
|
146
|
+
rack (>= 3.0.0)
|
|
147
|
+
rack-test (2.2.0)
|
|
148
|
+
rack (>= 1.3)
|
|
149
|
+
rackup (2.2.1)
|
|
150
|
+
rack (>= 3)
|
|
151
|
+
rails (7.1.5.2)
|
|
152
|
+
actioncable (= 7.1.5.2)
|
|
153
|
+
actionmailbox (= 7.1.5.2)
|
|
154
|
+
actionmailer (= 7.1.5.2)
|
|
155
|
+
actionpack (= 7.1.5.2)
|
|
156
|
+
actiontext (= 7.1.5.2)
|
|
157
|
+
actionview (= 7.1.5.2)
|
|
158
|
+
activejob (= 7.1.5.2)
|
|
159
|
+
activemodel (= 7.1.5.2)
|
|
160
|
+
activerecord (= 7.1.5.2)
|
|
161
|
+
activestorage (= 7.1.5.2)
|
|
162
|
+
activesupport (= 7.1.5.2)
|
|
163
|
+
bundler (>= 1.15.0)
|
|
164
|
+
railties (= 7.1.5.2)
|
|
165
|
+
rails-dom-testing (2.3.0)
|
|
166
|
+
activesupport (>= 5.0.0)
|
|
167
|
+
minitest
|
|
168
|
+
nokogiri (>= 1.6)
|
|
169
|
+
rails-html-sanitizer (1.6.2)
|
|
170
|
+
loofah (~> 2.21)
|
|
171
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
172
|
+
railties (7.1.5.2)
|
|
173
|
+
actionpack (= 7.1.5.2)
|
|
174
|
+
activesupport (= 7.1.5.2)
|
|
175
|
+
irb
|
|
176
|
+
rackup (>= 1.0.0)
|
|
177
|
+
rake (>= 12.2)
|
|
178
|
+
thor (~> 1.0, >= 1.2.2)
|
|
179
|
+
zeitwerk (~> 2.6)
|
|
180
|
+
rake (13.3.0)
|
|
181
|
+
rdoc (6.15.0)
|
|
182
|
+
erb
|
|
183
|
+
psych (>= 4.0.0)
|
|
184
|
+
tsort
|
|
185
|
+
reline (0.6.2)
|
|
186
|
+
io-console (~> 0.5)
|
|
187
|
+
rspec (3.13.0)
|
|
188
|
+
rspec-core (~> 3.13.0)
|
|
189
|
+
rspec-expectations (~> 3.13.0)
|
|
190
|
+
rspec-mocks (~> 3.13.0)
|
|
191
|
+
rspec-core (3.13.0)
|
|
192
|
+
rspec-support (~> 3.13.0)
|
|
193
|
+
rspec-expectations (3.13.1)
|
|
194
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
195
|
+
rspec-support (~> 3.13.0)
|
|
196
|
+
rspec-mocks (3.13.1)
|
|
197
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
198
|
+
rspec-support (~> 3.13.0)
|
|
199
|
+
rspec-support (3.13.1)
|
|
200
|
+
securerandom (0.3.2)
|
|
201
|
+
stringio (3.1.7)
|
|
202
|
+
thor (1.4.0)
|
|
203
|
+
timeout (0.4.3)
|
|
204
|
+
tsort (0.2.0)
|
|
205
|
+
tzinfo (2.0.6)
|
|
206
|
+
concurrent-ruby (~> 1.0)
|
|
207
|
+
websocket-driver (0.8.0)
|
|
208
|
+
base64
|
|
209
|
+
websocket-extensions (>= 0.1.0)
|
|
210
|
+
websocket-extensions (0.1.5)
|
|
211
|
+
zeitwerk (2.6.18)
|
|
212
|
+
|
|
213
|
+
PLATFORMS
|
|
214
|
+
arm64-darwin
|
|
215
|
+
|
|
216
|
+
DEPENDENCIES
|
|
217
|
+
rails-health-checker!
|
|
218
|
+
rake (~> 13.0)
|
|
219
|
+
rspec (~> 3.0)
|
|
220
|
+
|
|
221
|
+
BUNDLED WITH
|
|
222
|
+
2.5.16
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Arshdeep Singh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# RailsHealthChecker
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/rb/rails-health-checker)
|
|
4
|
+
[](https://rails-health-checker.netlify.app)
|
|
5
|
+
[](https://github.com/ArshdeepGrover/rails-health-checker/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
A comprehensive health checking gem for Ruby on Rails applications and their dependencies.
|
|
8
|
+
|
|
9
|
+
🌐 **[Live Documentation & Demo](https://rails-health-checker.netlify.app)**
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Rails Version Check**: Validates Rails version compatibility
|
|
14
|
+
- **Ruby Version Check**: Ensures Ruby version is supported
|
|
15
|
+
- **Database Connectivity**: Tests database connection health
|
|
16
|
+
- **Gem Dependencies**: Analyzes gem health and outdated packages
|
|
17
|
+
- **Security Vulnerabilities**: Checks for known security issues
|
|
18
|
+
- **HTTP Health Endpoint**: Provides `/health` endpoint for monitoring
|
|
19
|
+
- **Rake Tasks**: Command-line health checking tools
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Add this line to your application's Gemfile:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
gem 'rails-health-checker'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
And then execute:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bundle install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install it directly:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gem install rails-health-checker
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### Programmatic Usage
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
# Run complete health check
|
|
47
|
+
results = RailsHealthChecker.check
|
|
48
|
+
|
|
49
|
+
# Check specific components
|
|
50
|
+
analyzer = RailsHealthChecker::GemAnalyzer.new
|
|
51
|
+
gem_health = analyzer.analyze
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Rake Tasks
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Complete health check
|
|
58
|
+
rake health:check
|
|
59
|
+
|
|
60
|
+
# Check gem dependencies only
|
|
61
|
+
rake health:gems
|
|
62
|
+
|
|
63
|
+
# Check database connectivity
|
|
64
|
+
rake health:database
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### HTTP Health Dashboard
|
|
68
|
+
|
|
69
|
+
The gem automatically adds protected `/health` endpoints with comprehensive web dashboards:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Main dashboard (requires authentication)
|
|
73
|
+
http://localhost:3000/health
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Authentication:**
|
|
77
|
+
- Default: username `admin`, password `health123`
|
|
78
|
+
- Custom: Set `HEALTH_USERNAME` and `HEALTH_PASSWORD` environment variables
|
|
79
|
+
|
|
80
|
+
**Dashboard Features:**
|
|
81
|
+
- 🏥 Visual health overview with status indicators
|
|
82
|
+
- 📊 Real-time health score (0-100)
|
|
83
|
+
- 🔧 System information (Rails/Ruby versions)
|
|
84
|
+
- 💾 Database connectivity status
|
|
85
|
+
- 📦 Gem dependencies analysis
|
|
86
|
+
- 🔒 Security vulnerability overview with detailed list
|
|
87
|
+
- 🎯 Priority actions with color-coded urgency
|
|
88
|
+
- 🔄 Auto-refresh every 30 seconds
|
|
89
|
+
- 🔐 Password-protected access
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
The gem works out of the box with minimal configuration. The health middleware is automatically added to your Rails application.
|
|
94
|
+
|
|
95
|
+
### Authentication Configuration
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Set custom credentials (optional)
|
|
99
|
+
export HEALTH_USERNAME=your_username
|
|
100
|
+
export HEALTH_PASSWORD=your_secure_password
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Default credentials:**
|
|
104
|
+
- Username: `admin`
|
|
105
|
+
- Password: `health123`
|
|
106
|
+
|
|
107
|
+
### Manual Middleware Setup (if needed)
|
|
108
|
+
|
|
109
|
+
If the middleware doesn't load automatically, add to `config/application.rb`:
|
|
110
|
+
|
|
111
|
+
```ruby
|
|
112
|
+
require 'rails_health_checker'
|
|
113
|
+
|
|
114
|
+
class Application < Rails::Application
|
|
115
|
+
config.middleware.use RailsHealthChecker::DashboardMiddleware
|
|
116
|
+
end
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
After checking out the repo, run:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
bundle install
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
To run tests:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bundle exec rspec
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Building and Publishing
|
|
134
|
+
|
|
135
|
+
To build the gem:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
bundle exec rake build
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
To release a new version:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
bundle exec rake release
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This will:
|
|
148
|
+
1. Build the gem
|
|
149
|
+
2. Create a git tag for the version
|
|
150
|
+
3. Push the tag to GitHub
|
|
151
|
+
4. Push the gem to RubyGems.org
|
|
152
|
+
|
|
153
|
+
## Links
|
|
154
|
+
|
|
155
|
+
- 🌐 **[Documentation & Demo](https://rails-health-checker.netlify.app)**
|
|
156
|
+
- 📦 **[RubyGems](https://rubygems.org/gems/rails-health-checker)**
|
|
157
|
+
- 🐙 **[GitHub Repository](https://github.com/ArshdeepGrover/rails-health-checker)**
|
|
158
|
+
- 🐛 **[Issue Tracker](https://github.com/ArshdeepGrover/rails-health-checker/issues)**
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
1. Fork the repository
|
|
163
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
164
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
165
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
166
|
+
5. Create a new Pull Request
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
**Made with ❤️ by [Arshdeep Singh](https://github.com/ArshdeepGrover)**
|
data/Rakefile
ADDED
data/SECURITY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Authentication
|
|
4
|
+
|
|
5
|
+
The health dashboard is protected by HTTP Basic Authentication to prevent unauthorized access to sensitive application information.
|
|
6
|
+
|
|
7
|
+
### Default Credentials
|
|
8
|
+
- **Username:** `admin`
|
|
9
|
+
- **Password:** `health123`
|
|
10
|
+
|
|
11
|
+
### Custom Credentials
|
|
12
|
+
Set environment variables to use custom credentials:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
export HEALTH_USERNAME=your_username
|
|
16
|
+
export HEALTH_PASSWORD=your_secure_password
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Security Considerations
|
|
20
|
+
|
|
21
|
+
1. **Change Default Password:** Always change the default password in production
|
|
22
|
+
2. **Use Strong Passwords:** Use complex passwords with mixed characters
|
|
23
|
+
3. **Environment Variables:** Store credentials in environment variables, not in code
|
|
24
|
+
4. **HTTPS Only:** Use HTTPS in production to encrypt authentication headers
|
|
25
|
+
5. **Access Logs:** Monitor access to health endpoints
|
|
26
|
+
|
|
27
|
+
### Endpoints Protected
|
|
28
|
+
|
|
29
|
+
- `/health` - Main health dashboard
|
|
30
|
+
|
|
31
|
+
### What Information is Exposed
|
|
32
|
+
|
|
33
|
+
The health dashboard shows:
|
|
34
|
+
- Rails and Ruby versions
|
|
35
|
+
- Database connection status
|
|
36
|
+
- Gem dependencies and versions
|
|
37
|
+
- Security vulnerabilities (outdated gems)
|
|
38
|
+
- Background job status
|
|
39
|
+
- System configuration details
|
|
40
|
+
|
|
41
|
+
**Note:** This information should only be accessible to authorized personnel.
|
data/TESTING.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Testing RailsHealthChecker Gem
|
|
2
|
+
|
|
3
|
+
## 1. Basic Functionality Test
|
|
4
|
+
```bash
|
|
5
|
+
cd rails_health_checker
|
|
6
|
+
ruby simple_test.rb
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## 2. Test in Existing Rails App
|
|
10
|
+
|
|
11
|
+
### Add to Gemfile:
|
|
12
|
+
```ruby
|
|
13
|
+
gem 'rails_health_checker', path: '/path/to/rails_health_checker'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Run bundle:
|
|
17
|
+
```bash
|
|
18
|
+
bundle install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Test rake tasks:
|
|
22
|
+
```bash
|
|
23
|
+
rake health:check
|
|
24
|
+
rake health:gems
|
|
25
|
+
rake health:database
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Test HTTP endpoint:
|
|
29
|
+
```bash
|
|
30
|
+
# Start Rails server
|
|
31
|
+
rails server
|
|
32
|
+
|
|
33
|
+
# Test health endpoint
|
|
34
|
+
curl http://localhost:3000/health
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 3. Test with FinaSync Project
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cd /Users/arshdeepsingh/Desktop/personal/PROJECTS/FinaSync/FinaSync-rails
|
|
41
|
+
|
|
42
|
+
# Add gem to Gemfile
|
|
43
|
+
echo "gem 'rails_health_checker', path: '../rails_health_checker'" >> Gemfile
|
|
44
|
+
|
|
45
|
+
# Install
|
|
46
|
+
bundle install
|
|
47
|
+
|
|
48
|
+
# Test
|
|
49
|
+
rake health:check
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 4. RSpec Tests
|
|
53
|
+
```bash
|
|
54
|
+
cd rails_health_checker
|
|
55
|
+
bundle install
|
|
56
|
+
bundle exec rspec
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Expected Output:
|
|
60
|
+
- ✓ Version information
|
|
61
|
+
- ✓ Rails/Ruby version checks
|
|
62
|
+
- ✓ Database connectivity
|
|
63
|
+
- ✓ Gem dependency analysis
|
|
64
|
+
- ✓ HTTP health endpoint (200 OK)
|