From 9efa4a853d7048864e6be0f86969391ee4dfd077 Mon Sep 17 00:00:00 2001 From: Ryan McNeil Date: Fri, 5 Apr 2024 11:15:22 -0600 Subject: [PATCH] Revert "Remove whenever gem and unneeded cron stuff (#1081)" (#1082) This reverts commit b3e881a0ed1c2dbc0b1f64a2c7fae89570aa44d2. --- Dockerfile | 3 ++- Gemfile | 1 + Gemfile.lock | 4 ++++ config/schedule.rb | 21 +++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 config/schedule.rb diff --git a/Dockerfile b/Dockerfile index ee1d8b386..de1699455 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ SHELL ["/bin/bash", "-c"] RUN groupadd -g $userid -r gi-bill-data-service && \ useradd -u $userid -r -g gi-bill-data-service -d /srv/gi-bill-data-service gi-bill-data-service RUN apt-get update -qq && apt-get install -y \ - build-essential git curl wget libpq-dev dumb-init shared-mime-info nodejs + build-essential git curl wget libpq-dev dumb-init shared-mime-info nodejs cron RUN mkdir -p /srv/gi-bill-data-service/src && \ chown -R gi-bill-data-service:gi-bill-data-service /srv/gi-bill-data-service @@ -47,6 +47,7 @@ COPY --chown=gi-bill-data-service:gi-bill-data-service . . USER gi-bill-data-service RUN gem install bundler --no-document -v ${BUNDLER_VERSION} RUN bundle install --binstubs="${BUNDLE_APP_CONFIG}/bin" $bundler_opts && find ${BUNDLE_APP_CONFIG}/cache -type f -name \*.gem -delete +RUN bundle exec whenever --update-crontab ENV PATH="/usr/local/bundle/bin:${PATH}" ### diff --git a/Gemfile b/Gemfile index e4c70b10b..5a7794b85 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,7 @@ gem 'rails-html-sanitizer', '>= 1.4.4' gem 'ruby-saml' gem 'sitemap_generator' gem 'strong_migrations' +gem 'whenever', require: false gem 'will_paginate' group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 40df90e29..f27248b7d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -121,6 +121,7 @@ GEM case_transform (0.2) activesupport cgi (0.4.1) + chronic (0.10.2) coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) @@ -446,6 +447,8 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) + whenever (1.0.0) + chronic (>= 0.6.3) will_paginate (4.0.0) xpath (3.2.0) nokogiri (~> 1.8) @@ -519,6 +522,7 @@ DEPENDENCIES virtus (~> 2.0.0) watir (~> 7.3) web-console (~> 4.2) + whenever will_paginate RUBY VERSION diff --git a/config/schedule.rb b/config/schedule.rb new file mode 100644 index 000000000..5c31e6d36 --- /dev/null +++ b/config/schedule.rb @@ -0,0 +1,21 @@ +# Use this file to easily define all of your cron jobs. +# +# It's helpful, but not entirely necessary to understand cron before proceeding. +# http://en.wikipedia.org/wiki/Cron + +# Example: +# +# set :output, "/path/to/my/cron_log.log" +# +# every 2.hours do +# command "/usr/bin/some_great_command" +# runner "MyModel.some_method" +# rake "some:great:rake:task" +# end +# +# every 4.days do +# runner "AnotherModel.prune_old_records" +# end + +# Learn more: http://github.com/javan/whenever +#set :job_template, nil