sidekiq_queue_manager 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: decb676a394e280ac75b0a45c17541551d2191ad74205c57bf8cf5b333eb4341
4
+ data.tar.gz: ef24c3fd05b309c5df6eb852791238d8a458393f002d371c526b8fd3dc2512ed
5
+ SHA512:
6
+ metadata.gz: 553576ce338f3b59688ad806a5d227f021d2c2a0b84a775246724e1ba4e1c089a4f66ac796e7a155ce2da0da13b95bacd941287d31315c273b9e0a54f483f448
7
+ data.tar.gz: 100b3bdbf614358e6099721185ef05ed395620172fe743030cd1d64698c161afa72a75aac413cb6af450b0abef3dbbac48e71677909aa4031138c7c15a6ff032
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main, develop ]
8
+
9
+ jobs:
10
+ # ========================================
11
+ # Basic Build Test - Multiple Ruby versions
12
+ # ========================================
13
+ build:
14
+ runs-on: ubuntu-latest
15
+
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby-version: ['3.0', '3.1', '3.2', '3.3']
20
+
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Set up Ruby ${{ matrix.ruby-version }}
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ bundler-cache: true
30
+
31
+ - name: Install dependencies
32
+ run: bundle install
33
+
34
+ - name: Verify assets exist
35
+ run: bundle exec rake assets
36
+
37
+ - name: Build gem
38
+ run: gem build sidekiq_queue_manager.gemspec
39
+
40
+ - name: Test gem installation
41
+ run: gem install sidekiq_queue_manager-*.gem
data/INSTALLATION.md ADDED
@@ -0,0 +1,191 @@
1
+ # Sidekiq Queue Manager Installation Guide
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'sidekiq_queue_manager'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ ```bash
14
+ bundle install
15
+ ```
16
+
17
+ ## Quick Setup
18
+
19
+ ### **1. Set Authentication (REQUIRED)**
20
+
21
+ Create `config/initializers/sidekiq_queue_manager.rb`:
22
+
23
+ ```ruby
24
+ SidekiqQueueManager.configure do |config|
25
+ # REQUIRED: Set basic auth password (follows Sidekiq Web UI pattern)
26
+ config.basic_auth_password = 'your-secure-password-here'
27
+
28
+ # Optional: Protect critical queues
29
+ config.critical_queues = %w[mailers high_priority]
30
+ end
31
+ ```
32
+
33
+ **⚠️ Professional Standard**: Like Sidekiq Web UI, this gem requires explicit authentication configuration. You must set a password or configure custom authentication.
34
+
35
+ ### **2. Mount the Engine**
36
+
37
+ Add to your `config/routes.rb`:
38
+
39
+ ```ruby
40
+ Rails.application.routes.draw do
41
+ mount SidekiqQueueManager::Engine => '/sidekiq_manager'
42
+ # your other routes...
43
+ end
44
+ ```
45
+
46
+ ### **3. Access the Interface**
47
+
48
+ Visit `http://localhost:3000/sidekiq_manager` and login with:
49
+
50
+ - **Username**: `admin` (default)
51
+ - **Password**: `your-secure-password-here`
52
+
53
+ That's it! 🎉
54
+
55
+ ## Authentication Options
56
+
57
+ ### Basic HTTP Authentication (Default)
58
+
59
+ Following professional standards like Sidekiq Web UI, the gem uses explicit authentication:
60
+
61
+ ```ruby
62
+ SidekiqQueueManager.configure do |config|
63
+ config.basic_auth_password = 'your-secure-password'
64
+ config.basic_auth_username = 'admin' # optional, defaults to 'admin'
65
+ end
66
+ ```
67
+
68
+ ### Custom Authentication
69
+
70
+ Integrate with your existing Rails authentication system:
71
+
72
+ ```ruby
73
+ SidekiqQueueManager.configure do |config|
74
+ config.authentication_method = :authenticate_admin! # Your method name
75
+ config.basic_auth_enabled = false # Disable basic auth when using custom
76
+ end
77
+
78
+ # Then implement in your ApplicationController:
79
+ class ApplicationController < ActionController::Base
80
+ private
81
+
82
+ def authenticate_admin!
83
+ redirect_to login_path unless current_user&.admin?
84
+ end
85
+ end
86
+ ```
87
+
88
+ ### Disable Authentication (Development Only)
89
+
90
+ ```ruby
91
+ SidekiqQueueManager.configure do |config|
92
+ config.basic_auth_enabled = false # NOT recommended for production
93
+ end
94
+ ```
95
+
96
+ ### Professional Examples
97
+
98
+ #### Rails App with Devise
99
+
100
+ ```ruby
101
+ # config/initializers/sidekiq_queue_manager.rb
102
+ SidekiqQueueManager.configure do |config|
103
+ # Integrate with Devise authentication
104
+ config.authentication_method = :authenticate_user!
105
+ config.basic_auth_enabled = false
106
+ config.critical_queues = %w[mailers]
107
+ end
108
+ ```
109
+
110
+ #### Rails App with Custom Auth
111
+
112
+ ```ruby
113
+ # config/initializers/sidekiq_queue_manager.rb
114
+ SidekiqQueueManager.configure do |config|
115
+ # Use custom authentication method
116
+ config.authentication_method = :require_admin_access!
117
+ config.basic_auth_enabled = false
118
+ config.critical_queues = %w[mailers]
119
+ end
120
+ ```
121
+
122
+ #### API-only Rails App (No Authentication)
123
+
124
+ ```ruby
125
+ # config/initializers/sidekiq_queue_manager.rb
126
+ SidekiqQueueManager.configure do |config|
127
+ # Basic auth required for security
128
+ config.basic_auth_password = ENV['SIDEKIQ_ADMIN_PASSWORD']
129
+ config.critical_queues = %w[mailers]
130
+ end
131
+ ```
132
+
133
+ ## Advanced Configuration
134
+
135
+ For complete configuration options, see `examples/advanced_configuration.rb`.
136
+
137
+ ## What You DON'T Need to Configure
138
+
139
+ The gem handles these automatically:
140
+
141
+ - ✅ Asset compilation and loading (CSS, JavaScript, modals)
142
+ - ✅ Redis connection (uses Sidekiq's connection)
143
+ - ✅ Cache TTL and Redis key prefixes
144
+ - ✅ UI refresh rates and timeouts
145
+ - ✅ Default queue priorities
146
+
147
+ ## Troubleshooting
148
+
149
+ ### Configuration Error: Password Required
150
+
151
+ ```bash
152
+ basic_auth_password must be set when basic_auth_enabled is true
153
+ ```
154
+
155
+ **Solution**: Set a password in your configuration:
156
+
157
+ ```ruby
158
+ config.basic_auth_password = ENV['SIDEKIQ_ADMIN_PASSWORD']
159
+ ```
160
+
161
+ ### Runtime Error: Authentication Not Configured
162
+
163
+ If you see "Sidekiq Queue Manager: Authentication Not Configured" when accessing the interface:
164
+
165
+ **Cause**: You have `basic_auth_enabled = true` (default) but haven't set a password.
166
+
167
+ **Solution**: Add password to your `config/initializers/sidekiq_queue_manager.rb`:
168
+
169
+ ```ruby
170
+ SidekiqQueueManager.configure do |config|
171
+ config.basic_auth_password = 'your-secure-password'
172
+ end
173
+ ```
174
+
175
+ ### Missing Sidekiq Dependencies
176
+
177
+ If you see warnings about `sidekiq-limit_fetch`:
178
+
179
+ ```bash
180
+ sidekiq-limit_fetch not available
181
+ ```
182
+
183
+ **Solution**: This is normal and safe. The gem works without it but some advanced features may be limited.
184
+
185
+ ### Compatibility
186
+
187
+ - ✅ Rails 7.0+
188
+ - ✅ Sidekiq 7.0+
189
+ - ✅ Ruby 3.0+
190
+ - ✅ API-only Rails apps
191
+ - ✅ Standard Rails apps with asset pipeline
data/README.md ADDED
@@ -0,0 +1,376 @@
1
+ # 📊 Sidekiq Queue Manager
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/sidekiq_queue_manager.svg)](https://badge.fury.io/rb/sidekiq_queue_manager)
4
+ [![Rails](https://img.shields.io/badge/Rails-7.0%2B-red.svg)](https://rubyonrails.org)
5
+ [![Ruby](https://img.shields.io/badge/Ruby-3.0%2B-red.svg)](https://ruby-lang.org)
6
+ [![Sidekiq](https://img.shields.io/badge/Sidekiq-7.0%2B-orange.svg)](https://sidekiq.org)
7
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
+
9
+ **Professional Sidekiq queue monitoring and management interface for Rails applications.**
10
+
11
+ A modern, real-time web interface for monitoring and managing Sidekiq queues with zero configuration required. Perfect for production environments requiring professional queue monitoring capabilities.
12
+
13
+ ---
14
+
15
+ ## ✨ Features
16
+
17
+ ### 🚀 **Real-Time Queue Management**
18
+
19
+ - **Live Statistics** - Real-time queue metrics with 5-second auto-refresh
20
+ - **Universal Queue Discovery** - Automatically detects ALL Sidekiq queues
21
+ - **Pause/Resume Operations** - Individual and bulk queue control
22
+ - **Advanced Queue Controls** - Set limits, block queues, manage process limits
23
+ - **Job Management** - View, delete, and paginate through individual jobs
24
+
25
+ ### 🎨 **Professional Interface**
26
+
27
+ - **Modern UI/UX** - Dark-mode optimized responsive design
28
+ - **Live Pull Toggle** - Enable/disable real-time updates
29
+ - **Custom Modal System** - Professional confirmations and prompts
30
+ - **Mobile Responsive** - Optimized for all device sizes
31
+ - **Accessibility Ready** - ARIA labels, keyboard navigation, screen reader support
32
+
33
+ ### 🔒 **Enterprise Features**
34
+
35
+ - **Authentication Integration** - Configurable authentication methods
36
+ - **Critical Queue Protection** - Prevents accidental modification of important queues
37
+ - **Security Headers** - Built-in CSP and security middleware
38
+ - **Comprehensive Logging** - Configurable request and operation logging
39
+ - **Error Recovery** - Automatic retry logic and graceful error handling
40
+
41
+ ### ⚡ **Advanced Operations**
42
+
43
+ - **Queue Limits** - Set maximum job limits per queue
44
+ - **Process Limits** - Control how many processes can work on a queue
45
+ - **Queue Blocking** - Temporarily block queues from accepting new jobs
46
+ - **Bulk Operations** - Pause/resume multiple queues simultaneously
47
+ - **Job Inspection** - View job arguments, creation time, and metadata
48
+
49
+ ---
50
+
51
+ ## 🚀 Quick Start
52
+
53
+ ### Installation
54
+
55
+ Add to your Gemfile:
56
+
57
+ ```ruby
58
+ gem 'sidekiq_queue_manager'
59
+ ```
60
+
61
+ ```bash
62
+ bundle install
63
+ ```
64
+
65
+ ### Setup
66
+
67
+ Mount the engine in your routes:
68
+
69
+ ```ruby
70
+ # config/routes.rb
71
+ Rails.application.routes.draw do
72
+ mount SidekiqQueueManager::Engine, at: '/admin/queues'
73
+ # or mount at root level
74
+ # mount SidekiqQueueManager::Engine, at: '/queues'
75
+ end
76
+ ```
77
+
78
+ **That's it!** 🎉 Visit `/admin/queues` to access your professional queue management interface.
79
+
80
+ ---
81
+
82
+ ## ⚙️ Configuration
83
+
84
+ ### Basic Configuration
85
+
86
+ ```ruby
87
+ # config/initializers/sidekiq_queue_manager.rb
88
+ SidekiqQueueManager.configure do |config|
89
+ # Protect critical queues from bulk operations (recommended)
90
+ config.critical_queues = ['mailer', 'billing', 'notifications']
91
+
92
+ # Add authentication (recommended for production)
93
+ config.authentication_method = :authenticate_admin!
94
+
95
+ # Customize refresh interval (milliseconds)
96
+ config.refresh_interval = 5000
97
+
98
+ # Set theme preference
99
+ config.theme = 'auto' # 'auto', 'dark', 'light'
100
+ end
101
+ ```
102
+
103
+ ### Advanced Configuration
104
+
105
+ ```ruby
106
+ SidekiqQueueManager.configure do |config|
107
+ # Security & Performance
108
+ config.enable_csp = true
109
+ config.enable_caching = true
110
+ config.cache_ttl = 300
111
+
112
+ # Logging
113
+ config.enable_logging = true
114
+ config.log_level = :info
115
+
116
+ # Redis Configuration
117
+ config.redis_timeout = 5
118
+ config.redis_key_prefix = 'sqm'
119
+
120
+ # Default Queue Priorities
121
+ config.default_queue_priorities = {
122
+ 'critical' => 10,
123
+ 'high' => 7,
124
+ 'default' => 5,
125
+ 'low' => 1
126
+ }
127
+ end
128
+ ```
129
+
130
+ ### Authentication Integration
131
+
132
+ ```ruby
133
+ # config/initializers/sidekiq_queue_manager.rb
134
+ SidekiqQueueManager.configure do |config|
135
+ config.authentication_method = :authenticate_admin!
136
+ end
137
+
138
+ # In your ApplicationController
139
+ def authenticate_admin!
140
+ redirect_to login_path unless current_user&.admin?
141
+ end
142
+ ```
143
+
144
+ ---
145
+
146
+ ## 📖 Usage Guide
147
+
148
+ ### Dashboard Overview
149
+
150
+ The main dashboard provides:
151
+
152
+ - **Global Statistics** - Processed, failed, busy, and enqueued job counts
153
+ - **Queue Summary** - Total queues, paused queues, and total jobs
154
+ - **Live Controls** - Toggle real-time updates and manual refresh
155
+ - **Queue Table** - Detailed view of all queues with actions
156
+
157
+ ### Queue Operations
158
+
159
+ #### Individual Queue Actions
160
+
161
+ - **Pause/Resume** - Stop or start job processing for specific queues
162
+ - **View Jobs** - Browse jobs with pagination and search
163
+ - **Delete Jobs** - Remove specific jobs from queues
164
+ - **Set Limits** - Configure maximum jobs and process limits
165
+ - **Block/Unblock** - Prevent new jobs from being enqueued
166
+
167
+ #### Bulk Operations
168
+
169
+ - **Pause All** - Pause all non-critical queues simultaneously
170
+ - **Resume All** - Resume all paused queues
171
+ - **Critical Queue Protection** - Automatically protects specified critical queues
172
+
173
+ ### Advanced Features
174
+
175
+ #### Queue Limits
176
+
177
+ ```ruby
178
+ # Set maximum jobs in queue
179
+ # Via UI: Queue Actions → Set Queue Limit
180
+ # Prevents queue from growing beyond specified size
181
+ ```
182
+
183
+ #### Process Limits
184
+
185
+ ```ruby
186
+ # Set maximum Sidekiq processes working on queue
187
+ # Via UI: Queue Actions → Set Process Limit
188
+ # Controls parallel processing capacity
189
+ ```
190
+
191
+ #### Job Management
192
+
193
+ - **Pagination** - Navigate through large job lists
194
+ - **Job Details** - View arguments, creation time, retry count
195
+ - **Individual Deletion** - Remove problematic jobs
196
+ - **Bulk Clearing** - Clear entire queues (with confirmation)
197
+
198
+ ---
199
+
200
+ ## 🔌 API Reference
201
+
202
+ The gem provides a comprehensive REST API for programmatic access:
203
+
204
+ ### Global Endpoints
205
+
206
+ ```http
207
+ GET /metrics # Real-time queue statistics
208
+ GET /queues/summary # Queue summary statistics
209
+ POST /queues/pause_all # Pause all non-critical queues
210
+ POST /queues/resume_all # Resume all paused queues
211
+ ```
212
+
213
+ ### Queue-Specific Endpoints
214
+
215
+ ```http
216
+ GET /queues/:name/status # Get queue status
217
+ POST /queues/:name/pause # Pause specific queue
218
+ POST /queues/:name/resume # Resume specific queue
219
+ GET /queues/:name/jobs # List jobs (paginated)
220
+ DELETE /queues/:name/delete_job # Delete specific job
221
+ POST /queues/:name/clear # Clear all jobs in queue
222
+
223
+ # Advanced Operations
224
+ POST /queues/:name/set_limit # Set queue limit
225
+ DELETE /queues/:name/remove_limit # Remove queue limit
226
+ POST /queues/:name/set_process_limit # Set process limit
227
+ DELETE /queues/:name/remove_process_limit # Remove process limit
228
+ POST /queues/:name/block # Block queue
229
+ POST /queues/:name/unblock # Unblock queue
230
+ ```
231
+
232
+ ### Real-Time Updates
233
+
234
+ ```http
235
+ GET /live # Server-Sent Events stream for real-time updates
236
+ ```
237
+
238
+ ---
239
+
240
+ ## 🛡️ Security
241
+
242
+ ### Production Recommendations
243
+
244
+ 1. **Authentication Required**
245
+
246
+ ```ruby
247
+ config.authentication_method = :authenticate_admin!
248
+ ```
249
+
250
+ 2. **Network Security**
251
+
252
+ ```ruby
253
+ # Mount behind authentication
254
+ authenticated :admin do
255
+ mount SidekiqQueueManager::Engine, at: '/admin/queues'
256
+ end
257
+ ```
258
+
259
+ 3. **Critical Queue Protection**
260
+
261
+ ```ruby
262
+ config.critical_queues = ['billing', 'payments', 'notifications']
263
+ ```
264
+
265
+ ### Security Features
266
+
267
+ - **CSRF Protection** - Built-in Rails CSRF protection
268
+ - **Content Security Policy** - Configurable CSP headers
269
+ - **Request Logging** - Comprehensive request and action logging
270
+ - **Input Validation** - All parameters validated and sanitized
271
+
272
+ ---
273
+
274
+ ## 🚀 Deployment
275
+
276
+ ### Production Setup
277
+
278
+ After setting limits or process limits, restart your Sidekiq processes:
279
+
280
+ ```bash
281
+ # Systemd
282
+ sudo systemctl restart sidekiq
283
+
284
+ # Docker
285
+ docker-compose restart sidekiq
286
+
287
+ # Manual
288
+ kill -USR1 $(pgrep -f sidekiq)
289
+ ```
290
+
291
+ ### Docker Integration
292
+
293
+ ```dockerfile
294
+ # Dockerfile
295
+ FROM ruby:3.1
296
+ # ... your existing setup
297
+
298
+ # The gem works seamlessly in containerized environments
299
+ RUN bundle install
300
+ ```
301
+
302
+ ### Heroku Deployment
303
+
304
+ The gem works out-of-the-box on Heroku with no additional configuration needed.
305
+
306
+ ---
307
+
308
+ ## 📋 Requirements
309
+
310
+ - **Ruby** 3.0 or higher
311
+ - **Rails** 7.0 or higher
312
+ - **Sidekiq** 7.0 or higher
313
+ - **Redis** (required by Sidekiq)
314
+
315
+ ### Compatibility
316
+
317
+ - ✅ **Sidekiq Pro/Enterprise** - Full compatibility
318
+ - ✅ **Multi-process Sidekiq** - Advanced process management
319
+ - ✅ **Existing Sidekiq setups** - Zero breaking changes
320
+ - ✅ **All queue types** - Works with any Sidekiq job
321
+ - ✅ **Docker/Kubernetes** - Container-ready
322
+ - ✅ **Heroku/Cloud platforms** - Platform-agnostic
323
+
324
+ ---
325
+
326
+ ## 🤝 Contributing
327
+
328
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
329
+
330
+ ### Development Setup
331
+
332
+ ```bash
333
+ git clone https://github.com/jamalawd/sidekiq_queue_manager.git
334
+ cd sidekiq_queue_manager
335
+ bundle install
336
+
337
+ # Run tests
338
+ bundle exec rspec
339
+
340
+ # Start development server
341
+ cd spec/dummy
342
+ rails server
343
+ ```
344
+
345
+ ### Reporting Bugs
346
+
347
+ Please use our [Issue Tracker](https://github.com/jamalawd/sidekiq_queue_manager/issues) to report bugs or request features.
348
+
349
+ ---
350
+
351
+ ## 📄 License
352
+
353
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
354
+
355
+ ---
356
+
357
+ ## 🙏 Acknowledgments
358
+
359
+ - Built with ❤️ for the Ruby and Rails community by [Jamal Awad](https://github.com/jamalawd)
360
+ - Powered by [Sidekiq](https://sidekiq.org) - Simple, efficient background processing
361
+ - Designed for production environments requiring professional queue management
362
+
363
+ ---
364
+
365
+ ## 📞 Support
366
+
367
+ - **Documentation**: [GitHub Wiki](https://github.com/jamalawd/sidekiq_queue_manager/wiki)
368
+ - **Issues**: [GitHub Issues](https://github.com/jamalawd/sidekiq_queue_manager/issues)
369
+ - **Discussions**: [GitHub Discussions](https://github.com/jamalawd/sidekiq_queue_manager/discussions)
370
+
371
+ ---
372
+
373
+ **Created and maintained by [Jamal Awad](https://github.com/jamalawd)**
374
+ *Ruby enthusiast, tech lead, & architect passionate about open-source development*
375
+
376
+ *Transform your Sidekiq monitoring experience with professional-grade queue management.*