Module: Wurk::Preflight

Defined in:
lib/wurk/preflight.rb,
lib/wurk/preflight/checks.rb,
lib/wurk/preflight/owners.rb,
lib/wurk/preflight/reader.rb,
lib/wurk/preflight/report.rb,
lib/wurk/preflight/verify.rb,
lib/wurk/preflight/command.rb,
lib/wurk/preflight/app_scan.rb,
lib/wurk/preflight/keyspace.rb,
lib/wurk/preflight/redis_guard.rb,
lib/wurk/preflight/payload_sample.rb

Overview

wurk preflight: what a live Redis holds, and what will and will not carry over, before a cutover. wurk verify (Preflight::Verify) is its post-cutover counterpart. Both go through Reader, which refuses anything but reads.

Defined Under Namespace

Modules: RedisGuard Classes: AppScan, Checks, Command, Keyspace, Owners, PayloadSample, Reader, Report, Verify

Constant Summary collapse

DEFAULT_LIMIT =
2_000_000
DEFAULT_SAMPLE =
100

Class Method Summary collapse

Class Method Details

.app_findings(checks, report, root) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/wurk/preflight.rb', line 36

def app_findings(checks, report, root)
  checks.app
  AppScan.new(root: root, report: report).run
  report.info(Report::APP_CODE_RAN, "The app was booted, so its initializers ran. Wurk's own Redis clients sent " \
                                    'reads only while it booted, but a client the app opens itself ' \
                                    '(Redis.new, Rails.cache) is not covered by that.')
end

.run(config, limit: DEFAULT_LIMIT, sample: DEFAULT_SAMPLE, pause: 0.005, progress: nil, app: nil) ⇒ Report

app is the root of the booted app (--app), or nil.

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/wurk/preflight.rb', line 22

def run(config, limit: DEFAULT_LIMIT, sample: DEFAULT_SAMPLE, pause: 0.005, progress: nil, app: nil)
  reader = Reader.new(config)
  report = Report.new('preflight')
  keyspace = Keyspace.new(reader, limit: limit, pause: pause, progress: progress).walk
  report.target(reader, keyspace)
  checks = Checks.new(reader: reader, report: report, keyspace: keyspace, owners: Owners.new(reader),
                      sample: sample)
  checks.run
  app ? app_findings(checks, report, app) : report.info('app_checks_skipped', 'No --app: app code not inspected.')
  report
ensure
  reader&.close
end