good_job 2.5.0 → 2.7.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +69 -0
  3. data/README.md +58 -1
  4. data/engine/app/assets/scripts.js +1 -0
  5. data/engine/app/assets/style.css +5 -0
  6. data/engine/app/assets/vendor/chartjs/chart.min.js +13 -0
  7. data/engine/app/assets/vendor/rails_ujs.js +747 -0
  8. data/engine/app/charts/good_job/scheduled_by_queue_chart.rb +69 -0
  9. data/engine/app/controllers/good_job/assets_controller.rb +8 -4
  10. data/engine/app/controllers/good_job/base_controller.rb +19 -0
  11. data/engine/app/controllers/good_job/cron_entries_controller.rb +19 -0
  12. data/engine/app/filters/good_job/base_filter.rb +12 -54
  13. data/engine/app/filters/good_job/executions_filter.rb +9 -8
  14. data/engine/app/filters/good_job/jobs_filter.rb +9 -8
  15. data/engine/app/views/good_job/cron_entries/index.html.erb +51 -0
  16. data/engine/app/views/good_job/cron_entries/show.html.erb +4 -0
  17. data/engine/app/views/good_job/{shared/_executions_table.erb → executions/_table.erb} +1 -1
  18. data/engine/app/views/good_job/executions/index.html.erb +2 -2
  19. data/engine/app/views/good_job/{shared/_jobs_table.erb → jobs/_table.erb} +4 -4
  20. data/engine/app/views/good_job/jobs/index.html.erb +2 -2
  21. data/engine/app/views/good_job/jobs/show.html.erb +2 -2
  22. data/engine/app/views/good_job/shared/_chart.erb +19 -46
  23. data/engine/app/views/good_job/shared/_filter.erb +27 -13
  24. data/engine/app/views/good_job/shared/icons/_play.html.erb +4 -0
  25. data/engine/app/views/layouts/good_job/base.html.erb +6 -4
  26. data/engine/config/routes.rb +10 -3
  27. data/{engine/app/models → lib}/good_job/active_job_job.rb +2 -19
  28. data/lib/good_job/cli.rb +8 -0
  29. data/lib/good_job/configuration.rb +8 -1
  30. data/lib/good_job/cron_entry.rb +75 -4
  31. data/lib/good_job/cron_manager.rb +1 -5
  32. data/lib/good_job/current_thread.rb +26 -8
  33. data/lib/good_job/execution.rb +16 -31
  34. data/lib/good_job/filterable.rb +42 -0
  35. data/lib/good_job/notifier.rb +17 -7
  36. data/lib/good_job/probe_server.rb +51 -0
  37. data/lib/good_job/version.rb +1 -1
  38. metadata +41 -21
  39. data/engine/app/assets/vendor/chartist/chartist.css +0 -613
  40. data/engine/app/assets/vendor/chartist/chartist.js +0 -4516
  41. data/engine/app/controllers/good_job/cron_schedules_controller.rb +0 -9
  42. data/engine/app/views/good_job/cron_schedules/index.html.erb +0 -72
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a173683ec5e5879728536005c7dfd11827ffe87c268c59315f540911277f2df
4
- data.tar.gz: a5990d902838da25344ff96fc859bad39803f70f888dd95de8e3e6c201da4b0f
3
+ metadata.gz: f44a377e368104479ccd928977d0c99c673e468fdcce61530cdfef1ee045c61d
4
+ data.tar.gz: 3a5b29ba222be53ee571036ed27275517cb810a03bbd9b6fa5733b215742ef50
5
5
  SHA512:
6
- metadata.gz: 92378343ecf6f3750a98ac1e146c748e7440b267fad30ac04eaf984649e5640fad8cfdd58b9c627bb7f7792202a849222ee7ed7583b7ac847f2d15839c25519f
7
- data.tar.gz: f093bda085b00d82210e9bcf02ed6e39fec556aeeaa17c6f73a9465119867833f3145905482a20ec57840ae6bb6fa350f79e64209425cef8db9f45c0b59c4ea0
6
+ metadata.gz: 833b35f3faa5660d45e14adbb15d2b6f65c7a7cbc127ae0d6d9085844e55fe33c6c1b02cbb6196f5f753bdf7ec76cff18a1976cef3ca26288960f6028c6d3fac
7
+ data.tar.gz: def64d311e93139e7232fddd9aec1f0c0e0ff49696680dede67f87705d3a0dbc9338d083f1f2a22fdfff572465032c6ec75c97dee1ece7ffac20ca46c76fdc6c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # Changelog
2
2
 
