From dc44b6450cecd33de97aa001c386fa1fa6cef75d Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 1 Oct 2018 19:09:00 -0700 Subject: [PATCH 1/2] Add more OkComputer checks Largely borrowed from PreservationCatalog --- config/initializers/okcomputer.rb | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index 972ba07a..62e0c402 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -1,3 +1,42 @@ # by default, okcomputer does "app up?" and "database conntected?" checks OkComputer.mount_at = 'status' # use /status or /status/all or /status/ OkComputer.check_in_parallel = true + +OkComputer::Registry.register 'ruby_version', OkComputer::RubyVersionCheck.new + +# check whether resque workers are working +OkComputer::Registry.register 'feature-resque-down', OkComputer::ResqueDownCheck.new + +# check for backed up resque queues: this is a low volume app, so the threshold is low +Resque.queues.each do |queue| + OkComputer::Registry.register "feature-#{queue}-queue-depth", OkComputer::ResqueBackedUpCheck.new(queue, 5) +end + +class DirectoryExistsCheck < OkComputer::Check + attr_accessor :directory + + def initialize(directory) + self.directory = directory + end + + def check + stat = File.stat(directory) if File.exist?(directory) + if stat + if stat.directory? + mark_message "'#{directory}' is a reachable directory" + else + mark_message "'#{directory}' is not a directory." + mark_failure + end + else + mark_message "Directory '#{directory}' does not exist." + mark_failure + end + end +end + +# Confirm job_output_parent_dir exists (or else jobs cannot output) +OkComputer::Registry.register 'feature-job_output_parent_dir', DirectoryExistsCheck.new(Settings.job_output_parent_dir) + +# To make checks optional: +# OkComputer.make_optional %w[feature-resque-down] From b221d4dbd6c31fdad975cceeaf04ad7e58825993 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 1 Oct 2018 19:14:30 -0700 Subject: [PATCH 2/2] Give Travis redis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1733ddf0..1b25e3eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,3 +17,6 @@ cache: bundler rvm: - 2.4.4 + +services: + - redis-server