Class: Neetob::CLI::Sre::Checklist

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/sre/checklist.rb

Constant Summary

Constants inherited from Base

Base::APPS_LIST, Base::RESOURCES

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary collapse

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initialize(app, environment) ⇒ Checklist

Returns a new instance of Checklist.



11
12
13
14
15
# File 'lib/neetob/cli/sre/checklist.rb', line 11

def initialize(app, environment)
  super()
  @app = app
  @environment = environment
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



9
10
11
# File 'lib/neetob/cli/sre/checklist.rb', line 9

def app
  @app
end

#environmentObject

Returns the value of attribute environment.



9
10
11
# File 'lib/neetob/cli/sre/checklist.rb', line 9

def environment
  @environment
end

Instance Method Details

#runObject

Raises:

  • (StandardError)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/neetob/cli/sre/checklist.rb', line 17

def run
  raise(StandardError, "Environment should be staging or production.") unless environments.include?(environment)

  app_info = RESOURCES[app.to_sym][environment.to_sym]
  domain = app_info[:dns]
  app_name = app_info[:app]

  ui.info "Validating the SRE checklist for #{app} in the #{environment} environment..."
  ui.info "SSL mode"
  ui.info `neetob cloudflare ssl_mode -d #{domain} | sed 's/^/  /'`
  ui.info "Validating CDN"
  ui.info `neetob cloudflare ensure_cdn -a #{app_name} | sed 's/^/  /'`
  ui.info "DNS Proxy status"
  ui.info `neetob cloudflare dns_proxy -d #{domain} | sed 's/^/  /'`
  ui.info "Minimum TLS version"
  ui.info `neetob cloudflare min_tls_version -d #{domain} | sed 's/^/  /'`
  ui.info "HTTPS redirect"
  ui.info `neetob cloudflare always_use_https -d #{domain} | sed 's/^/  /'`
  ui.info "Bot fight mode"
  ui.info `neetob cloudflare bot_fight_mode -d #{domain} | sed 's/^/  /'`
  ui.info "Validating SPF records"
  ui.info `neetob cloudflare verify_spf -d #{domain} | sed 's/^/  /'`
  if is_heroku(app_name)
    ui.info "Heroku maintenance time"
    ui.info `neetob heroku maintenance_window -a #{app_name} | sed 's/^/  /'`
    ui.info "Heroku stack"
    ui.info `neetob heroku stack -a #{app_name} | sed 's/^/  /'`
    ui.info "Heroku autoscaling enabled"
    ui.info `neetob heroku autoscaling_config -a #{app_name} | sed 's/^/  /'`
  else
    ui.info "NeetoDeploy autoscaling status"
    ui.info `neetodeploy autoscaling_config list -a #{app_name} | sed 's/^/  /'`
    ui.info "Scheduled exports status"
    ui.info `neetodeploy addon scheduled_exports_enabled -a #{app_name} | sed 's/^/  /'`
  end
  ui.info "Validating essential envs"
  ui.info `neetob sre check_essential_env -a #{app_name} | sed 's/^/  /'`
end