Skip to content

Commit aa632a2

Browse files
committed
Rename project
1 parent 57db777 commit aa632a2

File tree

9 files changed

+282
-35
lines changed

9 files changed

+282
-35
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 1.0.0 (2025-11-11)
2+
3+
- New: Fuzzy find search across jobs
4+
- New: "Run now" — run any job immediately from the index page
5+
- New: View the Ruby implementation of each job
6+
- New: Highlight overdue jobs at a glance
7+
- New: Hourly health check callback via `ClockworkWebPlus.on_health_check`, with detailed overdue context
8+
- New: Redesigned jobs table with a sleeker, modern UI
9+
10+
Note: Versions prior to 1.0.0 (0.x.y) correspond to the original `clockwork_web` project by ankane. See `https://github.com/ankane/clockwork_web`.
11+
112
## 0.3.1 (2024-09-04)
213

314
- Improved CSP support

README.md

Lines changed: 95 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,169 @@
1-
# Clockwork Web
1+
# Clockwork Web Plus
22

3-
A web interface for [Clockwork](https://github.com/Rykian/clockwork)
3+
A fully compatible drop-in enhancement to [ankane/clockwork_web](https://github.com/ankane/clockwork_web), providing a modern web interface for [Clockwork](https://github.com/Rykian/clockwork) with fuzzy search, manual job run, overdue visibility, and hourly health checks.
44

5-
[View the demo](https://clockwork.dokkuapp.com/)
5+
[![Build Status](https://github.com/chaadow/clockwork_web_plus/actions/workflows/build.yml/badge.svg)](https://github.com/chaadow/clockwork_web_plus/actions/workflows/build.yml)
6+
7+
## Preview
8+
9+
<video src="https://github.com/user-attachments/assets/d145a4d5-834d-4c0d-9f11-397272b2d013" controls muted playsinline loop>
10+
Sorry, your browser doesn't support embedded videos. Here’s a <a href="https://github.com/user-attachments/assets/d145a4d5-834d-4c0d-9f11-397272b2d013">direct link</a>.
11+
</video>
12+
13+
## Features
14+
15+
### Core (from `clockwork_web`)
616

717
- see list of jobs
8-
- monitor jobs
9-
- disable jobs
18+
- monitor jobs ( when they were last run at)
19+
- Temporarily disable jobs
1020

11-
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
21+
### New compared to clockwork_web
1222

13-
[![Build Status](https://github.com/ankane/clockwork_web/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/clockwork_web/actions)
23+
- fuzzy find search across jobs
24+
- run any job immediately through the `Run now` button
25+
- view the Ruby implementation of each job
26+
- highlight overdue jobs at a glance
27+
- optional hourly health check callback with custom alerting
1428

1529
## Installation
1630

1731
Add this line to your application’s Gemfile:
1832

1933
```ruby
20-
gem "clockwork_web"
34+
gem "clockwork_web_plus"
2135
```
2236

37+
> [!TIP]
38+
> Already using `clockwork_web`? Keep your existing `ClockworkWeb::Engine` mount and initializers—no renaming needed. `ClockworkWebPlus` aliases `ClockworkWeb`, so it works out of the box.
39+
2340
And add it to your `config/routes.rb`.
2441

2542
```ruby
26-
mount ClockworkWeb::Engine, at: "clockwork"
43+
mount ClockworkWebPlus::Engine, at: "clockwork"
2744
```
2845

29-
Be sure to secure the dashboard in production.
46+
> [!IMPORTANT]
47+
> Secure the dashboard in production. Protect access with Basic Auth, Devise, or your app’s auth layer to avoid exposing job controls and status.
3048
3149
To monitor and disable jobs, hook up Redis in an initializer.
3250

3351
```ruby
34-
ClockworkWeb.redis = Redis.new
52+
ClockworkWebPlus.redis = Redis.new
3553
```
3654

3755
#### Basic Authentication
3856

3957
Set the following variables in your environment or an initializer.
4058

4159
```ruby
42-
ENV["CLOCKWORK_USERNAME"] = "andrew"
60+
ENV["CLOCKWORK_USERNAME"] = "chaadow"
4361
ENV["CLOCKWORK_PASSWORD"] = "secret"
4462
```
4563

64+
> [!NOTE]
65+
> These are example credentials. Use environment-specific secrets and rotate them regularly.
66+
4667
#### Devise
4768

4869
```ruby
4970
authenticate :user, ->(user) { user.admin? } do
50-
mount ClockworkWeb::Engine, at: "clockwork"
71+
mount ClockworkWebPlus::Engine, at: "clockwork"
5172
end
5273
```
5374

75+
> [!TIP]
76+
> Any authentication framework works—wrap the mount with whatever guard your app already uses for admin/ops access.
77+
5478
## Monitoring
5579

5680
```ruby
57-
ClockworkWeb.running?
58-
ClockworkWeb.multiple?
81+
ClockworkWebPlus.running?
82+
ClockworkWebPlus.multiple?
5983
```
6084

85+
> [!NOTE]
86+
> `running?` reflects recent heartbeats. `multiple?` indicates multiple active Clockwork processes (based on heartbeat contention).
87+
6188
## Customize
6289

6390
Change clock path
6491

6592
```ruby
66-
ClockworkWeb.clock_path = Rails.root.join("clock") # default
93+
ClockworkWebPlus.clock_path = Rails.root.join("clock") # default
6794
```
6895

96+
> [!NOTE]
97+
> The default `clock_path` matches `clockwork_web`. Change it only if your clock file lives elsewhere.
98+
6999
Turn off monitoring
70100

71101
```ruby
72-
ClockworkWeb.monitor = false
102+
ClockworkWebPlus.monitor = false
103+
```
104+
105+
> [!CAUTION]
106+
> Disabling monitoring stops heartbeats and multiple-process detection. The dashboard won’t show “running” status, but other features still work.
107+
108+
### Overdue Jobs & Health Checks
109+
110+
The dashboard highlights overdue jobs based on schedule and last run. You can also configure an hourly health check to alert when jobs are overdue:
111+
112+
```ruby
113+
ClockworkWebPlus.on_health_check = ->(overdue_jobs:) do
114+
# backlog contains array of hashes with details like:
115+
# { job:, should_have_run_at:, last_run:, period:, at: { hour:, min: } }
116+
if overdue_jobs.any?
117+
# send notification to Slack, email, etc.
118+
end
119+
end
73120
```
74121

122+
> [!NOTE]
123+
> Overdue detection uses `ClockworkWebPlus.warning_threshold` (default: 300 seconds).
124+
> - For `@at` schedules: a job is overdue when the most recent scheduled time has passed by more than `warning_threshold` and the job hasn’t run since that time.
125+
> - For periodic jobs (no `@at`): a job is overdue when `now > last_run + period + warning_threshold`.
126+
>
127+
> Example:
128+
> ```ruby
129+
> # consider jobs overdue 10 minutes after their expected time
130+
> ClockworkWebPlus.warning_threshold = 600
131+
> ```
132+
133+
> [!IMPORTANT]
134+
> With Redis configured, the health check runs at most once per hour across processes. Without Redis, throttling is per-process and approximate.
135+
75136
## History
76137
77138
View the [changelog](CHANGELOG.md)
78139
140+
## Compatibility
141+
142+
This gem is a drop-in replacement for `clockwork_web`. For backward compatibility, the original namespace is aliased:
143+
144+
```ruby
145+
# Both of these work:
146+
mount ClockworkWebPlus::Engine, at: "clockwork"
147+
mount ClockworkWeb::Engine, at: "clockwork"
148+
```
149+
150+
> [!TIP]
151+
> Adopting this gem can be as simple as swapping the gem name in your Gemfile. Your existing `ClockworkWeb` mounts and initializers continue to work unchanged.
152+
79153
## Contributing
80154

81155
Everyone is encouraged to help improve this project. Here are a few ways you can help:
82156

83-
- [Report bugs](https://github.com/ankane/clockwork_web/issues)
84-
- Fix bugs and [submit pull requests](https://github.com/ankane/clockwork_web/pulls)
157+
- [Report bugs](https://github.com/chaadow/clockwork_web_plus/issues)
158+
- Fix bugs and [submit pull requests](https://github.com/chaadow/clockwork_web_plus/pulls)
85159
- Write, clarify, or fix documentation
86160
- Suggest or add new features
87161

88162
To get started with development:
89163

90164
```sh
91-
git clone https://github.com/ankane/clockwork_web.git
92-
cd clockwork_web
165+
git clone https://github.com/chaadow/clockwork_web_plus.git
166+
cd clockwork_web_plus
93167
bundle install
94168
bundle exec rake test
95169
```

app/views/clockwork_web/home/index.html.erb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@
108108
background: #fffbeb;
109109
}
110110

111+
.badge.danger {
112+
color: var(--danger-600);
113+
border-color: rgba(220,38,38,0.18);
114+
background: var(--danger-50);
115+
}
116+
111117
.badge.info {
112118
color: var(--muted);
113119
background: #f8fafc;
@@ -337,11 +343,11 @@
337343
<tr class="<%= [enabled ? nil : 'row-disabled', is_overdue ? 'row-warning' : nil].compact.join(' ') %>">
338344
<td data-col="job">
339345
<strong><%= event.job %></strong>
340-
<% if is_overdue %>
341-
&nbsp;<span title="Overdue">⚠️</span>
342-
<% end %>
343346
<% unless enabled %>
344-
<div class="meta">Disabled</div>
347+
&nbsp;<span class="badge danger" title="Job is disabled">Disabled</span>
348+
<% end %>
349+
<% if is_overdue %>
350+
&nbsp;<span class="badge warn" title="Job is overdue">Overdue</span>
345351
<% end %>
346352
</td>
347353
<td data-col="schedule">

clockwork_web.gemspec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
require_relative "lib/clockwork_web/version"
1+
require_relative "lib/clockwork_web_plus/version"
22

33
Gem::Specification.new do |spec|
4-
spec.name = "clockwork_web"
5-
spec.version = ClockworkWeb::VERSION
6-
spec.summary = "A web interface for Clockwork"
7-
spec.homepage = "https://github.com/ankane/clockwork_web"
4+
spec.name = "clockwork_web_plus"
5+
spec.version = ClockworkWebPlus::VERSION
6+
spec.summary = "A modern web interface for Clockwork with search, run-now & health checks"
7+
spec.homepage = "https://github.com/chedli/clockwork_web_plus"
88
spec.license = "MIT"
99

10-
spec.author = "Andrew Kane"
11-
spec.email = "[email protected]"
10+
spec.authors = ["Andrew Kane", "Chedli Bourguiba"]
11+
spec.email = ["[email protected]"]
1212

1313
spec.files = Dir["*.{md,txt}", "{app,config,lib}/**/*"]
1414
spec.require_path = "lib"

lib/clockwork_web.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def self.health_check
131131

132132
events = Clockwork.manager.events
133133
last_runs = ClockworkWeb.last_runs
134-
overdue = ClockworkWeb.overdue_details(events, last_runs)
135-
ClockworkWeb.on_health_check.call(overdue: overdue) if overdue.any?
134+
overdue_jobs = ClockworkWeb.overdue_details(events, last_runs)
135+
ClockworkWeb.on_health_check.call(overdue_jobs: overdue_jobs) if overdue_jobs.any?
136136
end
137137

138138
# Returns the last time this event should have run before now.

lib/clockwork_web/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ClockworkWeb
2-
VERSION = "0.3.1"
2+
VERSION = "1.0.0"
33
end

lib/clockwork_web_plus.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "clockwork_web"
2+
3+
# New namespace that aliases the original, for easy drop-in replacement.
4+
ClockworkWebPlus = ClockworkWeb unless defined?(ClockworkWebPlus)
5+
6+

lib/clockwork_web_plus/version.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module ClockworkWebPlus
2+
VERSION = "1.0.0"
3+
end
4+
5+

0 commit comments

Comments
 (0)