Merge pull request #9584 from tchak/maintenance_tasks
use maintenance tasks gem
This commit is contained in:
commit
9ad2c4358a
11 changed files with 87 additions and 1 deletions
1
Gemfile
1
Gemfile
|
@ -58,6 +58,7 @@ gem 'listen' # Required by ActiveSupport::EventedFileUpdateChecker
|
|||
gem 'lograge'
|
||||
gem 'logstash-event'
|
||||
gem 'mailjet', require: false
|
||||
gem 'maintenance_tasks'
|
||||
gem 'matrix' # needed by prawn and not default in ruby 3.1
|
||||
gem 'mini_magick'
|
||||
gem 'net-imap', require: false # See https://github.com/mikel/mail/pull/1439
|
||||
|
|
|
@ -348,6 +348,8 @@ GEM
|
|||
ruby-vips (>= 2.0.17, < 3)
|
||||
invisible_captcha (2.0.0)
|
||||
rails (>= 5.0)
|
||||
job-iteration (1.4.1)
|
||||
activejob (>= 5.2)
|
||||
jquery-rails (4.5.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
|
@ -408,6 +410,12 @@ GEM
|
|||
activesupport (>= 3.1.0)
|
||||
rack (>= 1.4.0)
|
||||
rest-client (>= 2.0.0)
|
||||
maintenance_tasks (2.3.2)
|
||||
actionpack (>= 6.0)
|
||||
activejob (>= 6.0)
|
||||
activerecord (>= 6.0)
|
||||
job-iteration (>= 1.3.6)
|
||||
railties (>= 6.0)
|
||||
marcel (1.0.2)
|
||||
matrix (0.4.2)
|
||||
memory_profiler (1.0.0)
|
||||
|
@ -864,6 +872,7 @@ DEPENDENCIES
|
|||
lograge
|
||||
logstash-event
|
||||
mailjet
|
||||
maintenance_tasks
|
||||
matrix
|
||||
memory_profiler
|
||||
mina
|
||||
|
|
0
app/tasks/maintenance/.keep
Normal file
0
app/tasks/maintenance/.keep
Normal file
|
@ -25,6 +25,7 @@ as defined by the routes in the `admin/` namespace
|
|||
|
||||
<%= link_to "Delayed Jobs", manager_delayed_job_path, class: "navigation__link" %>
|
||||
<%= link_to "Features", manager_flipper_path, class: "navigation__link" %>
|
||||
<%= link_to "Maintenance Tasks", manager_maintenance_tasks_path, class: "navigation__link" %>
|
||||
<%= link_to "Import data via CSV", manager_import_procedure_tags_path, class: "navigation__link" %>
|
||||
<% if Rails.application.secrets.sendinblue[:enabled] && ENV["SAML_IDP_ENABLED"] == "enabled" %>
|
||||
<%= link_to "Sendinblue", ENV.fetch("SENDINBLUE_LOGIN_URL"), class: "navigation__link", target: '_blank' %>
|
||||
|
|
|
@ -92,6 +92,7 @@ Rails.application.routes.draw do
|
|||
authenticate :super_admin do
|
||||
mount Flipper::UI.app(-> { Flipper.instance }) => "/features", as: :flipper
|
||||
match "/delayed_job" => DelayedJobWeb, :anchor => false, :via => [:get, :post]
|
||||
mount MaintenanceTasks::Engine => "/maintenance_tasks"
|
||||
end
|
||||
|
||||
get 'import_procedure_tags' => 'procedures#import_data'
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from maintenance_tasks (originally 20201211151756)
|
||||
class CreateMaintenanceTasksRuns < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table(:maintenance_tasks_runs) do |t|
|
||||
t.string(:task_name, null: false)
|
||||
t.datetime(:started_at)
|
||||
t.datetime(:ended_at)
|
||||
t.float(:time_running, default: 0.0, null: false)
|
||||
t.bigint(:tick_count, default: 0, null: false)
|
||||
t.bigint(:tick_total)
|
||||
t.string(:job_id)
|
||||
t.string(:cursor)
|
||||
t.string(:status, default: :enqueued, null: false)
|
||||
t.string(:error_class)
|
||||
t.string(:error_message)
|
||||
t.text(:backtrace)
|
||||
t.timestamps
|
||||
t.index([:task_name, :status, :created_at], order: { created_at: :desc }, name: :index_maintenance_tasks_runs)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from maintenance_tasks (originally 20210517131953)
|
||||
class AddArgumentsToMaintenanceTasksRuns < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column(:maintenance_tasks_runs, :arguments, :text)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from maintenance_tasks (originally 20211210152329)
|
||||
class AddLockVersionToMaintenanceTasksRuns < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column(
|
||||
:maintenance_tasks_runs,
|
||||
:lock_version,
|
||||
:integer,
|
||||
default: 0,
|
||||
null: false
|
||||
)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from maintenance_tasks (originally 20230622035229)
|
||||
class AddMetadataToRuns < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column(:maintenance_tasks_runs, :metadata, :text)
|
||||
end
|
||||
end
|
23
db/schema.rb
23
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_10_10_083144) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_10_10_103144) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
@ -709,6 +709,27 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_10_083144) do
|
|||
t.index ["email", "dossier_id"], name: "index_invites_on_email_and_dossier_id", unique: true
|
||||
end
|
||||
|
||||
create_table "maintenance_tasks_runs", force: :cascade do |t|
|
||||
t.text "arguments"
|
||||
t.text "backtrace"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "cursor"
|
||||
t.datetime "ended_at", precision: nil
|
||||
t.string "error_class"
|
||||
t.string "error_message"
|
||||
t.string "job_id"
|
||||
t.integer "lock_version", default: 0, null: false
|
||||
t.text "metadata"
|
||||
t.datetime "started_at", precision: nil
|
||||
t.string "status", default: "enqueued", null: false
|
||||
t.string "task_name", null: false
|
||||
t.bigint "tick_count", default: 0, null: false
|
||||
t.bigint "tick_total"
|
||||
t.float "time_running", default: 0.0, null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["task_name", "status", "created_at"], name: "index_maintenance_tasks_runs", order: { created_at: :desc }
|
||||
end
|
||||
|
||||
create_table "merge_logs", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.string "from_user_email", null: false
|
||||
|
|
0
spec/tasks/maintenance/.keep
Normal file
0
spec/tasks/maintenance/.keep
Normal file
Loading…
Reference in a new issue