Class: Heighliner::Cmds::Shutdown

Inherits:
Heighliner::Cli show all
Defined in:
lib/heighliner/cmds/shutdown.rb

Instance Attribute Summary

Attributes inherited from Heighliner::Cli

#use_steerfile

Instance Method Summary collapse

Methods inherited from Heighliner::Cli

all_subcommands_usage, #define_options, register, run_command, #set_config, #start_services, #stop_app, #stop_services

Methods included from Heighliner::CliOptions

#option, #options

Constructor Details

#initializeShutdown

Returns a new instance of Shutdown.



16
17
18
19
# File 'lib/heighliner/cmds/shutdown.rb', line 16

def initialize
  super
  @use_steerfile = false
end

Instance Method Details

#execute(_opts) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/heighliner/cmds/shutdown.rb', line 21

def execute(_opts)
  Config.load(Dir.pwd, use_steerfile: false)

  shared_names = Config.config[:shared_names] || {}
  networkname = Config.config[:networkname] || 'heighliner_net'

  shared_names.each_value do |container_name|
    killrm container_name
  end

  CommandRunner.run Config.out, "docker network rm #{networkname}"
  CommandRunner.run Config.out, "docker volume rm #{shared_names[:certs]}"
end

#usageObject



6
7
8
9
10
11
12
13
14
# File 'lib/heighliner/cmds/shutdown.rb', line 6

def usage
  <<~EOS
    Shuts down the shared infrastructure containers used by Heighliner (nginx reverse proxy, DNS resolver, and Selenium Chrome). This does **not** stop your app or database containers — use \`heighliner down\` for that.

    NOTE: This command is destructive — it removes the shared Docker network and certs volume, which will affect all Heighliner environments on this machine.

    USAGE: heighliner shutdown
  EOS
end