diff --git a/.codeclimate.yml b/.codeclimate.yml index 4f803baf1..ffcd2856c 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -48,7 +48,6 @@ exclude_patterns: - "config/" - "db/" - "lib/core_monkey_patches/" - - "lib/daemons/" - "lib/gem_monkey_patches/" - "lib/tasks/api_log.rake" - "lib/tasks/bootstrap.rake" diff --git a/Gemfile b/Gemfile index f38931c70..4ba187b94 100644 --- a/Gemfile +++ b/Gemfile @@ -62,13 +62,10 @@ gem 'omniauth-tara', github: 'internetee/omniauth-tara' # gem 'omniauth-tara', path: 'vendor/gems/omniauth-tara' gem 'airbrake' -gem 'daemons-rails', '1.2.1' gem 'epp', github: 'internetee/epp', branch: :master gem 'epp-xml', '1.2.0', github: 'internetee/epp-xml', branch: :master gem 'jquery-ui-rails', '6.0.1' gem 'pdfkit' -gem 'que' -gem 'que-web' gem 'sidekiq', '>= 6.4.1' gem 'company_register', github: 'internetee/company_register', diff --git a/Gemfile.lock b/Gemfile.lock index 158e97986..10e0805f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -202,10 +202,6 @@ GEM crack (0.4.5) rexml crass (1.0.6) - daemons (1.3.1) - daemons-rails (1.2.1) - daemons - multi_json (~> 1.0) data_migrate (8.0.0) activerecord (>= 5.0) railties (>= 5.0) @@ -227,7 +223,6 @@ GEM domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) erubi (1.10.0) - erubis (2.7.0) execjs (2.7.0) ffi (1.15.0) figaro (1.2.0) @@ -318,9 +313,6 @@ GEM money (~> 6.13.2) railties (>= 3.0) msgpack (1.4.2) - multi_json (1.15.0) - mustermann (1.1.1) - ruby2_keywords (~> 0.0.1) netrc (0.11.0) newrelic-infinite_tracing (8.1.0) grpc (~> 1.34) @@ -365,11 +357,6 @@ GEM public_suffix (4.0.6) puma (5.6.4) nio4r (~> 2.0) - que (0.14.3) - que-web (0.7.2) - erubis - que (~> 0.8) - sinatra racc (1.6.0) rack (2.2.4) rack-oauth2 (1.16.0) @@ -546,7 +533,6 @@ DEPENDENCIES coffee-rails (>= 5.0) company_register! countries - daemons-rails (= 1.2.1) data_migrate (~> 8.0) database_cleaner devise (~> 4.8) @@ -582,8 +568,6 @@ DEPENDENCIES pghero pry (= 0.14.1) puma - que - que-web rails (~> 6.1.4) ransack (~> 2.6.0) rest-client diff --git a/README.md b/README.md index 2d5b058cc..5fcce9e91 100644 --- a/README.md +++ b/README.md @@ -390,7 +390,6 @@ sudo apt-get install libxext-dev libxrender1 fontconfig ### Deployment * [Application build and update](/doc/application_build_doc.md) -* [Registry que server](/doc/que/README.md) ### Autotesting diff --git a/app/models/que_job.rb b/app/models/que_job.rb deleted file mode 100644 index 40ef6a67e..000000000 --- a/app/models/que_job.rb +++ /dev/null @@ -1,3 +0,0 @@ -class QueJob < ApplicationRecord - self.primary_key = 'job_id' -end diff --git a/app/views/admin/base/_menu.haml b/app/views/admin/base/_menu.haml index 92efc2347..f53fddb0a 100644 --- a/app/views/admin/base/_menu.haml +++ b/app/views/admin/base/_menu.haml @@ -39,7 +39,6 @@ %li= link_to t('.bounced_email_addresses'), admin_bounced_mail_addresses_path %li= link_to t('.epp_log'), admin_epp_logs_path(created_after: 'today') %li= link_to t('.repp_log'), admin_repp_logs_path(created_after: 'today') - %li= link_to t('.que'), '/admin/que' %ul.nav.navbar-nav.navbar-right %li= link_to t('.sign_out'), destroy_admin_user_session_path, method: :delete, diff --git a/config.ru b/config.ru index ec46ca9f1..3ab73beb9 100644 --- a/config.ru +++ b/config.ru @@ -2,12 +2,3 @@ require_relative 'config/environment' run Rails.application - -# turn automatic que temp off -# if defined?(PhusionPassenger) - # PhusionPassenger.on_event(:starting_worker_process) do |forked| - # if forked - # Que.mode = :async - # end - # end -# end diff --git a/config/daemons.yml b/config/daemons.yml deleted file mode 100644 index e5c5f1b0d..000000000 --- a/config/daemons.yml +++ /dev/null @@ -1,9 +0,0 @@ -dir_mode: script -dir: ../../log/que -multiple: true -backtrace: true -monitor: true -ontop: false -app_name: 'que' -user: <%= ENV['QUE_USER'] || 'registry' %> -group: <%= ENV['QUE_GROUP'] || ENV['QUE_USER'] || 'registry' %> diff --git a/config/deploy.rb.sample b/config/deploy.rb.sample index a6f0d179b..501db013f 100644 --- a/config/deploy.rb.sample +++ b/config/deploy.rb.sample @@ -15,7 +15,6 @@ set :deploy_to, '$HOME/registry' set :repository, 'https://github.com/domify/registry' # dev repo set :branch, 'master' set :rails_env, 'alpha' -set :que_restart, true set :cron_group, 'registry' # alpha branch, only use for heavy debugging @@ -25,7 +24,6 @@ task :epp do set :repository, 'https://github.com/domify/registry' # dev repo set :branch, 'master' set :rails_env, 'alpha' - set :que_restart, false end # alpha branch, only use for heavy debugging @@ -35,7 +33,6 @@ task :registrar do set :repository, 'https://github.com/domify/registry' # dev repo set :branch, 'master' set :rails_env, 'alpha' - set :que_restart, false set :cron_group, 'registrar' end @@ -46,7 +43,6 @@ task :registrant do set :repository, 'https://github.com/domify/registry' # dev repo set :branch, 'master' set :rails_env, 'alpha' - set :que_restart, false set :cron_group, 'registrant' end @@ -57,7 +53,6 @@ task :st do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'staging' set :rails_env, 'staging' - set :que_restart, true end # staging @@ -67,7 +62,6 @@ task :eppst do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'staging' set :rails_env, 'staging' - set :que_restart, false set :cron_group, 'epp' end @@ -78,7 +72,6 @@ task :registrarst do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'staging' set :rails_env, 'staging' - set :que_restart, false set :cron_group, 'registrar' end @@ -89,7 +82,6 @@ task :registrantst do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'staging' set :rails_env, 'staging' - set :que_restart, false set :cron_group, 'registrant' end @@ -100,7 +92,6 @@ task :pr do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'master' set :rails_env, 'production' - set :que_restart, true end # production @@ -110,7 +101,6 @@ task :epppr do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'master' set :rails_env, 'production' - set :que_restart, false set :cron_group, 'epp' end @@ -121,7 +111,6 @@ task :registrarpr do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'master' set :rails_env, 'production' - set :que_restart, false set :cron_group, 'registrar' end @@ -132,7 +121,6 @@ task :registrantpr do set :repository, 'https://github.com/internetee/registry' # production repo set :branch, 'master' set :rails_env, 'production' - set :que_restart, false set :cron_group, 'registrant' end @@ -193,9 +181,6 @@ task setup: :environment do queue! %(mkdir -p "#{deploy_to}/shared/import/legal_documents") queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/import/legal_documents") - queue! %(mkdir -p "#{deploy_to}/shared/log/que") - queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/log/que") - queue! %(touch "#{deploy_to}/shared/config/database.yml") deploy do invoke :'git:clone' @@ -217,8 +202,6 @@ task deploy: :environment do invoke :load_commit_hash # TEMP until all servers are updated - queue! %(mkdir -p "#{deploy_to}/shared/log/que") - queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/log/que") invoke :'deploy:link_shared_paths' invoke :'bundle:install' @@ -233,7 +216,7 @@ task deploy: :environment do end end -# data_migrate=some_data_migration mina deploy env +# data_migrate=some_data_migration mina deploy env desc 'Run data migrations if any set with ENV[data_migrate]' task data_migration: :environment do if ENV['data_migrate'] @@ -258,11 +241,6 @@ task restart: :environment do queue "mkdir -p #{deploy_to}/current/tmp; touch #{deploy_to}/current/tmp/restart.txt" end -desc 'Restart que server' -task que_restart: :environment do - queue "/etc/init.d/que restart" -end - namespace :cron do desc 'Setup cron tasks.' task setup: :environment do diff --git a/config/initializers/que.rb b/config/initializers/que.rb deleted file mode 100644 index 560b1ec1e..000000000 --- a/config/initializers/que.rb +++ /dev/null @@ -1,7 +0,0 @@ -Que::Adapters::Base::CAST_PROCS[1184] = lambda do |value| - case value - when Time then value - when String then Time.parse(value) - else raise "Unexpected time class: #{value.class} (#{value.inspect})" - end -end diff --git a/config/locales/admin/menu.en.yml b/config/locales/admin/menu.en.yml index 8fd8bdc07..c73fcb3f5 100644 --- a/config/locales/admin/menu.en.yml +++ b/config/locales/admin/menu.en.yml @@ -19,4 +19,3 @@ en: mass_actions: Mass actions epp_log: EPP log repp_log: REPP log - que: Que diff --git a/config/routes.rb b/config/routes.rb index fd5967c9a..5f756e761 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -431,7 +431,6 @@ Rails.application.routes.draw do resources :bounced_mail_addresses, only: %i[index show destroy] authenticate :admin_user do - mount Que::Web, at: 'que' mount Sidekiq::Web, at: 'sidekiq' end end diff --git a/db/migrate/20150611124920_add_que.rb b/db/migrate/20150611124920_add_que.rb index 8e76e456c..3f5aa8284 100644 --- a/db/migrate/20150611124920_add_que.rb +++ b/db/migrate/20150611124920_add_que.rb @@ -1,11 +1,11 @@ class AddQue < ActiveRecord::Migration[6.0] def self.up # The current version as of this migration's creation. - Que.migrate! :version => 3 + # Que.migrate! :version => 3 end def self.down # Completely removes Que's job queue. - Que.migrate! :version => 0 + # Que.migrate! :version => 0 end end diff --git a/db/migrate/20220406085500_remove_que_jobs.rb b/db/migrate/20220406085500_remove_que_jobs.rb new file mode 100644 index 000000000..2d0d2bfa7 --- /dev/null +++ b/db/migrate/20220406085500_remove_que_jobs.rb @@ -0,0 +1,5 @@ +class RemoveQueJobs < ActiveRecord::Migration[6.1] + def change + # drop_table :que_jobs + end +end diff --git a/db/structure.sql b/db/structure.sql index 26515ee8e..f687591b1 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -51,20 +51,6 @@ CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public; COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs'; --- --- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public; - - --- --- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed'; - - -- -- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - -- @@ -955,14 +941,15 @@ CREATE TABLE public.domains ( pending_json jsonb, force_delete_date date, statuses character varying[], - status_notes public.hstore, + statuses_before_force_delete character varying[] DEFAULT '{}'::character varying[], upid integer, up_date timestamp without time zone, uuid uuid DEFAULT public.gen_random_uuid() NOT NULL, locked_by_registrant_at timestamp without time zone, force_delete_start timestamp without time zone, force_delete_data public.hstore, - json_statuses_history jsonb + json_statuses_history jsonb, + status_notes public.hstore ); @@ -2284,74 +2271,6 @@ CREATE SEQUENCE public.payment_orders_id_seq ALTER SEQUENCE public.payment_orders_id_seq OWNED BY public.payment_orders.id; --- --- Name: pghero_query_stats; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.pghero_query_stats ( - id bigint NOT NULL, - database text, - "user" text, - query text, - query_hash bigint, - total_time double precision, - calls bigint, - captured_at timestamp without time zone -); - - --- --- Name: pghero_query_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.pghero_query_stats_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pghero_query_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.pghero_query_stats_id_seq OWNED BY public.pghero_query_stats.id; - - --- --- Name: pghero_space_stats; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.pghero_space_stats ( - id bigint NOT NULL, - database text, - schema text, - relation text, - size bigint, - captured_at timestamp without time zone -); - - --- --- Name: pghero_space_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.pghero_space_stats_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pghero_space_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.pghero_space_stats_id_seq OWNED BY public.pghero_space_stats.id; - - -- -- Name: prices; Type: TABLE; Schema: public; Owner: - -- @@ -2390,48 +2309,6 @@ CREATE SEQUENCE public.prices_id_seq ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id; --- --- Name: que_jobs; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.que_jobs ( - priority smallint DEFAULT 100 NOT NULL, - run_at timestamp with time zone DEFAULT now() NOT NULL, - job_id bigint NOT NULL, - job_class text NOT NULL, - args json DEFAULT '[]'::json NOT NULL, - error_count integer DEFAULT 0 NOT NULL, - last_error text, - queue text DEFAULT ''::text NOT NULL -); - - --- --- Name: TABLE que_jobs; Type: COMMENT; Schema: public; Owner: - --- - -COMMENT ON TABLE public.que_jobs IS '3'; - - --- --- Name: que_jobs_job_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.que_jobs_job_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: que_jobs_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.que_jobs_job_id_seq OWNED BY public.que_jobs.job_id; - - -- -- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: - -- @@ -2712,7 +2589,8 @@ CREATE TABLE public.validation_events ( validation_eventable_type character varying, validation_eventable_id bigint, created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL + updated_at timestamp(6) without time zone NOT NULL, + event_type public.validation_type ); @@ -3254,20 +3132,6 @@ ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('publi ALTER TABLE ONLY public.payment_orders ALTER COLUMN id SET DEFAULT nextval('public.payment_orders_id_seq'::regclass); --- --- Name: pghero_query_stats id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.pghero_query_stats ALTER COLUMN id SET DEFAULT nextval('public.pghero_query_stats_id_seq'::regclass); - - --- --- Name: pghero_space_stats id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.pghero_space_stats ALTER COLUMN id SET DEFAULT nextval('public.pghero_space_stats_id_seq'::regclass); - - -- -- Name: prices id; Type: DEFAULT; Schema: public; Owner: - -- @@ -3275,13 +3139,6 @@ ALTER TABLE ONLY public.pghero_space_stats ALTER COLUMN id SET DEFAULT nextval(' ALTER TABLE ONLY public.prices ALTER COLUMN id SET DEFAULT nextval('public.prices_id_seq'::regclass); --- --- Name: que_jobs job_id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.que_jobs ALTER COLUMN job_id SET DEFAULT nextval('public.que_jobs_job_id_seq'::regclass); - - -- -- Name: registrant_verifications id; Type: DEFAULT; Schema: public; Owner: - -- @@ -3791,22 +3648,6 @@ ALTER TABLE ONLY public.payment_orders ADD CONSTRAINT payment_orders_pkey PRIMARY KEY (id); --- --- Name: pghero_query_stats pghero_query_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.pghero_query_stats - ADD CONSTRAINT pghero_query_stats_pkey PRIMARY KEY (id); - - --- --- Name: pghero_space_stats pghero_space_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.pghero_space_stats - ADD CONSTRAINT pghero_space_stats_pkey PRIMARY KEY (id); - - -- -- Name: prices prices_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -3815,14 +3656,6 @@ ALTER TABLE ONLY public.prices ADD CONSTRAINT prices_pkey PRIMARY KEY (id); --- --- Name: que_jobs que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.que_jobs - ADD CONSTRAINT que_jobs_pkey PRIMARY KEY (queue, priority, run_at, job_id); - - -- -- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -4577,20 +4410,6 @@ CREATE INDEX index_notifications_on_registrar_id ON public.notifications USING b CREATE INDEX index_payment_orders_on_invoice_id ON public.payment_orders USING btree (invoice_id); --- --- Name: index_pghero_query_stats_on_database_and_captured_at; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX index_pghero_query_stats_on_database_and_captured_at ON public.pghero_query_stats USING btree (database, captured_at); - - --- --- Name: index_pghero_space_stats_on_database_and_captured_at; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX index_pghero_space_stats_on_database_and_captured_at ON public.pghero_space_stats USING btree (database, captured_at); - - -- -- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: - -- @@ -4647,6 +4466,13 @@ CREATE INDEX index_users_on_registrar_id ON public.users USING btree (registrar_ CREATE INDEX index_validation_events_on_event_data ON public.validation_events USING gin (event_data); +-- +-- Name: index_validation_events_on_event_type; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_validation_events_on_event_type ON public.validation_events USING btree (event_type); + + -- -- Name: index_validation_events_on_validation_eventable; Type: INDEX; Schema: public; Owner: - -- @@ -5392,11 +5218,9 @@ INSERT INTO "schema_migrations" (version) VALUES ('20210708131814'), ('20210729131100'), ('20210729134625'), -('20211028122103'), -('20211028125245'), -('20211029082225'), +('20210827185249'), +('20211029073644'), ('20211124071418'), -('20211124084308'), ('20211125181033'), ('20211125184334'), ('20211126085139'), diff --git a/doc/que/README.md b/doc/que/README.md deleted file mode 100644 index 1fd0ef664..000000000 --- a/doc/que/README.md +++ /dev/null @@ -1,52 +0,0 @@ -Registry que server -=================== - -Que server responsibilites: - -* handle write type of communication between Registrant and Registry -* handle future jobs for Registry -* handle heavy load jobs for Registry - -Installation ------------- - -Que can deploy either separaetly or along to Registry server depends on real load situation. -In both serarious que requires working Registry deployment and full access to Registry databases. - -Installation at deployed server: - - cd /home/registry/registry/current - sudo cp doc/que/que_init_sample /etc/init.d/que # and edit it - sudo chmod +x /etc/init.d/que - sudo /etc/init.d/que # for help and other commands - sudo /etc/init.d/que start # for manual start - sudo update-rc.d que defaults # for start in server boot - -PID files ---------- - -All pid files are at log/que directory. - -Debugging ---------- - -You can run que manually as well for debugging: - - cd /home/registry/registry/current - -For all manual que tasks: - - RAILS_ENV=production bundle exec rake -T que # for all que tasks for manual control - rake que:clear # Clear Que's job table - rake que:drop # Drop Que's job table - rake que:migrate # Migrate Que's job table to the most recent version (creating it if it doesn't exist) - rake que:work # Process Que's jobs using a worker pool - -For all que daemon tasks what inist script uses - - RAILS_ENV=production bundle exec rake -T daemon # for all que daemon tasks what init script uses - rake daemon:que # Start que script - rake daemon:que:restart # Restart que daemon - rake daemon:que:start # Start que daemon - rake daemon:que:status # Status que daemon - rake daemon:que:stop # Stop que daemon diff --git a/doc/que/que_init_sample b/doc/que/que_init_sample deleted file mode 100644 index 28e27e957..000000000 --- a/doc/que/que_init_sample +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -### BEGIN INIT INFO -# Provides: Registry que server -# Required-Start: $all -# Required-Stop: $network $local_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Enable Registry que server -### END INIT INFO - -set -u -set -e - -### CHANGES -APP_HOME="/home/registry/registry" -APP_ROOT="$APP_HOME/current" -QUE_USER=registry # or use some other unprivileged OS user what your registry servers uses -RAILS_ENV=production -RUBY_BUNDLE=/home/$QUE_USER/.rbenv/shims/bundle -QUE_INSTANCES=1 # or as many really needed based on real load info -### END OF CHANGES - -cd $APP_ROOT || exit 1 - -case ${1-help} in -status) - cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE exec lib/daemons/que_ctl status - ;; -start) - echo "$1 que monitor and server" - for i in `seq 1 $QUE_INSTANCES`; do - cd $APP_ROOT && QUE_WORKER_COUNT=1 RAILS_ENV=$RAILS_ENV QUE_USER=$QUE_USER $RUBY_BUNDLE exec rake daemon:que:start - echo 'que instance started' - done - ;; -stop) - echo "$1 que monitor and server" - cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE exec lib/daemons/que_ctl stop - ;; -restart) - echo "$1 que monitor and server" - cd $APP_ROOT && RAILS_ENV=$RAILS_ENV QUE_USER=$QUE_USER $RUBY_BUNDLE exec rake daemon:que:restart - ;; -*) - echo >&2 "Usage: $0 " - exit 1 - ;; -esac diff --git a/lib/daemons/daemons b/lib/daemons/daemons deleted file mode 100755 index 42722e47c..000000000 --- a/lib/daemons/daemons +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby -results = [] -Dir[File.dirname(__FILE__) + "/*_ctl"].each { |f| results << `ruby #{f} #{ARGV.first}` } -results.delete_if { |result| result.nil? || result.empty? } -puts results.join unless results.empty? diff --git a/lib/daemons/que.rb b/lib/daemons/que.rb deleted file mode 100755 index e246212ba..000000000 --- a/lib/daemons/que.rb +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env ruby - -ENV["RAILS_ENV"] ||= "production" - -root = File.expand_path(File.dirname(__FILE__)) -root = File.dirname(root) until File.exist?(File.join(root, 'config')) -Dir.chdir(root) - -require File.join(root, "config", "environment") - -# from que gem rake task -if defined?(::Rails) && Rails.respond_to?(:application) - # ActiveSupport's dependency autoloading isn't threadsafe, and Que uses - # multiple threads, which means that eager loading is necessary. Rails - # explicitly prevents eager loading when the environment task is invoked, - # so we need to manually eager load the app here. - Rails.application.eager_load! -end - -Que.logger.level = Logger.const_get((ENV['QUE_LOG_LEVEL'] || 'INFO').upcase) -Que.worker_count = 1 -Que.wake_interval = (ENV['QUE_WAKE_INTERVAL'] || 1).to_f -Que.mode = :async - -# When changing how signals are caught, be sure to test the behavior with -# the rake task in tasks/safe_shutdown.rb. - -stop = false -%w( INT ).each do |signal| - trap(signal) { stop = true } -end - -at_exit do - $stdout.puts "Finishing Que's current jobs before exiting..." - Que.worker_count = 0 - Que.mode = :off - $stdout.puts "Que's jobs finished, exiting..." -end - -loop do - sleep 1 - break if stop -end diff --git a/lib/daemons/que_ctl b/lib/daemons/que_ctl deleted file mode 100755 index 9a3da9cd1..000000000 --- a/lib/daemons/que_ctl +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby -require 'rubygems' -require 'daemons/rails/config' -config = Daemons::Rails::Config.for_controller(File.expand_path(__FILE__)) -Daemons::Rails.run config[:script], config.to_hash diff --git a/lib/tasks/migrate_jobs.rake b/lib/tasks/migrate_jobs.rake deleted file mode 100644 index a5a4b5bcf..000000000 --- a/lib/tasks/migrate_jobs.rake +++ /dev/null @@ -1,31 +0,0 @@ -namespace :migrate_jobs do - task all: :environment do - QueJob.all.each do |job| - process_que_job(job) - end - end - - task first: :environment do - job = QueJob.first - process_que_job(job) - end - - def process_que_job(que_job) - return unless que_job - - if skip_condition(que_job) - puts "Skipped Que job migration: #{que_job.inspect}" - else - args = que_job.args - time = que_job.run_at - time = Time.zone.now + 1.minute if time < Time.zone.now - - que_job.job_class.constantize.set(wait_until: time).perform_later(*args) - end - end - - def skip_condition(que_job) - que_job.last_error.present? || !(que_job.job_class.constantize < ApplicationJob) || - !(que_job.job_class == 'DomainExpireEmailJob') - end -end diff --git a/test/test_helper.rb b/test/test_helper.rb index 98a7d0f39..0cd407f84 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,7 +4,6 @@ if ENV['COVERAGE'] add_filter '/app/models/version/' add_filter '/lib/action_controller/' add_filter '/lib/core_monkey_patches/' - add_filter '/lib/daemons/' add_filter '/lib/gem_monkey_patches/' add_filter '/lib/tasks/' end