From 51ef4a2fed382833833f15afae1da3f98bfa5031 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Sat, 12 Dec 2015 23:06:23 -0200 Subject: [PATCH] Sidekiq-cron configuration moved to gitlab.yml --- config/gitlab.yml.example | 9 +++++++++ config/initializers/1_settings.rb | 9 +++++++++ config/initializers/sidekiq.rb | 7 ++----- config/schedule.yml | 10 ---------- 4 files changed, 20 insertions(+), 15 deletions(-) delete mode 100644 config/schedule.yml diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index db378118f85..54dddb41ac4 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -144,6 +144,15 @@ production: &base # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon + ## Auxiliary jobs + # Periodically executed jobs, to self-heal Gitlab, do external synchronizations, etc. + # Please read here for more information: https://github.com/ondrejbartas/sidekiq-cron#adding-cron-job + cron_jobs: + # Flag stuck CI builds as failed + stuck_ci_builds_worker: + cron: "0 0 * * *" + + # # 2. GitLab CI settings # ========================== diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 63d8ae17436..37b92d07946 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -224,6 +224,15 @@ Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{ Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon' Settings.gravatar['host'] = Settings.get_host_without_www(Settings.gravatar['plain_url']) +# +# Cron Jobs +# +Settings['cron_jobs'] ||= Settingslogic.new({}) +Settings.cron_jobs['stuck_ci_builds_worker'] ||= Settingslogic.new({}) +Settings.cron_jobs['stuck_ci_builds_worker']['cron'] ||= '0 0 * * *' +Settings.cron_jobs['stuck_ci_builds_worker']['class'] = 'StuckCiBuildsWorker' + + # # GitLab Shell # diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 2e3a71912ef..b42b718a7db 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -18,11 +18,8 @@ Sidekiq.configure_server do |config| chain.add Gitlab::SidekiqMiddleware::MemoryKiller if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS'] end - # Sidekiq-cron: load recurring jobs from schedule.yml - schedule_file = 'config/schedule.yml' - if File.exists?(schedule_file) - Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) - end + # Sidekiq-cron: load recurring jobs from gitlab.yml + Sidekiq::Cron::Job.load_from_hash! Gitlab.config.cron_jobs # Database pool should be at least `sidekiq_concurrency` + 2 # For more info, see: https://github.com/mperham/sidekiq/blob/master/4.0-Upgrade.md diff --git a/config/schedule.yml b/config/schedule.yml deleted file mode 100644 index 993a95fef56..00000000000 --- a/config/schedule.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Here is a list of jobs that are scheduled to run periodically. -# We use a UNIX cron notation to specify execution schedule. -# -# Please read here for more information: -# https://github.com/ondrejbartas/sidekiq-cron#adding-cron-job - -stuck_ci_builds_worker: - cron: "0 0 * * *" - class: "StuckCiBuildsWorker" - queue: "default"