solid_bro 0.1.2
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/MIT-LICENSE +20 -0
- data/README.md +133 -0
- data/Rakefile +15 -0
- data/app/assets/javascripts/solid_bro/application.js +25 -0
- data/app/assets/stylesheets/solid_bro/application.css +636 -0
- data/app/assets/stylesheets/solid_bro/core.css +0 -0
- data/app/controllers/solid_bro/application_controller.rb +29 -0
- data/app/controllers/solid_bro/jobs_controller.rb +99 -0
- data/app/controllers/solid_bro/processes_controller.rb +7 -0
- data/app/controllers/solid_bro/queues_controller.rb +25 -0
- data/app/controllers/solid_bro/recurring_tasks_controller.rb +9 -0
- data/app/helpers/solid_bro/application_helper.rb +38 -0
- data/app/jobs/solid_bro/application_job.rb +4 -0
- data/app/mailers/solid_bro/application_mailer.rb +6 -0
- data/app/models/solid_bro/application_record.rb +5 -0
- data/app/views/layouts/solid_bro/application.html.erb +56 -0
- data/app/views/solid_bro/jobs/index.html.erb +139 -0
- data/app/views/solid_bro/jobs/show.html.erb +73 -0
- data/app/views/solid_bro/processes/index.html.erb +37 -0
- data/app/views/solid_bro/queues/index.html.erb +44 -0
- data/app/views/solid_bro/recurring_tasks/index.html.erb +35 -0
- data/config/initializers/pagy.rb +15 -0
- data/config/routes.rb +21 -0
- data/lib/generators/solid_bro/install/install_generator.rb +56 -0
- data/lib/solid_bro/engine.rb +42 -0
- data/lib/solid_bro/version.rb +3 -0
- data/lib/solid_bro.rb +8 -0
- data/lib/tasks/solid_bro_tasks.rake +53 -0
- metadata +130 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0575114fea552d5585ae04378861ae261cdc27e99feb5ddd669b87c25cb43062
|
|
4
|
+
data.tar.gz: 591212912d620f5567e875d9c9e533f9b9579608fffbb4e2ff54cc8498aca842
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f8fe6346ca1fcf4a0cfd322c4d0024c72b32a6e990aa6813518c8abbc9f71dd7ab8a362c92c395737517dfc51322cbdd57076910e726672db18ae468253526ca
|
|
7
|
+
data.tar.gz: e85ceae138bb5fc6a9777171bd876697a0bb89c85aa54261c2f08e0a66e2c4a0d815a7a793cf3c98070938abf9bd37202d137577ea40c3f778814c6c30657361
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright Emanuel Comsa
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# SolidBro
|
|
2
|
+
|
|
3
|
+
A web UI dashboard for managing SolidQueue jobs, queues, workers, and recurring tasks in Rails applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Job Management**: View all jobs with filtering by class name, queue name, and date ranges
|
|
8
|
+
- **Job Scopes**: Filter by status (All, Failed, In Progress, Blocked, Scheduled, Finished)
|
|
9
|
+
- **Pagination**: Built-in pagination using Pagy
|
|
10
|
+
- **Queue Management**: View queues with job counts
|
|
11
|
+
- **Worker Monitoring**: Monitor SolidQueue worker processes
|
|
12
|
+
- **Recurring Tasks**: View and manage recurring job tasks
|
|
13
|
+
- **Job Details**: Detailed job view with formatted arguments and exception information
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Add this line to your application's Gemfile:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem "solid_bro"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
And then execute:
|
|
24
|
+
```bash
|
|
25
|
+
$ bundle install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
### 1. Mount the Engine
|
|
31
|
+
|
|
32
|
+
Add the engine to your main application's routes file (`config/routes.rb`):
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
Rails.application.routes.draw do
|
|
36
|
+
# Your existing routes...
|
|
37
|
+
|
|
38
|
+
mount SolidBro::Engine => "/solid_bro"
|
|
39
|
+
end
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will make the dashboard available at `/solid_bro` in your application.
|
|
43
|
+
|
|
44
|
+
### 1.1. Protecting the Dashboard with HTTP Basic Auth
|
|
45
|
+
|
|
46
|
+
Authentication is handled by the host application. A simple way to protect the SolidBro UI is to wrap the engine in HTTP Basic auth in an initializer:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
# config/initializers/solid_bro.rb
|
|
50
|
+
|
|
51
|
+
if Rails.env.production?
|
|
52
|
+
SolidBro::Engine.middleware.use Rack::Auth::Basic, "SolidBro" do |username, password|
|
|
53
|
+
# Use environment variables so credentials are not hard‑coded
|
|
54
|
+
ActiveSupport::SecurityUtils.secure_compare(username, ENV.fetch("SOLID_BRO_USER")) &
|
|
55
|
+
ActiveSupport::SecurityUtils.secure_compare(password, ENV.fetch("SOLID_BRO_PASSWORD"))
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Set the credentials in your environment (for example in `credentials.yml.enc`, your deployment environment, or `.env`):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
SOLID_BRO_USER=admin
|
|
64
|
+
SOLID_BRO_PASSWORD=super-secret
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
You can also choose to integrate with your existing authentication system instead of HTTP Basic (e.g. only allow signed‑in admins) by adding the appropriate middleware or constraints around the engine mount in your app.
|
|
68
|
+
|
|
69
|
+
### 2. Configure SolidQueue (if not already done)
|
|
70
|
+
|
|
71
|
+
Make sure SolidQueue is configured in your application. Add to `config/application.rb`:
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
config.active_job.queue_adapter = :solid_queue
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 3. Run Migrations
|
|
78
|
+
|
|
79
|
+
Ensure SolidQueue migrations are run:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
rails solid_queue:install:migrations
|
|
83
|
+
rails db:migrate
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 4. Assets Setup
|
|
87
|
+
|
|
88
|
+
**For Propshaft (Rails 7+ default)**: Assets are automatically added to your `manifest.js` in development/test environments. For production, you can run:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
rails generate solid_bro:install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Or manually add to `app/assets/config/manifest.js`:
|
|
95
|
+
```javascript
|
|
96
|
+
//= link solid_bro/application.css
|
|
97
|
+
//= link solid_bro/application.js
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**For Sprockets**: Assets are automatically precompiled - no additional setup needed.
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
Once mounted, access the dashboard at:
|
|
105
|
+
|
|
106
|
+
- **Jobs**: `/solid_bro/jobs` (or `/solid_bro/` as the root)
|
|
107
|
+
- **Queues**: `/solid_bro/queues`
|
|
108
|
+
- **Workers**: `/solid_bro/workers`
|
|
109
|
+
- **Recurring Tasks**: `/solid_bro/recurring-tasks`
|
|
110
|
+
|
|
111
|
+
### Job Filtering
|
|
112
|
+
|
|
113
|
+
The jobs index supports filtering by:
|
|
114
|
+
- **Job class name**: Case-insensitive partial match
|
|
115
|
+
- **Queue name**: Case-insensitive partial match
|
|
116
|
+
- **Date range**: Filter by created_at (for all/failed/in_progress/blocked/scheduled) or finished_at (for finished jobs)
|
|
117
|
+
|
|
118
|
+
### Job Actions
|
|
119
|
+
|
|
120
|
+
- **Retry**: Retry a failed job (available on failed jobs)
|
|
121
|
+
- **Discard**: Delete a job from the queue
|
|
122
|
+
|
|
123
|
+
## Requirements
|
|
124
|
+
|
|
125
|
+
- Rails >= 7.0
|
|
126
|
+
- SolidQueue gem
|
|
127
|
+
- Pagy >= 8.0
|
|
128
|
+
|
|
129
|
+
## Contributing
|
|
130
|
+
Contribution directions go here.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "bundler/setup"
|
|
2
|
+
|
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
|
4
|
+
load "rails/tasks/engine.rake"
|
|
5
|
+
|
|
6
|
+
require "bundler/gem_tasks"
|
|
7
|
+
|
|
8
|
+
begin
|
|
9
|
+
require "rspec/core/rake_task"
|
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
11
|
+
rescue LoadError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
task default: :spec
|
|
15
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
2
|
+
console.log('Dashboard initialized');
|
|
3
|
+
|
|
4
|
+
// Add interactivity to buttons
|
|
5
|
+
const deleteButtons = document.querySelectorAll('.btn-danger');
|
|
6
|
+
deleteButtons.forEach(btn => {
|
|
7
|
+
btn.addEventListener('click', (e) => {
|
|
8
|
+
if(confirm('Are you sure you want to delete this user?')) {
|
|
9
|
+
const row = e.target.closest('tr');
|
|
10
|
+
row.style.opacity = '0.5';
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
alert('User deleted (mock action)');
|
|
13
|
+
row.style.opacity = '1';
|
|
14
|
+
}, 500);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const editButtons = document.querySelectorAll('.btn-icon:not(.btn-danger)');
|
|
20
|
+
editButtons.forEach(btn => {
|
|
21
|
+
btn.addEventListener('click', () => {
|
|
22
|
+
console.log('Edit clicked');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|