3
+ ## [v2.7.0](https://github.com/bensheldon/good_job/tree/v2.7.0) (2021-11-10)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.6.2...v2.7.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add http probe for CLI healthcheck/readiness/liveliness [\#452](https://github.com/bensheldon/good_job/pull/452) ([bensheldon](https://github.com/bensheldon))
10
+ - Add explicit Content Security Policy \(CSP\) for Dashboard [\#449](https://github.com/bensheldon/good_job/pull/449) ([bensheldon](https://github.com/bensheldon))
11
+
12
+ **Closed issues:**
13
+
14
+ - Add a default Content-Security-Policy for the Dashboard [\#420](https://github.com/bensheldon/good_job/issues/420)
15
+
16
+ ## [v2.6.2](https://github.com/bensheldon/good_job/tree/v2.6.2) (2021-11-05)
17
+
18
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.6.1...v2.6.2)
19
+
20
+ **Fixed bugs:**
21
+
22
+ - Rename Filterable\#search to Filterable\#search\_text to avoid name collision [\#451](https://github.com/bensheldon/good_job/pull/451) ([bensheldon](https://github.com/bensheldon))
23
+
24
+ **Closed issues:**
25
+
26
+ - v2.6.1 is incompatible with gem thinking-sphinx [\#450](https://github.com/bensheldon/good_job/issues/450)
27
+
28
+ ## [v2.6.1](https://github.com/bensheldon/good_job/tree/v2.6.1) (2021-11-05)
29
+
30
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.6.0...v2.6.1)
31
+
32
+ **Implemented enhancements:**
33
+
34
+ - Allow job management \(retry, destroy\) through the Web UI [\#256](https://github.com/bensheldon/good_job/issues/256)
35
+ - Add fulltext search filter [\#440](https://github.com/bensheldon/good_job/pull/440) ([bensheldon](https://github.com/bensheldon))
36
+
37
+ **Fixed bugs:**
38
+
39
+ - Unsubscribed LISTEN forever after database connection lost [\#303](https://github.com/bensheldon/good_job/issues/303)
40
+ - Add `PG::UnableToSend` and `PG::Error` as a Notifier connection error [\#445](https://github.com/bensheldon/good_job/pull/445) ([bensheldon](https://github.com/bensheldon))
41
+
42
+ **Closed issues:**
43
+
44
+ - Question: what's the correct way to handle database connection pool size when using cron [\#443](https://github.com/bensheldon/good_job/issues/443)
45
+ - Add a search bar to Dashboard [\#432](https://github.com/bensheldon/good_job/issues/432)
46
+ - Hacktoberfest 2021 [\#393](https://github.com/bensheldon/good_job/issues/393)
47
+ - Ideas for improvements to Cron [\#392](https://github.com/bensheldon/good_job/issues/392)
48
+ - Fix flakey test that times out [\#382](https://github.com/bensheldon/good_job/issues/382)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Update development dependencies [\#447](https://github.com/bensheldon/good_job/pull/447) ([bensheldon](https://github.com/bensheldon))
53
+ - Replace Chartist.js with Chart.js [\#444](https://github.com/bensheldon/good_job/pull/444) ([bensheldon](https://github.com/bensheldon))
54
+ - Fix JRuby flake: "Scheduler\#create\_thread returns false if there are no threads available" [\#442](https://github.com/bensheldon/good_job/pull/442) ([bensheldon](https://github.com/bensheldon))
55
+
56
+ ## [v2.6.0](https://github.com/bensheldon/good_job/tree/v2.6.0) (2021-10-30)
57
+
58
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.5.0...v2.6.0)
59
+
60
+ **Implemented enhancements:**
61
+
62
+ - Allow for cron schedules to be expressed using fugit natural language parsing [\#441](https://github.com/bensheldon/good_job/pull/441) ([jgrau](https://github.com/jgrau))
63
+ - Add Rails UJS javascript to Dashboard along with confirmations [\#437](https://github.com/bensheldon/good_job/pull/437) ([bensheldon](https://github.com/bensheldon))
64
+ - Reorganize Cron dashboard screen; add jobs drill-drown and enqueue-now action [\#436](https://github.com/bensheldon/good_job/pull/436) ([bensheldon](https://github.com/bensheldon))
65
+
66
+ **Closed issues:**
67
+
68
+ - Ability to express cron schedule using fugit natural language parser [\#439](https://github.com/bensheldon/good_job/issues/439)
69
+ - Best way to ensure ordering of a queue. [\#402](https://github.com/bensheldon/good_job/issues/402)
70
+ - ActiveJob concurrency raises FrozenError [\#386](https://github.com/bensheldon/good_job/issues/386)
71
+
3
72
  ## [v2.5.0](https://github.com/bensheldon/good_job/tree/v2.5.0) (2021-10-25)
4
73
 
5
74
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.4.2...v2.5.0)
data/README.md CHANGED
@@ -55,6 +55,7 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
55
55
  - [Migrate to GoodJob from a different ActiveJob backend](#migrate-to-goodjob-from-a-different-activejob-backend)
56
56
  - [Monitor and preserve worked jobs](#monitor-and-preserve-worked-jobs)
57
57
  - [PgBouncer compatibility](#pgbouncer-compatibility)
58
+ - [CLI HTTP health check probes](#cli-http-healthcheck-probes)
58
59
  - [Contribute](#contribute)
59
60
  - [Gem development](#gem-development)
60
61
  - [Release](#release)
@@ -170,6 +171,7 @@ Options:
170
171
  [--enable-cron] # Whether to run cron process (default: false)
171
172
  [--daemonize] # Run as a background daemon (default: false)
172
173
  [--pidfile=PIDFILE] # Path to write daemonized Process ID (env var: GOOD_JOB_PIDFILE, default: tmp/pids/good_job.pid)
174
+ [--probe-port=PORT] # Port for http health check (env var: GOOD_JOB_PROBE_PORT, default: nil)
173
175
 
174
176
  Executes queued jobs.
175
177
 
@@ -401,7 +403,7 @@ GoodJob can enqueue jobs on a recurring basis that can be used as a replacement
401
403
 
402
404
  Cron-style jobs are run on every GoodJob process (e.g. CLI or `async` execution mode) when `config.good_job.enable_cron = true`, but GoodJob's cron uses unique indexes to ensure that only a single job is enqeued at the given time interval.
403
405
 
404
- Cron-format is parsed by the [`fugit`](https://github.com/floraison/fugit) gem, which has support for seconds-level resolution (e.g. `* * * * * *`).
406
+ Cron-format is parsed by the [`fugit`](https://github.com/floraison/fugit) gem, which has support for seconds-level resolution (e.g. `* * * * * *`) and natural language parsing (e.g. `every second`).
405
407
 
406
408
  ```ruby
407
409
  # config/environments/application.rb or a specific environment e.g. production.rb
@@ -837,6 +839,61 @@ A workaround to this limitation is to make a direct database connection availabl
837
839
  GoodJob.active_record_parent_class = "ApplicationDirectRecord"
838
840
  ```
839
841
 
842
+ ### CLI HTTP health check probes
843
+
844
+ GoodJob's CLI offers an http health check probe to better manage process lifecycle in containerized environments like Kubernetes:
845
+
846
+ ```bash
847
+ # Run the CLI with a health check on port 7001
848
+ good_job start --probe-port=7001
849
+
850
+ # or via an environment variable
851
+ GOOD_JOB_PROBE_PORT=7001 good_job start
852
+
853
+ # Probe the status
854
+ curl localhost:7001/status
855
+ curl localhost:7001/status/started
856
+ curl localhost:7001/status/connected
857
+ ```
858
+
859
+ Multiple health checks are available at different paths:
860
+
861
+ - `/` or `/status`: the CLI process is running
862
+ - `/status/started`: the multithreaded job executor is running
863
+ - `/status/connected`: the database connection is established
864
+
865
+ This can be configured, for example with Kubernetes:
866
+
867
+ ```yaml
868
+ spec:
869
+ containers:
870
+ - name: good_job
871
+ image: my_app:latest
872
+ env:
873
+ - name: RAILS_ENV
874
+ value: production
875
+ - name: GOOD_JOB_PROBE_PORT
876
+ value: 7001
877
+ command:
878
+ - good_job
879
+ - start
880
+ ports:
881
+ - name: probe-port
882
+ containerPort: 7001
883
+ startupProbe:
884
+ httpGet:
885
+ path: "/status/started"
886
+ port: probe-port
887
+ failureThreshold: 30
888
+ periodSeconds: 10
889
+ livenessProbe:
890
+ httpGet:
891
+ path: "/status/connected"
892
+ port: probe-port
893
+ failureThreshold: 1
894
+ periodSeconds: 10
895
+ ```
896
+
840
897
  ## Contribute
841
898
 
842
899
  Contributions are welcomed and appreciated 🙏
@@ -0,0 +1 @@
1
+ GoodJob = {};
@@ -18,3 +18,8 @@
18
18
  .ct-label.ct-horizontal {
19
19
  white-space: nowrap;
20
20
  }
21
+
22
+ .chart-wrapper {
23
+ position: relative;
24
+ height: 200px;
25
+ }